Examples of Veto


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

                    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

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

                ApplicationWorkspace.this.markDamaged();
            }

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

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

                session.setCurrentSession(user);
            }

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

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

    @Override
    public Consent canDrop(final Content sourceContent) {
        final ObjectAdapter target = getObject();
        if (!(sourceContent instanceof ObjectContent) || target == null) {
            // TODO: move logic into Facet
            return new Veto(String.format("Can't drop %s onto empty target", sourceContent.getAdapter().titleString()));
        } else {
            final ObjectAdapter source = ((ObjectContent) sourceContent).getObject();
            return canDropOntoObject(target, source);
        }
    }
View Full Code Here

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

    }

    private Consent setFieldOfMatchingType(final ObjectAdapter targetAdapter, final ObjectAdapter sourceAdapter) {
        if (targetAdapter.isTransient() && sourceAdapter.isPersistent()) {
            // TODO: use Facet for this test instead.
            return new Veto("Can't set field in persistent object with reference to non-persistent object");
        }
        final List<ObjectAssociation> fields = targetAdapter.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), targetAdapter));
        for (final ObjectAssociation fld : fields) {
            if (!fld.isOneToOneAssociation()) {
                continue;
            }
            if (!sourceAdapter.getSpecification().isOfType(fld.getSpecification())) {
                continue;
            }
            if (fld.get(targetAdapter) != null) {
                continue;
            }
            final Consent associationValid = ((OneToOneAssociation) fld).isAssociationValid(targetAdapter, sourceAdapter);
            if (associationValid.isAllowed()) {
                return associationValid.setDescription("Set field " + fld.getName());
            }

        }
        // TODO: use Facet for this test instead
        return new Veto(String.format("No empty field accepting object of type %s in %s", sourceAdapter.getSpecification().getSingularName(), title()));
    }
View Full Code Here

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

                    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

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

    @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

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

                ApplicationWorkspace.this.markDamaged();
            }

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

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

                session.setCurrentSession(user);
            }

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

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

        if (dragSource.getSpecification().isOfType(getSpecification())) {
            // TODO: move logic into Facet
            return Allow.DEFAULT;
        } else {
            // TODO: move logic into Facet
            return new Veto(String.format("Object must be ", getSpecification().getShortIdentifier()));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.