You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/09/04 02:50:08 UTC

svn commit: r1380413 [2/4] - in /incubator/isis/trunk/framework: applib/src/main/java/org/apache/isis/applib/annotation/ core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/hide/ core/metamodel/src/main/java/org/apache/isis/core/metamode...

Modified: incubator/isis/trunk/framework/progmodels/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/DomainObjectInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/progmodels/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/DomainObjectInvocationHandler.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/progmodels/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/DomainObjectInvocationHandler.java (original)
+++ incubator/isis/trunk/framework/progmodels/wrapper/wrapper-metamodel/src/main/java/org/apache/isis/progmodel/wrapper/metamodel/internal/DomainObjectInvocationHandler.java Tue Sep  4 00:50:04 2012
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.events.CollectionAccessEvent;
 import org.apache.isis.applib.events.InteractionEvent;
 import org.apache.isis.applib.events.ObjectTitleEvent;
@@ -504,14 +505,20 @@ public class DomainObjectInvocationHandl
     // visibility and usability checks (common to all members)
     // /////////////////////////////////////////////////////////////////
 
+    /**
+     * REVIEW: ideally should provide some way to allow to caller to indicate the 'where' context.  Having
+     * a hard-coded value like this is an approximation. 
+     */
+    private final Where where = Where.ANYWHERE;
+
     private void checkVisibility(final AuthenticationSession session, final ObjectAdapter targetObjectAdapter, final ObjectMember objectMember) {
-        final Consent visibleConsent = objectMember.isVisible(getAuthenticationSession(), targetObjectAdapter);
+        final Consent visibleConsent = objectMember.isVisible(getAuthenticationSession(), targetObjectAdapter, where);
         final InteractionResult interactionResult = visibleConsent.getInteractionResult();
         notifyListenersAndVetoIfRequired(interactionResult);
     }
 
     private void checkUsability(final AuthenticationSession session, final ObjectAdapter targetObjectAdapter, final ObjectMember objectMember) {
-        final InteractionResult interactionResult = objectMember.isUsable(getAuthenticationSession(), targetObjectAdapter).getInteractionResult();
+        final InteractionResult interactionResult = objectMember.isUsable(getAuthenticationSession(), targetObjectAdapter, where).getInteractionResult();
         notifyListenersAndVetoIfRequired(interactionResult);
     }
 

Modified: incubator/isis/trunk/framework/progmodels/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject_transient.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/progmodels/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject_transient.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/progmodels/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject_transient.java (original)
+++ incubator/isis/trunk/framework/progmodels/wrapper/wrapper-metamodel/src/test/java/org/apache/isis/progmodel/wrapper/WrappedFactoryDefaultTest_wrappedObject_transient.java Tue Sep  4 00:50:04 2012
@@ -34,6 +34,7 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.events.PropertyModifyEvent;
 import org.apache.isis.applib.events.PropertyUsabilityEvent;
 import org.apache.isis.applib.events.PropertyVisibilityEvent;
@@ -183,10 +184,10 @@ public class WrappedFactoryDefaultTest_w
                 allowing(mockPasswordMember).getFacets(with(any(Filter.class)));
                 will(returnValue(facets));
                 
-                allowing(mockPasswordMember).isVisible(session, mockEmployeeAdapter);
+                allowing(mockPasswordMember).isVisible(session, mockEmployeeAdapter, Where.ANYWHERE);
                 will(returnValue(visibilityConsent));
                 
-                allowing(mockPasswordMember).isUsable(session, mockEmployeeAdapter);
+                allowing(mockPasswordMember).isUsable(session, mockEmployeeAdapter, Where.ANYWHERE);
                 will(returnValue(usabilityConsent));
             }
         });
