Package org.apache.isis.core.metamodel.facets.actions.semantics

Examples of org.apache.isis.core.metamodel.facets.actions.semantics.ActionSemanticsFacet


        final FacetedMethod facetHolder = processMethodContext.getFacetHolder();
        final Class<?> cls = processMethodContext.getCls();
        final Method method = processMethodContext.getMethod();

        final ActionSemanticsFacet actionSemanticsFacet = facetHolder.getFacet(ActionSemanticsFacet.class);
        if(actionSemanticsFacet == null) {
            throw new IllegalStateException("Require ActionSemanticsFacet in order to process");
        }
        if(facetHolder.containsDoOpFacet(CommandFacet.class)) {
            // do not replace
            return;
        }
        if(HasTransactionId.class.isAssignableFrom(cls)) {
            // do not install on any implementation of HasTransactionId
            // (ie commands, audit entries, published events).
            return;
        }
        final ActionCategorization categorization = ActionCategorization.parse(configuration.getString(COMMAND_ACTIONS_KEY));
        if(categorization == ActionCategorization.NONE) {
            return;
        }
        if(actionSemanticsFacet.value() == Of.SAFE && categorization == ActionCategorization.IGNORE_SAFE) {
            return;
        }
        final Command annotation = Annotations.getAnnotation(method, Command.class);
        FacetUtil.addFacet(create(annotation, facetHolder));
    }
View Full Code Here


        return facet.getOnType();
    }

    @Override
    public ActionSemantics.Of getSemantics() {
        final ActionSemanticsFacet facet = getFacet(ActionSemanticsFacet.class);
        return facet != null? facet.value(): ActionSemantics.Of.NON_IDEMPOTENT;
    }
View Full Code Here

                for (final ObjectAction objectAction : objectActions) {
                    final BookmarkPolicyFacet bookmarkFacet = objectAction.getFacet(BookmarkPolicyFacet.class);
                    if(bookmarkFacet == null || bookmarkFacet.isNoop() || bookmarkFacet.value() == BookmarkPolicy.NEVER) {
                        continue;
                    }
                    final ActionSemanticsFacet semanticsFacet = objectAction.getFacet(ActionSemanticsFacet.class);
                    if(semanticsFacet == null || semanticsFacet.isNoop() || semanticsFacet.value() != Of.SAFE) {
                      validationFailures.add(
                      "Action %s is bookmarkable but action semantics are not explicitly indicated as being safe.  Either add @ActionSemantics(Of.Safe), or remove @Bookmarkable.",
                      objectAction.getIdentifier().toClassAndNameIdentityString());
                    }
                }
View Full Code Here

        return facet.getOnType();
    }

    @Override
    public ActionSemantics.Of getSemantics() {
        final ActionSemanticsFacet facet = getFacet(ActionSemanticsFacet.class);
        return facet != null? facet.value(): ActionSemantics.Of.NON_IDEMPOTENT;
    }
View Full Code Here

        final FacetedMethod facetHolder = processMethodContext.getFacetHolder();
        final Class<?> cls = processMethodContext.getCls();
        final Method method = processMethodContext.getMethod();

        final ActionSemanticsFacet actionSemanticsFacet = facetHolder.getFacet(ActionSemanticsFacet.class);
        if(actionSemanticsFacet == null) {
            throw new IllegalStateException("Require ActionSemanticsFacet in order to process");
        }
        if(facetHolder.containsDoOpFacet(CommandFacet.class)) {
            // do not replace
            return;
        }
        if(HasTransactionId.class.isAssignableFrom(cls)) {
            // do not install on any implementation of HasTransactionId
            // (ie commands, audit entries, published events).
            return;
        }
        final ActionCategorization categorization = ActionCategorization.parse(configuration.getString(COMMAND_ACTIONS_KEY));
        if(categorization == ActionCategorization.NONE) {
            return;
        }
        if(actionSemanticsFacet.value() == Of.SAFE && categorization == ActionCategorization.IGNORE_SAFE) {
            return;
        }
        final Command annotation = Annotations.getAnnotation(method, Command.class);
        FacetUtil.addFacet(create(annotation, facetHolder));
    }
View Full Code Here

                for (final ObjectAction objectAction : objectActions) {
                    final BookmarkPolicyFacet bookmarkFacet = objectAction.getFacet(BookmarkPolicyFacet.class);
                    if(bookmarkFacet == null || bookmarkFacet.isNoop() || bookmarkFacet.value() == BookmarkPolicy.NEVER) {
                        continue;
                    }
                    final ActionSemanticsFacet semanticsFacet = objectAction.getFacet(ActionSemanticsFacet.class);
                    if(semanticsFacet == null || semanticsFacet.isNoop() || semanticsFacet.value() != Of.SAFE) {
                      validationFailures.add(
                      "Action %s is bookmarkable but action semantics are not explicitly indicated as being safe.  Either add @ActionSemantics(Of.Safe), or remove @Bookmarkable.",
                      objectAction.getIdentifier().toClassAndNameIdentityString());
                    }
                }
View Full Code Here

        return facet.getOnType();
    }

    @Override
    public ActionSemantics.Of getSemantics() {
        final ActionSemanticsFacet facet = getFacet(ActionSemanticsFacet.class);
        return facet != null? facet.value(): ActionSemantics.Of.NON_IDEMPOTENT;
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.facets.actions.semantics.ActionSemanticsFacet

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.