Package org.apache.isis.applib.annotation

Examples of org.apache.isis.applib.annotation.PostsCollectionAddedToEvent


        final Method method = processMethodContext.getMethod();
        FacetUtil.addFacet(create(method, processMethodContext.getFacetHolder()));
    }

    private PostsCollectionAddedToEventFacet create(Method method, final FacetHolder holder) {
        final PostsCollectionAddedToEvent annotation = Annotations.getAnnotation(method, PostsCollectionAddedToEvent.class);
        if(annotation == null) {
            return null;
        }
       
        final PropertyOrCollectionAccessorFacet getterFacet = holder.getFacet(PropertyOrCollectionAccessorFacet.class);
        if(getterFacet == null) {
            return null;
        }
        final CollectionAddToFacet collectionAddToFacet = holder.getFacet(CollectionAddToFacet.class);
        if(collectionAddToFacet == null) {
            return null;
        }
        // the collectionAddToFacet will end up as the underlying facet of the PostsCollectionAddedToEventFacetAnnotation

        final Class<? extends CollectionAddedToEvent<?,?>> changedEventType = annotation.value();
        return new PostsCollectionAddedToEventFacetAnnotation(changedEventType, getterFacet, collectionAddToFacet, servicesInjector, holder);
    }
View Full Code Here


        // if the collection is mutable, then replace the existing addTo and removeFrom facets with equivalents that
        // 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);
View Full Code Here

TOP

Related Classes of org.apache.isis.applib.annotation.PostsCollectionAddedToEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.