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

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


        final String paramContext = PageParameterNames.ACTION_PARAM_CONTEXT.getStringFrom(pageParameters);
        if (paramContext == null) {
            return false;
        }

        final ObjectAction action = actionMemento.getAction();
        final List<ObjectSpecification> parameterTypes = action.getParameterTypes();
        final int parameterCount = parameterTypes.size();

        final Map.Entry<Integer, String> mapEntry = parse(paramContext);

        final int paramNum = mapEntry.getKey();
View Full Code Here


            return null;
        }
    }

    private void setArgument(final int paramNum, final ObjectAdapter argumentAdapter) {
        final ObjectAction action = actionMemento.getAction();
        final ObjectActionParameter actionParam = action.getParameters().get(paramNum);
        final ActionParameterMemento apm = new ActionParameterMemento(actionParam);
        final ScalarModel argumentModel = getArgumentModel(apm);
        argumentModel.setObject(argumentAdapter);
    }
View Full Code Here

    private ObjectAdapter executeAction() {

        final ObjectAdapter targetAdapter = getTargetAdapter();
        final ObjectAdapter[] arguments = getArgumentsAsArray();
        final ObjectAction action = getActionMemento().getAction();

        final AuthenticationSession session = getAuthenticationSession();
        return action.executeWithRuleChecking(targetAdapter, arguments, session, WHERE_FOR_ACTION_INVOCATION);
    }
View Full Code Here

    }

    public String getReasonInvalidIfAny() {
        final ObjectAdapter targetAdapter = getTargetAdapter();
        final ObjectAdapter[] proposedArguments = getArgumentsAsArray();
        final ObjectAction objectAction = getActionMemento().getAction();
        final Consent validity = objectAction.isProposedArgumentSetValid(targetAdapter, proposedArguments);
        return validity.isAllowed() ? null : validity.getReason();
    }
View Full Code Here

    public ObjectAdapter[] getArgumentsAsArray() {
      if(this.arguments.size() < this.getActionMemento().getAction().getParameterCount()) {
        primeArgumentModels();
      }
     
        final ObjectAction objectAction = getActionMemento().getAction();
        final ObjectAdapter[] arguments = new ObjectAdapter[objectAction.getParameterCount()];
        for (int i = 0; i < arguments.length; i++) {
            final ScalarModel scalarModel = this.arguments.get(i);
            arguments[i] = scalarModel.getObject();
        }
        return arguments;
View Full Code Here

    /**
     * Bookmarkable if the {@link ObjectAction action} has a {@link BookmarkPolicyFacet bookmark} policy
     * of {@link BookmarkPolicy#AS_ROOT root}, and has safe {@link ObjectAction#getSemantics() semantics}.
     */
    public boolean isBookmarkable() {
        final ObjectAction action = getActionMemento().getAction();
        final BookmarkPolicyFacet bookmarkPolicy = action.getFacet(BookmarkPolicyFacet.class);
        final boolean safeSemantics = action.getSemantics() == ActionSemantics.Of.SAFE;
        return bookmarkPolicy.value() == BookmarkPolicy.AS_ROOT && safeSemantics;
    }
View Full Code Here

    }

    // //////////////////////////////////////
   
    public List<ActionParameterMemento> primeArgumentModels() {
        final ObjectAction objectAction = getActionMemento().getAction();

        final List<ObjectActionParameter> parameters = objectAction.getParameters();
        final List<ActionParameterMemento> mementos = buildParameterMementos(parameters);
        for (final ActionParameterMemento apm : mementos) {
            getArgumentModel(apm);
        }
       
View Full Code Here

            requestedParamNum = Integer.valueOf(arg0Cell.getText());
        } catch (final NumberFormatException ex) {
            throw ScenarioBoundValueException.current(arg0Binding, ex.getMessage());
        }

        final ObjectAction noa = (ObjectAction) nakedObjectMember;
        final int parameterCount = noa.getParameterCount();
        if (requestedParamNum < 0 || requestedParamNum > parameterCount - 1) {
            throw ScenarioBoundValueException.current(arg0Binding, "(must be between 0 and " + (parameterCount - 1) + ")");
        }

        final ObjectAdapter[] defaults = noa.getDefaults(onAdapter);
        result = defaults[requestedParamNum];
    }
View Full Code Here

        final ObjectAdapter onAdapter = performContext.getOnAdapter();
        final ObjectMember nakedObjectMember = performContext.getObjectMember();
        final CellBinding onMemberBinding = performContext.getPeer().getOnMemberBinding();
        final List<ScenarioCell> argumentCells = performContext.getArgumentCells();

        final ObjectAction nakedObjectAction = (ObjectAction) nakedObjectMember;
        final int parameterCount = nakedObjectAction.getParameterCount();
        final boolean isContributedOneArgAction = nakedObjectAction.isContributed() && parameterCount == 1;

        if (isContributedOneArgAction) {
            return null;
        }

        // lookup arguments
        final ObjectAdapter[] proposedArguments = performContext.getPeer().getAdapters(onAdapter, nakedObjectAction, onMemberBinding, argumentCells);

        // validate arguments
        final Consent argSetValid = nakedObjectAction.isProposedArgumentSetValid(onAdapter, proposedArguments);
        if (argSetValid.isAllowed()) {
            final CellBinding thatItBinding = performContext.getPeer().getThatItBinding();
            throw ScenarioBoundValueException.current(thatItBinding, "(valid)");
        }
View Full Code Here

        final ObjectAdapter onAdapter = performContext.getOnAdapter();
        final ObjectMember nakedObjectMember = performContext.getObjectMember();
        final CellBinding onMemberBinding = performContext.getPeer().getOnMemberBinding();
        final List<ScenarioCell> argumentCells = performContext.getArgumentCells();

        final ObjectAction nakedObjectAction = (ObjectAction) nakedObjectMember;
        final int parameterCount = nakedObjectAction.getParameterCount();
        final boolean isContributedOneArgAction = nakedObjectAction.isContributed() && parameterCount == 1;

        if (isContributedOneArgAction) {
            return null;
        }

        // lookup arguments
        final ObjectAdapter[] proposedArguments = performContext.getPeer().getAdapters(onAdapter, nakedObjectAction, onMemberBinding, argumentCells);

        // validate arguments
        final Consent argSetValid = nakedObjectAction.isProposedArgumentSetValid(onAdapter, proposedArguments);
        if (argSetValid.isVetoed()) {
            throw ScenarioBoundValueException.current(onMemberBinding, argSetValid.getReason());
        }

        // execute
View Full Code Here

TOP

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

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.