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

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


        final Consent visibilityConsent = new Allow(new InteractionResult(new PropertyVisibilityEvent(employeeDO, null)));

        final InteractionResult usabilityInteractionResult = new InteractionResult(new PropertyUsabilityEvent(employeeDO, null));
        usabilityInteractionResult.advise("disabled", disabledFacet);
        final Consent usabilityConsent = new Veto(usabilityInteractionResult);

        context.checking(new Expectations() {
            {
                allowing(mockPasswordMember).getFacets(with(any(Filter.class)));
                will(returnValue(facets));
View Full Code Here


        final Consent visibilityConsent = new Allow(new InteractionResult(new PropertyVisibilityEvent(employeeDO, null)));

        final InteractionResult usabilityInteractionResult = new InteractionResult(new PropertyUsabilityEvent(employeeDO, null));
        usabilityInteractionResult.advise("disabled", disabledFacet);
        final Consent usabilityConsent = new Veto(usabilityInteractionResult);

        context.checking(new Expectations() {
            {
                allowing(mockPasswordMember).getFacets(with(any(Filter.class)));
                will(returnValue(facets));
View Full Code Here

    @Override
    public Consent disabled(final View view) {
        if (isEmpty(view)) {
            // TODO: move logic into Facets
            return new Veto("Field is empty");
        }
        // TODO: move logic into Facets
        return Allow.DEFAULT;
        // return new Allow(String.format("Copy value '%s' to clipboard",
        // field.getSelectedText()));
View Full Code Here

                    invalidFields.append(parameterName);
                }
            }
            if (missingFields.length() > 0) {
                // TODO: move logic into Facet
                return new Veto(String.format("Fields needed: %s", missingFields));
            }
            if (invalidFields.length() > 0) {
                // TODO: move logic into Facet
                return new Veto(String.format("Invalid fields: %s", invalidFields));
            }

            final ActionContent actionContent = ((ActionContent) view.getContent());
            return actionContent.disabled();
        }
View Full Code Here

            }
            final FieldEditState fieldState = formState.createField(fieldName, newEntry);
            Consent consent = null;

            if (!parameters2.get(i).isOptional() && newEntry.equals("")) {
                consent = new Veto(parameters2.get(i).getName() + " required");
                formState.setError("Not all fields have been set");

            } else if (parameters2.get(i).getSpecification().getFacet(ParseableFacet.class) != null) {
                try {
                    final ParseableFacet facet = parameters2.get(i).getSpecification().getFacet(ParseableFacet.class);
                    Localization localization = IsisContext.getLocalization();
                    final String message = parameters2.get(i).isValid(object, newEntry, localization);
                    if (message != null) {
                        consent = new Veto(message);
                        formState.setError("Not all fields are valid");
                    }
                    final ObjectAdapter entry = facet.parseTextEntry(null, newEntry, localization);
                    fieldState.setValue(entry);
                } catch (final TextEntryParseException e) {
                    consent = new Veto(e.getMessage());
                    formState.setError("Not all fields are valid");
                }
            } else {
                fieldState.setValue(newEntry == null ? null : context.getMappedObject(newEntry));
            }
View Full Code Here

                ApplicationWorkspace.this.markDamaged();
            }

            @Override
            public Consent disabled(final View view) {
                return LookFactory.getInstalledLook() == look ? new Veto("Current look") : Allow.DEFAULT;
            }
        });
    }
View Full Code Here

                session.setCurrentSession(user);
            }

            @Override
            public Consent disabled(final View view) {
                return user.equals(currentUser) ? new Veto("Current user") : Allow.DEFAULT;
            }
        });
    }
View Full Code Here

            }
            final FieldEditState fieldState = formState.createField(fieldId, newEntry);

            Consent consent = null;
            if (field.isMandatory() && (newEntry.equals("") || newEntry.equals("NULL"))) {
                consent = new Veto(field.getName() + " required");
                formState.setError("Not all fields have been set");
            } else if (field.getSpecification().containsFacet(ParseableFacet.class)) {
                try {
                    final ParseableFacet facet = field.getSpecification().getFacet(ParseableFacet.class);
                    final ObjectAdapter originalValue = field.get(object);
                    Localization localization = IsisContext.getLocalization();
                    final ObjectAdapter newValue = facet.parseTextEntry(originalValue, newEntry, localization);
                    consent = ((OneToOneAssociation) field).isAssociationValid(object, newValue);
                    fieldState.setValue(newValue);
                } catch (final TextEntryParseException e) {
                    consent = new Veto(e.getMessage());
                    // formState.setError("Not all fields have been entered correctly");
                }

            } else {
                final ObjectAdapter associate = newEntry.equals("null") ? null : context.getMappedObject(newEntry);
View Full Code Here

            if (appender instanceof SnapshotAppender) {
                return Allow.DEFAULT;
            }
        }
        // TODO: move logic into Facet
        return new Veto("No available snapshot appender");
    }
View Full Code Here

            return consent;
        }
        final Consent canClear = field.canClear();
        if (canClear.isVetoed()) {
            // TODO: move logic into Facets.
            return new Veto(String.format("Can't clear %s values", value.getSpecification().getShortIdentifier()));
        }
        if (value == null || isEmpty(view)) {
            // TODO: move logic into Facets.
            return new Veto("Field is already empty");
        }
        // TODO: move logic into Facets.
        return consent.setDescription(String.format("Clear value ", value.titleString()));
    }
View Full Code Here

TOP

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

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.