Package org.apache.isis.core.metamodel.consent

Examples of org.apache.isis.core.metamodel.consent.Consent


            final ObjectAssociation fld = allFields.get(j);
            fields[i] = fld;
            names[i] = fld.getName();
            descriptions[i] = fld.getDescription();

            final Consent usableByUser = fld.isUsable(getAuthenticationSession(), adapter, where);
            if (usableByUser.isVetoed()) {
                descriptions[i] = usableByUser.getReason();
            }

            fieldSpecifications[i] = fld.getSpecification();
            initialState[i] = fld.get(adapter);
            if (skipField(adapter, fld)) {
View Full Code Here


            throw ScenarioBoundValueException.current(onMemberBinding, "(not visible)");
        }
    }

    public void ensureUsable(final CellBinding onMemberBinding, final ScenarioCell onMemberCell) throws ScenarioBoundValueException {
        final Consent usable = objectMember.isUsable(getAuthenticationSession(), getOnAdapter(), where);
        if (usable.isVetoed()) {
            throw ScenarioBoundValueException.current(onMemberBinding, "(not usable)");
        }
    }
View Full Code Here

            if (fld.isOneToOneAssociation()) {
                final OneToOneAssociation oneToOneAssociation = (OneToOneAssociation) fld;
                final ObjectAdapter entryReference = entries[i];
                final ObjectAdapter currentReference = oneToOneAssociation.get(target);
                if (currentReference != entryReference) {
                    final Consent valueValid = ((OneToOneAssociation) fld).isAssociationValid(target, entryReference);
                    errors[i] = valueValid.getReason();
                }
            }
        }

        if (target.isTransient()) {
            saveState(target, entries);
            final Consent isValid = target.getSpecification().isValid(target);
            error = isValid.isVetoed() ? isValid.getReason() : null;
        }
    }
View Full Code Here

        if (clearFacet == null) {
            throw ScenarioBoundValueException.current(thatItBinding, "(cannot clear)");
        }

        // validate setting to null
        final Consent validConsent = otoa.isAssociationValid(onAdapter, null);
        if (validConsent.isVetoed()) {
            throw ScenarioBoundValueException.current(thatItBinding, validConsent.getReason());
        }

        clearFacet.clearProperty(onAdapter);

    }
View Full Code Here

                } else if (action.getParameterCount() == 1 && action.isContributed() && target.getSpecification().isOfType(action.getParameters().get(0).getSpecification())) {
                    collectParameters = false;
                } else {
                    collectParameters = true;
                }
                final Consent consent = action.isUsable(IsisContext.getAuthenticationSession(), target, where);
                final String consentReason = consent.getReason();
                menuItem = context.getComponentFactory().createMenuItem(actionId, action.getName(), action.getDescription(), consentReason, action.getType(), collectParameters, targetObjectId);
            }
            if (menuItem != null) {
                menuItems.add(menuItem);
            }
View Full Code Here

    @Override
    public void checkForValidity(final Context context) {
        final ObjectAdapter[] parameters = getEntries(context);
        final ObjectAdapter target = getTarget(context);
        final Consent consent = action.isProposedArgumentSetValid(target, parameters);
        error = consent.getReason();
    }
View Full Code Here

            throw ScenarioBoundValueException.current(arg0Binding, "(unknown alias)");
        }

        // validate argument
        otma.createValidateAddInteractionContext(getSession(), InteractionInvocationMethod.BY_USER, onAdapter, toAddAdapter);
        final Consent validToAdd = otma.isValidToAdd(onAdapter, toAddAdapter);
        if (validToAdd.isVetoed()) {
            throw ScenarioBoundValueException.current(arg0Binding, validToAdd.getReason());
        }

        // add
        addToFacet.add(onAdapter, toAddAdapter);
    }
View Full Code Here

            throw ScenarioBoundValueException.current(arg0Binding, "(unknown alias)");
        }

        // validate argument
        otma.createValidateAddInteractionContext(getSession(), InteractionInvocationMethod.BY_USER, onAdapter, toRemoveAdapter);
        final Consent validToRemove = otma.isValidToRemove(onAdapter, toRemoveAdapter);
        if (validToRemove.isVetoed()) {
            throw ScenarioBoundValueException.current(onMemberBinding, validToRemove.getReason());
        }

        // remove
        removeFromFacet.remove(onAdapter, toRemoveAdapter);
View Full Code Here

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

        final ObjectAdapter onAdapter = performContext.getOnAdapter();

        final Consent valid = onAdapter.getSpecification().isValid(onAdapter);

        final CellBinding performBinding = performContext.getPeer().getPerformBinding();
        if (valid.isVetoed()) {
            throw ScenarioBoundValueException.current(performBinding, valid.getReason());
        }

        if (onAdapter.representsPersistent()) {
            throw ScenarioBoundValueException.current(performBinding, "(already persistent)");
        }
View Full Code Here

        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));
        }

        return toValidateAdapter;
View Full Code Here

TOP

Related Classes of org.apache.isis.core.metamodel.consent.Consent

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.