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

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


            return getActionElseThrowException(id, specification);
        }
    }

    private ObjectMember getActionElseThrowException(final Identifier id, final ObjectSpecification specification) {
        final ObjectMember member =
            specification.getObjectAction(ActionType.USER, id.getMemberName(), loadParameterSpecifications(id));
        if (member == null) {
            throw new IsisException("No user action found for id " + id);
        }
        return member;
View Full Code Here


        }
        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

    @Override
    public void doHandle(final PerformContext performContext) throws ScenarioBoundValueException {

        final ObjectAdapter onAdapter = performContext.getOnAdapter();
        final ObjectMember nakedObjectMember = performContext.getObjectMember();
        final CellBinding onMemberBinding = performContext.getPeer().getOnMemberBinding();

        final OneToManyAssociation otma = (OneToManyAssociation) nakedObjectMember;

        final CollectionAddToFacet addToFacet = nakedObjectMember.getFacet(CollectionAddToFacet.class);
        if (addToFacet == null) {
            throw ScenarioBoundValueException.current(onMemberBinding, "(cannot add to collection)");
        }

        // safe since guaranteed by superclass
View Full Code Here

    @Override
    public void doHandle(final PerformContext performContext) throws ScenarioBoundValueException {

        final ObjectAdapter onAdapter = performContext.getOnAdapter();
        final ObjectMember nakedObjectMember = performContext.getObjectMember();
        final CellBinding onMemberBinding = performContext.getPeer().getOnMemberBinding();
        @SuppressWarnings("unused")
        final ScenarioCell onMemberCell = onMemberBinding.getCurrentCell();

        final List<ScenarioCell> argumentCells = performContext.getArgumentCells();

        final OneToManyAssociation otma = (OneToManyAssociation) nakedObjectMember;

        // safe since guaranteed by superclass
        final CellBinding arg0Binding = performContext.getPeer().getArg0Binding();
        final ScenarioCell arg0Cell = argumentCells.get(0);
        final String toRemove = arg0Cell.getText();

        final CollectionRemoveFromFacet removeFromFacet = nakedObjectMember.getFacet(CollectionRemoveFromFacet.class);
        if (removeFromFacet == null) {
            throw ScenarioBoundValueException.current(onMemberBinding, "(cannot remove from collection)");
        }

        final ObjectAdapter toRemoveAdapter = performContext.getPeer().getAliasRegistry().getAliased(toRemove);
View Full Code Here

    @Override
    public void doHandle(final PerformContext performContext) throws ScenarioBoundValueException {

        final ObjectAdapter onAdapter = performContext.getOnAdapter();
        final ObjectMember nakedObjectMember = performContext.getObjectMember();
        final CellBinding arg0Binding = performContext.getPeer().getArg0Binding();
        final ScenarioCell arg0Cell = arg0Binding.getCurrentCell();

        int requestedParamNum = -1;
        try {
View Full Code Here

                ImperativeFacetFlags flags = null;

                if (!ignore) {
                    final ObjectSpecificationDefault targetObjSpec = getJavaSpecificationOfOwningClass(proxiedMethod);

                    final ObjectMember member = targetObjSpec.getMember(proxiedMethod);
                    flags = ImperativeFacetUtils.getImperativeFacetFlags(member, proxiedMethod);

                    if (flags.impliesResolve()) {
                        objectResolver.resolve(proxied, member.getName());
                    }
                }

                final Object proxiedReturn = proxiedMethod.invoke(proxied, args); // execute the original method.
View Full Code Here

    }

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

        final ObjectMember nakedObjectMember = performContext.getObjectMember();
        final CellBinding thatBinding = performContext.getPeer().getThatItBinding();
        final CellBinding arg0Binding = performContext.getPeer().getArg0Binding();

        // check we have an argument to validate (if one is required)
        if (!arg0Binding.isFound()) {
            throw ScenarioBoundValueException.current(thatBinding, "(requires argument)");
        }

        final ScenarioCell arg0Cell = arg0Binding.getCurrentCell();
        final String toValidate = arg0Cell.getText();
        if (StringUtils.isNullOrEmpty(toValidate)) {
            throw ScenarioBoundValueException.current(arg0Binding, "(required)");
        }

        final ObjectAdapter toValidateAdapter =
            performContext.getPeer().getAdapter(null, nakedObjectMember.getSpecification(), arg0Binding, arg0Cell);
        final Consent validityConsent = determineConsent(performContext, toValidateAdapter);
        if (!getAssertion().satisfiedBy(validityConsent)) {
            throw ScenarioBoundValueException.current(getAssertion().colorBinding(arg0Binding, thatBinding),
                getAssertion().getReason(validityConsent));
        }
View Full Code Here

    @Override
    protected void doThat(final PerformContext performContext, final Iterable<ObjectAdapter> collection)
        throws ScenarioBoundValueException {

        final ObjectMember nakedObjectMember = performContext.getObjectMember();
        final CellBinding thatBinding = performContext.getPeer().getThatItBinding();
        final CellBinding arg0Binding = performContext.getPeer().getArg0Binding();

        if (!arg0Binding.isFound()) {
            throw ScenarioBoundValueException.current(thatBinding, "(requires argument)");
        }

        final ScenarioCell arg0Cell = arg0Binding.getCurrentCell();

        final ObjectAdapter containedAdapter =
            performContext.getPeer().getAdapter(null, nakedObjectMember.getSpecification(), arg0Binding, arg0Cell);

        boolean contains = false;
        for (final ObjectAdapter eachAdapter : collection) {
            if (containedAdapter == eachAdapter) {
                contains = true;
View Full Code Here

    // TODO: a lot of duplication with InvokeAction; simplify somehow?
    @Override
    public ObjectAdapter that(final PerformContext performContext) throws ScenarioBoundValueException {

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

    // TODO: a lot of duplication with InvokeAction; simplify somehow?
    @Override
    public ObjectAdapter that(final PerformContext performContext) throws ScenarioBoundValueException {

        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();
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.