> Anyway, looking at your code, the reason it isn't working is that you are
> installing the facet onto the object, rather than each of the members.

That is the purpose of it - an object-level disable() (and eventual 
hide(), possibly). 

My reasons for the disable are obvious: Certain objects in my domain 
must only be interacted with via actions (promoteMember() to set the 
member level and log the action, etc) for certain roles, and it's a bit 
tedious putting: String DisableXXX() on every method to runtime 
checking.

As for Hide() - how secure is the HTMLviewer against hacking? Can 
you probe the entity space by spoofing / loading URLs?  I want certain 
objects to be completely invisible to certain roles.

> In the processClassContext(), the problem is that facetHolder is going to
> relate to the ObjectSpecification:
> 
>         if (method != null) {
>             FacetUtil.addFacet(new
> DisabledObjectFacetViaDisabledMethod(method, *facetHolder*));    <<<<<<<
> HERE'S THE PROBLEM

> 
> Instead, you're going to have to hack it a little, by looping through the
> members and installing the facet on each.  It'll be something like:
> 
> for(ObjectMember member: objectSpec.getMembers()) {
>   FacetUtil.addFacet(new DisabledObjectFacetViaDisabledMethod(method,
> member);
> }
> 
> processClassContext.removeMethod(method);

Ah - I understand. Spoof object disabling by installing the same facet 
on all members. Ugly - the object's disabled() method will be called for 
every method in the object.


> As for your hidden() facet, you'll probably need to do something similar.
>  It shouldn't be necessary to hack individual viewers. 
>  A good place to put a break point in order to see the stacktrace is in the
> InteractionUtils class.

Thanks - I realised this morning where a breakpoint would be a good 
idea - create a disabledXXX() method, and see when *IT* is called, 
working upstream of the stacktrace until a suitable loop is found.

BTW: My gut feeling is that hooking into the ObjectMember's 
isUsable()/isVisible() Consent in the metamodel makes more sense? 
Find where the members are iterated through, and don't bother 
checking all members, if the Object-level facet is present?

I'll decide further when I next fire up the IDE - probably tomorrow 
evening or Monday.

Thanks for your help.

Regards,
Kevin


Reply via email to