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 2011/01/17 19:23:18 UTC

svn commit: r1060035 [7/14] - in /incubator/isis/trunk: alternatives/embedded/src/main/java/org/apache/isis/alternatives/embedded/ alternatives/objectstore/nosql/src/test/java/org/apache/isis/alternatives/objectstore/nosql/ alternatives/objectstore/sql...

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/annotation/ValueFacetAnnotation.java (from r1059849, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/ValueFacetAnnotation.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/annotation/ValueFacetAnnotation.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/annotation/ValueFacetAnnotation.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/ValueFacetAnnotation.java&r1=1059849&r2=1060035&rev=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/ValueFacetAnnotation.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/annotation/ValueFacetAnnotation.java Mon Jan 17 18:22:58 2011
@@ -18,12 +18,15 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.value;
+package org.apache.isis.core.progmodel.facets.object.value.annotation;
 
 import org.apache.isis.applib.annotation.Value;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.lang.StringUtils;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.value.ValueFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderUtil;
 
 
 public class ValueFacetAnnotation extends ValueFacetAbstract {

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/annotation/ValueFacetFactory.java (from r1059849, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/ValueFacetFactory.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/annotation/ValueFacetFactory.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/annotation/ValueFacetFactory.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/ValueFacetFactory.java&r1=1059849&r2=1060035&rev=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/ValueFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/object/value/annotation/ValueFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.object.value;
+package org.apache.isis.core.progmodel.facets.object.value.annotation;
 
 import org.apache.isis.applib.adapters.EncoderDecoder;
 import org.apache.isis.applib.annotation.Value;
@@ -33,16 +33,19 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facetapi.FacetUtil;
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
 import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.ebc.EqualByContentFacet;
 import org.apache.isis.core.metamodel.facets.object.aggregated.AggregatedFacet;
 import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
-import org.apache.isis.core.metamodel.facets.object.ident.icon.IconFacet;
-import org.apache.isis.core.metamodel.facets.object.ident.title.TitleFacet;
+import org.apache.isis.core.metamodel.facets.object.icon.IconFacet;
 import org.apache.isis.core.metamodel.facets.object.immutable.ImmutableFacet;
 import org.apache.isis.core.metamodel.facets.object.parseable.ParseableFacet;
+import org.apache.isis.core.metamodel.facets.object.title.TitleFacet;
 import org.apache.isis.core.metamodel.facets.object.value.ValueFacet;
 import org.apache.isis.core.metamodel.runtimecontext.DependencyInjector;
 import org.apache.isis.core.metamodel.runtimecontext.DependencyInjectorAware;
-import org.apache.isis.core.progmodel.facets.object.ebc.EqualByContentFacet;
+import org.apache.isis.core.progmodel.facets.object.value.ValueFacetFromConfiguration;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderContext;
+import org.apache.isis.core.progmodel.facets.object.value.ValueSemanticsProviderUtil;
 
 
 /**

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/ActionParameterChoicesFacetAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/ActionParameterChoicesFacetAbstract.java?rev=1060035&r1=1060034&r2=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/ActionParameterChoicesFacetAbstract.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/ActionParameterChoicesFacetAbstract.java Mon Jan 17 18:22:58 2011
@@ -24,7 +24,7 @@ import org.apache.isis.core.metamodel.ad
 import org.apache.isis.core.metamodel.facetapi.Facet;
 import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.actions.choices.ActionParameterChoicesFacet;
+import org.apache.isis.core.metamodel.facets.param.choices.ActionParameterChoicesFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLookup;
 

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/enums/ActionParameterChoicesFacetDerivedFromChoicesFacet.java (from r1059849, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/propparam/enums/ActionParameterChoicesFacetDerivedFromChoicesFacet.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/enums/ActionParameterChoicesFacetDerivedFromChoicesFacet.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/enums/ActionParameterChoicesFacetDerivedFromChoicesFacet.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/propparam/enums/ActionParameterChoicesFacetDerivedFromChoicesFacet.java&r1=1059849&r2=1060035&rev=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/propparam/enums/ActionParameterChoicesFacetDerivedFromChoicesFacet.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/enums/ActionParameterChoicesFacetDerivedFromChoicesFacet.java Mon Jan 17 18:22:58 2011
@@ -17,12 +17,13 @@
  *  under the License.
  */
 
-package org.apache.isis.core.progmodel.facets.propparam.enums;
+package org.apache.isis.core.progmodel.facets.param.choices.enums;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.TypedHolder;
+import org.apache.isis.core.metamodel.facets.choices.ChoicesFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLookup;
 import org.apache.isis.core.progmodel.facets.param.choices.ActionParameterChoicesFacetAbstract;

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/enums/ParameterChoicesFacetDerivedFromChoicesFacetFacetFactory.java (from r1059849, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/propparam/enums/PropertyAndParameterChoicesFacetDerivedFromChoicesFacetFacetFactory.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/enums/ParameterChoicesFacetDerivedFromChoicesFacetFacetFactory.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/enums/ParameterChoicesFacetDerivedFromChoicesFacetFacetFactory.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/propparam/enums/PropertyAndParameterChoicesFacetDerivedFromChoicesFacetFacetFactory.java&r1=1059849&r2=1060035&rev=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/propparam/enums/PropertyAndParameterChoicesFacetDerivedFromChoicesFacetFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/enums/ParameterChoicesFacetDerivedFromChoicesFacetFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.propparam.enums;
+package org.apache.isis.core.progmodel.facets.param.choices.enums;
 
 
 import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
@@ -27,28 +27,16 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
 import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
 
-public class PropertyAndParameterChoicesFacetDerivedFromChoicesFacetFacetFactory extends
+public class ParameterChoicesFacetDerivedFromChoicesFacetFacetFactory extends
     FacetFactoryAbstract implements AdapterMapAware {
 
     private AdapterMap adapterMap;
 
-    public PropertyAndParameterChoicesFacetDerivedFromChoicesFacetFacetFactory() {
-        super(FeatureType.PROPERTIES_AND_PARAMETERS);
+    public ParameterChoicesFacetDerivedFromChoicesFacetFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
     }
 
     @Override
-    public void process(ProcessMethodContext processMethodContext) {
-
-        Class<?> returnType = processMethodContext.getMethod().getReturnType();
-        
-        if (!returnType.isEnum()) {
-            return;
-        }
-        
-        FacetUtil.addFacet(new PropertyChoicesFacetDerivedFromChoicesFacet(processMethodContext.getFacetHolder(), getSpecificationLookup()));
-    }
-    
-    @Override
     public void processParams(ProcessParameterContext processParameterContext) {
         Class<?> paramType = processParameterContext.getMethod().getParameterTypes()[processParameterContext.getParamNum()];
         

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/method/ActionChoicesFacetViaMethod.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/method/ActionChoicesFacetViaMethod.java?rev=1060035&r1=1060034&r2=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/method/ActionChoicesFacetViaMethod.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/method/ActionChoicesFacetViaMethod.java Mon Jan 17 18:22:58 2011
@@ -23,17 +23,17 @@ import java.lang.reflect.Method;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.isis.core.commons.lang.ArrayUtil;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
 import org.apache.isis.core.metamodel.adapter.util.AdapterInvokeUtils;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.ChoicesUtils;
 import org.apache.isis.core.metamodel.facets.ImperativeFacet;
+import org.apache.isis.core.metamodel.facets.actions.choices.ActionChoicesFacetAbstract;
 import org.apache.isis.core.metamodel.spec.DomainModelException;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLookup;
-import org.apache.isis.core.progmodel.facets.param.choices.ActionChoicesFacetAbstract;
-import org.apache.isis.core.progmodel.util.ArrayUtil;
+import org.apache.isis.core.progmodel.util.CollectionUtils;
 
 public class ActionChoicesFacetViaMethod extends ActionChoicesFacetAbstract implements ImperativeFacet {
 
@@ -87,7 +87,7 @@ public class ActionChoicesFacetViaMethod
             } else {
                 final ObjectSpecification specification = getSpecificationLookup().loadSpecification(choicesType);
                 results[i] =
-                    ChoicesUtils.getCollectionAsObjectArray(options[i], specification, getAdapterMap());
+                    CollectionUtils.getCollectionAsObjectArray(options[i], specification, getAdapterMap());
             }
         }
         return results;

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetViaMethod.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetViaMethod.java?rev=1060035&r1=1060034&r2=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetViaMethod.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/choices/methodnum/ActionParameterChoicesFacetViaMethod.java Mon Jan 17 18:22:58 2011
@@ -24,16 +24,16 @@ import java.lang.reflect.Method;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.isis.core.commons.lang.ArrayUtil;
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.adapter.map.AdapterMap;
 import org.apache.isis.core.metamodel.adapter.util.AdapterInvokeUtils;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.ChoicesUtils;
 import org.apache.isis.core.metamodel.facets.ImperativeFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.SpecificationLookup;
 import org.apache.isis.core.progmodel.facets.param.choices.ActionParameterChoicesFacetAbstract;
-import org.apache.isis.core.progmodel.util.ArrayUtil;
+import org.apache.isis.core.progmodel.util.CollectionUtils;
 
 
 
@@ -83,7 +83,7 @@ public class ActionParameterChoicesFacet
         }
         else {
             final ObjectSpecification specification = getSpecification(choicesType);
-            return ChoicesUtils.getCollectionAsObjectArray(options, specification, getAdapterMap());
+            return CollectionUtils.getCollectionAsObjectArray(options, specification, getAdapterMap());
         }
     }
 

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetAbstract.java?rev=1060035&r1=1060034&r2=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetAbstract.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/ActionParameterDefaultsFacetAbstract.java Mon Jan 17 18:22:58 2011
@@ -23,7 +23,7 @@ package org.apache.isis.core.progmodel.f
 import org.apache.isis.core.metamodel.facetapi.Facet;
 import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.actions.defaults.ActionParameterDefaultsFacet;
+import org.apache.isis.core.metamodel.facets.param.defaults.ActionParameterDefaultsFacet;
 
 
 public abstract class ActionParameterDefaultsFacetAbstract extends FacetAbstract implements ActionParameterDefaultsFacet {

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ActionParameterDefaultFacetDerivedFromTypeFacets.java (from r1059849, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/ActionDefaultsFacetDerivedFromDefaultedFacets.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ActionParameterDefaultFacetDerivedFromTypeFacets.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ActionParameterDefaultFacetDerivedFromTypeFacets.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/ActionDefaultsFacetDerivedFromDefaultedFacets.java&r1=1059849&r2=1060035&rev=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/defaults/ActionDefaultsFacetDerivedFromDefaultedFacets.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ActionParameterDefaultFacetDerivedFromTypeFacets.java Mon Jan 17 18:22:58 2011
@@ -18,18 +18,19 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.defaults;
+package org.apache.isis.core.progmodel.facets.param.defaults.fromtype;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.progmodel.facets.param.defaults.ActionDefaultsFacetAbstract;
+import org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacetAbstract;
+import org.apache.isis.core.progmodel.facets.object.defaults.DefaultedFacet;
 
 
-public class ActionDefaultsFacetDerivedFromDefaultedFacets extends ActionDefaultsFacetAbstract {
+public class ActionParameterDefaultFacetDerivedFromTypeFacets extends ActionDefaultsFacetAbstract {
 
     private final DefaultedFacet[] defaultedFacets;
 
-    public ActionDefaultsFacetDerivedFromDefaultedFacets(final DefaultedFacet[] defaultedFacets, final FacetHolder holder) {
+    public ActionParameterDefaultFacetDerivedFromTypeFacets(final DefaultedFacet[] defaultedFacets, final FacetHolder holder) {
         super(holder, true);
         this.defaultedFacets = defaultedFacets;
     }

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ParameterDefaultDerivedFromTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ParameterDefaultDerivedFromTypeFacetFactory.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ParameterDefaultDerivedFromTypeFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/defaults/fromtype/ParameterDefaultDerivedFromTypeFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.defaults.fromtype;
+
+
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.actions.defaults.ActionDefaultsFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.progmodel.facets.object.defaults.DefaultedFacet;
+
+
+public class ParameterDefaultDerivedFromTypeFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+	public ParameterDefaultDerivedFromTypeFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+
+	/**
+     * If there is a {@link DefaultedFacet} on any of the action's parameter types, then installs a
+     * {@link ActionDefaultsFacet} for the action.
+     */
+    @Override
+    public void processParams(ProcessParameterContext processParameterContext) {
+        // don't overwrite any defaults already picked up
+        if (processParameterContext.getFacetHolder().getFacet(ActionDefaultsFacet.class) != null) {
+            return;
+        }
+
+        // try to infer defaults from any of the parameter's underlying types
+        final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes();
+        final DefaultedFacet[] parameterTypeDefaultedFacets = new DefaultedFacet[parameterTypes.length];
+        boolean hasAtLeastOneDefault = false;
+        for (int i = 0; i < parameterTypes.length; i++) {
+            final Class<?> paramType = parameterTypes[i];
+            parameterTypeDefaultedFacets[i] = getDefaultedFacet(paramType);
+            hasAtLeastOneDefault = hasAtLeastOneDefault | (parameterTypeDefaultedFacets[i] != null);
+        }
+        if (hasAtLeastOneDefault) {
+            FacetUtil.addFacet(new ActionParameterDefaultFacetDerivedFromTypeFacets(parameterTypeDefaultedFacets, processParameterContext.getFacetHolder()));
+        }
+    }
+
+    private DefaultedFacet getDefaultedFacet(final Class<?> paramType) {
+        final ObjectSpecification paramTypeSpec = 
+            getSpecificationLookup().loadSpecification(paramType);
+        return paramTypeSpec.getFacet(DefaultedFacet.class);
+    }
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsAnnotationOnParameterFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsAnnotationOnParameterFacetFactory.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsAnnotationOnParameterFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsAnnotationOnParameterFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,71 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.describedas.annotation;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.isis.applib.annotation.DescribedAs;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+
+public class DescribedAsAnnotationOnParameterFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+    public DescribedAsAnnotationOnParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(ProcessParameterContext processParameterContext) {
+
+        final int paramNum = processParameterContext.getParamNum();
+        final Class<?> parameterType = processParameterContext.getMethod().getParameterTypes()[paramNum];
+        final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[paramNum];
+        for (int j = 0; j < parameterAnnotations.length; j++) {
+            if (parameterAnnotations[j] instanceof DescribedAs) {
+                FacetUtil.addFacet(create((DescribedAs) parameterAnnotations[j], processParameterContext.getFacetHolder()));
+                return;
+            }
+        }
+
+        // otherwise, fall back to a description on the parameter's type, if available
+        final DescribedAsFacet parameterTypeDescribedAsFacet = getDescribedAsFacet(parameterType);
+        if (parameterTypeDescribedAsFacet != null) {
+            FacetUtil.addFacet(new DescribedAsFacetForParameterDerivedFromType(parameterTypeDescribedAsFacet, processParameterContext.getFacetHolder()));
+            return;
+        }
+
+    }
+
+    private DescribedAsFacet create(final DescribedAs annotation, final FacetHolder holder) {
+        return annotation == null ? null : new DescribedAsFacetAnnotationOnParameter(annotation.value(), holder);
+    }
+
+    private DescribedAsFacet getDescribedAsFacet(final Class<?> type) {
+        final ObjectSpecification paramTypeSpec = getSpecificationLookup().loadSpecification(type);
+        return paramTypeSpec.getFacet(DescribedAsFacet.class);
+    }
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetAnnotationOnParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetAnnotationOnParameter.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetAnnotationOnParameter.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetAnnotationOnParameter.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.describedas.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacetAbstract;
+
+
+public class DescribedAsFacetAnnotationOnParameter extends DescribedAsFacetAbstract {
+
+    public DescribedAsFacetAnnotationOnParameter(final String value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}
+

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetForParameterDerivedFromType.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetForParameterDerivedFromType.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetForParameterDerivedFromType.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/describedas/annotation/DescribedAsFacetForParameterDerivedFromType.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.describedas.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacet;
+import org.apache.isis.core.metamodel.facets.describedas.DescribedAsFacetAbstract;
+
+
+public class DescribedAsFacetForParameterDerivedFromType extends DescribedAsFacetAbstract {
+
+    public DescribedAsFacetForParameterDerivedFromType(final DescribedAsFacet describedAsFacet, final FacetHolder holder) {
+        super(describedAsFacet.value(), holder);
+    }
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/MandatoryFacetInvertedByOptionalForParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/MandatoryFacetInvertedByOptionalForParameter.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/MandatoryFacetInvertedByOptionalForParameter.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/MandatoryFacetInvertedByOptionalForParameter.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.mandatory.annotation;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetAbstract;
+
+
+/**
+ * Derived by presence of an <tt>@Optional</tt> method.
+ * 
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is <i>not</i> mandatory, as per
+ * {@link #isInvertedSemantics()}.
+ */
+public class MandatoryFacetInvertedByOptionalForParameter extends MandatoryFacetAbstract {
+
+    public MandatoryFacetInvertedByOptionalForParameter(final FacetHolder holder) {
+        super(holder);
+    }
+
+    /**
+     * Always returns <tt>false</tt>, indicating that the facet holder is in fact optional.
+     */
+    public boolean isRequiredButNull(final ObjectAdapter adapter) {
+        return false;
+    }
+
+    public boolean isInvertedSemantics() {
+        return true;
+    }
+
+}
+

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/OptionalAnnotationForParameterFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/OptionalAnnotationForParameterFacetFactory.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/OptionalAnnotationForParameterFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/annotation/OptionalAnnotationForParameterFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.mandatory.annotation;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.isis.applib.annotation.Optional;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+
+
+public class OptionalAnnotationForParameterFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+    public OptionalAnnotationForParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(ProcessParameterContext processParameterContext) {
+        final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes();
+        if (processParameterContext.getParamNum() >= parameterTypes.length) {
+            // ignore
+            return;
+        }
+        if (parameterTypes[processParameterContext.getParamNum()].isPrimitive()) {
+            return;
+        }
+        final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()];
+        for (int j = 0; j < parameterAnnotations.length; j++) {
+            if (parameterAnnotations[j] instanceof Optional) {
+                FacetUtil.addFacet(new MandatoryFacetInvertedByOptionalForParameter(processParameterContext.getFacetHolder()));
+                return;
+            }
+        }
+    }
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/dflt/MandatoryDefaultForParametersFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/dflt/MandatoryDefaultForParametersFacetFactory.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/dflt/MandatoryDefaultForParametersFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/dflt/MandatoryDefaultForParametersFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.mandatory.dflt;
+
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactory;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacet;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetDefault;
+import org.apache.isis.core.metamodel.specloader.facetprocessor.FacetProcessor;
+
+
+/**
+ * Simply installs a {@link MandatoryFacetDefault} onto all properties and parameters.
+ * 
+ * <p>
+ * The idea is that this {@link FacetFactory} is included early on in the {@link FacetProcessor}, but
+ * other {@link MandatoryFacet} implementations which don't require mandatory semantics will potentially
+ * replace these where the property or parameter is annotated or otherwise indicated as being optional.
+ */
+public class MandatoryDefaultForParametersFacetFactory extends FacetFactoryAbstract {
+
+    public MandatoryDefaultForParametersFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(ProcessParameterContext processParameterContext) {
+        FacetUtil.addFacet(create(processParameterContext.getFacetHolder()));
+    }
+
+    private MandatoryFacet create(final FacetHolder holder) {
+        return new MandatoryFacetDefault(holder);
+    }
+
+}

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/ActionParameterOptionalViaMethodFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/ActionParameterOptionalViaMethodFacetFactory.java?rev=1060035&r1=1060034&r2=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/ActionParameterOptionalViaMethodFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/ActionParameterOptionalViaMethodFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -82,7 +82,7 @@ public class ActionParameterOptionalViaM
             for (int i = 0; i < optionals.length; i++) {
                 if (optionals[i]) {
                     // add facets directly to parameters, not to actions
-                    FacetUtil.addFacet(new MandatoryFacetOverriddenByMethod(parameters.get(i)));
+                    FacetUtil.addFacet(new MandatoryFacetOptionalViaMethodForParameter(parameters.get(i)));
                 }
             }
         } finally {

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/MandatoryFacetOptionalViaMethodForParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/MandatoryFacetOptionalViaMethodForParameter.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/MandatoryFacetOptionalViaMethodForParameter.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/mandatory/staticmethod/MandatoryFacetOptionalViaMethodForParameter.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.mandatory.staticmethod;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.mandatory.MandatoryFacetAbstract;
+
+
+/**
+ * Derived by presence of an <tt>optionalXxx</tt> method.
+ * 
+ * <p>
+ * This implementation indicates that the {@link FacetHolder} is <i>not</i> mandatory, as per
+ * {@link #isInvertedSemantics()}.
+ */
+public class MandatoryFacetOptionalViaMethodForParameter extends MandatoryFacetAbstract {
+
+    public MandatoryFacetOptionalViaMethodForParameter(final FacetHolder holder) {
+        super(holder);
+    }
+
+    /**
+     * Always returns <tt>false</tt>, indicating that the facet holder is in fact optional.
+     */
+    public boolean isRequiredButNull(final ObjectAdapter adapter) {
+        return false;
+    }
+
+    public boolean isInvertedSemantics() {
+        return true;
+    }
+
+}
+

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineAnnotationOnParameterFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineAnnotationOnParameterFacetFactory.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineAnnotationOnParameterFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineAnnotationOnParameterFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.multiline.annotation;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.isis.applib.annotation.MultiLine;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.multiline.MultiLineFacet;
+
+
+public class MultiLineAnnotationOnParameterFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+    public MultiLineAnnotationOnParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(ProcessParameterContext processParameterContext) {
+        final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes();
+        if (processParameterContext.getParamNum() >= parameterTypes.length) {
+            // ignore
+            return;
+        }
+        if (!isString(parameterTypes[processParameterContext.getParamNum()])) {
+            return;
+        }
+        final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()];
+        for (int j = 0; j < parameterAnnotations.length; j++) {
+            if (parameterAnnotations[j] instanceof MultiLine) {
+                final MultiLine annotation = (MultiLine) parameterAnnotations[j];
+                FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder()));
+                return;
+            }
+        }
+    }
+
+    private MultiLineFacet create(final MultiLine annotation, final FacetHolder holder) {
+        return (annotation != null) ? new MultiLineFacetAnnotationOnParameter(annotation.numberOfLines(), annotation.preventWrapping(),
+                holder) : null;
+    }
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineFacetAnnotationOnParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineFacetAnnotationOnParameter.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineFacetAnnotationOnParameter.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/multiline/annotation/MultiLineFacetAnnotationOnParameter.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.multiline.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.multiline.MultiLineFacetAbstract;
+
+
+public class MultiLineFacetAnnotationOnParameter extends MultiLineFacetAbstract {
+
+    public MultiLineFacetAnnotationOnParameter(final int numberOfLines, final boolean preventWrapping, final FacetHolder holder) {
+        super(numberOfLines, preventWrapping, holder);
+    }
+
+}
+

Copied: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedAnnotationOnParameterFacetFactory.java (from r1059849, incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/named/annotation/NamedAnnotationFacetFactory.java)
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedAnnotationOnParameterFacetFactory.java?p2=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedAnnotationOnParameterFacetFactory.java&p1=incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/named/annotation/NamedAnnotationFacetFactory.java&r1=1059849&r2=1060035&rev=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/named/annotation/NamedAnnotationFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedAnnotationOnParameterFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -18,7 +18,7 @@
  */
 
 
-package org.apache.isis.core.progmodel.facets.named.annotation;
+package org.apache.isis.core.progmodel.facets.param.named.annotation;
 
 import java.lang.annotation.Annotation;
 
@@ -27,25 +27,13 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.facetapi.FacetUtil;
 import org.apache.isis.core.metamodel.facetapi.FeatureType;
 import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
-import org.apache.isis.core.metamodel.facets.naming.named.NamedFacet;
+import org.apache.isis.core.metamodel.facets.named.NamedFacet;
 
 
-public class NamedAnnotationFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+public class NamedAnnotationOnParameterFacetFactory extends AnnotationBasedFacetFactoryAbstract {
 
-    public NamedAnnotationFacetFactory() {
-        super(FeatureType.EVERYTHING);
-    }
-
-    @Override
-    public void process(ProcessClassContext processClassContaxt) {
-        final Named annotation = getAnnotation(processClassContaxt.getCls(), Named.class);
-        FacetUtil.addFacet(create(annotation, processClassContaxt.getFacetHolder()));
-    }
-
-    @Override
-    public void process(ProcessMethodContext processMethodContext) {
-        final Named annotation = getAnnotation(processMethodContext.getMethod(), Named.class);
-        FacetUtil.addFacet(create(annotation, processMethodContext.getFacetHolder()));
+    public NamedAnnotationOnParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
     }
 
     @Override
@@ -61,7 +49,7 @@ public class NamedAnnotationFacetFactory
     }
 
     private NamedFacet create(final Named annotation, final FacetHolder holder) {
-        return annotation != null ? new NamedFacetAnnotation(annotation.value(), holder) : null;
+        return annotation != null ? new NamedFacetAnnotationOnParameter(annotation.value(), holder) : null;
     }
 
 }

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedFacetAnnotationOnParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedFacetAnnotationOnParameter.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedFacetAnnotationOnParameter.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/annotation/NamedFacetAnnotationOnParameter.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.named.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.named.NamedFacetAbstract;
+
+
+public class NamedFacetAnnotationOnParameter extends NamedFacetAbstract {
+
+    public NamedFacetAnnotationOnParameter(final String value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}
+

Modified: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/staticmethod/ActionParameterNamesMethodFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/staticmethod/ActionParameterNamesMethodFacetFactory.java?rev=1060035&r1=1060034&r2=1060035&view=diff
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/staticmethod/ActionParameterNamesMethodFacetFactory.java (original)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/named/staticmethod/ActionParameterNamesMethodFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -36,7 +36,7 @@ import org.apache.isis.core.metamodel.me
 import org.apache.isis.core.progmodel.facets.MethodFinderUtils;
 import org.apache.isis.core.progmodel.facets.MethodPrefixBasedFacetFactoryAbstract;
 import org.apache.isis.core.progmodel.facets.MethodPrefixConstants;
-import org.apache.isis.core.progmodel.facets.members.name.staticmethod.NamedFacetViaMethod;
+import org.apache.isis.core.progmodel.facets.members.named.staticmethod.NamedFacetViaMethod;
 
 /**
  * Sets up all the {@link Facet}s for an action in a single shot.

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthAnnotationOnParameterFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthAnnotationOnParameterFacetFactory.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthAnnotationOnParameterFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthAnnotationOnParameterFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.typicallen.annotation;
+
+import java.lang.annotation.Annotation;
+
+import org.apache.isis.applib.annotation.TypicalLength;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.typicallength.TypicalLengthFacet;
+
+
+public class TypicalLengthAnnotationOnParameterFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+    public TypicalLengthAnnotationOnParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(ProcessParameterContext processParameterContext) {
+        final Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()];
+        for (int j = 0; j < parameterAnnotations.length; j++) {
+            if (parameterAnnotations[j] instanceof TypicalLength) {
+                final TypicalLength annotation = (TypicalLength) parameterAnnotations[j];
+                FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder()));
+                return;
+            }
+        }
+    }
+
+    private TypicalLengthFacet create(final TypicalLength annotation, final FacetHolder holder) {
+        return annotation != null ? new TypicalLengthFacetAnnotationOnParameter(annotation.value(), holder) : null;
+    }
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthFacetAnnotationOnParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthFacetAnnotationOnParameter.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthFacetAnnotationOnParameter.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/annotation/TypicalLengthFacetAnnotationOnParameter.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,42 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.typicallen.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.typicallength.TypicalLengthFacetAbstract;
+
+
+public class TypicalLengthFacetAnnotationOnParameter extends TypicalLengthFacetAbstract {
+
+    private final int value;
+
+	public TypicalLengthFacetAnnotationOnParameter(final int value, final FacetHolder holder) {
+        super(holder, false);
+        this.value = value;
+    }
+
+	@Override
+	public int value() {
+		return value;
+	}
+
+}
+

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/fromtype/TypicalLengthFacetForParameterDerivedFromType.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/fromtype/TypicalLengthFacetForParameterDerivedFromType.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/fromtype/TypicalLengthFacetForParameterDerivedFromType.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/fromtype/TypicalLengthFacetForParameterDerivedFromType.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,43 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.typicallen.fromtype;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.multiline.MultiLineFacet;
+import org.apache.isis.core.metamodel.facets.typicallength.TypicalLengthFacet;
+import org.apache.isis.core.metamodel.facets.typicallength.TypicalLengthFacetAbstract;
+
+
+public class TypicalLengthFacetForParameterDerivedFromType extends TypicalLengthFacetAbstract {
+
+    private final TypicalLengthFacet typicalLengthFacet;
+
+	public TypicalLengthFacetForParameterDerivedFromType(final TypicalLengthFacet typicalLengthFacet, final FacetHolder holder) {
+        super(holder, true);
+        this.typicalLengthFacet = typicalLengthFacet;
+    }
+
+    public int value() {
+        final MultiLineFacet facet = getFacetHolder().getFacet(MultiLineFacet.class);
+        return facet.numberOfLines() * typicalLengthFacet.value();
+    }
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/fromtype/TypicalLengthFacetForParameterDerivedFromTypeFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/fromtype/TypicalLengthFacetForParameterDerivedFromTypeFacetFactory.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/fromtype/TypicalLengthFacetForParameterDerivedFromTypeFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/typicallen/fromtype/TypicalLengthFacetForParameterDerivedFromTypeFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.typicallen.fromtype;
+
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.FacetedMethodParameter;
+import org.apache.isis.core.metamodel.facets.typicallength.TypicalLengthFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+
+public class TypicalLengthFacetForParameterDerivedFromTypeFacetFactory extends FacetFactoryAbstract {
+
+    public TypicalLengthFacetForParameterDerivedFromTypeFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(ProcessParameterContext processParameterContext) {
+        final Class<?> type = processParameterContext.getMethod().getParameterTypes()[processParameterContext.getParamNum()];
+        final FacetedMethodParameter facetHolder = processParameterContext.getFacetHolder();
+        addFacetDerivedFromTypeIfPresent(facetHolder, type);
+    }
+
+    private void addFacetDerivedFromTypeIfPresent(final FacetHolder holder, final Class<?> type) {
+        final TypicalLengthFacet facet = getTypicalLengthFacet(type);
+        if (facet != null) {
+            FacetUtil.addFacet(new TypicalLengthFacetForParameterDerivedFromType(facet, holder));
+        }
+    }
+
+    private TypicalLengthFacet getTypicalLengthFacet(final Class<?> type) {
+        final ObjectSpecification paramTypeSpec = getSpecificationLookup().loadSpecification(type);
+        return paramTypeSpec.getFacet(TypicalLengthFacet.class);
+    }
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maskannot/MaskAnnotationForParameterFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maskannot/MaskAnnotationForParameterFacetFactory.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maskannot/MaskAnnotationForParameterFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maskannot/MaskAnnotationForParameterFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,80 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.validate.maskannot;
+
+
+import org.apache.isis.applib.annotation.Mask;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.object.title.TitleFacet;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.progmodel.facets.object.mask.MaskFacet;
+import org.apache.isis.core.progmodel.facets.object.mask.TitleFacetBasedOnMask;
+
+
+public class MaskAnnotationForParameterFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+    public MaskAnnotationForParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(ProcessParameterContext processParameterContext) {
+        final Class<?>[] parameterTypes = processParameterContext.getMethod().getParameterTypes();
+        if (processParameterContext.getParamNum() >= parameterTypes.length) {
+            // ignore
+            return;
+        }
+
+        final java.lang.annotation.Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()];
+        for (int i = 0; i < parameterAnnotations.length; i++) {
+            if (parameterAnnotations[i] instanceof Mask) {
+                final Mask annotation = (Mask) parameterAnnotations[i];
+                addMaskFacetAndCorrespondingTitleFacet(processParameterContext.getFacetHolder(), annotation, parameterTypes[i]);
+                return;
+            }
+        }
+    }
+
+    private boolean addMaskFacetAndCorrespondingTitleFacet(final FacetHolder holder, final Mask annotation, Class<?> cls) {
+        final MaskFacet maskFacet = createMaskFacet(annotation, holder);
+        if (maskFacet == null) {
+            return false;
+        }
+        FacetUtil.addFacet(maskFacet);
+
+        ObjectSpecification type = getSpecificationLookup().loadSpecification(cls);
+        final TitleFacet underlyingTitleFacet = type.getFacet(TitleFacet.class);
+        if (underlyingTitleFacet != null) {
+            final TitleFacet titleFacet = new TitleFacetBasedOnMask(maskFacet, underlyingTitleFacet);
+            FacetUtil.addFacet(titleFacet);
+        }
+        return true;
+    }
+
+    private MaskFacet createMaskFacet(final Mask annotation, final FacetHolder holder) {
+        return annotation != null ? new MaskFacetAnnotationForParameter(annotation.value(), null, holder) : null;
+    }
+
+
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maskannot/MaskFacetAnnotationForParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maskannot/MaskFacetAnnotationForParameter.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maskannot/MaskFacetAnnotationForParameter.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maskannot/MaskFacetAnnotationForParameter.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,53 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.validate.maskannot;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.object.mask.MaskEvaluator;
+import org.apache.isis.core.progmodel.facets.object.mask.MaskFacetAbstract;
+
+
+public class MaskFacetAnnotationForParameter extends MaskFacetAbstract {
+    private final MaskEvaluator evaluator;
+
+    public MaskFacetAnnotationForParameter(final String outputMask, String inputMask, final FacetHolder holder) {
+        super(outputMask, holder);
+        evaluator = inputMask == null ? null : new MaskEvaluator(inputMask);
+    }
+
+    public boolean doesNotMatch(final ObjectAdapter adapter) {
+        if (evaluator == null) {
+            return false;
+        } else {
+            if (adapter == null) {
+                return false;
+            }
+            final Object object = adapter.getObject();
+            if (object == null) {
+                return false;
+            }
+            return !evaluator.evaluate(object.toString());
+        }
+    }
+
+}
+

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maxlenannot/MaxLengthAnnotationForParameterFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maxlenannot/MaxLengthAnnotationForParameterFacetFactory.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maxlenannot/MaxLengthAnnotationForParameterFacetFactory.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maxlenannot/MaxLengthAnnotationForParameterFacetFactory.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,54 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.validate.maxlenannot;
+
+
+import org.apache.isis.applib.annotation.MaxLength;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.AnnotationBasedFacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.propparam.maxlength.MaxLengthFacet;
+
+
+public class MaxLengthAnnotationForParameterFacetFactory extends AnnotationBasedFacetFactoryAbstract {
+
+    public MaxLengthAnnotationForParameterFacetFactory() {
+        super(FeatureType.PARAMETERS_ONLY);
+    }
+
+    @Override
+    public void processParams(ProcessParameterContext processParameterContext) {
+        final java.lang.annotation.Annotation[] parameterAnnotations = getParameterAnnotations(processParameterContext.getMethod())[processParameterContext.getParamNum()];
+
+        for (int j = 0; j < parameterAnnotations.length; j++) {
+            if (parameterAnnotations[j] instanceof MaxLength) {
+                final MaxLength annotation = (MaxLength) parameterAnnotations[j];
+                FacetUtil.addFacet(create(annotation, processParameterContext.getFacetHolder()));
+                return;
+            }
+        }
+    }
+
+    private MaxLengthFacet create(final MaxLength annotation, final FacetHolder holder) {
+        return annotation == null ? null : new MaxLengthFacetAnnotationForParameter(annotation.value(), holder);
+    }
+}

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maxlenannot/MaxLengthFacetAnnotationForParameter.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maxlenannot/MaxLengthFacetAnnotationForParameter.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maxlenannot/MaxLengthFacetAnnotationForParameter.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/maxlenannot/MaxLengthFacetAnnotationForParameter.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,34 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.validate.maxlenannot;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.propparam.maxlength.MaxLengthFacetAbstract;
+
+
+public class MaxLengthFacetAnnotationForParameter extends MaxLengthFacetAbstract {
+
+    public MaxLengthFacetAnnotationForParameter(final int value, final FacetHolder holder) {
+        super(value, holder);
+    }
+
+}
+

Added: incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/perspec/MustSatisfySpecificationOnParameterFacet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/perspec/MustSatisfySpecificationOnParameterFacet.java?rev=1060035&view=auto
==============================================================================
--- incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/perspec/MustSatisfySpecificationOnParameterFacet.java (added)
+++ incubator/isis/trunk/core/progmodel/src/main/java/org/apache/isis/core/progmodel/facets/param/validate/perspec/MustSatisfySpecificationOnParameterFacet.java Mon Jan 17 18:22:58 2011
@@ -0,0 +1,63 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+
+package org.apache.isis.core.progmodel.facets.param.validate.perspec;
+
+import java.util.List;
+
+import org.apache.isis.applib.events.ValidityEvent;
+import org.apache.isis.applib.spec.Specification;
+import org.apache.isis.applib.util.ReasonBuffer;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.interactions.ProposedHolder;
+import org.apache.isis.core.metamodel.interactions.ValidatingInteractionAdvisor;
+import org.apache.isis.core.metamodel.interactions.ValidityContext;
+
+public class MustSatisfySpecificationOnParameterFacet extends FacetAbstract implements ValidatingInteractionAdvisor {
+
+    public static Class<? extends Facet> type() {
+        return MustSatisfySpecificationOnParameterFacet.class;
+    }
+
+    private final List<Specification> specifications;
+
+    public MustSatisfySpecificationOnParameterFacet(final List<Specification> specifications, final FacetHolder holder) {
+        super(type(), holder, false);
+        this.specifications = specifications;
+    }
+
+    public String invalidates(final ValidityContext<? extends ValidityEvent> validityContext) {
+        if (!(validityContext instanceof ProposedHolder)) {
+            return null;
+        }
+        ProposedHolder proposedHolder = (ProposedHolder) validityContext;
+        final ObjectAdapter targetNO = proposedHolder.getProposed();
+        final Object targetObject = targetNO.getObject();
+        ReasonBuffer buf = new ReasonBuffer();
+        for(Specification specification: specifications) {
+            buf.append(specification.satisfies(targetObject));
+        }
+        return buf.getReason();
+    }
+
+}