public Consent disabled() { // REVIEW this is no good as it lumps all the parameters together; I need to know which parameter is disabled! return action.isParameterSetValid(target, parameters); }
protected Consent checkValid() { return action.isParameterSetValid(target, null); }
public boolean isValidToExecute( Naked[] parameterNakeds) { final Consent parameterSetValid = getNakedObjectAction().isParameterSetValid(getNakedObject(), parameterNakeds); return parameterSetValid.isAllowed(); }
public String check( Naked[] values) { Consent parameterSetValid = getNakedObjectActionInstance().getNakedObjectAction().isParameterSetValid(getNakedObjectActionInstance().getNakedObject(), values); return parameterSetValid.isAllowed()?null:parameterSetValid.getReason(); }
private Consent canDropOntoObject(final NakedObject target, final NakedObject source) { NakedObjectAction action = dropAction(source, target); if (action != null) { Consent parameterSetValid = action.isParameterSetValid(target, new NakedObject[] { source }); if (parameterSetValid.isAllowed()) { parameterSetValid = new Allow("Execute '" + action.getName() + "' with " + source.titleString()); } return parameterSetValid; } else { return setFieldOfMatchingType(target, source); } }
public Naked drop(final Content sourceContent) { if (sourceContent instanceof ObjectContent) { NakedObject source = (NakedObject) sourceContent.getNaked(); Assert.assertNotNull(source); NakedObject target = (NakedObject) getObject(); Assert.assertNotNull(target); if (canDrop(sourceContent).isAllowed()) { NakedObjectAction action = dropAction(source, target); if ((action != null) && action.isParameterSetValid(target, new NakedObject[] { source }).isAllowed()) { return action.execute(target, new NakedObject[] { source }); } else { NakedObjectField[] fields = target.getSpecification().getDynamicallyVisibleFields(target); for (int i = 0; i < fields.length; i++) { NakedObjectField fld = fields[i]; if (fld.isObject() && source.getSpecification().isOfType(fld.getSpecification())) { if (fld.get(target) == null && ((OneToOneAssociation) fld).isAssociationValid(target, source).isAllowed()) { ((OneToOneAssociation) fld).setAssociation(target, source); break; } } } } } } return null; }