// also post to the event bus.
//
// here we support the deprecated annotations
//
final PostsCollectionAddedToEvent postsCollectionAddedToEvent = Annotations.getAnnotation(method, PostsCollectionAddedToEvent.class);
final PostsCollectionRemovedFromEvent postsCollectionRemovedFromEvent = Annotations.getAnnotation(method, PostsCollectionRemovedFromEvent.class);
final CollectionAddToFacet collectionAddToFacet = holder.getFacet(CollectionAddToFacet.class);
if (collectionAddToFacet != null) {
// the current collectionAddToFacet will end up as the underlying facet of one of these facets to be created.
final CollectionAddToFacetForInteractionAbstract replacementFacet;
if(collectionInteraction != null) {
replacementFacet = new CollectionAddToFacetForCollectionInteractionAnnotation(
collectionInteractionEventType, getterFacet, collectionAddToFacet, collectionInteractionFacet, holder, servicesInjector);
} else if (postsCollectionAddedToEvent != null) {
replacementFacet = new CollectionAddToFacetForPostsCollectionAddedToEventAnnotation(
postsCollectionAddedToEvent.value(), getterFacet, collectionAddToFacet, collectionInteractionFacet, holder, servicesInjector);
} else {
replacementFacet = new CollectionAddToFacetForCollectionInteractionDefault(
collectionInteractionEventType, getterFacet, collectionAddToFacet, collectionInteractionFacet, holder, servicesInjector);
}
FacetUtil.addFacet(replacementFacet);
}
final CollectionRemoveFromFacet collectionRemoveFromFacet = holder.getFacet(CollectionRemoveFromFacet.class);
if (collectionRemoveFromFacet != null) {
// the current collectionRemoveFromFacet will end up as the underlying facet of the PostsCollectionRemovedFromEventFacetAnnotation
final CollectionRemoveFromFacetForInteractionAbstract replacementFacet;
if(collectionInteraction != null) {
replacementFacet = new CollectionRemoveFromFacetForCollectionInteractionAnnotation(collectionInteractionEventType, getterFacet, collectionRemoveFromFacet, collectionInteractionFacet, servicesInjector, holder);
} else if (postsCollectionRemovedFromEvent != null) {
replacementFacet = new CollectionRemoveFromFacetForPostsCollectionRemovedFromEventAnnotation(postsCollectionRemovedFromEvent.value(), getterFacet, collectionRemoveFromFacet, collectionInteractionFacet, servicesInjector, holder);
} else {
replacementFacet = new CollectionRemoveFromFacetForCollectionInteractionDefault(collectionInteractionEventType, getterFacet, collectionRemoveFromFacet, collectionInteractionFacet, servicesInjector, holder);
}
FacetUtil.addFacet(replacementFacet);
}