Package org.apache.isis.core.metamodel.spec.feature

Examples of org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation


            if (instanceOf(imperativeFacets, CollectionValidateAddToFacetViaMethod.class, CollectionValidateRemoveFromFacetViaMethod.class)) {
                throw new UnsupportedOperationException(String.format("Cannot invoke supporting method '%s'; use only collection accessor/mutator", memberName));
            }

            final OneToManyAssociation otma = (OneToManyAssociation) objectMember;
            if (instanceOf(imperativeFacets, PropertyOrCollectionAccessorFacet.class)) {
                return handleGetterMethodOnCollection(method, args, targetAdapter, otma, memberName);
            }
            if (instanceOf(imperativeFacets, CollectionAddToFacet.class)) {
                checkUsability(getAuthenticationSession(), targetAdapter, objectMember);
View Full Code Here


                    final PropertyMemento pm = new PropertyMemento(otoa);

                    final ScalarModel scalarModel = entityModel.getPropertyModel(pm);
                    component = getComponentFactoryRegistry().addOrReplaceComponent(container, ID_PROPERTY_OR_COLLECTION, ComponentType.SCALAR_NAME_AND_VALUE, scalarModel);
                } else {
                    final OneToManyAssociation otma = (OneToManyAssociation) association;

                    final EntityCollectionModel entityCollectionModel = EntityCollectionModel.createParented(entityModel, otma);
                    final CollectionPanel collectionPanel = new CollectionPanel(ID_PROPERTY_OR_COLLECTION, entityCollectionModel);
                    container.addOrReplace(collectionPanel);
View Full Code Here

            if (association.isOneToOneAssociation()) {
                final OneToOneAssociation property = (OneToOneAssociation) association;
                final LinkBuilder linkBuilder = PropertyDescriptionReprRenderer.newLinkToBuilder(getResourceContext(), Rel.PROPERTY, objectSpecification, property);
                membersList.arrayAdd(linkBuilder.build());
            } else if (association.isOneToManyAssociation()) {
                final OneToManyAssociation collection = (OneToManyAssociation) association;
                final LinkBuilder linkBuilder = CollectionDescriptionReprRenderer.newLinkToBuilder(getResourceContext(), Rel.PROPERTY, objectSpecification, collection);
                membersList.arrayAdd(linkBuilder.build());
            }
        }
        final List<ObjectAction> actions = objectSpecification.getObjectActions(Contributed.INCLUDED);
View Full Code Here

    }

    @Override
    public Consent canClear() {
        final ObjectAdapter parentObject = getParent();
        final OneToManyAssociation association = getOneToManyAssociation();
        final ObjectAdapter associatedObject = getObject();

        final Consent isEditable = isEditable();
        if (isEditable.isVetoed()) {
            return isEditable;
        }

        final Consent consent = association.isValidToRemove(parentObject, associatedObject);
        if (consent.isAllowed()) {
            consent.setDescription("Clear the association to this object from '" + parentObject.titleString() + "'");
        }
        return consent;
    }
View Full Code Here

    }

    @Override
    public void clear() {
        final ObjectAdapter parentObject = getParent();
        final OneToManyAssociation association = getOneToManyAssociation();
        LOG.debug("remove " + element + " from " + parentObject);
        association.removeElement(parentObject, element);
    }
View Full Code Here

        final ObjectMember objectMember = parentSpec.getAssociation(collectionId);
        if (objectMember == null || objectMember.isOneToOneAssociation()) {
            throw JsonApplicationException.create(HttpStatusCode.NOT_FOUND);
        }
        final OneToManyAssociation collection = (OneToManyAssociation) objectMember;

        final RendererFactory rendererFactory = rendererFactoryRegistry.find(representationType);

        final CollectionDescriptionReprRenderer renderer = (CollectionDescriptionReprRenderer) rendererFactory.newRenderer(getResourceContext(), null, JsonRepresentation.newMap());
        renderer.with(new ParentSpecAndCollection(parentSpec, collection)).includesSelf();
View Full Code Here

    @Override
    public void build(final View view, final Axes axes) {
        Assert.assertEquals(view.getView(), view);

        final Content content = view.getContent();
        final OneToManyAssociation field = content instanceof OneToManyField ? ((OneToManyField) content).getOneToManyAssociation() : null;

        LOG.debug("rebuild view " + view + " for " + content);

        final CollectionContent collectionContent = ((CollectionContent) content);
        Enumeration elements;
View Full Code Here

    @Override
    public void objectActionResult(final ObjectAdapter result, final Placement placement) {
        if (getContent() instanceof OneToManyField && result instanceof ObjectAdapter) {
            // same as InternalCollectionBorder
            final OneToManyField internalCollectionContent = (OneToManyField) getContent();
            final OneToManyAssociation field = internalCollectionContent.getOneToManyAssociation();
            final ObjectAdapter target = ((ObjectContent) getParent().getContent()).getObject();

            final Consent about = field.isValidToAdd(target, result);
            if (about.isAllowed()) {
                field.addElement(target, result);
            }
        }
        super.objectActionResult(result, placement);
    }
View Full Code Here

    @Override
    public void objectActionResult(final ObjectAdapter result, final Placement placement) {
        if (getContent() instanceof OneToManyField && result instanceof ObjectAdapter) {
            // same as InternalCollectionBorder
            final OneToManyField internalCollectionContent = (OneToManyField) getContent();
            final OneToManyAssociation field = internalCollectionContent.getOneToManyAssociation();
            final ObjectAdapter target = ((ObjectContent) getParent().getContent()).getObject();

            final Consent about = field.isValidToAdd(target, result);
            if (about.isAllowed()) {
                field.addElement(target, result);
            }
        }
        super.objectActionResult(result, placement);
    }
View Full Code Here

    @Override
    public void objectActionResult(final ObjectAdapter result, final Placement placement) {
        // same as in TreeNodeBorder
        final OneToManyField internalCollectionContent = (OneToManyField) getContent();
        final OneToManyAssociation field = internalCollectionContent.getOneToManyAssociation();
        final ObjectAdapter target = ((ObjectContent) getParent().getContent()).getObject();

        final Consent valid = field.isValidToAdd(target, result);
        if (valid.isAllowed()) {
            field.addElement(target, result);
        }
        super.objectActionResult(result, placement);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation

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.