Package org.apache.isis.core.metamodel.facets.collections.modify

Examples of org.apache.isis.core.metamodel.facets.collections.modify.CollectionAddToFacet


            requiredHolder.addFacet(decoratingFacet);
            return decoratingFacet;
        }

        if (facetType == CollectionAddToFacet.class) {
            final CollectionAddToFacet decoratedFacet = (CollectionAddToFacet) facet;
            final Facet decoratingFacet = new CollectionAddToFacetWrapTransaction(decoratedFacet);
            requiredHolder.addFacet(decoratingFacet);
            return decoratingFacet;
        }
View Full Code Here


        }
        if (readWrite()) {
            if (ownerAdapter.representsPersistent() && referencedAdapter.isTransient()) {
                throw new IsisException("can't set a reference to a transient object from a persistent one: " + ownerAdapter.titleString() + " (persistent) -> " + referencedAdapter.titleString() + " (transient)");
            }
            final CollectionAddToFacet facet = getFacet(CollectionAddToFacet.class);
            facet.add(ownerAdapter, referencedAdapter);
        }
    }
View Full Code Here

       
        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
View Full Code Here

        // 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(
View Full Code Here

        }
        if (readWrite()) {
            if (ownerAdapter.representsPersistent() && referencedAdapter.isTransient()) {
                throw new IsisException("can't set a reference to a transient object from a persistent one: " + ownerAdapter.titleString() + " (persistent) -> " + referencedAdapter.titleString() + " (transient)");
            }
            final CollectionAddToFacet facet = getFacet(CollectionAddToFacet.class);
            facet.add(ownerAdapter, referencedAdapter);
        }
    }
View Full Code Here

            requiredHolder.addFacet(decoratingFacet);
            return decoratingFacet;
        }

        if (facetType == CollectionAddToFacet.class) {
            final CollectionAddToFacet decoratedFacet = (CollectionAddToFacet) facet;
            final Facet decoratingFacet = new CollectionAddToFacetWrapTransaction(decoratedFacet);
            requiredHolder.addFacet(decoratingFacet);
            return decoratingFacet;
        }
View Full Code Here

        final ObjectMember nakedObjectMember = performContext.getObjectMember();
        final CellBinding onMemberBinding = performContext.getPeer().getOnMemberBinding();

        final OneToManyAssociation otma = (OneToManyAssociation) nakedObjectMember;

        final CollectionAddToFacet addToFacet = nakedObjectMember.getFacet(CollectionAddToFacet.class);
        if (addToFacet == null) {
            throw ScenarioBoundValueException.current(onMemberBinding, "(cannot add to collection)");
        }

        // safe since guaranteed by superclass
        final CellBinding arg0Binding = performContext.getPeer().getArg0Binding();
        final ScenarioCell arg0Cell = arg0Binding.getCurrentCell();
        final String toAddAlias = arg0Cell.getText();

        final ObjectAdapter toAddAdapter = performContext.getPeer().getAliasRegistry().getAliased(toAddAlias);
        if (toAddAdapter == null) {
            throw ScenarioBoundValueException.current(arg0Binding, "(unknown alias)");
        }

        // validate argument
        otma.createValidateAddInteractionContext(getSession(), InteractionInvocationMethod.BY_USER, onAdapter, toAddAdapter);
        final Consent validToAdd = otma.isValidToAdd(onAdapter, toAddAdapter);
        if (validToAdd.isVetoed()) {
            throw ScenarioBoundValueException.current(arg0Binding, validToAdd.getReason());
        }

        // add
        addToFacet.add(onAdapter, toAddAdapter);
    }
View Full Code Here

            requiredHolder.addFacet(decoratingFacet);
            return decoratingFacet;
        }

        if (facetType == CollectionAddToFacet.class) {
            final CollectionAddToFacet collectionAddToFacet = (CollectionAddToFacet) facet;
            final CollectionAddToFacetWrapProxy decoratingFacet = new CollectionAddToFacetWrapProxy(collectionAddToFacet, serverFacade, encoderDecoder, identifiedHolder.getIdentifier().getMemberName());
            requiredHolder.addFacet(decoratingFacet);
            return decoratingFacet;
        }
View Full Code Here

            requiredHolder.addFacet(decoratingFacet);
            return decoratingFacet;
        }

        if (facetType == CollectionAddToFacet.class) {
            final CollectionAddToFacet decoratedFacet = (CollectionAddToFacet) facet;
            final Facet decoratingFacet = new CollectionAddToFacetWrapTransaction(decoratedFacet);
            requiredHolder.addFacet(decoratingFacet);
            return decoratingFacet;
        }
View Full Code Here

        }
        if (readWrite()) {
            if (ownerAdapter.isPersistent() && referencedAdapter.isTransient()) {
                throw new IsisException("can't set a reference to a transient object from a persistent one: " + ownerAdapter.titleString() + " (persistent) -> " + referencedAdapter.titleString() + " (transient)");
            }
            final CollectionAddToFacet facet = getFacet(CollectionAddToFacet.class);
            facet.add(ownerAdapter, referencedAdapter);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.facets.collections.modify.CollectionAddToFacet

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.