[ 
https://issues.apache.org/jira/browse/ISIS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dan Haywood updated ISIS-454:
-----------------------------

          Component/s: Core
    Affects Version/s: core-1.2.0

There is already the DisabledObjectViaDisabledMethodFacetFactory which does 
something very similar...

String disable(Interaction.Type.Xxx) { ... }

The only thing this doesn't support, I think, is the precedence rules.
                
> 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
>          Components: Core
>    Affects Versions: core-1.2.0
>            Reporter: Jeroen van der Wal
>            Assignee: Dan Haywood
>            Priority: Minor
>             Fix For: core-2.0.0
>
>
> 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

Reply via email to