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

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


        }
        return member;
    }

    private ObjectMember getAssociationElseThrowException(final Identifier id, final ObjectSpecification specification) {
        final ObjectMember member = specification.getAssociation(id.getMemberName());
        if (member == null) {
            throw new IsisException("No property or collection found for id " + id);
        }
        return member;
    }
View Full Code Here


        if (isUnderlyingMethod(method)) {
            return getDelegate();
        }

        final ObjectMember objectMember = locateAndCheckMember(method);
        final List<Facet> imperativeFacets = getImperativeFacets(objectMember, method);

        final String memberName = objectMember.getName();

        if (instanceOf(imperativeFacets, DisableForContextFacetViaMethod.class, HideForContextFacetViaMethod.class)) {
            throw new UnsupportedOperationException(String.format("Cannot invoke supporting method '%s'", memberName));
        }

        final String methodName = method.getName();

        if (instanceOf(imperativeFacets, ActionDefaultsFacet.class, PropertyDefaultFacet.class, ActionChoicesFacet.class, ActionParameterChoicesFacet.class, PropertyChoicesFacet.class)) {
            return method.invoke(getDelegate(), args);
        }

        // for all members, check visibility and usability
        checkVisibility(getAuthenticationSession(), targetAdapter, objectMember);

        if (objectMember.isOneToOneAssociation()) {

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

            final OneToOneAssociation otoa = (OneToOneAssociation) objectMember;
            if (instanceOf(imperativeFacets, PropertyOrCollectionAccessorFacet.class)) {
                return handleGetterMethodOnProperty(args, targetAdapter, otoa, methodName);
            }
            if (instanceOf(imperativeFacets, PropertySetterFacet.class, PropertyInitializationFacet.class)) {
                checkUsability(getAuthenticationSession(), targetAdapter, objectMember);
                return handleSetterMethodOnProperty(args, getAuthenticationSession(), targetAdapter, otoa, methodName);
            }
        }
        if (objectMember.isOneToManyAssociation()) {

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

    // switching
    // /////////////////////////////////////////////////////////////////

    private ObjectMember locateAndCheckMember(final Method method) {
        final ObjectSpecificationDefault objectSpecificationDefault = getJavaSpecificationOfOwningClass(method);
        final ObjectMember member = objectSpecificationDefault.getMember(method);
        if (member == null) {
            final String methodName = method.getName();
            throw new UnsupportedOperationException("Method '" + methodName + "' being invoked does not correspond to any of the object's fields or actions.");
        }
        return member;
View Full Code Here

        final ObjectAdapter onAdapter = getPeer().validateOnObject();
        final String aliasAs = getPeer().validateAliasAs();
        final Perform performCommand = getPeer().validatePerform();

        ObjectMember objectMember = null;
        if (performCommand.requiresMember()) {
            objectMember = getPeer().validateOnMember(onAdapter);
        }

        getPeer().performCommand(onAdapter, aliasAs, objectMember, performCommand, asValues(argumentCells));
View Full Code Here

        final ObjectSpecification parentSpec = getSpecificationLoader().loadSpecification(domainType);
        if (parentSpec == null) {
            throw JsonApplicationException.create(HttpStatusCode.NOT_FOUND);
        }

        final ObjectMember objectMember = parentSpec.getAssociation(propertyId);
        if (objectMember == null || objectMember.isOneToManyAssociation()) {
            throw JsonApplicationException.create(HttpStatusCode.NOT_FOUND);
        }
        final OneToOneAssociation property = (OneToOneAssociation) objectMember;

        final RendererFactory rendererFactory = rendererFactoryRegistry.find(representationType);
View Full Code Here

        final ObjectSpecification parentSpec = getSpecificationLoader().loadSpecification(domainType);
        if (parentSpec == null) {
            throw JsonApplicationException.create(HttpStatusCode.NOT_FOUND);
        }

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

        final ObjectSpecification parentSpec = getSpecificationLoader().loadSpecification(domainType);
        if (parentSpec == null) {
            throw JsonApplicationException.create(HttpStatusCode.NOT_FOUND);
        }

        final ObjectMember objectMember = parentSpec.getObjectAction(actionId);
        if (objectMember == null) {
            throw JsonApplicationException.create(HttpStatusCode.NOT_FOUND);
        }
        final ObjectAction action = (ObjectAction) objectMember;
View Full Code Here

        final ObjectSpecification parentSpec = getSpecificationLoader().loadSpecification(domainType);
        if (parentSpec == null) {
            throw JsonApplicationException.create(HttpStatusCode.NOT_FOUND);
        }

        final ObjectMember objectMember = parentSpec.getObjectAction(actionId);
        if (objectMember == null) {
            throw JsonApplicationException.create(HttpStatusCode.NOT_FOUND);
        }
        final ObjectAction parentAction = (ObjectAction) objectMember;
View Full Code Here

        final StringBuffer buffer = new StringBuffer();
        if (members.size() == 0) {
            buffer.append("none");
        } else {
            for (int i = 0; i < members.size(); i++) {
                final ObjectMember member = members.get(i);
                buffer.append("<a href=\"#" + members.get(i).getId() + "\">" + member.getId() + "</a>   <small>");
                buffer.append(member.isAlwaysHidden() ? "" : "Visible ");
                if (member.isPropertyOrCollection()) {
                    buffer.append(((ObjectAssociation) member).isNotPersisted() ? "Not-Persisted " : " ");
                    buffer.append(((ObjectAssociation) member).isMandatory() ? "Mandatory " : "");
                }
                buffer.append("</small></a><br>");
            }
View Full Code Here

    protected void addLinkSelfIfRequired() {
        if (!includesSelf) {
            return;
        }

        final ObjectMember objectMember = getObjectFeature();
        final LinkBuilder linkBuilder = LinkBuilder.newBuilder(getResourceContext(), Rel.SELF, getRepresentationType(), "domainTypes/%s/%s%s", getParentSpecification().getFullIdentifier(), getMemberType().getUrlPart(), objectMember.getId());
        getLinks().arrayAdd(linkBuilder.build());
    }
View Full Code Here

TOP

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

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.