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

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


                OneToOneAssociation property = (OneToOneAssociation)assoc;
                Representation propertyRep = PropertyRepBuilder.newBuilder(repContext.underAttribute(id), objectAdapter, property).build();
                withMember(id, propertyRep);
            }
            if(assoc instanceof OneToManyAssociation) {
                OneToManyAssociation collection = (OneToManyAssociation) assoc;
                Representation collectionRep = CollectionRepBuilder.newBuilder(repContext.underAttribute(id), objectAdapter, collection).build();
                withMember(id, collectionRep);
            }
        }
       
View Full Code Here


    @Override
    public ObjectAdapter that(final PerformContext performContext) throws ScenarioBoundValueException {

        final ObjectAdapter onAdapter = performContext.getOnAdapter();
        final OneToManyAssociation otma = (OneToManyAssociation) performContext.getObjectMember();

        final ObjectAdapter nakedObjectRepresentingCollection = otma.get(onAdapter);
        final CollectionFacet collectionFacet =
            nakedObjectRepresentingCollection.getSpecification().getFacet(CollectionFacet.class);

        doThat(performContext, collectionFacet.iterable(nakedObjectRepresentingCollection));
View Full Code Here

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

        final ObjectAdapter objectAdapter = getObjectAdapter(oidStr);
        ObjectAssociation association = objectAdapter.getSpecification().getAssociation(collectionId);
        if(association == null || !association.isOneToManyAssociation()) {
            throwCollectionNotFoundException(collectionId);
        }
        OneToManyAssociation collection = (OneToManyAssociation) association;
        CollectionRepBuilder builder = CollectionRepBuilder.newBuilder(getResourceContext().repContext(), objectAdapter, collection);
        if(!builder.isMemberVisible()) {
            throwCollectionNotFoundException(collectionId);
        }
View Full Code Here

                checkUsability(getAuthenticationSession(), targetAdapter, objectMember);
                return handleSetterMethodOnProperty(args, getAuthenticationSession(), targetAdapter, otoa, methodName);
            }
        }
        if (objectMember.isOneToManyAssociation()) {
            final OneToManyAssociation otma = (OneToManyAssociation) objectMember;
            if (isGetterMethod) {
                return handleGetterMethodOnCollection(method, args, targetAdapter, otma, memberName);
            }
            if (isAddToMethod) {
                checkUsability(getAuthenticationSession(), targetAdapter, objectMember);
View Full Code Here

        collectionRvContainer.add(fieldset);
       
        final String name = association.getName();
        fieldset.add(new Label(ID_COLLECTION_NAME, name));

    final OneToManyAssociation otma = (OneToManyAssociation) association;

    final CollectionPanel collectionPanel = new CollectionPanel(ID_COLLECTION, entityModel, otma);

    fieldset.addOrReplace(collectionPanel);
  }
View Full Code Here

            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

        } else if (field instanceof OneToManyAssociation) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("includeField(Pl, Vec, Str): field is 1->M");
            }

            final OneToManyAssociation oneToManyAssociation = (OneToManyAssociation) field;
            final ObjectAdapter collection = oneToManyAssociation.get(fieldPlace.getObject());
            final CollectionFacet facet = collection.getSpecification().getFacet(CollectionFacet.class);

            if (LOG.isDebugEnabled()) {
                LOG.debug("includeField(Pl, Vec, Str): 1->M: " + log("collection.size", "" + facet.size(collection)));
            }
View Full Code Here

                if (LOG.isDebugEnabled()) {
                    LOG.debug("objectToElement(NO): " + log("field", fieldName) + " is OneToManyAssociation");
                }

                final OneToManyAssociation oneToManyAssociation = (OneToManyAssociation) field;
                final Element xmlCollectionElement = xmlFieldElement; // more meaningful locally scoped name

                ObjectAdapter collection;
                try {
                    collection = oneToManyAssociation.get(object);
                    final ObjectSpecification referencedTypeNos = oneToManyAssociation.getSpecification();
                    final String fullyQualifiedClassName = referencedTypeNos.getFullIdentifier();

                    // XML
                    isisMetaModel.setIsisCollection(xmlCollectionElement, schema.getPrefix(), fullyQualifiedClassName, collection);
                } catch (final Exception ex) {
                    LOG.warn("objectToElement(NO): " + log("field", fieldName) + ": get(obj) threw exception - skipping XML generation");
                }

                // XSD
                xsdFieldElement = schema.createXsElementForNofCollection(xsElement, xmlCollectionElement, oneToManyAssociation.getSpecification().getFullIdentifier(), FacetUtil.getFacetsByType(oneToManyAssociation));

            } else {
                if (LOG.isInfoEnabled()) {
                    LOG.info("objectToElement(NO): " + log("field", fieldName) + " is unknown type; ignored");
                }
View Full Code Here

                }
                rows.add(new MetaModelRow(spec, otoa));
            }
            final List<ObjectAssociation> associations = spec.getAssociations(Contributed.EXCLUDED, ObjectAssociation.Filters.COLLECTIONS);
            for (ObjectAssociation collection : associations) {
                final OneToManyAssociation otma = (OneToManyAssociation) collection;
                if (exclude(otma)) {
                    continue;
                }
                rows.add(new MetaModelRow(spec, otma));
            }
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.