incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1377996 - in /incubator/isis/trunk/framework: core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/ core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ core/metamodel/src/main/java/org/apache/isis/core/met...
Date Tue, 28 Aug 2012 07:04:32 GMT
Author: danhaywood
Date: Tue Aug 28 07:04:32 2012
New Revision: 1377996

URL: http://svn.apache.org/viewvc?rev=1377996&view=rev
Log:
ISIS-14: ActionSemantics

Added ActionSemantics as an enum and responsibility of metamodel.

Added:
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ActionSemantics.java
Modified:
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/ObjectActionSet.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAction.java
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java
    incubator/isis/trunk/framework/viewer/html/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/ObjectActionSet.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/ObjectActionSet.java?rev=1377996&r1=1377995&r2=1377996&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/ObjectActionSet.java
(original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/ObjectActionSet.java
Tue Aug 28 07:04:32 2012
@@ -38,6 +38,7 @@ import org.apache.isis.core.metamodel.fa
 import org.apache.isis.core.metamodel.interactions.ActionInvocationContext;
 import org.apache.isis.core.metamodel.interactions.UsabilityContext;
 import org.apache.isis.core.metamodel.interactions.VisibilityContext;
+import org.apache.isis.core.metamodel.spec.feature.ActionSemantics;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
 
@@ -130,6 +131,11 @@ public class ObjectActionSet implements 
         return null;
     }
 
+    @Override
+    public ActionSemantics getSemantics() {
+        return null;
+    }
+
     // /////////////////////////////////////////////////////////////
     // target
     // /////////////////////////////////////////////////////////////
@@ -371,4 +377,5 @@ public class ObjectActionSet implements 
         return adapter.getInstance(specification);
     }
 
+
 }

Added: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ActionSemantics.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ActionSemantics.java?rev=1377996&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ActionSemantics.java
(added)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ActionSemantics.java
Tue Aug 28 07:04:32 2012
@@ -0,0 +1,23 @@
+package org.apache.isis.core.metamodel.spec.feature;
+
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager.ConcurrencyChecking;
+import org.apache.isis.core.metamodel.facets.actions.idempotent.IdempotentFacet;
+import org.apache.isis.core.metamodel.facets.actions.queryonly.QueryOnlyFacet;
+
+public enum ActionSemantics {
+    QUERY_ONLY, IDEMPOTENT, SIDE_EFFECTS;
+
+    public static ActionSemantics determine(final ObjectAction action) {
+        if (action.containsFacet(QueryOnlyFacet.class)) {
+            return QUERY_ONLY;
+        }
+        if (action.containsFacet(IdempotentFacet.class)) {
+            return IDEMPOTENT;
+        }
+        return SIDE_EFFECTS;
+    }
+
+    public ConcurrencyChecking getConcurrencyChecking() {
+        return this == QUERY_ONLY? ConcurrencyChecking.NO_CHECK: ConcurrencyChecking.CHECK;
+    }
+}
\ No newline at end of file

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAction.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAction.java?rev=1377996&r1=1377995&r2=1377996&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAction.java
(original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/spec/feature/ObjectAction.java
Tue Aug 28 07:04:32 2012
@@ -197,4 +197,6 @@ public interface ObjectAction extends Ob
      */
     ObjectAdapter[][] getChoices(ObjectAdapter target);
 
+    ActionSemantics getSemantics();
+
 }

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java?rev=1377996&r1=1377995&r2=1377996&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java
(original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/ObjectActionImpl.java
Tue Aug 28 07:04:32 2012
@@ -67,6 +67,7 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.Instance;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.Target;
+import org.apache.isis.core.metamodel.spec.feature.ActionSemantics;
 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;
@@ -147,6 +148,11 @@ public class ObjectActionImpl extends Ob
         return Collections.emptyList();
     }
 
+    @Override
+    public ActionSemantics getSemantics() {
+        return ActionSemantics.determine(this);
+    }
+
     // /////////////////////////////////////////////////////////////
     // getInstance
     // /////////////////////////////////////////////////////////////
@@ -622,4 +628,5 @@ public class ObjectActionImpl extends Ob
         return servicesProvider;
     }
 
+
 }

Modified: incubator/isis/trunk/framework/viewer/html/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/viewer/html/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java?rev=1377996&r1=1377995&r2=1377996&view=diff
==============================================================================
--- incubator/isis/trunk/framework/viewer/html/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java
(original)
+++ incubator/isis/trunk/framework/viewer/html/src/test/java/org/apache/isis/viewer/html/context/ObjectActionNoop.java
Tue Aug 28 07:04:32 2012
@@ -39,6 +39,7 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.metamodel.spec.Instance;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.metamodel.spec.Target;
+import org.apache.isis.core.metamodel.spec.feature.ActionSemantics;
 import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
 import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
 
@@ -308,4 +309,9 @@ public class ObjectActionNoop implements
         return FeatureType.ACTION;
     }
 
+    @Override
+    public ActionSemantics getSemantics() {
+        return null;
+    }
+
 }



Mime
View raw message