You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@isis.apache.org by "Jeroen van der Wal (JIRA)" <ji...@apache.org> on 2013/07/02 12:31:20 UTC

[jira] [Created] (ISIS-454) New mechanism to disable members "globally". However, any disablement rules applied on the member should overrule the policy defined on the type.

Jeroen van der Wal created ISIS-454:
---------------------------------------

             Summary: New mechanism to disable members "globally".  However, any disablement rules applied on the member should overrule the policy defined on the type.
                 Key: ISIS-454
                 URL: https://issues.apache.org/jira/browse/ISIS-454
             Project: Isis
          Issue Type: New Feature
            Reporter: Jeroen van der Wal
            Assignee: Dan Haywood
            Priority: Minor


If done using a method, this would be something like:

public String disable(String memberName, MemberType memberType) {
    if(memberName.equals("notes")) { return null; }
    if(memberType == MemberType.PROPERTY) {
         WithStatus ws = (WithStatus)domainObject;
         return ws.isLocked()? "cannot modify because locked": null;
     }
    return null;
}


If done using an annotation, this would be something like:

@Disabled(policy=StateIsLockedPolicy.class)
public abstract class MyDomainObject<T extends EstatioDomainObject<T>, S extends Lockable> extends MyDomainObject<T> implements WithStatus<T,S> {

    public static StateIsLockedPolicy implements DisabledPolicy {
        public String disable(Object domainObject, String memberName, MemberType memberType) {
            if(memberName.equals("notes")) { return null; }
            if(memberType == MemberType.PROPERTY) {
                WithStatus ws = (WithStatus)domainObject;
                return ws.isLocked()? "cannot modify because locked": null;
            }
            return null;
        }
    }
    ...
}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira