Hi Alessandro, You cannot just cast because there are different services in each interface. However, they are derived from common interfaces. For example,
public interface IOutputAddActivity extends IOutputQualifyActivity,IOutputHistoryActivity,IOutputCheckActivity public interface IOutputRemoveActivity extends IOutputHistoryActivity The only one in common is IOutputHistoryActivity, so as long as your addOrReplace method is calling IOutputHistoryActivity methods only, you can write a second method that accepts just IOutputHistoryActivity and call that from addOrReplace AND from deleteDocument. Karl On Wed, Jul 2, 2014 at 6:13 AM, Alessandro Benedetti < [email protected]> wrote: > 2014-07-02 11:04 GMT+01:00 Karl Wright <[email protected]>: > > > Hi Alessandro, > > > > The "activities" metaphor is simply to make available appropriate > framework > > services to specific connector methods. The metaphor is good for > > ManifoldCF because it allows services to be added in new releases without > > upsetting backwards compatibility etc. > > > > If you have a "deleteDocument" implementation that is trying to call an > > "addOrReplaceDocument" method, this can *only* work if the services you > are > > using in the addOrReplaceDocument method do not include any of those that > > are not in IOutputDeleteActivity. If that is the case, you should be > able > > to write a common method which accepts the appropriate common parent > > interface of IOutputAddActivity and IOutputDeleteActivity. If not, you > > will have to rethink how you are doing this. > > > > Ok, assuming I don't want to include any further services. > I have in the deleteDocument, the IOutputDeleteActivity but the > addOrReplaceDocument is taking the IOutputAddActivity. > Which is the proper way to instantiate IOutputAddActivity from > the IOutputDeleteActivity ? > Because they are different interfaces and i don't know exactly which > implementation arrives there, should I do a hardcoded casting ? > Or what else? > Thank you very much for your time, > > Cheers > > > > > > Thanks, > > Karl > > > > > > > > On Wed, Jul 2, 2014 at 5:17 AM, Alessandro Benedetti < > > [email protected]> wrote: > > > > > Hi guys, > > > I'm trying to implement a specific logic in a custom output connector > > > where, under specific conditions, in the deleteDocument method is then > > > called an AddOrUpdate method. > > > > > > This can happen when the deletion of a document causes the update of > > other > > > documents already indexed. > > > I know is a very specific use case, but let's see if there is a > solution > > > ... > > > So far no problem until I reach the Activities management ... > > > I found the hierarchy of this objects really confusing, with a lot of > > > interfaces and different inner classes sparse in the code. > > > > > > Furthermore it appears to be really hard to create an > > *IOutputAddActivity* > > > object where you have a IOutputDeleteActivity. > > > > > > What can be the best way to instantiate correctly an > > > *IOutputAddActivity *inside > > > the DeleteDocument method *?* > > > Why this activities objects that seems a sort of logging/tracking > feature > > > is such coupled with the logic ? > > > > > > Thank's for the help > > > -- > > > -------------------------- > > > > > > Benedetti Alessandro > > > Visiting card : http://about.me/alessandro_benedetti > > > > > > "Tyger, tyger burning bright > > > In the forests of the night, > > > What immortal hand or eye > > > Could frame thy fearful symmetry?" > > > > > > William Blake - Songs of Experience -1794 England > > > > > > > > > -- > -------------------------- > > Benedetti Alessandro > Visiting card : http://about.me/alessandro_benedetti > > "Tyger, tyger burning bright > In the forests of the night, > What immortal hand or eye > Could frame thy fearful symmetry?" > > William Blake - Songs of Experience -1794 England >
