incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1096837 [12/14] - in /incubator/isis/trunk: core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/ core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/map/ core/metamodel/src/main/java/org/apache/isis/core/met...
Date Tue, 26 Apr 2011 18:24:13 GMT
Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java Tue Apr 26 18:24:05 2011
@@ -17,16 +17,11 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.specloader.specimpl;
 
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.log4j.Logger;
-
-import com.google.common.collect.Lists;
-
 import org.apache.isis.applib.filter.Filter;
 import org.apache.isis.applib.query.QueryFindAllInstances;
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
@@ -70,21 +65,23 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMemberContext;
+import org.apache.log4j.Logger;
 
+import com.google.common.collect.Lists;
 
 public class ObjectActionImpl extends ObjectMemberAbstract implements ObjectAction {
     private final static Logger LOG = Logger.getLogger(ObjectActionImpl.class);
 
     public static ActionType getType(final String typeStr) {
-    	ActionType type = ActionType.valueOf(typeStr);
-    	if (type == null) {
-    		throw new IllegalArgumentException();
-    	} 
-    	return type;
+        final ActionType type = ActionType.valueOf(typeStr);
+        if (type == null) {
+            throw new IllegalArgumentException();
+        }
+        return type;
     }
 
     private final ServicesProvider servicesProvider;
-    
+
     /**
      * Lazily initialized by {@link #getParameters()} (so don't use directly!)
      */
@@ -105,14 +102,11 @@ public class ObjectActionImpl extends Ob
     // Constructors
     // //////////////////////////////////////////////////////////////////
 
-    public ObjectActionImpl(
-    		final FacetedMethod facetedMethod, 
-            final ObjectMemberContext objectMemberContext,
-            final ServicesProvider servicesProvider) {
+    public ObjectActionImpl(final FacetedMethod facetedMethod, final ObjectMemberContext objectMemberContext,
+        final ServicesProvider servicesProvider) {
         super(facetedMethod, FeatureType.ACTION, objectMemberContext);
         this.servicesProvider = servicesProvider;
     }
-    
 
     // //////////////////////////////////////////////////////////////////
     // ReturnType, OnType, Actions (set)
@@ -154,10 +148,10 @@ public class ObjectActionImpl extends Ob
     // /////////////////////////////////////////////////////////////
     // getInstance
     // /////////////////////////////////////////////////////////////
-    
+
     @Override
-    public Instance getInstance(ObjectAdapter adapter) {
-        ObjectAction specification = this;
+    public Instance getInstance(final ObjectAdapter adapter) {
+        final ObjectAction specification = this;
         return adapter.getInstance(specification);
     }
 
@@ -185,7 +179,7 @@ public class ObjectActionImpl extends Ob
         return getType(this);
     }
 
-    private static ActionType getType(FacetHolder facetHolder) {
+    private static ActionType getType(final FacetHolder facetHolder) {
         Facet facet = facetHolder.getFacet(DebugFacet.class);
         if (facet != null) {
             return ActionType.DEBUG;
@@ -203,15 +197,15 @@ public class ObjectActionImpl extends Ob
 
     @Override
     public boolean isContributed() {
-    	if (!knownWhetherContributed) {
-    		contributed = determineWhetherContributed();
-    		knownWhetherContributed = true;
-    	}
+        if (!knownWhetherContributed) {
+            contributed = determineWhetherContributed();
+            knownWhetherContributed = true;
+        }
         return contributed;
     }
 
-	private boolean determineWhetherContributed() {
-		if (getOnType().isService() && getParameterCount() > 0) {
+    private boolean determineWhetherContributed() {
+        if (getOnType().isService() && getParameterCount() > 0) {
             final List<ObjectActionParameter> params = getParameters();
             for (int i = 0; i < params.size(); i++) {
                 if (params.get(i).isObject()) {
@@ -220,7 +214,7 @@ public class ObjectActionImpl extends Ob
             }
         }
         return false;
-	}
+    }
 
     // /////////////////////////////////////////////////////////////
     // Parameters
@@ -233,7 +227,7 @@ public class ObjectActionImpl extends Ob
 
     @Override
     public boolean promptForParameters(final ObjectAdapter target) {
-    	final List<ObjectActionParameter> parameters = getParameters();
+        final List<ObjectActionParameter> parameters = getParameters();
         if (isContributed() && !target.getSpecification().isService()) {
             return getParameterCount() > 1 || !target.getSpecification().isOfType(parameters.get(0).getSpecification());
         } else {
@@ -245,8 +239,8 @@ public class ObjectActionImpl extends Ob
      * Build lazily by {@link #getParameters()}.
      * 
      * <p>
-     * Although this is lazily loaded, the method is also <tt>synchronized</tt> so there shouldn't be any
-     * thread race conditions.
+     * Although this is lazily loaded, the method is also <tt>synchronized</tt> so there shouldn't be any thread race
+     * conditions.
      */
     @Override
     public synchronized List<ObjectActionParameter> getParameters() {
@@ -255,8 +249,9 @@ public class ObjectActionImpl extends Ob
             final List<ObjectActionParameter> parameters = Lists.newArrayList();
             final List<FacetedMethodParameter> paramPeers = getFacetedMethod().getParameters();
             for (int i = 0; i < parameterCount; i++) {
-                TypedHolder paramPeer = paramPeers.get(i);
-                final ObjectSpecification specification = ObjectMemberAbstract.getSpecification(getSpecificationLookup(), paramPeer.getType());
+                final TypedHolder paramPeer = paramPeers.get(i);
+                final ObjectSpecification specification =
+                    ObjectMemberAbstract.getSpecification(getSpecificationLookup(), paramPeer.getType());
                 if (specification.isParseable()) {
                     parameters.add(new ObjectActionParameterParseable(i, this, paramPeer));
                 } else if (specification.isNotCollection()) {
@@ -274,9 +269,9 @@ public class ObjectActionImpl extends Ob
 
     @Override
     public synchronized List<ObjectSpecification> getParameterTypes() {
-        List<ObjectSpecification> parameterTypes = Lists.newArrayList();
+        final List<ObjectSpecification> parameterTypes = Lists.newArrayList();
         final List<ObjectActionParameter> parameters = getParameters();
-        for(ObjectActionParameter parameter: parameters) {
+        for (final ObjectActionParameter parameter : parameters) {
             parameterTypes.add(parameter.getSpecification());
         }
         return parameterTypes;
@@ -297,8 +292,8 @@ public class ObjectActionImpl extends Ob
     private ObjectActionParameter getParameter(final int position) {
         final List<ObjectActionParameter> parameters = getParameters();
         if (position >= parameters.size()) {
-            throw new IllegalArgumentException("getParameter(int): only " + parameters.size() + " parameters, position="
-                    + position);
+            throw new IllegalArgumentException("getParameter(int): only " + parameters.size()
+                + " parameters, position=" + position);
         }
         return parameters.get(position);
     }
@@ -308,10 +303,8 @@ public class ObjectActionImpl extends Ob
     // /////////////////////////////////////////////////////////////
 
     @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) {
         return new ActionVisibilityContext(session, invocationMethod, targetObjectAdapter, getIdentifier());
     }
 
@@ -325,10 +318,8 @@ public class ObjectActionImpl extends Ob
     // /////////////////////////////////////////////////////////////
 
     @Override
-    public UsabilityContext<?> createUsableInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod invocationMethod,
-            final ObjectAdapter targetObjectAdapter) {
+    public UsabilityContext<?> createUsableInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod invocationMethod, final ObjectAdapter targetObjectAdapter) {
         return new ActionUsabilityContext(session, invocationMethod, targetObjectAdapter, getIdentifier());
     }
 
@@ -351,9 +342,8 @@ public class ObjectActionImpl extends Ob
         return isProposedArgumentSetValidResultSet(realTarget(object), parameters).createConsent();
     }
 
-    private InteractionResultSet isProposedArgumentSetValidResultSet(
-            final ObjectAdapter object,
-            final ObjectAdapter[] proposedArguments) {
+    private InteractionResultSet isProposedArgumentSetValidResultSet(final ObjectAdapter object,
+        final ObjectAdapter[] proposedArguments) {
         final InteractionInvocationMethod invocationMethod = InteractionInvocationMethod.BY_USER;
 
         final InteractionResultSet resultSet = new InteractionResultSet();
@@ -362,14 +352,16 @@ public class ObjectActionImpl extends Ob
             // TODO: doesn't seem to be used...
             // ObjectAdapter[] params = realParameters(object, proposedArguments);
             for (int i = 0; i < proposedArguments.length; i++) {
-                final ValidityContext<?> ic = actionParameters.get(i).createProposedArgumentInteractionContext(getAuthenticationSession(),
+                final ValidityContext<?> ic =
+                    actionParameters.get(i).createProposedArgumentInteractionContext(getAuthenticationSession(),
                         invocationMethod, object, proposedArguments, i);
                 InteractionUtils.isValidResultSet(getParameter(i), ic, resultSet);
             }
         }
         // only check the action's own validity if all the arguments are OK.
         if (resultSet.isAllowed()) {
-            final ValidityContext<?> ic = createActionInvocationInteractionContext(getAuthenticationSession(), invocationMethod, object,
+            final ValidityContext<?> ic =
+                createActionInvocationInteractionContext(getAuthenticationSession(), invocationMethod, object,
                     proposedArguments);
             InteractionUtils.isValidResultSet(this, ic, resultSet);
         }
@@ -377,12 +369,11 @@ public class ObjectActionImpl extends Ob
     }
 
     @Override
-    public ActionInvocationContext createActionInvocationInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod invocationMethod,
-            final ObjectAdapter targetObject,
-            final ObjectAdapter[] proposedArguments) {
-        return new ActionInvocationContext(getAuthenticationSession(), invocationMethod, targetObject, getIdentifier(), proposedArguments);
+    public ActionInvocationContext createActionInvocationInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod invocationMethod, final ObjectAdapter targetObject,
+        final ObjectAdapter[] proposedArguments) {
+        return new ActionInvocationContext(getAuthenticationSession(), invocationMethod, targetObject, getIdentifier(),
+            proposedArguments);
     }
 
     // //////////////////////////////////////////////////////////////////
@@ -403,9 +394,8 @@ public class ObjectActionImpl extends Ob
     }
 
     /**
-     * Previously (prior to 3.0.x) this method had a check to see if the action was on an instance. With the
-     * reflector redesign this has been removed, because NOF 3.x only supports instance methods, not
-     * class-level methods.
+     * Previously (prior to 3.0.x) this method had a check to see if the action was on an instance. With the reflector
+     * redesign this has been removed, because NOF 3.x only supports instance methods, not class-level methods.
      */
     @Override
     public ObjectAdapter realTarget(final ObjectAdapter target) {
@@ -422,7 +412,7 @@ public class ObjectActionImpl extends Ob
 
     private ObjectAdapter findService() {
         final List<ObjectAdapter> services = getServicesProvider().getServices();
-        for (ObjectAdapter serviceAdapter : services) {
+        for (final ObjectAdapter serviceAdapter : services) {
             if (serviceAdapter.getSpecification() == getOnType()) {
                 return serviceAdapter;
             }
@@ -455,34 +445,36 @@ public class ObjectActionImpl extends Ob
         // set a flag on entry if for a service - or get from spec using isService
         final ActionDefaultsFacet facet = getFacet(ActionDefaultsFacet.class);
         if (!facet.isNoop()) {
-        	// use the old defaultXxx approach
+            // use the old defaultXxx approach
             parameterDefaultPojos = facet.getDefaults(realTarget);
             if (parameterDefaultPojos.length != parameterCount) {
-                throw new DomainModelException("Defaults array of incompatible size; expected " + parameterCount + " elements, but was "
-                        + parameterDefaultPojos.length + " for " + facet);
-            } 
+                throw new DomainModelException("Defaults array of incompatible size; expected " + parameterCount
+                    + " elements, but was " + parameterDefaultPojos.length + " for " + facet);
+            }
             for (int i = 0; i < parameterCount; i++) {
                 if (parameterDefaultPojos[i] != null) {
-                     ObjectSpecification componentSpec = getSpecificationLookup().loadSpecification(
-                            parameterDefaultPojos[i].getClass());
-                    ObjectSpecification parameterSpec = parameters.get(i).getSpecification();
+                    final ObjectSpecification componentSpec =
+                        getSpecificationLookup().loadSpecification(parameterDefaultPojos[i].getClass());
+                    final ObjectSpecification parameterSpec = parameters.get(i).getSpecification();
                     if (!componentSpec.isOfType(parameterSpec)) {
-                        throw new DomainModelException("Defaults type incompatible with parameter " + (i + 1) + " type; expected "
-                                + parameterSpec.getFullIdentifier() + ", but was " + componentSpec.getFullIdentifier());
+                        throw new DomainModelException("Defaults type incompatible with parameter " + (i + 1)
+                            + " type; expected " + parameterSpec.getFullIdentifier() + ", but was "
+                            + componentSpec.getFullIdentifier());
                     }
                 }
             }
         } else {
-        	// use the new defaultNXxx approach for each param in turn
-        	// (the reflector will have made sure both aren't installed).
-        	parameterDefaultPojos = new Object[parameterCount];
+            // use the new defaultNXxx approach for each param in turn
+            // (the reflector will have made sure both aren't installed).
+            parameterDefaultPojos = new Object[parameterCount];
             for (int i = 0; i < parameterCount; i++) {
-            	ActionParameterDefaultsFacet paramFacet = parameters.get(i).getFacet(ActionParameterDefaultsFacet.class);
-            	if (paramFacet != null && !paramFacet.isNoop()) {
-            		parameterDefaultPojos[i] = paramFacet.getDefault(realTarget);
-            	} else {
-            		parameterDefaultPojos[i] = null;
-            	}
+                final ActionParameterDefaultsFacet paramFacet =
+                    parameters.get(i).getFacet(ActionParameterDefaultsFacet.class);
+                if (paramFacet != null && !paramFacet.isNoop()) {
+                    parameterDefaultPojos[i] = paramFacet.getDefault(realTarget);
+                } else {
+                    parameterDefaultPojos[i] = null;
+                }
             }
         }
 
@@ -492,7 +484,7 @@ public class ObjectActionImpl extends Ob
                 parameterDefaultAdapters[i] = adapterFor(parameterDefaultPojos[i]);
             }
         }
-        
+
         // set the target if contributed.
         if (isContributed() && target != null) {
             for (int i = 0; i < parameterCount; i++) {
@@ -508,7 +500,6 @@ public class ObjectActionImpl extends Ob
         return pojo == null ? null : getAdapterMap().adapterFor(pojo);
     }
 
-
     // /////////////////////////////////////////////////////////////
     // options (choices)
     // /////////////////////////////////////////////////////////////
@@ -516,55 +507,57 @@ public class ObjectActionImpl extends Ob
     @Override
     public ObjectAdapter[][] getChoices(final ObjectAdapter target) {
         final ObjectAdapter realTarget = realTarget(target);
-        
+
         final int parameterCount = getParameterCount();
         Object[][] parameterChoicesPojos;
-        
+
         final ActionChoicesFacet facet = getFacet(ActionChoicesFacet.class);
         final List<ObjectActionParameter> parameters = getParameters();
-        
+
         if (!facet.isNoop()) {
             // using the old choicesXxx() approach
-        	parameterChoicesPojos = facet.getChoices(realTarget);
-        	
+            parameterChoicesPojos = facet.getChoices(realTarget);
+
             // if no options, or not the right number of pojos, then default
             if (parameterChoicesPojos == null) {
                 parameterChoicesPojos = new Object[parameterCount][];
-            } else if (parameterChoicesPojos.length != parameterCount)  {
-                throw new DomainModelException("Choices array of incompatible size; expected " + parameterCount + " elements, but was " + parameterChoicesPojos.length + " for " + facet);
+            } else if (parameterChoicesPojos.length != parameterCount) {
+                throw new DomainModelException("Choices array of incompatible size; expected " + parameterCount
+                    + " elements, but was " + parameterChoicesPojos.length + " for " + facet);
             }
         } else {
-        	// use the new choicesNXxx approach for each param in turn
-        	// (the reflector will have made sure both aren't installed).
-        	
-        	parameterChoicesPojos = new Object[parameterCount][];
+            // use the new choicesNXxx approach for each param in turn
+            // (the reflector will have made sure both aren't installed).
+
+            parameterChoicesPojos = new Object[parameterCount][];
             for (int i = 0; i < parameterCount; i++) {
-            	ActionParameterChoicesFacet paramFacet = parameters.get(i).getFacet(ActionParameterChoicesFacet.class);
-            	if (paramFacet != null && !paramFacet.isNoop()) {
-            		parameterChoicesPojos[i] = paramFacet.getChoices(realTarget);
-            	} else {
-            		parameterChoicesPojos[i] = new Object[0];
-            	}
+                final ActionParameterChoicesFacet paramFacet =
+                    parameters.get(i).getFacet(ActionParameterChoicesFacet.class);
+                if (paramFacet != null && !paramFacet.isNoop()) {
+                    parameterChoicesPojos[i] = paramFacet.getChoices(realTarget);
+                } else {
+                    parameterChoicesPojos[i] = new Object[0];
+                }
             }
         }
 
-
         final ObjectAdapter[][] parameterChoicesAdapters = new ObjectAdapter[parameterCount][];
         for (int i = 0; i < parameterCount; i++) {
             final ObjectSpecification paramSpec = parameters.get(i).getSpecification();
 
             if (parameterChoicesPojos[i] != null && parameterChoicesPojos[i].length > 0) {
-                ObjectActionParameterAbstract.checkChoicesType(getSpecificationLookup(), parameterChoicesPojos[i], paramSpec);
+                ObjectActionParameterAbstract.checkChoicesType(getSpecificationLookup(), parameterChoicesPojos[i],
+                    paramSpec);
                 parameterChoicesAdapters[i] = new ObjectAdapter[parameterChoicesPojos[i].length];
                 for (int j = 0; j < parameterChoicesPojos[i].length; j++) {
                     parameterChoicesAdapters[i][j] = adapterFor(parameterChoicesPojos[i][j]);
                 }
             } else if (BoundedFacetUtils.isBoundedSet(paramSpec)) {
-                QueryFindAllInstances query = new QueryFindAllInstances(paramSpec.getFullIdentifier());
-				final List<ObjectAdapter> allInstancesAdapter = getQuerySubmitter().allMatchingQuery(query);
+                final QueryFindAllInstances query = new QueryFindAllInstances(paramSpec.getFullIdentifier());
+                final List<ObjectAdapter> allInstancesAdapter = getQuerySubmitter().allMatchingQuery(query);
                 parameterChoicesAdapters[i] = new ObjectAdapter[allInstancesAdapter.size()];
                 int j = 0;
-                for(ObjectAdapter adapter: allInstancesAdapter) {
+                for (final ObjectAdapter adapter : allInstancesAdapter) {
                     parameterChoicesAdapters[i][j++] = adapter;
                 }
             } else if (paramSpec.isNotCollection()) {
@@ -581,7 +574,6 @@ public class ObjectActionImpl extends Ob
         return parameterChoicesAdapters;
     }
 
-
     // //////////////////////////////////////////////////////////////////
     // debug, toString
     // //////////////////////////////////////////////////////////////////
@@ -613,14 +605,12 @@ public class ObjectActionImpl extends Ob
         return sb.toString();
     }
 
-    
-    //////////////////////////////////////////////////////
+    // ////////////////////////////////////////////////////
     // Dependencies (from constructor)
-    //////////////////////////////////////////////////////
-    
+    // ////////////////////////////////////////////////////
+
     public ServicesProvider getServicesProvider() {
         return servicesProvider;
     }
 
-    
 }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.specimpl;
 
-package org.apache.isis.core.metamodel.specloader.specimpl;
-
 import java.util.ArrayList;
 import java.util.List;
 
@@ -52,219 +51,214 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
 
 import com.google.common.collect.Lists;
-
-
-public abstract class ObjectActionParameterAbstract implements ObjectActionParameter {
-
-    private final int number;
-    private final ObjectActionImpl parentAction;
-    private final TypedHolder peer;
-
-    protected ObjectActionParameterAbstract(
-            final int number,
-            final ObjectActionImpl objectAction,
-            final TypedHolder peer) {
-        this.number = number;
-        this.parentAction = objectAction;
-        this.peer = peer;
-    }
-
-    /**
-     * Subclasses should override either {@link #isObject()} or {@link #isCollection()}.
-     */
-    @Override
-    public boolean isObject() {
-        return false;
-    }
-
-    /**
-     * Subclasses should override either {@link #isObject()} or {@link #isCollection()}.
-     */
-    @Override
-    public boolean isCollection() {
-        return false;
-    }
-
-    /**
-     * Parameter number, 0-based.
-     */
-    @Override
-    public int getNumber() {
-        return number;
-    }
-
-    @Override
-    public ObjectAction getAction() {
-        return parentAction;
-    }
-
-    @Override
-    public ObjectSpecification getSpecification() {
-        return ObjectMemberAbstract.getSpecification(getSpecificationLookup(), peer.getType());
-    }
-
-    @Override
-    public Identifier getIdentifier() {
-        return parentAction.getIdentifier();
-    }
-
-    @Override
-    public String getName() {
-        final NamedFacet facet = getFacet(NamedFacet.class);
-        String name = facet == null ? null : facet.value();
-        name = name == null ? getSpecification().getSingularName() : name;
-        return name;
-    }
-
-    @Override
-    public String getDescription() {
-        final DescribedAsFacet facet = getFacet(DescribedAsFacet.class);
-        final String description = facet.value();
-        return description == null ? "" : description;
-    }
-
-    @Override
-    public boolean isOptional() {
-        final MandatoryFacet facet = getFacet(MandatoryFacet.class);
-        return facet.isInvertedSemantics();
-    }
-
-    public Consent isUsable() {
-        return Allow.DEFAULT;
-    }
-
-    // //////////////////////////////////////////////////////////
-    // FacetHolder
-    // //////////////////////////////////////////////////////////
-
-    @Override
-    public boolean containsFacet(final Class<? extends Facet> facetType) {
-        return peer != null ? peer.containsFacet(facetType) : false;
-    }
-
+
+public abstract class ObjectActionParameterAbstract implements ObjectActionParameter {
+
+    private final int number;
+    private final ObjectActionImpl parentAction;
+    private final TypedHolder peer;
+
+    protected ObjectActionParameterAbstract(final int number, final ObjectActionImpl objectAction,
+        final TypedHolder peer) {
+        this.number = number;
+        this.parentAction = objectAction;
+        this.peer = peer;
+    }
+
+    /**
+     * Subclasses should override either {@link #isObject()} or {@link #isCollection()}.
+     */
+    @Override
+    public boolean isObject() {
+        return false;
+    }
+
+    /**
+     * Subclasses should override either {@link #isObject()} or {@link #isCollection()}.
+     */
+    @Override
+    public boolean isCollection() {
+        return false;
+    }
+
+    /**
+     * Parameter number, 0-based.
+     */
+    @Override
+    public int getNumber() {
+        return number;
+    }
+
+    @Override
+    public ObjectAction getAction() {
+        return parentAction;
+    }
+
+    @Override
+    public ObjectSpecification getSpecification() {
+        return ObjectMemberAbstract.getSpecification(getSpecificationLookup(), peer.getType());
+    }
+
+    @Override
+    public Identifier getIdentifier() {
+        return parentAction.getIdentifier();
+    }
+
+    @Override
+    public String getName() {
+        final NamedFacet facet = getFacet(NamedFacet.class);
+        String name = facet == null ? null : facet.value();
+        name = name == null ? getSpecification().getSingularName() : name;
+        return name;
+    }
+
+    @Override
+    public String getDescription() {
+        final DescribedAsFacet facet = getFacet(DescribedAsFacet.class);
+        final String description = facet.value();
+        return description == null ? "" : description;
+    }
+
+    @Override
+    public boolean isOptional() {
+        final MandatoryFacet facet = getFacet(MandatoryFacet.class);
+        return facet.isInvertedSemantics();
+    }
+
+    public Consent isUsable() {
+        return Allow.DEFAULT;
+    }
+
+    // //////////////////////////////////////////////////////////
+    // FacetHolder
+    // //////////////////////////////////////////////////////////
+
+    @Override
+    public boolean containsFacet(final Class<? extends Facet> facetType) {
+        return peer != null ? peer.containsFacet(facetType) : false;
+    }
+
     @Override
     public boolean containsDoOpFacet(final Class<? extends Facet> facetType) {
         return peer == null ? false : peer.containsDoOpFacet(facetType);
     }
 
     @Override
-    public <T extends Facet> T getFacet(final Class<T> cls) {
-        return peer != null ? peer.getFacet(cls) : null;
-    }
-
-    @Override
-    public Class<? extends Facet>[] getFacetTypes() {
-        return peer != null ? peer.getFacetTypes() : new Class[] {};
-    }
-
-    @Override
-    public List<Facet> getFacets(final Filter<Facet> filter) {
-        return peer != null ? peer.getFacets(filter) : Lists.<Facet>newArrayList();
-    }
-
-    @Override
-    public void addFacet(final Facet facet) {
-        if (peer != null) {
-            peer.addFacet(facet);
-        }
-    }
-
-    @Override
-    public void addFacet(final MultiTypedFacet facet) {
-        if (peer != null) {
-            peer.addFacet(facet);
-        }
-    }
-
-    @Override
-    public void removeFacet(final Facet facet) {
-        if (peer != null) {
-            peer.removeFacet(facet);
-        }
-    }
-
-    @Override
-    public void removeFacet(final Class<? extends Facet> facetType) {
-        if (peer != null) {
-            peer.removeFacet(facetType);
-        }
-    }
-
-    // //////////////////////////////////////////////////////////
-    // Interaction
-    // //////////////////////////////////////////////////////////
-
-    @Override
-    public ActionArgumentContext createProposedArgumentInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod invocationMethod,
-            final ObjectAdapter targetObject,
-            final ObjectAdapter[] proposedArguments,
-            final int position) {
-        return new ActionArgumentContext(getAuthenticationSession(), invocationMethod, targetObject, getIdentifier(),
-                proposedArguments, position);
-    }
-
-    @Override
-    public ObjectAdapter[] getChoices(ObjectAdapter adapter) {
-        final List<ObjectAdapter> parameterChoices = new ArrayList<ObjectAdapter>();
-        final ActionParameterChoicesFacet choicesFacet = getFacet(ActionParameterChoicesFacet.class);
-
-        if (choicesFacet != null) {
-            Object[] choices = choicesFacet.getChoices(parentAction.realTarget(adapter));
-            checkChoicesType(getSpecificationLookup(), choices, getSpecification());
-            for (Object choice : choices) {
-                parameterChoices.add(getAdapterMap().adapterFor(choice));
-            }
-        }
-        if (parameterChoices.size() == 0 && BoundedFacetUtils.isBoundedSet(getSpecification())) {
-            Query query = new QueryFindAllInstances(getSpecification().getFullIdentifier());
-			final List<ObjectAdapter> allInstancesAdapter = getQuerySubmitter().allMatchingQuery(query);
-            for (ObjectAdapter choiceAdapter: allInstancesAdapter) {
-                parameterChoices.add(choiceAdapter);
-            }
-        }
-        return parameterChoices.toArray(new ObjectAdapter[0]);
-    }
-
-    protected static void checkChoicesType(SpecificationLookup specificationLookup, Object[] objects, ObjectSpecification paramSpec) {
-        for (Object object : objects) {
-            ObjectSpecification componentSpec = specificationLookup.loadSpecification(object.getClass());
-            if (!componentSpec.isOfType(paramSpec)) {
-                throw new DomainModelException("Choice type incompatible with parameter type; expected " + paramSpec.getFullIdentifier() + ", but was " + componentSpec.getFullIdentifier());
-            }
-        }
-    }
-    
-    @Override
-    public ObjectAdapter getDefault(ObjectAdapter adapter) {
-        if (parentAction.isContributed() && adapter != null) {
-            if (adapter.getSpecification().isOfType(getSpecification())) {
-                return adapter;
-            }
-        }
-        final ActionParameterDefaultsFacet defaultsFacet = getFacet(ActionParameterDefaultsFacet.class);
-        if (defaultsFacet != null) {
-            Object dflt = defaultsFacet.getDefault(parentAction.realTarget(adapter));
-            if (dflt == null) {
-            	// it's possible that even though there is a default facet, when invoked it
-            	// is unable to return a default.
-            	return null;
-            }
-			return getAdapterMap().adapterFor(dflt);
-        }
-        return null;
-    }
-    
+    public <T extends Facet> T getFacet(final Class<T> cls) {
+        return peer != null ? peer.getFacet(cls) : null;
+    }
+
+    @Override
+    public Class<? extends Facet>[] getFacetTypes() {
+        return peer != null ? peer.getFacetTypes() : new Class[] {};
+    }
+
+    @Override
+    public List<Facet> getFacets(final Filter<Facet> filter) {
+        return peer != null ? peer.getFacets(filter) : Lists.<Facet> newArrayList();
+    }
+
+    @Override
+    public void addFacet(final Facet facet) {
+        if (peer != null) {
+            peer.addFacet(facet);
+        }
+    }
+
+    @Override
+    public void addFacet(final MultiTypedFacet facet) {
+        if (peer != null) {
+            peer.addFacet(facet);
+        }
+    }
+
+    @Override
+    public void removeFacet(final Facet facet) {
+        if (peer != null) {
+            peer.removeFacet(facet);
+        }
+    }
+
+    @Override
+    public void removeFacet(final Class<? extends Facet> facetType) {
+        if (peer != null) {
+            peer.removeFacet(facetType);
+        }
+    }
+
+    // //////////////////////////////////////////////////////////
+    // Interaction
+    // //////////////////////////////////////////////////////////
+
+    @Override
+    public ActionArgumentContext createProposedArgumentInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod invocationMethod, final ObjectAdapter targetObject,
+        final ObjectAdapter[] proposedArguments, final int position) {
+        return new ActionArgumentContext(getAuthenticationSession(), invocationMethod, targetObject, getIdentifier(),
+            proposedArguments, position);
+    }
+
+    @Override
+    public ObjectAdapter[] getChoices(final ObjectAdapter adapter) {
+        final List<ObjectAdapter> parameterChoices = new ArrayList<ObjectAdapter>();
+        final ActionParameterChoicesFacet choicesFacet = getFacet(ActionParameterChoicesFacet.class);
+
+        if (choicesFacet != null) {
+            final Object[] choices = choicesFacet.getChoices(parentAction.realTarget(adapter));
+            checkChoicesType(getSpecificationLookup(), choices, getSpecification());
+            for (final Object choice : choices) {
+                parameterChoices.add(getAdapterMap().adapterFor(choice));
+            }
+        }
+        if (parameterChoices.size() == 0 && BoundedFacetUtils.isBoundedSet(getSpecification())) {
+            final Query query = new QueryFindAllInstances(getSpecification().getFullIdentifier());
+            final List<ObjectAdapter> allInstancesAdapter = getQuerySubmitter().allMatchingQuery(query);
+            for (final ObjectAdapter choiceAdapter : allInstancesAdapter) {
+                parameterChoices.add(choiceAdapter);
+            }
+        }
+        return parameterChoices.toArray(new ObjectAdapter[0]);
+    }
+
+    protected static void checkChoicesType(final SpecificationLookup specificationLookup, final Object[] objects,
+        final ObjectSpecification paramSpec) {
+        for (final Object object : objects) {
+            final ObjectSpecification componentSpec = specificationLookup.loadSpecification(object.getClass());
+            if (!componentSpec.isOfType(paramSpec)) {
+                throw new DomainModelException("Choice type incompatible with parameter type; expected "
+                    + paramSpec.getFullIdentifier() + ", but was " + componentSpec.getFullIdentifier());
+            }
+        }
+    }
+
+    @Override
+    public ObjectAdapter getDefault(final ObjectAdapter adapter) {
+        if (parentAction.isContributed() && adapter != null) {
+            if (adapter.getSpecification().isOfType(getSpecification())) {
+                return adapter;
+            }
+        }
+        final ActionParameterDefaultsFacet defaultsFacet = getFacet(ActionParameterDefaultsFacet.class);
+        if (defaultsFacet != null) {
+            final Object dflt = defaultsFacet.getDefault(parentAction.realTarget(adapter));
+            if (dflt == null) {
+                // it's possible that even though there is a default facet, when invoked it
+                // is unable to return a default.
+                return null;
+            }
+            return getAdapterMap().adapterFor(dflt);
+        }
+        return null;
+    }
 
     protected AuthenticationSession getAuthenticationSession() {
         return getAuthenticationSessionProvider().getAuthenticationSession();
     }
-
-    // /////////////////////////////////////////////////////////////
-    // Dependencies (from parent)
-    // /////////////////////////////////////////////////////////////
-
+
+    // /////////////////////////////////////////////////////////////
+    // Dependencies (from parent)
+    // /////////////////////////////////////////////////////////////
+
     protected SpecificationLookup getSpecificationLookup() {
         return parentAction.getSpecificationLookup();
     }
@@ -281,6 +275,4 @@ public abstract class ObjectActionParame
         return parentAction.getQuerySubmitter();
     }
 
-    
-
-}
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionParameterParseable.java Tue Apr 26 18:24:05 2011
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.metamodel.specloader.specimpl;
 
-package org.apache.isis.core.metamodel.specloader.specimpl;
-
 import org.apache.isis.core.metamodel.adapter.MutableProposedHolder;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.consent.InteractionInvocationMethod;
@@ -37,144 +36,137 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
 import org.apache.isis.core.metamodel.spec.feature.OneToOneActionParameter;
 import org.apache.isis.core.metamodel.spec.feature.ParseableEntryActionParameter;
-
-
-public class ObjectActionParameterParseable extends ObjectActionParameterAbstract implements
-        ParseableEntryActionParameter {
-
-    public ObjectActionParameterParseable(
-            final int index,
-            final ObjectActionImpl action,
-            final TypedHolder peer) {
-        super(index, action, peer);
-    }
-
-    @Override
-    public int getNoLines() {
-        final MultiLineFacet facet = getFacet(MultiLineFacet.class);
-        return facet.numberOfLines();
-    }
-
-    @Override
-    public boolean canWrap() {
-        final MultiLineFacet facet = getFacet(MultiLineFacet.class);
-        return !facet.preventWrapping();
-    }
-
-    @Override
-    public int getMaximumLength() {
-        final MaxLengthFacet facet = getFacet(MaxLengthFacet.class);
-        return facet.value();
-    }
-
-    @Override
-    public int getTypicalLineLength() {
-        final TypicalLengthFacet facet = getFacet(TypicalLengthFacet.class);
-        return facet.value();
-    }
-
-    /**
-     * Invoked when tab away, disables the OK button.
-     * 
-     * <p>
-     * Assumed to be invoked {@link InteractionInvocationMethod#BY_USER by user}.
-     */
-    @Override
-    public String isValid(final ObjectAdapter adapter, final Object proposedValue) {
-
-        if (!(proposedValue instanceof String)) {
-            return null;
-        }
-        final String proposedString = (String) proposedValue;
-
-        final ObjectActionParameter objectActionParameter = getAction().getParameters().get(getNumber());
-        if (!(objectActionParameter instanceof ParseableEntryActionParameter)) {
-            return null;
-        }
-        final ParseableEntryActionParameter parameter = (ParseableEntryActionParameter) objectActionParameter;
-
-        final ObjectSpecification parameterSpecification = parameter.getSpecification();
-        final ParseableFacet p = parameterSpecification.getFacet(ParseableFacet.class);
-        final ObjectAdapter newValue = p.parseTextEntry(null, proposedString);
-
-        final ValidityContext<?> ic = parameter.createProposedArgumentInteractionContext(getAuthenticationSession(),
-                InteractionInvocationMethod.BY_USER, adapter, arguments(newValue), getNumber());
-
-        final InteractionResultSet buf = new InteractionResultSet();
-        InteractionUtils.isValidResultSet(parameter, ic, buf);
-        if (buf.isVetoed()) {
-            return buf.getInteractionResult().getReason();
-        }
-        return null;
-
-    }
-
-    /**
-     * TODO: this is not ideal, because we can only populate the array for single argument, rather than the
-     * entire argument set. Instead, we ought to do this in two passes, one to build up the argument set as a
-     * single unit, and then validate each in turn.
-     * 
-     * @param proposedValue
-     * @return
-     */
-    private ObjectAdapter[] arguments(final ObjectAdapter proposedValue) {
-        final int parameterCount = getAction().getParameterCount();
-        final ObjectAdapter[] arguments = new ObjectAdapter[parameterCount];
-        arguments[getNumber()] = proposedValue;
-        return arguments;
-    }
-
-
-    // /////////////////////////////////////////////////////////////
-    // getInstance
-    // /////////////////////////////////////////////////////////////
-    
-    @Override
-    public Instance getInstance(ObjectAdapter adapter) {
-        OneToOneActionParameter specification = this;
-        return adapter.getInstance(specification);
-    }
-
-
-    
-    // //////////////////////////////////////////////////////////////////////
-    // get, set
-    // //////////////////////////////////////////////////////////////////////
-
-    /**
-     * Gets the proposed value of the {@link Instance} (downcast as a
-     * {@link MutableProposed}, wrapping the proposed value into a {@link ObjectAdapter}.
-     */
-    @Override
-    public ObjectAdapter get(ObjectAdapter owner) {
-        MutableProposedHolder proposedHolder = getProposedHolder(owner);
-        Object proposed = proposedHolder.getProposed();
-        return getAdapterMap().adapterFor(proposed);
-    }
-
-    /**
-     * Sets the proposed value of the {@link Instance} (downcast as a
-     * {@link MutableProposed}, unwrapped the proposed value from a {@link ObjectAdapter}.
-     */
-    public void set(ObjectAdapter owner, ObjectAdapter newValue) {
-        MutableProposedHolder proposedHolder = getProposedHolder(owner);
-        Object newValuePojo = newValue.getObject();
-        proposedHolder.setProposed(newValuePojo);
-    }
-
-    private MutableProposedHolder getProposedHolder(ObjectAdapter owner) {
-        Instance instance = getInstance(owner);
-        if(!(instance instanceof MutableProposedHolder)) {
-            throw new IllegalArgumentException("Instance should implement MutableProposedHolder");
-        }
-        MutableProposedHolder proposedHolder = (MutableProposedHolder) instance;
-        return proposedHolder;
+
+public class ObjectActionParameterParseable extends ObjectActionParameterAbstract implements
+    ParseableEntryActionParameter {
+
+    public ObjectActionParameterParseable(final int index, final ObjectActionImpl action, final TypedHolder peer) {
+        super(index, action, peer);
+    }
+
+    @Override
+    public int getNoLines() {
+        final MultiLineFacet facet = getFacet(MultiLineFacet.class);
+        return facet.numberOfLines();
+    }
+
+    @Override
+    public boolean canWrap() {
+        final MultiLineFacet facet = getFacet(MultiLineFacet.class);
+        return !facet.preventWrapping();
+    }
+
+    @Override
+    public int getMaximumLength() {
+        final MaxLengthFacet facet = getFacet(MaxLengthFacet.class);
+        return facet.value();
+    }
+
+    @Override
+    public int getTypicalLineLength() {
+        final TypicalLengthFacet facet = getFacet(TypicalLengthFacet.class);
+        return facet.value();
+    }
+
+    /**
+     * Invoked when tab away, disables the OK button.
+     * 
+     * <p>
+     * Assumed to be invoked {@link InteractionInvocationMethod#BY_USER by user}.
+     */
+    @Override
+    public String isValid(final ObjectAdapter adapter, final Object proposedValue) {
+
+        if (!(proposedValue instanceof String)) {
+            return null;
+        }
+        final String proposedString = (String) proposedValue;
+
+        final ObjectActionParameter objectActionParameter = getAction().getParameters().get(getNumber());
+        if (!(objectActionParameter instanceof ParseableEntryActionParameter)) {
+            return null;
+        }
+        final ParseableEntryActionParameter parameter = (ParseableEntryActionParameter) objectActionParameter;
+
+        final ObjectSpecification parameterSpecification = parameter.getSpecification();
+        final ParseableFacet p = parameterSpecification.getFacet(ParseableFacet.class);
+        final ObjectAdapter newValue = p.parseTextEntry(null, proposedString);
+
+        final ValidityContext<?> ic =
+            parameter.createProposedArgumentInteractionContext(getAuthenticationSession(),
+                InteractionInvocationMethod.BY_USER, adapter, arguments(newValue), getNumber());
+
+        final InteractionResultSet buf = new InteractionResultSet();
+        InteractionUtils.isValidResultSet(parameter, ic, buf);
+        if (buf.isVetoed()) {
+            return buf.getInteractionResult().getReason();
+        }
+        return null;
+
+    }
+
+    /**
+     * TODO: this is not ideal, because we can only populate the array for single argument, rather than the entire
+     * argument set. Instead, we ought to do this in two passes, one to build up the argument set as a single unit, and
+     * then validate each in turn.
+     * 
+     * @param proposedValue
+     * @return
+     */
+    private ObjectAdapter[] arguments(final ObjectAdapter proposedValue) {
+        final int parameterCount = getAction().getParameterCount();
+        final ObjectAdapter[] arguments = new ObjectAdapter[parameterCount];
+        arguments[getNumber()] = proposedValue;
+        return arguments;
+    }
+
+    // /////////////////////////////////////////////////////////////
+    // getInstance
+    // /////////////////////////////////////////////////////////////
+
+    @Override
+    public Instance getInstance(final ObjectAdapter adapter) {
+        final OneToOneActionParameter specification = this;
+        return adapter.getInstance(specification);
+    }
+
+    // //////////////////////////////////////////////////////////////////////
+    // get, set
+    // //////////////////////////////////////////////////////////////////////
+
+    /**
+     * Gets the proposed value of the {@link Instance} (downcast as a {@link MutableProposed}, wrapping the proposed
+     * value into a {@link ObjectAdapter}.
+     */
+    @Override
+    public ObjectAdapter get(final ObjectAdapter owner) {
+        final MutableProposedHolder proposedHolder = getProposedHolder(owner);
+        final Object proposed = proposedHolder.getProposed();
+        return getAdapterMap().adapterFor(proposed);
+    }
+
+    /**
+     * Sets the proposed value of the {@link Instance} (downcast as a {@link MutableProposed}, unwrapped the proposed
+     * value from a {@link ObjectAdapter}.
+     */
+    public void set(final ObjectAdapter owner, final ObjectAdapter newValue) {
+        final MutableProposedHolder proposedHolder = getProposedHolder(owner);
+        final Object newValuePojo = newValue.getObject();
+        proposedHolder.setProposed(newValuePojo);
+    }
+
+    private MutableProposedHolder getProposedHolder(final ObjectAdapter owner) {
+        final Instance instance = getInstance(owner);
+        if (!(instance instanceof MutableProposedHolder)) {
+            throw new IllegalArgumentException("Instance should implement MutableProposedHolder");
+        }
+        final MutableProposedHolder proposedHolder = (MutableProposedHolder) instance;
+        return proposedHolder;
     }
 
     @Override
     public FeatureType getFeatureType() {
         return FeatureType.ACTION_PARAMETER;
-    }
-
-
-}
+    }
+
+}

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectAssociationAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectAssociationAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectAssociationAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectAssociationAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.specloader.specimpl;
 
 import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
@@ -31,17 +30,13 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMemberContext;
 
-
 // TODO need to pull up the common methods. like getName(), from subclasses
 public abstract class ObjectAssociationAbstract extends ObjectMemberAbstract implements ObjectAssociation {
-    
+
     private final ObjectSpecification specification;
 
-    public ObjectAssociationAbstract(
-            final FacetedMethod facetedMethod,
-            final FeatureType featureType,
-            final ObjectSpecification specification,
-            final ObjectMemberContext parameterObject) {
+    public ObjectAssociationAbstract(final FacetedMethod facetedMethod, final FeatureType featureType,
+        final ObjectSpecification specification, final ObjectMemberContext parameterObject) {
         super(facetedMethod, featureType, parameterObject);
         if (specification == null) {
             throw new IllegalArgumentException("field type for '" + getId() + "' must exist");
@@ -53,9 +48,9 @@ public abstract class ObjectAssociationA
     public abstract ObjectAdapter get(final ObjectAdapter fromObject);
 
     /**
-     * Return the specification of the object (or objects) that this field holds. For a value are one-to-one
-     * reference this will be type that the accessor returns. For a collection it will be the type of element,
-     * not the type of collection.
+     * Return the specification of the object (or objects) that this field holds. For a value are one-to-one reference
+     * this will be type that the accessor returns. For a collection it will be the type of element, not the type of
+     * collection.
      */
     @Override
     public ObjectSpecification getSpecification() {
@@ -66,7 +61,7 @@ public abstract class ObjectAssociationA
     public boolean isNotPersisted() {
         return containsFacet(NotPersistedFacet.class);
     }
-    
+
     @Override
     public boolean hasChoices() {
         return containsFacet(PropertyChoicesFacet.class);
@@ -74,10 +69,10 @@ public abstract class ObjectAssociationA
 
     @Override
     public boolean isMandatory() {
-    	final MandatoryFacet mandatoryFacet = getFacet(MandatoryFacet.class);
-    	return mandatoryFacet != null && !mandatoryFacet.isInvertedSemantics();
+        final MandatoryFacet mandatoryFacet = getFacet(MandatoryFacet.class);
+        return mandatoryFacet != null && !mandatoryFacet.isInvertedSemantics();
     }
-    
+
     @Override
     public abstract boolean isEmpty(final ObjectAdapter adapter);
 
@@ -90,7 +85,5 @@ public abstract class ObjectAssociationA
     public String getBusinessKeyName() {
         throw new NotYetImplementedException();
     }
-    
-    
-    
+
 }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectMemberAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectMemberAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectMemberAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectMemberAbstract.java Tue Apr 26 18:24:05 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.specloader.specimpl;
 
 import java.util.List;
@@ -51,10 +50,10 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
 import org.apache.isis.core.metamodel.spec.feature.ObjectMemberContext;
 
-
 public abstract class ObjectMemberAbstract implements ObjectMember {
 
-    public static ObjectSpecification getSpecification(final SpecificationLookup specificationLookup, final Class<?> type) {
+    public static ObjectSpecification getSpecification(final SpecificationLookup specificationLookup,
+        final Class<?> type) {
         return type == null ? null : specificationLookup.loadSpecification(type);
     }
 
@@ -67,10 +66,8 @@ public abstract class ObjectMemberAbstra
     private final AdapterMap adapterMap;
     private final QuerySubmitter querySubmitter;
 
-    protected ObjectMemberAbstract(
-    		final FacetedMethod facetedMethod, 
-    		final FeatureType featureType, 
-    		ObjectMemberContext objectMembercontext) {
+    protected ObjectMemberAbstract(final FacetedMethod facetedMethod, final FeatureType featureType,
+        final ObjectMemberContext objectMembercontext) {
         final String id = facetedMethod.getIdentifier().getMemberName();
         if (id == null) {
             throw new IllegalArgumentException("Name must always be set");
@@ -79,14 +76,13 @@ public abstract class ObjectMemberAbstra
         this.featureType = featureType;
         this.id = id;
         this.defaultName = NameUtils.naturalName(this.id);
-        
+
         this.authenticationSessionProvider = objectMembercontext.getAuthenticationSessionProvider();
         this.specificationLookup = objectMembercontext.getSpecificationLookup();
         this.adapterMap = objectMembercontext.getAdapterManager();
         this.querySubmitter = objectMembercontext.getQuerySubmitter();
     }
 
-
     // /////////////////////////////////////////////////////////////
     // Identifiers
     // /////////////////////////////////////////////////////////////
@@ -112,9 +108,7 @@ public abstract class ObjectMemberAbstra
     public FeatureType getFeatureType() {
         return featureType;
     }
-    
 
-    
     // /////////////////////////////////////////////////////////////
     // Facets
     // /////////////////////////////////////////////////////////////
@@ -197,15 +191,14 @@ public abstract class ObjectMemberAbstra
     // Hidden (or visible)
     // /////////////////////////////////////////////////////////////
 
-
     @Override
     public boolean isAlwaysHidden() {
         return containsFacet(HiddenFacet.class);
     }
-    
+
     /**
-     * Loops over all {@link HidingInteractionAdvisor} {@link Facet}s and returns <tt>true</tt> only if none
-     * hide the member.
+     * Loops over all {@link HidingInteractionAdvisor} {@link Facet}s and returns <tt>true</tt> only if none hide the
+     * member.
      * 
      * <p>
      * TODO: currently this method is hard-coded to assume all interactions are initiated
@@ -217,7 +210,8 @@ public abstract class ObjectMemberAbstra
     }
 
     private InteractionResult isVisibleResult(final AuthenticationSession session, final ObjectAdapter target) {
-        final VisibilityContext<?> ic = createVisibleInteractionContext(session, InteractionInvocationMethod.BY_USER, target);
+        final VisibilityContext<?> ic =
+            createVisibleInteractionContext(session, InteractionInvocationMethod.BY_USER, target);
         return InteractionUtils.isVisibleResult(this, ic);
     }
 
@@ -226,8 +220,8 @@ public abstract class ObjectMemberAbstra
     // /////////////////////////////////////////////////////////////
 
     /**
-     * Loops over all {@link DisablingInteractionAdvisor} {@link Facet}s and returns <tt>true</tt> only if
-     * none disables the member.
+     * Loops over all {@link DisablingInteractionAdvisor} {@link Facet}s and returns <tt>true</tt> only if none disables
+     * the member.
      * 
      * <p>
      * TODO: currently this method is hard-coded to assume all interactions are initiated
@@ -239,11 +233,11 @@ public abstract class ObjectMemberAbstra
     }
 
     private InteractionResult isUsableResult(final AuthenticationSession session, final ObjectAdapter target) {
-        final UsabilityContext<?> ic = createUsableInteractionContext(session, InteractionInvocationMethod.BY_USER, target);
+        final UsabilityContext<?> ic =
+            createUsableInteractionContext(session, InteractionInvocationMethod.BY_USER, target);
         return InteractionUtils.isUsableResult(this, ic);
     }
 
-
     // //////////////////////////////////////////////////////////////////
     // isAssociation, isAction
     // //////////////////////////////////////////////////////////////////
@@ -273,14 +267,12 @@ public abstract class ObjectMemberAbstra
     // //////////////////////////////////////////////////////////////////
 
     /**
-     * The current {@link AuthenticationSession} (can change over time so
-     * do not cache).
+     * The current {@link AuthenticationSession} (can change over time so do not cache).
      */
     protected AuthenticationSession getAuthenticationSession() {
         return authenticationSessionProvider.getAuthenticationSession();
     }
 
-
     // //////////////////////////////////////////////////////////////////
     // toString
     // //////////////////////////////////////////////////////////////////
@@ -290,7 +282,6 @@ public abstract class ObjectMemberAbstra
         return String.format("id=%s,name='%s'", getId(), getName());
     }
 
-
     // //////////////////////////////////////////////////////////////////
     // Dependencies
     // //////////////////////////////////////////////////////////////////
@@ -298,11 +289,11 @@ public abstract class ObjectMemberAbstra
     public AuthenticationSessionProvider getAuthenticationSessionProvider() {
         return authenticationSessionProvider;
     }
-    
+
     public SpecificationLookup getSpecificationLookup() {
         return specificationLookup;
     }
-    
+
     public AdapterMap getAdapterMap() {
         return adapterMap;
     }
@@ -311,6 +302,4 @@ public abstract class ObjectMemberAbstra
         return querySubmitter;
     }
 
-
-
 }

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectSpecificationAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectSpecificationAbstract.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectSpecificationAbstract.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectSpecificationAbstract.java Tue Apr 26 18:24:05 2011
@@ -25,11 +25,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.log4j.Logger;
-
-import com.google.common.collect.Lists;
-import com.google.inject.internal.Maps;
-
 import org.apache.isis.applib.Identifier;
 import org.apache.isis.applib.adapters.Localization;
 import org.apache.isis.applib.filter.Filter;
@@ -84,9 +79,12 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
 import org.apache.isis.core.metamodel.specloader.specimpl.objectlist.ObjectSpecificationForObjectList;
+import org.apache.log4j.Logger;
 
-public abstract class ObjectSpecificationAbstract extends FacetHolderImpl implements
-    ObjectSpecification {
+import com.google.common.collect.Lists;
+import com.google.inject.internal.Maps;
+
+public abstract class ObjectSpecificationAbstract extends FacetHolderImpl implements ObjectSpecification {
 
     private final static Logger LOG = Logger.getLogger(ObjectSpecificationAbstract.class);
 
@@ -144,9 +142,8 @@ public abstract class ObjectSpecificatio
     // Constructor
     // //////////////////////////////////////////////////////////////////////
 
-    public ObjectSpecificationAbstract(
-            final Class<?> introspectedClass, final String shortName,
-            final SpecificationContext specificationContext) {
+    public ObjectSpecificationAbstract(final Class<?> introspectedClass, final String shortName,
+        final SpecificationContext specificationContext) {
 
         this.correspondingClass = introspectedClass;
         this.fullName = introspectedClass.getName();
@@ -172,8 +169,7 @@ public abstract class ObjectSpecificatio
 
     /**
      * As provided explicitly within the
-     * {@link #IntrospectableSpecificationAbstract(Class, String, SpecificationContext)
-     * constructor}.
+     * {@link #IntrospectableSpecificationAbstract(Class, String, SpecificationContext) constructor}.
      * 
      * <p>
      * Not API, but <tt>public</tt> so that {@link FacetedMethodsBuilder} can call it.
@@ -185,8 +181,7 @@ public abstract class ObjectSpecificatio
 
     /**
      * As provided explicitly within the
-     * {@link #IntrospectableSpecificationAbstract(Class, String, SpecificationContext)
-     * constructor}.
+     * {@link #IntrospectableSpecificationAbstract(Class, String, SpecificationContext) constructor}.
      */
     @Override
     public String getShortIdentifier() {
@@ -217,7 +212,7 @@ public abstract class ObjectSpecificatio
     /**
      * Intended to be called within {@link #introspectTypeHierarchyAndMembers()}.
      */
-    protected void setSuperclass(Class<?> superclass) {
+    protected void setSuperclass(final Class<?> superclass) {
         if (superclass == null) {
             return;
         }
@@ -233,27 +228,27 @@ public abstract class ObjectSpecificatio
     /**
      * Intended to be called within {@link #introspectTypeHierarchyAndMembers()}.
      */
-    protected void addInterfaces(List<ObjectSpecification> interfaces) {
+    protected void addInterfaces(final List<ObjectSpecification> interfaces) {
         this.interfaces.addAll(interfaces);
     }
 
     /**
      * Intended to be called within {@link #introspectTypeHierarchyAndMembers()}.
      */
-    protected void addAsSubclassTo(ObjectSpecification supertypeSpec) {
+    protected void addAsSubclassTo(final ObjectSpecification supertypeSpec) {
         if (!(supertypeSpec instanceof ObjectSpecificationAbstract)) {
             return;
         }
         // downcast required because addSubclass is (deliberately) not public API
-        ObjectSpecificationAbstract introspectableSpec = (ObjectSpecificationAbstract) supertypeSpec;
+        final ObjectSpecificationAbstract introspectableSpec = (ObjectSpecificationAbstract) supertypeSpec;
         introspectableSpec.addSubclass(this);
     }
 
     /**
      * Intended to be called within {@link #introspectTypeHierarchyAndMembers()}.
      */
-    protected void addAsSubclassTo(List<ObjectSpecification> supertypeSpecs) {
-        for (ObjectSpecification supertypeSpec : supertypeSpecs) {
+    protected void addAsSubclassTo(final List<ObjectSpecification> supertypeSpecs) {
+        for (final ObjectSpecification supertypeSpec : supertypeSpecs) {
             addAsSubclassTo(supertypeSpec);
         }
     }
@@ -265,8 +260,8 @@ public abstract class ObjectSpecificatio
     /**
      * Intended to be called within {@link #introspectTypeHierarchyAndMembers()}.
      */
-    protected void addAssociations(List<ObjectAssociation> associations) {
-        if(associations == null) {
+    protected void addAssociations(final List<ObjectAssociation> associations) {
+        if (associations == null) {
             return;
         }
         this.associations.addAll(associations);
@@ -275,8 +270,8 @@ public abstract class ObjectSpecificatio
     /**
      * Intended to be called within {@link #introspectTypeHierarchyAndMembers()}.
      */
-    protected void addObjectActions(List<ObjectAction> objectActions) {
-        if(objectActions == null) {
+    protected void addObjectActions(final List<ObjectAction> objectActions) {
+        if (objectActions == null) {
             return;
         }
         this.objectActions.addAll(objectActions);
@@ -295,13 +290,13 @@ public abstract class ObjectSpecificatio
         titleFacet = getFacet(TitleFacet.class);
         iconFacet = getFacet(IconFacet.class);
 
-        Persistability persistability = determinePersistability();
+        final Persistability persistability = determinePersistability();
         this.persistability = persistability;
     }
 
     private Persistability determinePersistability() {
         final NotPersistableFacet notPersistableFacet = getFacet(NotPersistableFacet.class);
-        if(notPersistableFacet==null) {
+        if (notPersistableFacet == null) {
             return Persistability.USER_PERSISTABLE;
         }
         final InitiatedBy initiatedBy = notPersistableFacet.value();
@@ -314,27 +309,26 @@ public abstract class ObjectSpecificatio
         }
     }
 
-
     /**
      * Intended to be called (if at all) within {@link #updateFromFacetValues()}.
      */
-    protected void setClearDirtyObjectFacet(ClearDirtyObjectFacet clearDirtyObjectFacet) {
+    protected void setClearDirtyObjectFacet(final ClearDirtyObjectFacet clearDirtyObjectFacet) {
         this.clearDirtyObjectFacet = clearDirtyObjectFacet;
     }
 
     /**
      * Intended to be called within {@link #updateFromFacetValues()}.
      */
-    protected void setIntrospected(boolean introspected) {
+    protected void setIntrospected(final boolean introspected) {
         this.introspected = introspected;
     }
 
     // //////////////////////////////////////////////////////////////////////
     // Title, Icon
     // //////////////////////////////////////////////////////////////////////
-    
+
     @Override
-    public String getTitle(final ObjectAdapter object, Localization localization) {
+    public String getTitle(final ObjectAdapter object, final Localization localization) {
         if (titleFacet != null) {
             final String titleString = titleFacet.title(object, localization);
             if (titleString != null && !titleString.equals("")) {
@@ -349,13 +343,12 @@ public abstract class ObjectSpecificatio
         return iconFacet == null ? null : iconFacet.iconName(reference);
     }
 
-
     // //////////////////////////////////////////////////////////////////////
     // Specification
     // //////////////////////////////////////////////////////////////////////
 
     @Override
-    public Instance getInstance(ObjectAdapter adapter) {
+    public Instance getInstance(final ObjectAdapter adapter) {
         return adapter;
     }
 
@@ -387,7 +380,7 @@ public abstract class ObjectSpecificatio
         if (specification == this) {
             return true;
         }
-        for (ObjectSpecification interfaceSpec : interfaces()) {
+        for (final ObjectSpecification interfaceSpec : interfaces()) {
             if (interfaceSpec.isOfType(specification)) {
                 return true;
             }
@@ -405,7 +398,7 @@ public abstract class ObjectSpecificatio
      */
     @Override
     public String getSingularName() {
-        NamedFacet namedFacet = getFacet(NamedFacet.class);
+        final NamedFacet namedFacet = getFacet(NamedFacet.class);
         return namedFacet.value();
     }
 
@@ -414,7 +407,7 @@ public abstract class ObjectSpecificatio
      */
     @Override
     public String getPluralName() {
-        PluralFacet pluralFacet = getFacet(PluralFacet.class);
+        final PluralFacet pluralFacet = getFacet(PluralFacet.class);
         return pluralFacet.value();
     }
 
@@ -424,11 +417,12 @@ public abstract class ObjectSpecificatio
     @Override
     public String getDescription() {
         final DescribedAsFacet describedAsFacet = getFacet(DescribedAsFacet.class);
-        String describedAs = describedAsFacet.value();
+        final String describedAs = describedAsFacet.value();
         return describedAs == null ? "" : describedAs;
     }
-    
-    /* help is typically a reference (eg a URL) and so should not default to a textual value if not set up */ 
+
+    /* help is typically a reference (eg a URL) and so should not default to a textual value if not set up */
+    @Override
     public String getHelp() {
         final HelpFacet helpFacet = getFacet(HelpFacet.class);
         return helpFacet == null ? null : helpFacet.value();
@@ -495,9 +489,9 @@ public abstract class ObjectSpecificatio
             }
         }
         // search up the inheritance hierarchy
-        ObjectSpecification superSpec = superclass();
+        final ObjectSpecification superSpec = superclass();
         if (superSpec != null) {
-            Q superClassFacet = superSpec.getFacet(facetType);
+            final Q superClassFacet = superSpec.getFacet(facetType);
             if (isNotANoopFacet(superClassFacet)) {
                 return superClassFacet;
             }
@@ -591,7 +585,7 @@ public abstract class ObjectSpecificatio
      */
     @Override
     public ObjectAssociation getAssociation(final String id) {
-        for (ObjectAssociation objectAssociation : getAssociations()) {
+        for (final ObjectAssociation objectAssociation : getAssociations()) {
             if (objectAssociation.getId().equals(id)) {
                 return objectAssociation;
             }
@@ -616,8 +610,8 @@ public abstract class ObjectSpecificatio
     @Override
     @SuppressWarnings("unchecked")
     public List<OneToOneAssociation> getProperties() {
-        List<OneToOneAssociation> list = new ArrayList<OneToOneAssociation>();
-        List associationList = getAssociations(ObjectAssociationFilters.PROPERTIES);
+        final List<OneToOneAssociation> list = new ArrayList<OneToOneAssociation>();
+        final List associationList = getAssociations(ObjectAssociationFilters.PROPERTIES);
         list.addAll(associationList);
         return list;
     }
@@ -625,8 +619,8 @@ public abstract class ObjectSpecificatio
     @Override
     @SuppressWarnings("unchecked")
     public List<OneToManyAssociation> getCollections() {
-        List<OneToManyAssociation> list = new ArrayList<OneToManyAssociation>();
-        List associationList = getAssociations(ObjectAssociationFilters.COLLECTIONS);
+        final List<OneToManyAssociation> list = new ArrayList<OneToManyAssociation>();
+        final List associationList = getAssociations(ObjectAssociationFilters.COLLECTIONS);
         list.addAll(associationList);
         return list;
     }
@@ -642,14 +636,14 @@ public abstract class ObjectSpecificatio
 
     @Override
     public List<ObjectAction> getObjectActions(final ActionType... requestedTypes) {
-        List<ObjectAction> actions = Lists.newArrayList();
-        for (ActionType type : requestedTypes) {
+        final List<ObjectAction> actions = Lists.newArrayList();
+        for (final ActionType type : requestedTypes) {
             addActions(type, actions);
         }
         return actions;
     }
 
-    private void addActions(ActionType type, List<ObjectAction> actions) {
+    private void addActions(final ActionType type, final List<ObjectAction> actions) {
         if (!isService()) {
             actions.addAll(getContributedActions(type));
         }
@@ -684,7 +678,6 @@ public abstract class ObjectSpecificatio
         return type == null || action.getType().equals(type);
     }
 
-
     // //////////////////////////////////////////////////////////////////////
     // service actions
     // //////////////////////////////////////////////////////////////////////
@@ -693,32 +686,34 @@ public abstract class ObjectSpecificatio
     public List<ObjectAction> getServiceActionsReturning(final ActionType... types) {
         final List<ObjectAction> serviceActions = Lists.newArrayList();
         final List<ObjectAdapter> services = getServicesProvider().getServices();
-        for (ObjectAdapter serviceAdapter : services) {
+        for (final ObjectAdapter serviceAdapter : services) {
             appendServiceActionsReturning(serviceAdapter, Arrays.asList(types), serviceActions);
         }
         return serviceActions;
     }
 
-    private void appendServiceActionsReturning(ObjectAdapter serviceAdapter, final List<ActionType> types,
+    private void appendServiceActionsReturning(final ObjectAdapter serviceAdapter, final List<ActionType> types,
         final List<ObjectAction> relatedActionsToAppendTo) {
         final List<ObjectAction> matchingActionsToAppendTo = Lists.newArrayList();
-        for (ActionType type : types) {
+        for (final ActionType type : types) {
             final List<ObjectAction> serviceActions = serviceAdapter.getSpecification().getObjectActions(type);
-            for (ObjectAction serviceAction : serviceActions) {
+            for (final ObjectAction serviceAction : serviceActions) {
                 addIfReturnsSubtype(serviceAction, matchingActionsToAppendTo);
             }
         }
         if (matchingActionsToAppendTo.size() > 0) {
-            final ObjectActionSet set = new ObjectActionSet("id", serviceAdapter.titleString(), matchingActionsToAppendTo);
+            final ObjectActionSet set =
+                new ObjectActionSet("id", serviceAdapter.titleString(), matchingActionsToAppendTo);
             relatedActionsToAppendTo.add(set);
         }
     }
 
-    private void addIfReturnsSubtype(final ObjectAction serviceAction, final List<ObjectAction> matchingActionsToAppendTo) {
+    private void addIfReturnsSubtype(final ObjectAction serviceAction,
+        final List<ObjectAction> matchingActionsToAppendTo) {
         final ObjectSpecification returnType = serviceAction.getReturnType();
         if (returnType == null) {
             return;
-        } 
+        }
         if (returnType.isCollection()) {
             final TypeOfFacet facet = serviceAction.getFacet(TypeOfFacet.class);
             if (facet != null) {
@@ -760,7 +755,7 @@ public abstract class ObjectSpecificatio
             // populate an ActionSet with all actions contributed by each service
             contributedActionSets = Lists.newArrayList();
             final List<ObjectAdapter> services = getServicesProvider().getServices();
-            for (ObjectAdapter serviceAdapter : services) {
+            for (final ObjectAdapter serviceAdapter : services) {
                 addContributedActionsIfAny(serviceAdapter, actionType, contributedActionSets);
             }
             contributedActionSetsByType.put(actionType, contributedActionSets);
@@ -768,7 +763,7 @@ public abstract class ObjectSpecificatio
         return contributedActionSets;
     }
 
-    private void addContributedActionsIfAny(ObjectAdapter serviceAdapter, final ActionType actionType,
+    private void addContributedActionsIfAny(final ObjectAdapter serviceAdapter, final ActionType actionType,
         final List<ObjectAction> contributedActionSetsToAppendTo) {
         final ObjectSpecification specification = serviceAdapter.getSpecification();
         if (specification == this) {
@@ -788,7 +783,7 @@ public abstract class ObjectSpecificatio
         final ActionType actionType) {
         final List<ObjectAction> contributedActions = Lists.newArrayList();
         final List<ObjectAction> serviceActions = specification.getObjectActions(actionType);
-        for (ObjectAction serviceAction : serviceActions) {
+        for (final ObjectAction serviceAction : serviceActions) {
             if (serviceAction.isAlwaysHidden()) {
                 continue;
             }
@@ -802,7 +797,7 @@ public abstract class ObjectSpecificatio
 
     private boolean matchesParameterOf(final ObjectAction serviceAction) {
         final List<ObjectActionParameter> params = serviceAction.getParameters();
-        for (ObjectActionParameter param : params) {
+        for (final ObjectActionParameter param : params) {
             if (isOfType(param.getSpecification())) {
                 return true;
             }
@@ -899,11 +894,12 @@ public abstract class ObjectSpecificatio
     }
 
     @Override
-    public Object createObject(CreationMode creationMode) {
+    public Object createObject(final CreationMode creationMode) {
         throw new UnsupportedOperationException(getFullIdentifier());
     }
-    
-    public Object createAggregatedObject(ObjectAdapter parent, CreationMode creationMode) {
+
+    @Override
+    public Object createAggregatedObject(final ObjectAdapter parent, final CreationMode creationMode) {
         throw new UnsupportedOperationException(getFullIdentifier());
     }
 

Modified: incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToManyAssociationImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToManyAssociationImpl.java?rev=1096837&r1=1096836&r2=1096837&view=diff
==============================================================================
--- incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToManyAssociationImpl.java (original)
+++ incubator/isis/trunk/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/OneToManyAssociationImpl.java Tue Apr 26 18:24:05 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.core.metamodel.specloader.specimpl;
 
 import org.apache.isis.core.commons.authentication.AuthenticationSession;
@@ -48,13 +47,11 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.feature.ObjectMemberContext;
 import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
 
-
 public class OneToManyAssociationImpl extends ObjectAssociationAbstract implements OneToManyAssociation {
 
-    public OneToManyAssociationImpl(
-    		final FacetedMethod facetedMethod,
-            final ObjectMemberContext objectMemberContext) {
-        super(facetedMethod, FeatureType.COLLECTION, getSpecification(objectMemberContext.getSpecificationLookup(), facetedMethod.getType()), objectMemberContext);
+    public OneToManyAssociationImpl(final FacetedMethod facetedMethod, final ObjectMemberContext objectMemberContext) {
+        super(facetedMethod, FeatureType.COLLECTION, getSpecification(objectMemberContext.getSpecificationLookup(),
+            facetedMethod.getType()), objectMemberContext);
     }
 
     // /////////////////////////////////////////////////////////////
@@ -62,10 +59,8 @@ public class OneToManyAssociationImpl ex
     // /////////////////////////////////////////////////////////////
 
     @Override
-    public VisibilityContext<?> createVisibleInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod invocationMethod,
-            final ObjectAdapter ownerAdapter) {
+    public VisibilityContext<?> createVisibleInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod invocationMethod, final ObjectAdapter ownerAdapter) {
         return new CollectionVisibilityContext(session, invocationMethod, ownerAdapter, getIdentifier());
     }
 
@@ -74,25 +69,21 @@ public class OneToManyAssociationImpl ex
     // /////////////////////////////////////////////////////////////
 
     @Override
-    public UsabilityContext<?> createUsableInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod invocationMethod,
-            final ObjectAdapter ownerAdapter) {
+    public UsabilityContext<?> createUsableInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod invocationMethod, final ObjectAdapter ownerAdapter) {
         return new CollectionUsabilityContext(session, invocationMethod, ownerAdapter, getIdentifier());
     }
 
-
     // /////////////////////////////////////////////////////////////
     // Validate Add
     // /////////////////////////////////////////////////////////////
 
     @Override
-    public ValidityContext<?> createValidateAddInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod invocationMethod,
-            final ObjectAdapter ownerAdapter,
-            final ObjectAdapter proposedToAddAdapter) {
-        return new CollectionAddToContext(session, invocationMethod, ownerAdapter, getIdentifier(), proposedToAddAdapter);
+    public ValidityContext<?> createValidateAddInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod invocationMethod, final ObjectAdapter ownerAdapter,
+        final ObjectAdapter proposedToAddAdapter) {
+        return new CollectionAddToContext(session, invocationMethod, ownerAdapter, getIdentifier(),
+            proposedToAddAdapter);
     }
 
     /**
@@ -104,9 +95,11 @@ public class OneToManyAssociationImpl ex
         return isValidToAddResult(ownerAdapter, proposedToAddAdapter).createConsent();
     }
 
-    private InteractionResult isValidToAddResult(final ObjectAdapter ownerAdapter, final ObjectAdapter proposedToAddAdapter) {
-        final ValidityContext<?> validityContext = createValidateAddInteractionContext(getAuthenticationSession(),
-                InteractionInvocationMethod.BY_USER, ownerAdapter, proposedToAddAdapter);
+    private InteractionResult isValidToAddResult(final ObjectAdapter ownerAdapter,
+        final ObjectAdapter proposedToAddAdapter) {
+        final ValidityContext<?> validityContext =
+            createValidateAddInteractionContext(getAuthenticationSession(), InteractionInvocationMethod.BY_USER,
+                ownerAdapter, proposedToAddAdapter);
         return InteractionUtils.isValidResult(this, validityContext);
     }
 
@@ -115,13 +108,11 @@ public class OneToManyAssociationImpl ex
     // /////////////////////////////////////////////////////////////
 
     @Override
-    public ValidityContext<?> createValidateRemoveInteractionContext(
-            final AuthenticationSession session,
-            final InteractionInvocationMethod invocationMethod,
-            final ObjectAdapter ownerAdapter,
-            final ObjectAdapter proposedToRemoveAdapter) {
+    public ValidityContext<?> createValidateRemoveInteractionContext(final AuthenticationSession session,
+        final InteractionInvocationMethod invocationMethod, final ObjectAdapter ownerAdapter,
+        final ObjectAdapter proposedToRemoveAdapter) {
         return new CollectionRemoveFromContext(session, invocationMethod, ownerAdapter, getIdentifier(),
-                proposedToRemoveAdapter);
+            proposedToRemoveAdapter);
     }
 
     /**
@@ -133,9 +124,11 @@ public class OneToManyAssociationImpl ex
         return isValidToRemoveResult(ownerAdapter, proposedToRemoveAdapter).createConsent();
     }
 
-    private InteractionResult isValidToRemoveResult(final ObjectAdapter ownerAdapter, final ObjectAdapter proposedToRemoveAdapter) {
-        final ValidityContext<?> validityContext = createValidateRemoveInteractionContext(getAuthenticationSession(),
-                InteractionInvocationMethod.BY_USER, ownerAdapter, proposedToRemoveAdapter);
+    private InteractionResult isValidToRemoveResult(final ObjectAdapter ownerAdapter,
+        final ObjectAdapter proposedToRemoveAdapter) {
+        final ValidityContext<?> validityContext =
+            createValidateRemoveInteractionContext(getAuthenticationSession(), InteractionInvocationMethod.BY_USER,
+                ownerAdapter, proposedToRemoveAdapter);
         return InteractionUtils.isValidResult(this, validityContext);
     }
 
@@ -158,9 +151,6 @@ public class OneToManyAssociationImpl ex
         return getAdapterMap().adapterFor(collection, ownerAdapter, this);
     }
 
-
-
-
     @Override
     public boolean isEmpty(final ObjectAdapter parentAdapter) {
         // REVIEW should we be able to determine if a collection is empty without loading it?
@@ -169,7 +159,6 @@ public class OneToManyAssociationImpl ex
         return facet.size(collection) == 0;
     }
 
-
     // /////////////////////////////////////////////////////////////
     // add, clear
     // /////////////////////////////////////////////////////////////
@@ -182,7 +171,8 @@ public class OneToManyAssociationImpl ex
         if (readWrite()) {
             if (ownerAdapter.isPersistent() && referencedAdapter.isTransient()) {
                 throw new IsisException("can't set a reference to a transient object from a persistent one: "
-                        + ownerAdapter.titleString() + " (persistent) -> " + referencedAdapter.titleString() + " (transient)");
+                    + ownerAdapter.titleString() + " (persistent) -> " + referencedAdapter.titleString()
+                    + " (transient)");
             }
             final CollectionAddToFacet facet = getFacet(CollectionAddToFacet.class);
             facet.add(ownerAdapter, referencedAdapter);
@@ -223,9 +213,9 @@ public class OneToManyAssociationImpl ex
     }
 
     @Override
-    public void toDefault(final ObjectAdapter ownerAdapter) {}
+    public void toDefault(final ObjectAdapter ownerAdapter) {
+    }
 
-    
     // /////////////////////////////////////////////////////////////
     // options (choices)
     // /////////////////////////////////////////////////////////////
@@ -240,18 +230,15 @@ public class OneToManyAssociationImpl ex
         return false;
     }
 
-
-
     // /////////////////////////////////////////////////////////////
     // getInstance
     // /////////////////////////////////////////////////////////////
-    
+
     @Override
-    public Instance getInstance(ObjectAdapter adapter) {
-        OneToManyAssociation specification = this;
+    public Instance getInstance(final ObjectAdapter adapter) {
+        final OneToManyAssociation specification = this;
         return adapter.getInstance(specification);
     }
-    
 
     // /////////////////////////////////////////////////////////////
     // debug, toString
@@ -276,8 +263,4 @@ public class OneToManyAssociationImpl ex
         return str.toString();
     }
 
-
-
-
-
 }



Mime
View raw message