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

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


    }

    @Override
    public void parseTextEntry(final String entryText) {
        object = validateAndParse(entryText);
        final Consent valid = ((OneToOneAssociation) getField()).isAssociationValid(getParent(), object);
        if (valid.isVetoed()) {
            throw new InvalidEntryException(valid.getReason());
        }
        if (getValueAssociation().isMandatory() && object == null) {
            throw new InvalidEntryException("Mandatory field cannot be empty");
        }
    }
View Full Code Here


    private ObjectAndAction objectAndActionIfHomePageAndUsable(ObjectAdapter serviceAdapter, ObjectAction objectAction) {
        if (!objectAction.containsDoOpFacet(HomePageFacet.class)) {
            return null;
        }

        final Consent visibility = objectAction.isVisible(getAuthenticationSession(), serviceAdapter, Where.ANYWHERE);
        if (visibility.isVetoed()) {
            return null;
        }

        final Consent usability = objectAction.isUsable(getAuthenticationSession(), serviceAdapter, Where.ANYWHERE);
        if (usability.isVetoed()) {
            return  null;
        }

        return new ObjectAndAction(serviceAdapter, objectAction);
    }
View Full Code Here

            final CssMenuBuilder.CssMenuContext cssMenuContext) {

        // check visibility
        final AuthenticationSession session = getAuthenticationSession();
        final ObjectAdapter adapter = targetAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK);
        final Consent visibility = objectAction.isVisible(session, adapter, ActionModel.WHERE_FOR_ACTION_INVOCATION);
        if (visibility.isVetoed()) {
            return null;
        }

        // build the link
        final LinkAndLabel linkAndLabel = cssMenuContext.getCssMenuLinkFactory().newLink(
                targetAdapterMemento, objectAction, PageAbstract.ID_MENU_LINK,
                cssMenuContext.getActionPromptProvider());
        if(linkAndLabel==null) {
            // can only get a null if invisible, so this should not happen given guard above
            return null;
        }
        final AbstractLink link = linkAndLabel.getLink();
        final String actionLabel = linkAndLabel.getLabel();

        final Consent usability = objectAction.isUsable(session, adapter, ActionModel.WHERE_FOR_ACTION_INVOCATION);
        final String reasonDisabledIfAny = usability.getReason();
       
        final DescribedAsFacet describedAsFacet = objectAction.getFacet(DescribedAsFacet.class);
        final String descriptionIfAny = describedAsFacet != null? describedAsFacet.value(): null;

        Builder builder = newSubMenuItem(actionLabel)
View Full Code Here

    public Consent canClear() {
        final ObjectAdapter parentAdapter = getParent();
        final OneToOneAssociation association = getOneToOneAssociation();
        // ObjectAdapter associatedObject = getObject();

        final Consent isEditable = isEditable();
        if (isEditable.isVetoed()) {
            return isEditable;
        }

        final Consent consent = association.isAssociationValid(parentAdapter, null);
        if (consent.isAllowed()) {
            consent.setDescription("Clear the association to this object from '" + parentAdapter.titleString() + "'");
        }
        return consent;
    }
View Full Code Here

        if (getParent().representsPersistent() && adapter.isTransient()) {
            // TODO: move logic into Facet
            return new Veto("Can't drop a non-persistent into this persistent object");
        }

        final Consent perm = getOneToOneAssociation().isAssociationValid(getParent(), adapter);
        return perm;
    }
View Full Code Here

    @Override
    public void entered() {
        super.entered();
        identified = true;
        final Consent changable = canChangeValue();
        if (changable.isVetoed()) {
            getFeedbackManager().setViewDetail(changable.getReason());
        }
        markDamaged();
    }
View Full Code Here

        final ObjectAdapter adapter = view.getContent().getAdapter();
        if (adapter != null && adapter.isDestroyed()) {
            // TODO: move logic into Facet
            return new Veto("Can't do anything with a destroyed object");
        }
        final Consent usableForUser = action.isUsable(IsisContext.getAuthenticationSession(), target, where);
        if (usableForUser.isVetoed()) {
            return usableForUser;
        }

        final Consent validParameters = checkValid();
        if (validParameters != null && validParameters.isVetoed()) {
            return validParameters;
        }
        final String desc = action.getDescription();
        final String description = getName(view) + (desc.length() == 0 ? "" : ": " + desc);
        // TODO: replace with a Facet
View Full Code Here

            }
        }

        // validate all args
        final ObjectAdapter[] argArray = argAdapters.toArray(new ObjectAdapter[0]);
        final Consent consent = action.isProposedArgumentSetValid(objectAdapter, argArray);
        if (consent.isVetoed()) {
            arguments.mapPut("x-ro-invalidReason", consent.getReason());
            valid = false;
        }

        if(!valid) {
            throw RestfulObjectsApplicationException.createWithBody(RestfulResponse.HttpStatusCode.VALIDATION_FAILED, arguments, "Validation failed, see body for details");
View Full Code Here

    }

    @Override
    public void entered() {
        final View target = getParent();
        final Consent consent = action.disabled(target);
        final String actionText = action.getName(target) + " - " + (consent.isVetoed() ? consent.getReason() : action.getDescription(target));
        getFeedbackManager().setAction(actionText);

        isOver = true;
        isPressed = false;
        markDamaged();
View Full Code Here

    }

    private Consent canDropOntoObject(final ObjectAdapter target, final ObjectAdapter source) {
        final ObjectAction action = dropAction(source, target);
        if (action != null) {
            final Consent parameterSetValid = action.isProposedArgumentSetValid(target, new ObjectAdapter[] { source });
            parameterSetValid.setDescription("Execute '" + action.getName() + "' with " + source.titleString());
            return parameterSetValid;
        } else {
            return setFieldOfMatchingType(target, source);
        }
    }
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.