@@ -207,10 +208,10 @@ public class WrappedFactoryDefaultTest_w
 
         context.checking(new Expectations() {
             {
-                allowing(mockPasswordMember).isVisible(session, mockEmployeeAdapter);
+                allowing(mockPasswordMember).isVisible(session, mockEmployeeAdapter, Where.ANYWHERE);
                 will(returnValue(visibilityConsent));
                 
-                allowing(mockPasswordMember).isUsable(session, mockEmployeeAdapter);
+                allowing(mockPasswordMember).isUsable(session, mockEmployeeAdapter, Where.ANYWHERE);
                 will(returnValue(usabilityConsent));
                 
                 allowing(mockPasswordMember).isAssociationValid(mockEmployeeAdapter, mockPasswordAdapter);

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/DisabledFacetDerivedFromJdoPrimaryKeyAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/DisabledFacetDerivedFromJdoPrimaryKeyAnnotation.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/DisabledFacetDerivedFromJdoPrimaryKeyAnnotation.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/jdo-metamodel/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/metamodel/facets/prop/primarykey/DisabledFacetDerivedFromJdoPrimaryKeyAnnotation.java Tue Sep  4 00:50:04 2012
@@ -30,7 +30,7 @@ import org.apache.isis.core.progmodel.fa
 public class DisabledFacetDerivedFromJdoPrimaryKeyAnnotation extends DisabledFacetImpl {
 
     public DisabledFacetDerivedFromJdoPrimaryKeyAnnotation(final FacetHolder holder) {
-        super(When.ALWAYS, Where.EVERYWHERE, holder);
+        super(When.ALWAYS, Where.ANYWHERE, holder);
     }
 
 }

Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/pom.xml?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/pom.xml (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jdo/pom.xml Tue Sep  4 00:50:04 2012
@@ -154,7 +154,7 @@
 	        <dependency>
 	            <groupId>org.datanucleus</groupId>
 	            <artifactId>datanucleus-core</artifactId>
-	            <version>3.1.0-release</version>
+	            <version>3.1.1</version>
 	        </dependency>
 	        <dependency>
 	            <groupId>org.datanucleus</groupId>
@@ -169,12 +169,12 @@
 	        <dependency>
 	            <groupId>org.datanucleus</groupId>
 	            <artifactId>datanucleus-api-jdo</artifactId>
-	            <version>3.1.0-release</version>
+	            <version>3.1.1</version>
 	        </dependency>
 	        <dependency>
 	            <groupId>org.datanucleus</groupId>
 	            <artifactId>datanucleus-rdbms</artifactId>
-	            <version>3.1.0-release</version>
+	            <version>3.1.1</version>
 	        </dependency>
 	        <!-- 
 	        <dependency>

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/ObjectMemberAbstractTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/ObjectMemberAbstractTest.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/ObjectMemberAbstractTest.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/test/java/org/apache/isis/runtimes/dflt/runtime/system/ObjectMemberAbstractTest.java Tue Sep  4 00:50:04 2012
@@ -94,7 +94,7 @@ public class ObjectMemberAbstractTest {
                 return null;
             }
         });
-        final Consent usable = testMember.isUsable(null, persistentAdapter);
+        final Consent usable = testMember.isUsable(null, persistentAdapter, Where.ANYWHERE);
         final boolean allowed = usable.isAllowed();
         assertTrue(allowed);
     }
@@ -102,37 +102,37 @@ public class ObjectMemberAbstractTest {
     @Test
     public void testVisibleWhenHiddenFacetSetToAlways() {
         testMember.addFacet(new HideForContextFacetNone(testMember));
-        testMember.addFacet(new HiddenFacetAbstract(When.ALWAYS, Where.EVERYWHERE, testMember) {
+        testMember.addFacet(new HiddenFacetAbstract(When.ALWAYS, Where.ANYWHERE, testMember) {
             @Override
-            public String hiddenReason(final ObjectAdapter target) {
+            public String hiddenReason(final ObjectAdapter target, final Where whereContext) {
                 return null;
             }
         });
-        final Consent visible = testMember.isVisible(null, persistentAdapter);
+        final Consent visible = testMember.isVisible(null, persistentAdapter, Where.ANYWHERE);
         assertTrue(visible.isAllowed());
     }
 
     @Test
     public void testVisibleWhenTargetPersistentAndHiddenFacetSetToOncePersisted() {
         testMember.addFacet(new HideForContextFacetNone(testMember));
-        testMember.addFacet(new HiddenFacetImpl(When.ONCE_PERSISTED, Where.EVERYWHERE, testMember));
-        assertFalse(testMember.isVisible(null, persistentAdapter).isAllowed());
+        testMember.addFacet(new HiddenFacetImpl(When.ONCE_PERSISTED, Where.ANYWHERE, testMember));
+        assertFalse(testMember.isVisible(null, persistentAdapter, Where.ANYWHERE).isAllowed());
     }
 
     @Test
     public void testVisibleWhenTargetPersistentAndHiddenFacetSetToUntilPersisted() {
         testMember.addFacet(new HideForContextFacetNone(testMember));
-        testMember.addFacet(new HiddenFacetImpl(When.UNTIL_PERSISTED, Where.EVERYWHERE, testMember));
-        final Consent visible = testMember.isVisible(null, persistentAdapter);
+        testMember.addFacet(new HiddenFacetImpl(When.UNTIL_PERSISTED, Where.ANYWHERE, testMember));
+        final Consent visible = testMember.isVisible(null, persistentAdapter, Where.ANYWHERE);
         assertTrue(visible.isAllowed());
     }
 
     @Test
     public void testVisibleWhenTargetTransientAndHiddenFacetSetToUntilPersisted() {
         testMember.addFacet(new HideForContextFacetNone(testMember));
-        testMember.addFacet(new HiddenFacetImpl(When.UNTIL_PERSISTED, Where.EVERYWHERE, testMember));
+        testMember.addFacet(new HiddenFacetImpl(When.UNTIL_PERSISTED, Where.ANYWHERE, testMember));
         
-        final Consent visible = testMember.isVisible(null, transientAdapter);
+        final Consent visible = testMember.isVisible(null, transientAdapter, Where.ANYWHERE);
         assertFalse(visible.isAllowed());
     }
 
@@ -140,19 +140,19 @@ public class ObjectMemberAbstractTest {
     public void testVisibleDeclarativelyByDefault() {
         testMember.addFacet(new HiddenFacetNever(testMember) {
         });
-        assertTrue(testMember.isVisible(null, persistentAdapter).isAllowed());
+        assertTrue(testMember.isVisible(null, persistentAdapter, Where.ANYWHERE).isAllowed());
     }
 
     @Test
     public void testVisibleDeclaratively() {
         testMember.addFacet(new HiddenFacetAlwaysEverywhere(testMember) {
         });
-        assertFalse(testMember.isVisible(null, persistentAdapter).isAllowed());
+        assertFalse(testMember.isVisible(null, persistentAdapter, Where.ANYWHERE).isAllowed());
     }
 
     @Test
     public void testVisibleForSessionByDefault() {
-        final Consent visible = testMember.isVisible(null, persistentAdapter);
+        final Consent visible = testMember.isVisible(null, persistentAdapter, Where.ANYWHERE);
         assertTrue(visible.isAllowed());
     }
 
@@ -164,7 +164,7 @@ public class ObjectMemberAbstractTest {
                 return "Hidden";
             }
         });
-        assertFalse(testMember.isVisible(null, persistentAdapter).isAllowed());
+        assertFalse(testMember.isVisible(null, persistentAdapter, Where.ANYWHERE).isAllowed());
     }
 
     @Test
@@ -175,7 +175,7 @@ public class ObjectMemberAbstractTest {
                 return "hidden";
             }
         });
-        assertFalse(testMember.isVisible(null, persistentAdapter).isAllowed());
+        assertFalse(testMember.isVisible(null, persistentAdapter, Where.ANYWHERE).isAllowed());
     }
 
     @Test
@@ -224,13 +224,13 @@ class ObjectMemberAbstractImpl extends O
     }
 
     @Override
-    public UsabilityContext<?> createUsableInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter target) {
-        return new PropertyUsabilityContext(session, invocationMethod, target, getIdentifier());
+    public UsabilityContext<?> createUsableInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter target, Where where) {
+        return new PropertyUsabilityContext(session, invocationMethod, target, getIdentifier(), where);
     }
 
     @Override
-    public VisibilityContext<?> createVisibleInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter targetObjectAdapter) {
-        return new PropertyVisibilityContext(session, invocationMethod, targetObjectAdapter, getIdentifier());
+    public VisibilityContext<?> createVisibleInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter targetObjectAdapter, Where where) {
+        return new PropertyVisibilityContext(session, invocationMethod, targetObjectAdapter, getIdentifier(), where);
     }
 
     // /////////////////////////////////////////////////////////////

