Package org.apache.isis.core.metamodel.facets.members.disabled

Examples of org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet


    @Test(expected = DisabledException.class)
    public void shouldNotBeAbleToModifyProperty() {

        // given
        final DisabledFacet disabledFacet = new DisabledFacetAlwaysEverywhere(mockPasswordMember);
        facets = Arrays.asList((Facet)disabledFacet, new PropertySetterFacetViaSetterMethod(setPasswordMethod, mockPasswordMember));

        final Consent visibilityConsent = new Allow(new InteractionResult(new PropertyVisibilityEvent(employeeDO, null)));

        final InteractionResult usabilityInteractionResult = new InteractionResult(new PropertyUsabilityEvent(employeeDO, null));
View Full Code Here


        if(namedFacet != null && !namedFacet.isNoop()) {
            NamedFacetRepr namedFacetRepr = new NamedFacetRepr();
            namedFacetRepr.value = namedFacet.value();
            memberRepr.named = namedFacetRepr;
        }
        DisabledFacet disabledFacet = assoc.getFacet(DisabledFacet.class);
        if(disabledFacet != null && !disabledFacet.isNoop()) {
            DisabledFacetRepr disabledFacetRepr = new DisabledFacetRepr();
            if(disabledFacet instanceof DisabledFacetImpl) {
                DisabledFacetImpl disabledFacetImpl = (DisabledFacetImpl) disabledFacet;
                disabledFacetRepr.reason = Strings.emptyToNull(disabledFacetImpl.getReason());
            }
            disabledFacetRepr.when = whenAlwaysToNull(disabledFacet.when());
            disabledFacetRepr.where = whereAnywhereToNull(disabledFacet.where());
            memberRepr.disabled = disabledFacetRepr;
        }
        HiddenFacet hiddenFacet = assoc.getFacet(HiddenFacet.class);
        if(hiddenFacet != null && !hiddenFacet.isNoop()) {
            HiddenFacetRepr hiddenFacetRepr = new HiddenFacetRepr();
View Full Code Here

        super(FeatureType.MEMBERS);
    }

    @Override
    public void process(final ProcessMethodContext processMethodContext) {
        DisabledFacet disabledFacet = createFromMetadataPropertiesIfPossible(processMethodContext);
        if(disabledFacet == null) {
            disabledFacet = createFromAnnotationIfPossible(processMethodContext);
        }
        // no-op if null
        FacetUtil.addFacet(disabledFacet);
View Full Code Here

        FacetUtil.addFacet(disabledFacet);
    }

    @Override
    public void process(ProcessContributeeMemberContext processMemberContext) {
        DisabledFacet disabledFacet = createFromMetadataPropertiesIfPossible(processMemberContext);
        // no-op if null
        FacetUtil.addFacet(disabledFacet);
    }
View Full Code Here

        // copy over facets from contributed to own.
        FacetUtil.copyFacets(serviceAction.getFacetedMethod(), facetHolder);
       
        final NotPersistedFacet notPersistedFacet = new NotPersistedFacetAbstract(this) {};
        final DisabledFacet disabledFacet = disabledFacet();
        final TypeOfFacet typeOfFacet = new TypeOfFacetAbstract(getSpecification().getCorrespondingClass(), this, objectMemberContext.getSpecificationLookup()) {};
       
        FacetUtil.addFacet(notPersistedFacet);
        FacetUtil.addFacet(disabledFacet);
        FacetUtil.addFacet(typeOfFacet);
View Full Code Here

       
        identifier = Identifier.actionIdentifier(contributeeType.getCorrespondingClass().getName(), memberName, memberParameterNames);
    }

    private DisabledFacet disabledFacet() {
        final DisabledFacet originalFacet = facetHolder.getFacet(DisabledFacet.class);
        if( originalFacet != null &&
            originalFacet.when() == When.ALWAYS &&
            originalFacet.where() == Where.ANYWHERE) {
            return originalFacet;
        }
        // ensure that the contributed association is always disabled
        return new DisabledFacetImpl(When.ALWAYS, Where.ANYWHERE, "Contributed collection", this);
    }
View Full Code Here

       
        // copy over facets from contributed to own.
        FacetUtil.copyFacets(serviceAction.getFacetedMethod(), facetHolder);
       
        final NotPersistedFacet notPersistedFacet = new NotPersistedFacetAbstract(this) {};
        final DisabledFacet disabledFacet = disabledFacet();
       
        FacetUtil.addFacet(notPersistedFacet);
        FacetUtil.addFacet(disabledFacet);
       
        // calculate the identifier
View Full Code Here

       
        identifier = Identifier.actionIdentifier(contributeeType.getCorrespondingClass().getName(), memberName, memberParameterNames);
    }

    private DisabledFacet disabledFacet() {
        final DisabledFacet originalFacet = facetHolder.getFacet(DisabledFacet.class);
        if( originalFacet != null &&
            originalFacet.when() == When.ALWAYS &&
            originalFacet.where() == Where.ANYWHERE) {
            return originalFacet;
        }
        // ensure that the contributed association is always disabled
        return new DisabledFacetImpl(When.ALWAYS, Where.ANYWHERE, "Contributed property", this);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.facets.members.disabled.DisabledFacet

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.