Modified: incubator/isis/trunk/framework/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/perform/PerformContext.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/perform/PerformContext.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/perform/PerformContext.java (original)
+++ incubator/isis/trunk/framework/viewer/bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/fixtures/perform/PerformContext.java Tue Sep  4 00:50:04 2012
@@ -20,6 +20,7 @@ package org.apache.isis.viewer.bdd.commo
 
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.consent.Consent;
@@ -39,6 +40,13 @@ import org.apache.isis.viewer.bdd.common
  */
 public class PerformContext {
 
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
     private final UsingIsisViewerPeer peer;
 
     private final ObjectAdapter onAdapter;
@@ -69,11 +77,11 @@ public class PerformContext {
     }
 
     public Consent visibleMemberConsent() {
-        return getObjectMember().isVisible(getAuthenticationSession(), getOnAdapter());
+        return getObjectMember().isVisible(getAuthenticationSession(), getOnAdapter(), where);
     }
 
     public Consent usableMemberConsent() {
-        return getObjectMember().isUsable(getAuthenticationSession(), getOnAdapter());
+        return getObjectMember().isUsable(getAuthenticationSession(), getOnAdapter(), where);
     }
 
     public Consent validObjectConsent() {
@@ -82,14 +90,14 @@ public class PerformContext {
     }
 
     public void ensureVisible(final CellBinding onMemberBinding, final ScenarioCell onMemberCell) throws ScenarioBoundValueException {
-        final Consent visible = objectMember.isVisible(getAuthenticationSession(), getOnAdapter());
+        final Consent visible = objectMember.isVisible(getAuthenticationSession(), getOnAdapter(), where);
         if (visible.isVetoed()) {
             throw ScenarioBoundValueException.current(onMemberBinding, "(not visible)");
         }
     }
 
     public void ensureUsable(final CellBinding onMemberBinding, final ScenarioCell onMemberCell) throws ScenarioBoundValueException {
-        final Consent usable = objectMember.isUsable(getAuthenticationSession(), getOnAdapter());
+        final Consent usable = objectMember.isUsable(getAuthenticationSession(), getOnAdapter(), where);
         if (usable.isVetoed()) {
             throw ScenarioBoundValueException.current(onMemberBinding, "(not usable)");
         }

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/FormWithTableSpecification.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/FormWithTableSpecification.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/FormWithTableSpecification.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/FormWithTableSpecification.java Tue Sep  4 00:50:04 2012
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.dnd.combi
 
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -39,6 +40,9 @@ import org.apache.isis.viewer.dnd.view.c
 
 public class FormWithTableSpecification extends SplitViewSpecification {
 
+    // REVIEW: confirm this rendering context
+    final Where where = Where.OBJECT_FORM;
+
     @Override
     public Layout createLayout(final Content content, final Axes axes) {
         return new StackLayout();
@@ -72,7 +76,7 @@ public class FormWithTableSpecification 
         final ObjectSpecification spec = content.getSpecification();
         final ObjectAdapter target = content.getAdapter();
         final AuthenticationSession session = IsisContext.getAuthenticationSession();
-        final List<ObjectAssociation> fields = spec.getAssociations(ObjectAssociationFilters.dynamicallyVisible(session, target));
+        final List<ObjectAssociation> fields = spec.getAssociations(ObjectAssociationFilters.dynamicallyVisible(session, target, where));
         for (final ObjectAssociation field : fields) {
             if (field.isOneToManyAssociation()) {
                 return Toolkit.getContentFactory().createFieldContent(field, target);

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/SplitViewSpecification.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/SplitViewSpecification.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/SplitViewSpecification.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/SplitViewSpecification.java Tue Sep  4 00:50:04 2012
@@ -22,6 +22,7 @@ package org.apache.isis.viewer.dnd.combi
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -37,6 +38,13 @@ import org.apache.isis.viewer.dnd.view.c
 
 public abstract class SplitViewSpecification extends CompositeViewSpecification {
 
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    final Where where = Where.ANYWHERE;
+
     public SplitViewSpecification() {
         builder = new SplitViewBuilder(this);
     }
@@ -67,7 +75,7 @@ public abstract class SplitViewSpecifica
         final ObjectSpecification spec = content.getSpecification();
         final ObjectAdapter target = content.getAdapter();
         final AuthenticationSession session = IsisContext.getAuthenticationSession();
-        final List<ObjectAssociation> fields = spec.getAssociations(ObjectAssociationFilters.dynamicallyVisible(session, target));
+        final List<ObjectAssociation> fields = spec.getAssociations(ObjectAssociationFilters.dynamicallyVisible(session, target, where));
         final List<ObjectAssociation> selectableFields = new ArrayList<ObjectAssociation>();
         for (final ObjectAssociation field : fields) {
             if (validField(field)) {

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/TwoPartViewSpecification.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/TwoPartViewSpecification.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/TwoPartViewSpecification.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/combined/TwoPartViewSpecification.java Tue Sep  4 00:50:04 2012
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.dnd.combi
 
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
@@ -69,7 +70,7 @@ public class TwoPartViewSpecification ex
         final ObjectSpecification spec = content.getSpecification();
         final ObjectAdapter target = content.getAdapter();
         final AuthenticationSession session = IsisContext.getAuthenticationSession();
-        final List<ObjectAssociation> fields = spec.getAssociations(ObjectAssociationFilters.dynamicallyVisible(session, target));
+        final List<ObjectAssociation> fields = spec.getAssociations(ObjectAssociationFilters.dynamicallyVisible(session, target, where));
         for (final ObjectAssociation field : fields) {
             if (validField(field)) {
                 return Toolkit.getContentFactory().createFieldContent(field, target);

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/form/ExpandableViewBorder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/form/ExpandableViewBorder.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/form/ExpandableViewBorder.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/form/ExpandableViewBorder.java Tue Sep  4 00:50:04 2012
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.dnd.form;
 
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.facets.collections.modify.CollectionFacet;
@@ -94,6 +95,13 @@ public class ExpandableViewBorder extend
     private final ViewSpecification closedViewSpecification;
     private int canOpen;
 
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
     public ExpandableViewBorder(final View view, final ViewSpecification closedViewSpecification, final ViewSpecification openViewSpecification) {
         super(view);
         left = Toolkit.defaultFieldHeight();
@@ -197,7 +205,7 @@ public class ExpandableViewBorder extend
     private int canOpenObject(final Content content) {
         final ObjectAdapter object = ((ObjectContent) content).getObject();
         if (object != null) {
-            final List<ObjectAssociation> fields = object.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), object));
+            final List<ObjectAssociation> fields = object.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), object, where));
             for (int i = 0; i < fields.size(); i++) {
                 if (fields.get(i).isOneToManyAssociation()) {
                     return CAN_OPEN;

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/table/TableCellBuilder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/table/TableCellBuilder.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/table/TableCellBuilder.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/table/TableCellBuilder.java Tue Sep  4 00:50:04 2012
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.dnd.table
 
 import org.apache.log4j.Logger;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.commons.exceptions.UnexpectedCallException;
 import org.apache.isis.core.commons.exceptions.UnknownTypeException;
@@ -52,6 +53,14 @@ import org.apache.isis.viewer.dnd.viewer
 class TableCellBuilder extends AbstractViewBuilder {
     private static final Logger LOG = Logger.getLogger(TableCellBuilder.class);
 
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with
+    // @Hidden(where=Where.ALL_TABLES) will indeed be hidden from all tables
+    // but will be shown (perhaps incorrectly) if annotated with Where.PARENTED_TABLE
+    // or Where.STANDALONE_TABLE
+    private final Where where = Where.ALL_TABLES;
+    
+
     private void addField(final View view, final Axes axes, final ObjectAdapter object, final ObjectAssociation field) {
         final ObjectAdapter value = field.get(object);
         View fieldView;
@@ -92,7 +101,7 @@ class TableCellBuilder extends AbstractV
             // to replace what was
             // typed in with the actual title.
             if (field.getSpecification().isParseable()) {
-                final boolean visiblityChange = !field.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed() ^ (subview instanceof BlankView);
+                final boolean visiblityChange = !field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed() ^ (subview instanceof BlankView);
                 final ObjectAdapter adapter = subview.getContent().getAdapter();
                 final boolean valueChange = value != null && value.getObject() != null && !value.getObject().equals(adapter.getObject());
 
@@ -155,7 +164,7 @@ class TableCellBuilder extends AbstractV
                     return new BlankView(content);
                 }
 
-                if (!field.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed()) {
+                if (!field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
                     return new BlankView(content);
                 }
                 if (((TextParseableContent) content).getNoLines() > 0) {
@@ -175,7 +184,8 @@ class TableCellBuilder extends AbstractV
                 }
             } else {
                 content = new OneToOneFieldImpl(object, value, (OneToOneAssociation) field);
-                if (!field.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed()) {
+                
+                if (!field.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
                     return new BlankView(content);
                 }
                 return factory.createView(new ViewRequirement(content, ViewRequirement.CLOSED | ViewRequirement.SUBVIEW));

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedObjectNodeSpecification.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedObjectNodeSpecification.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedObjectNodeSpecification.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/tree/ClosedObjectNodeSpecification.java Tue Sep  4 00:50:04 2012
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.dnd.tree;
 
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.facets.object.bounded.BoundedFacetUtils;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
@@ -47,6 +48,13 @@ class ClosedObjectNodeSpecification exte
     private final boolean showObjectContents;
     private final SubviewDecorator decorator = new SelectObjectBorder.Factory();
 
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
     public ClosedObjectNodeSpecification(final boolean showObjectContents) {
         this.showObjectContents = showObjectContents;
     }
@@ -59,7 +67,7 @@ class ClosedObjectNodeSpecification exte
     @Override
     public int canOpen(final Content content) {
         final ObjectAdapter object = ((ObjectContent) content).getObject();
-        final List<ObjectAssociation> fields = object.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), object));
+        final List<ObjectAssociation> fields = object.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), object, where));
         for (int i = 0; i < fields.size(); i++) {
             if (fields.get(i).isOneToManyAssociation()) {
                 return CAN_OPEN;

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/tree/OpenObjectNodeSpecification.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/tree/OpenObjectNodeSpecification.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/tree/OpenObjectNodeSpecification.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/tree/OpenObjectNodeSpecification.java Tue Sep  4 00:50:04 2012
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.dnd.tree;
 
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociationFilters;
@@ -43,8 +44,16 @@ import org.apache.isis.viewer.dnd.view.c
  *      displaying a closed collection within an object.
  */
 public class OpenObjectNodeSpecification extends CompositeNodeSpecification {
+
     private final SubviewDecorator decorator = new SelectObjectBorder.Factory();
 
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
     public OpenObjectNodeSpecification() {
         builder = new ObjectFieldBuilder(this);
     }
@@ -62,7 +71,7 @@ public class OpenObjectNodeSpecification
     public boolean canDisplay(final ViewRequirement requirement) {
         if (requirement.isObject() && requirement.hasReference()) {
             final ObjectAdapter object = requirement.getAdapter();
-            final List<ObjectAssociation> fields = object.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), object));
+            final List<ObjectAssociation> fields = object.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), object, where));
             for (int i = 0; i < fields.size(); i++) {
                 if (fields.get(i).isOneToManyAssociation()) {
                     return true;

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/AbstractObjectOption.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/AbstractObjectOption.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/AbstractObjectOption.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/AbstractObjectOption.java Tue Sep  4 00:50:04 2012
@@ -19,6 +19,7 @@
 
 package org.apache.isis.viewer.dnd.view.action;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.lang.ToString;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.consent.Allow;
@@ -31,6 +32,10 @@ import org.apache.isis.viewer.dnd.view.V
 import org.apache.isis.viewer.dnd.view.option.UserActionAbstract;
 
 public abstract class AbstractObjectOption extends UserActionAbstract {
+
+    // REVIEW: confirm this rendering context
+    private final Where where = Where.OBJECT_FORM;
+
     protected final ObjectAction action;
     protected final ObjectAdapter target;
 
@@ -47,7 +52,7 @@ public abstract class AbstractObjectOpti
             // TODO: move logic into Facet
             return new Veto("Can't do anything with a destroyed object");
         }
-        final Consent usableForUser = action.isUsable(IsisContext.getAuthenticationSession(), target);
+        final Consent usableForUser = action.isUsable(IsisContext.getAuthenticationSession(), target, where);
         if (usableForUser.isVetoed()) {
             return usableForUser;
         }

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/DialoggedObjectOption.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/DialoggedObjectOption.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/DialoggedObjectOption.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/DialoggedObjectOption.java Tue Sep  4 00:50:04 2012
@@ -19,6 +19,7 @@
 
 package org.apache.isis.viewer.dnd.view.action;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.commons.exceptions.UnknownTypeException;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -38,10 +39,18 @@ import org.apache.isis.viewer.dnd.view.W
  * vetoing the option and giving the option an name respectively.
  */
 public class DialoggedObjectOption extends AbstractObjectOption {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final static Where where = Where.ANYWHERE;
+
     public static DialoggedObjectOption createOption(final ObjectAction action, final ObjectAdapter object) {
         final int paramCount = action.getParameterCount();
         Assert.assertTrue("Only for actions taking one or more params", paramCount > 0);
-        if (!action.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed() || !action.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed()) {
+        if (!action.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed() || !action.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
             return null;
         }
 

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/ImmediateObjectOption.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/ImmediateObjectOption.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/ImmediateObjectOption.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/action/ImmediateObjectOption.java Tue Sep  4 00:50:04 2012
@@ -19,6 +19,7 @@
 
 package org.apache.isis.viewer.dnd.view.action;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.consent.Consent;
@@ -37,9 +38,16 @@ import org.apache.isis.viewer.dnd.view.W
  */
 public class ImmediateObjectOption extends AbstractObjectOption {
 
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final static Where where = Where.ANYWHERE;
+
     public static ImmediateObjectOption createOption(final ObjectAction action, final ObjectAdapter object) {
         Assert.assertTrue("Only suitable for 0 param methods", action.getParameterCount() == 0);
-        if (!action.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed()) {
+        if (!action.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
             return null;
         }
         final ImmediateObjectOption option = new ImmediateObjectOption(action, object);
@@ -48,7 +56,7 @@ public class ImmediateObjectOption exten
 
     public static ImmediateObjectOption createServiceOption(final ObjectAction action, final ObjectAdapter object) {
         Assert.assertTrue("Only suitable for 1 param methods", action.getParameterCount() == 1);
-        if (!action.isVisible(IsisContext.getAuthenticationSession(), object).isAllowed()) {
+        if (!action.isVisible(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
             return null;
         }
         final ImmediateObjectOption option = new ImmediateObjectOption(action, object);

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/composite/ObjectFieldBuilder.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/composite/ObjectFieldBuilder.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/composite/ObjectFieldBuilder.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/composite/ObjectFieldBuilder.java Tue Sep  4 00:50:04 2012
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.log4j.Logger;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.filter.Filter;
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.commons.exceptions.UnknownTypeException;
@@ -44,6 +45,10 @@ import org.apache.isis.viewer.dnd.view.c
 
 public class ObjectFieldBuilder extends AbstractViewBuilder {
     private static final Logger LOG = Logger.getLogger(ObjectFieldBuilder.class);
+
+    // REVIEW: confirm this rendering context
+    private final Where where = Where.OBJECT_FORM;
+
     private final ViewFactory subviewDesign;
 
     // TODO remove - transitional
@@ -66,7 +71,7 @@ public class ObjectFieldBuilder extends 
         LOG.debug("build view " + view + " for " + object);
 
         final ObjectSpecification spec = object.getSpecification();
-        final Filter<ObjectAssociation> filter = ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), object);
+        final Filter<ObjectAssociation> filter = ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), object, where);
         final List<ObjectAssociation> flds = spec.getAssociations(filter);
 
         if (view.getSubviews().length == 0) {

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractObjectContent.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractObjectContent.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractObjectContent.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/content/AbstractObjectContent.java Tue Sep  4 00:50:04 2012
@@ -22,6 +22,7 @@ package org.apache.isis.viewer.dnd.view.
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.query.QueryFindAllInstances;
 import org.apache.isis.core.commons.ensure.Assert;
 import org.apache.isis.core.commons.exceptions.UnexpectedCallException;
@@ -128,6 +129,13 @@ public abstract class AbstractObjectCont
         }
     }
 
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    protected final Where where = Where.ANYWHERE;
+
     @Override
     public abstract Consent canClear();
 
@@ -159,7 +167,7 @@ public abstract class AbstractObjectCont
             // 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));
+        final List<ObjectAssociation> fields = targetAdapter.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), targetAdapter, where));
         for (final ObjectAssociation fld : fields) {
             if (!fld.isOneToOneAssociation()) {
                 continue;
@@ -207,7 +215,7 @@ public abstract class AbstractObjectCont
             return action.execute(target, new ObjectAdapter[] { source });
         }
 
-        final List<ObjectAssociation> associations = target.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), target));
+        final List<ObjectAssociation> associations = target.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(IsisContext.getAuthenticationSession(), target, where));
 
         for (int i = 0; i < associations.size(); i++) {
             final ObjectAssociation association = associations.get(i);

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToManyFieldElementImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToManyFieldElementImpl.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToManyFieldElementImpl.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToManyFieldElementImpl.java Tue Sep  4 00:50:04 2012
@@ -62,7 +62,7 @@ public class OneToManyFieldElementImpl e
 
     @Override
     public Consent isEditable() {
-        return getField().isUsable(IsisContext.getAuthenticationSession(), getParent());
+        return getField().isUsable(IsisContext.getAuthenticationSession(), getParent(), where);
     }
 
     @Override

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToManyFieldImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToManyFieldImpl.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToManyFieldImpl.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToManyFieldImpl.java Tue Sep  4 00:50:04 2012
@@ -19,6 +19,7 @@
 
 package org.apache.isis.viewer.dnd.view.field;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.commons.exceptions.IsisException;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -35,6 +36,14 @@ import org.apache.isis.viewer.dnd.view.U
 import org.apache.isis.viewer.dnd.view.collection.AbstractCollectionContent;
 
 public class OneToManyFieldImpl extends AbstractCollectionContent implements OneToManyField {
+
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final Where where = Where.ANYWHERE;
+
     private final ObjectAdapter collection;
     private final ObjectField field;
 
@@ -55,7 +64,7 @@ public class OneToManyFieldImpl extends 
                 return new Veto("Collection not set up; can't add elements to a non-existant collection");
             }
 
-            final Consent usableInState = getOneToManyAssociation().isUsable(IsisContext.getAuthenticationSession(), parentAdapter);
+            final Consent usableInState = getOneToManyAssociation().isUsable(IsisContext.getAuthenticationSession(), parentAdapter, where);
             if (usableInState.isVetoed()) {
                 return usableInState;
             }
@@ -177,7 +186,7 @@ public class OneToManyFieldImpl extends 
 
     @Override
     public Consent isEditable() {
-        return getField().isUsable(IsisContext.getAuthenticationSession(), getParent());
+        return getField().isUsable(IsisContext.getAuthenticationSession(), getParent(), where);
     }
 
     @Override

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToOneFieldImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToOneFieldImpl.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToOneFieldImpl.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/OneToOneFieldImpl.java Tue Sep  4 00:50:04 2012
@@ -105,7 +105,7 @@ public class OneToOneFieldImpl extends A
 
     @Override
     public Consent isEditable() {
-        return getField().isUsable(IsisContext.getAuthenticationSession(), getParent());
+        return getField().isUsable(IsisContext.getAuthenticationSession(), getParent(), where);
     }
 
     @Override

Modified: incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/TextParseableFieldImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/TextParseableFieldImpl.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/TextParseableFieldImpl.java (original)
+++ incubator/isis/trunk/framework/viewer/dnd/src/main/java/org/apache/isis/viewer/dnd/view/field/TextParseableFieldImpl.java Tue Sep  4 00:50:04 2012
@@ -19,6 +19,7 @@
 
 package org.apache.isis.viewer.dnd.view.field;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.profiles.Localization;
 import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -162,7 +163,7 @@ public class TextParseableFieldImpl exte
 
     @Override
     public Consent isEditable() {
-        return getValueAssociation().isUsable(IsisContext.getAuthenticationSession(), getParent());
+        return getValueAssociation().isUsable(IsisContext.getAuthenticationSession(), getParent(), Where.ANYWHERE);
     }
 
     @Override

Modified: incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/FieldCollectionView.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/FieldCollectionView.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/FieldCollectionView.java (original)
+++ incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/FieldCollectionView.java Tue Sep  4 00:50:04 2012
@@ -19,6 +19,7 @@
 
 package org.apache.isis.viewer.html.action.view;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
@@ -30,6 +31,9 @@ import org.apache.isis.viewer.html.conte
 import org.apache.isis.viewer.html.request.Request;
 
 public class FieldCollectionView extends ObjectViewAbstract {
+    
+    private final Where where = Where.PARENTED_TABLE;
+
     @Override
     protected void doExecute(final Context context, final ViewPane content, final ObjectAdapter object, final String field) {
         final String id = context.mapObject(object);
@@ -43,7 +47,7 @@ public class FieldCollectionView extends
         content.add(context.getComponentFactory().createHeading(collection.getName()));
         final Table table = TableUtil.createTable(context, id, object, collection);
         content.add(table);
-        if (collection.isUsable(IsisContext.getAuthenticationSession(), object).isAllowed()) {
+        if (collection.isUsable(IsisContext.getAuthenticationSession(), object, where).isAllowed()) {
             content.add(context.getComponentFactory().createAddOption(id, collection.getId()));
         }
     }

Modified: incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/ObjectView.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/ObjectView.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/ObjectView.java (original)
+++ incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/ObjectView.java Tue Sep  4 00:50:04 2012
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.html.acti
 
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.exceptions.UnknownTypeException;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -36,6 +37,9 @@ import org.apache.isis.viewer.html.reque
 
 public class ObjectView extends ObjectViewAbstract {
 
+    // REVIEW: confirm this rendering context
+    private final Where where = Where.OBJECT_FORM;
+
     @Override
     protected boolean addObjectToHistory() {
         return true;
@@ -61,7 +65,7 @@ public class ObjectView extends ObjectVi
         boolean atLeastOneFieldVisibleAndEditable = false;
         final List<ObjectAssociation> flds = specification.getAssociations();
         for (int i = 0; i < flds.size(); i++) {
-            if (flds.get(i).isVisible(authenticationSession, adapter).isAllowed() && flds.get(i).isUsable(authenticationSession, adapter).isAllowed()) {
+            if (flds.get(i).isVisible(authenticationSession, adapter, where).isAllowed() && flds.get(i).isUsable(authenticationSession, adapter, where).isAllowed()) {
                 atLeastOneFieldVisibleAndEditable = true;
                 break;
             }
@@ -76,7 +80,7 @@ public class ObjectView extends ObjectVi
     private void createObjectView(final Context context, final ObjectAdapter object, final ViewPane pane, final String id) {
 
         final ObjectSpecification specification = object.getSpecification();
-        final List<ObjectAssociation> visibleFields = specification.getAssociations(ObjectAssociationFilters.dynamicallyVisible(getAuthenticationSession(), object));
+        final List<ObjectAssociation> visibleFields = specification.getAssociations(ObjectAssociationFilters.dynamicallyVisible(getAuthenticationSession(), object, where));
         for (int i = 0; i < visibleFields.size(); i++) {
             final ObjectAssociation field = visibleFields.get(i);
 

Modified: incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/util/MenuUtil.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/util/MenuUtil.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/util/MenuUtil.java (original)
+++ incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/util/MenuUtil.java Tue Sep  4 00:50:04 2012
@@ -23,6 +23,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.consent.Consent;
 import org.apache.isis.core.metamodel.spec.ActionType;
@@ -35,6 +36,9 @@ import org.apache.isis.viewer.html.conte
 
 public class MenuUtil {
 
+    // REVIEW: confirm this rendering context
+    private final static Where where = Where.OBJECT_FORM;
+
     public static Component[] menu(final ObjectAdapter target, final String targetObjectId, final Context context) {
         final ObjectSpecification specification = target.getSpecification();
         final List<ObjectAction> actions = specification.getObjectActions(Arrays.asList(ActionType.USER, ActionType.EXPLORATION, ActionType.PROTOTYPE), Contributed.INCLUDED);
@@ -52,7 +56,7 @@ public class MenuUtil {
                 final Component[] components = createMenu(name, target, action.getActions(), context, targetObjectId);
                 menuItem = context.getComponentFactory().createSubmenu(name, components);
             } else {
-                if (!action.isVisible(IsisContext.getAuthenticationSession(), target).isAllowed()) {
+                if (!action.isVisible(IsisContext.getAuthenticationSession(), target, where).isAllowed()) {
                     continue;
                 }
 
@@ -92,7 +96,7 @@ public class MenuUtil {
                 } else {
                     collectParameters = true;
                 }
-                final Consent consent = action.isUsable(IsisContext.getAuthenticationSession(), target);
+                final Consent consent = action.isUsable(IsisContext.getAuthenticationSession(), target, where);
                 final String consentReason = consent.getReason();
                 menuItem = context.getComponentFactory().createMenuItem(actionId, action.getName(), action.getDescription(), consentReason, action.getType(), collectParameters, targetObjectId);
             }

Modified: incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/util/TableUtil.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/util/TableUtil.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/util/TableUtil.java (original)
+++ incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/action/view/util/TableUtil.java Tue Sep  4 00:50:04 2012
@@ -24,6 +24,7 @@ import static org.apache.isis.core.metam
 
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.filter.Filters;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -41,6 +42,13 @@ import org.apache.isis.viewer.html.conte
 
 public class TableUtil {
 
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with
+    // @Hidden(where=Where.ALL_TABLES) or @Disabled(where=Where.ALL_TABLES) will indeed
+    // be hidden from all tables but will be visible/enabled (perhaps incorrectly) 
+    // if annotated with Where.PARENTED_TABLE or Where.STANDALONE_TABLE
+    private final static Where where = Where.ALL_TABLES;
+
     public static Table createTable(final Context context, final String id, final ObjectAdapter object, final OneToManyAssociation collectionField) {
 
         final ObjectAdapter collection = collectionField.get(object);
@@ -75,7 +83,8 @@ public class TableUtil {
                 final ObjectAdapter columnAdapter = columnAssociation.get(rowAdapter);
 
                 final ObjectSpecification columnSpec = columnAssociation.getSpecification();
-                if (!columnAssociation.isVisible(getAuthenticationSession(), rowAdapter).isAllowed()) {
+
+                if (!columnAssociation.isVisible(getAuthenticationSession(), rowAdapter, where).isAllowed()) {
                     table.addEmptyCell();
                 } else if (columnSpec.isParseable()) {
                     final MultiLineFacet multiline = columnSpec.getFacet(MultiLineFacet.class);

Modified: incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/task/EditTask.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/task/EditTask.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/task/EditTask.java (original)
+++ incubator/isis/trunk/framework/viewer/html/src/main/java/org/apache/isis/viewer/html/task/EditTask.java Tue Sep  4 00:50:04 2012
@@ -21,6 +21,7 @@ package org.apache.isis.viewer.html.task
 
 import java.util.List;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.ResolveState;
@@ -42,13 +43,20 @@ import org.apache.isis.viewer.html.conte
 
 public class EditTask extends Task {
 
+    // REVIEW: should provide this rendering context, rather than hardcoding.
+    // the net effect currently is that class members annotated with 
+    // @Hidden(where=Where.ANYWHERE) or @Disabled(where=Where.ANYWHERE) will indeed
+    // be hidden/disabled, but will be visible/enabled (perhaps incorrectly) 
+    // for any other value for Where
+    private final static Where where = Where.ANYWHERE;
+
     private static int size(final ObjectAdapter object) {
-        final List<ObjectAssociation> fields = object.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(getAuthenticationSession(), object));
+        final List<ObjectAssociation> fields = object.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(getAuthenticationSession(), object, where));
         return fields.size();
     }
 
     private static boolean skipField(final ObjectAdapter object, final ObjectAssociation fld) {
-        return fld.isOneToManyAssociation() || fld.isUsable(getAuthenticationSession(), object).isVetoed();
+        return fld.isOneToManyAssociation() || fld.isUsable(getAuthenticationSession(), object, where).isVetoed();
     }
 
     private final ObjectAssociation[] fields;
@@ -57,7 +65,7 @@ public class EditTask extends Task {
     public EditTask(final Context context, final ObjectAdapter adapter) {
         super(context, "Edit", "", adapter, size(adapter));
 
-        final List<ObjectAssociation> allFields = adapter.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(getAuthenticationSession(), adapter));
+        final List<ObjectAssociation> allFields = adapter.getSpecification().getAssociations(ObjectAssociationFilters.dynamicallyVisible(getAuthenticationSession(), adapter, where));
 
         fields = new ObjectAssociation[names.length];
         for (int i = 0, j = 0; j < allFields.size(); j++) {
@@ -66,7 +74,7 @@ public class EditTask extends Task {
             names[i] = fld.getName();
             descriptions[i] = fld.getDescription();
 
-            final Consent usableByUser = fld.isUsable(getAuthenticationSession(), adapter);
+            final Consent usableByUser = fld.isUsable(getAuthenticationSession(), adapter, where);
             if (usableByUser.isVetoed()) {
                 descriptions[i] = usableByUser.getReason();
             }

Modified: incubator/isis/trunk/framework/viewer/html/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/html/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/html/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java (original)
+++ incubator/isis/trunk/framework/viewer/html/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java Tue Sep  4 00:50:04 2012
@@ -23,6 +23,7 @@ import java.util.List;
 
 import org.apache.isis.applib.Identifier;
 import org.apache.isis.applib.annotation.ActionSemantics;
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.filter.Filter;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -203,7 +204,7 @@ public class ObjectActionNoop implements
     }
 
     @Override
-    public VisibilityContext<?> createVisibleInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter targetObjectAdapter) {
+    public VisibilityContext<?> createVisibleInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter targetObjectAdapter, Where where) {
         return null;
     }
 
@@ -213,12 +214,12 @@ public class ObjectActionNoop implements
     }
 
     @Override
-    public Consent isVisible(final AuthenticationSession session, final ObjectAdapter target) {
+    public Consent isVisible(final AuthenticationSession session, final ObjectAdapter target, Where where) {
         return Allow.DEFAULT;
     }
 
     @Override
-    public Consent isUsable(final AuthenticationSession session, final ObjectAdapter target) {
+    public Consent isUsable(final AuthenticationSession session, final ObjectAdapter target, Where where) {
         return Allow.DEFAULT;
     }
 
@@ -238,7 +239,7 @@ public class ObjectActionNoop implements
     }
 
     @Override
-    public UsabilityContext<?> createUsableInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter target) {
+    public UsabilityContext<?> createUsableInteractionContext(final AuthenticationSession session, final InteractionInvocationMethod invocationMethod, final ObjectAdapter target, Where where) {
         return null;
     }
 

Modified: incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/ResourceContext.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/ResourceContext.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/ResourceContext.java (original)
+++ incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/ResourceContext.java Tue Sep  4 00:50:04 2012
@@ -29,6 +29,7 @@ import javax.ws.rs.core.Request;
 import javax.ws.rs.core.SecurityContext;
 import javax.ws.rs.core.UriInfo;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.profiles.Localization;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.config.IsisConfiguration;
@@ -76,10 +77,11 @@ public class ResourceContext {
             return mediaType.getParameters().containsKey("profile");
         }
     };
+    private final Where where;
     private JsonRepresentation readQueryStringAsMap;
 
     public ResourceContext(final RepresentationType representationType, final HttpHeaders httpHeaders, final UriInfo uriInfo, final Request request, final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse, final SecurityContext securityContext,
-            final Localization localization, final AuthenticationSession authenticationSession, final PersistenceSession persistenceSession, final AdapterManager objectAdapterLookup, final SpecificationLoader specificationLookup, IsisConfiguration configuration) {
+            final Localization localization, final AuthenticationSession authenticationSession, final PersistenceSession persistenceSession, final AdapterManager objectAdapterLookup, final SpecificationLoader specificationLookup, IsisConfiguration configuration, Where where) {
 
         this.httpHeaders = httpHeaders;
         this.uriInfo = uriInfo;
@@ -93,6 +95,7 @@ public class ResourceContext {
         this.persistenceSession = persistenceSession;
         this.adapterManager = objectAdapterLookup;
         this.specificationLookup = specificationLookup;
+        this.where = where;
 
         init(representationType);
     }
@@ -212,4 +215,8 @@ public class ResourceContext {
         return specificationLookup;
     }
 
+    public Where getWhere() {
+        return where;
+    }
+    
 }

Modified: incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/ResourceAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/ResourceAbstract.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/ResourceAbstract.java (original)
+++ incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/ResourceAbstract.java Tue Sep  4 00:50:04 2012
@@ -34,6 +34,10 @@ import javax.ws.rs.core.Response.Respons
 import javax.ws.rs.core.SecurityContext;
 import javax.ws.rs.core.UriInfo;
 
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.JsonMappingException;
+
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.profiles.Localization;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
 import org.apache.isis.core.commons.config.IsisConfiguration;
@@ -56,8 +60,6 @@ import org.apache.isis.viewer.restfulobj
 import org.apache.isis.viewer.restfulobjects.viewer.representations.ReprRenderer;
 import org.apache.isis.viewer.restfulobjects.viewer.util.OidUtils;
 import org.apache.isis.viewer.restfulobjects.viewer.util.UrlDecoderUtils;
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.map.JsonMappingException;
 
 public abstract class ResourceAbstract {
 
@@ -108,11 +110,11 @@ public abstract class ResourceAbstract {
 
     private ResourceContext resourceContext;
 
-    protected void init() {
-        init(RepresentationType.GENERIC);
+    protected void init(Where where) {
+        init(RepresentationType.GENERIC, where);
     }
 
-    protected void init(final RepresentationType representationType) {
+    protected void init(final RepresentationType representationType, Where where) {
         if (!IsisContext.inSession()) {
             throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED);
         } 
@@ -120,7 +122,7 @@ public abstract class ResourceAbstract {
             throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED);
         }
 
-        this.resourceContext = new ResourceContext(representationType, httpHeaders, uriInfo, request, httpServletRequest, httpServletResponse, securityContext, getLocalization(), getAuthenticationSession(), getPersistenceSession(), getAdapterManager(), getSpecificationLoader(), getConfiguration());
+        this.resourceContext = new ResourceContext(representationType, httpHeaders, uriInfo, request, httpServletRequest, httpServletResponse, securityContext, getLocalization(), getAuthenticationSession(), getPersistenceSession(), getAdapterManager(), getSpecificationLoader(), getConfiguration(), where);
     }
 
     protected ResourceContext getResourceContext() {

Modified: incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java (original)
+++ incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/domainobjects/AbstractObjectMemberReprRenderer.java Tue Sep  4 00:50:04 2012
@@ -18,6 +18,7 @@ package org.apache.isis.viewer.restfulob
 
 import org.codehaus.jackson.node.NullNode;
 
+import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.consent.Consent;
 import org.apache.isis.core.metamodel.facetapi.Facet;
@@ -63,8 +64,11 @@ public abstract class AbstractObjectMemb
     protected T objectMember;
     protected Mode mode = Mode.INLINE; // unless we determine otherwise
 
-    public AbstractObjectMemberReprRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final RepresentationType representationType, final JsonRepresentation representation) {
+    private final Where where;
+
+    public AbstractObjectMemberReprRenderer(final ResourceContext resourceContext, final LinkFollower linkFollower, final RepresentationType representationType, final JsonRepresentation representation, Where where) {
         super(resourceContext, linkFollower, representationType, representation);
+        this.where = where;
     }
 
     @Override
@@ -244,11 +248,11 @@ public abstract class AbstractObjectMemb
     }
 
     protected Consent usability() {
-        return objectMember.isUsable(getSession(), objectAdapter);
+        return objectMember.isUsable(getSession(), objectAdapter, where);
     }
 
     protected Consent visibility() {
-        return objectMember.isVisible(getSession(), objectAdapter);
+        return objectMember.isVisible(getSession(), objectAdapter, where);
     }
 
 }
\ No newline at end of file

Modified: incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/domainobjects/DomainObjectReprRenderer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/domainobjects/DomainObjectReprRenderer.java?rev=1380413&r1=1380412&r2=1380413&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/domainobjects/DomainObjectReprRenderer.java (original)
+++ incubator/isis/trunk/framework/viewer/restfulobjects/restfulobjects-viewer/src/main/java/org/apache/isis/viewer/restfulobjects/viewer/resources/domainobjects/DomainObjectReprRenderer.java Tue Sep  4 00:50:04 2012
@@ -186,7 +186,7 @@ public class DomainObjectReprRenderer ex
         for (final ObjectAssociation assoc : associations) {
 
             if (!mode.isCutDown()) {
-                final Consent visibility = assoc.isVisible(getSession(), objectAdapter);
+                final Consent visibility = assoc.isVisible(getSession(), objectAdapter, resourceContext.getWhere());
                 if (!visibility.isAllowed()) {
                     continue;
                 }
@@ -226,7 +226,7 @@ public class DomainObjectReprRenderer ex
     private void addActions(final ObjectAdapter objectAdapter, final List<ObjectAction> actions, final JsonRepresentation members) {
         final LinkFollower linkFollower = getLinkFollower().follow("members");
         for (final ObjectAction action : actions) {
-            final Consent visibility = action.isVisible(getSession(), objectAdapter);
+            final Consent visibility = action.isVisible(getSession(), objectAdapter, resourceContext.getWhere());
             if (!visibility.isAllowed()) {
                 continue;
             }