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 2014/07/11 12:57:12 UTC

[60/61] ISIS-831: more tidy-up, now passing tests.

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ActionInvocationFacetForPostsActionInvokedEventAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ActionInvocationFacetForPostsActionInvokedEventAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ActionInvocationFacetForPostsActionInvokedEventAnnotation.java
new file mode 100644
index 0000000..efb150b
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ActionInvocationFacetForPostsActionInvokedEventAnnotation.java
@@ -0,0 +1,52 @@
+/*
+ *  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.metamodel.facets.actions.interaction;
+
+import java.lang.reflect.Method;
+import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+
+public class ActionInvocationFacetForPostsActionInvokedEventAnnotation
+        extends ActionInvocationFacetForInteractionAbstract {
+
+    public ActionInvocationFacetForPostsActionInvokedEventAnnotation(
+            final Class<? extends ActionInteractionEvent<?>> eventType,
+            final Method method,
+            final ObjectSpecification onType,
+            final ObjectSpecification returnType,
+            final ActionInteractionFacetAbstract actionInteractionFacet,
+            final FacetHolder holder,
+            final RuntimeContext runtimeContext,
+            final AdapterManager adapterManager,
+            final ServicesInjector servicesInjector) {
+        super(eventType, method, onType, returnType, actionInteractionFacet, holder, runtimeContext, adapterManager, servicesInjector);
+    }
+
+    @Override
+    protected ActionInteractionEvent<?> verify(final ActionInteractionEvent<?> event) {
+        // will discard event if different type to that specified in the PostsActionInvokedEvent annotation.
+        return event != null && eventType == event.getClass() ? event : null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/CommandUtil.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/CommandUtil.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/CommandUtil.java
new file mode 100644
index 0000000..92ccb24
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/CommandUtil.java
@@ -0,0 +1,120 @@
+/*
+ *  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.metamodel.facets.actions.interaction;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.bookmark.BookmarkService;
+import org.apache.isis.applib.services.memento.MementoService;
+import org.apache.isis.core.commons.lang.StringExtensions;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
+import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
+
+
+/**
+ * Factoring out the commonality between {@link ActionInvocationFacetViaMethod} and <tt>BackgroundServiceDefault</tt>.
+ */
+public class CommandUtil {
+
+    private CommandUtil(){}
+
+    public static String targetActionNameFor(ObjectAction owningAction) {
+        return owningAction.getName();
+    }
+
+    public static String targetClassNameFor(ObjectAdapter targetAdapter) {
+        return StringExtensions.asNaturalName2(targetAdapter.getSpecification().getSingularName());
+    }
+
+    public static String actionIdentifierFor(ObjectAction owningAction) {
+        return owningAction.getIdentifier().toClassAndNameIdentityString();
+    }
+
+    public static String argDescriptionFor(ObjectAction owningAction, ObjectAdapter[] arguments) {
+        final StringBuilder argsBuf = new StringBuilder();
+        List<ObjectActionParameter> parameters = owningAction.getParameters();
+        if(parameters.size() == arguments.length) {
+            // should be the case
+            int i=0;
+            for (ObjectActionParameter param : parameters) {
+                CommandUtil.appendParamArg(argsBuf, param, arguments[i++]);
+            }
+        }
+        String argsStr = argsBuf.toString();
+        return argsStr;
+    }
+
+    public static Bookmark bookmarkFor(final ObjectAdapter adapter) {
+        final Oid oid = adapter.getOid();
+        if(!(oid instanceof RootOid)) {
+            return null;
+        } 
+        final RootOid rootOid = (RootOid) oid;
+        return rootOid.asBookmark();
+    }
+
+    static void appendParamArg(final StringBuilder buf, ObjectActionParameter param, ObjectAdapter objectAdapter) {
+        String titleOf = objectAdapter != null? objectAdapter.titleString(null): "null";
+        buf.append(param.getName()).append(": ").append(titleOf).append("\n");
+    }
+
+    public static void buildMementoArgLists(MementoService mementoService, BookmarkService bookmarkService, final Method method, final Object[] args, final List<Class<?>> argTypes, final List<Object> argObjs) {
+        for (int i = 0; i < args.length; i++) {
+            Object input = args[i];
+            if (mementoService.canSet(input)) {
+                argTypes.add(method.getParameterTypes()[i]);
+                argObjs.add(input);
+            } else {
+                Bookmark argBookmark = bookmarkService.bookmarkFor(input);
+                argTypes.add(Bookmark.class);
+                argObjs.add(argBookmark);
+            }
+        }
+    }
+    
+    
+    public static ObjectAdapter[] adaptersFor(final Object[] args, final AdapterManager adapterManager) {
+        List<Object> argList = Arrays.asList(args);
+        Iterable<ObjectAdapter> adapterList = 
+                Iterables.transform(
+                        argList, ObjectAdapter.Functions.adapterForUsing(adapterManager));
+        return Lists.newArrayList(adapterList).toArray(new ObjectAdapter[]{});
+    }
+
+    public static Object[] objectsFor(ObjectAdapter[] arguments) {
+        List<ObjectAdapter> argList = Arrays.asList(arguments);
+        Iterable<Object> adapterList = 
+                Iterables.transform(
+                        argList, ObjectAdapter.Functions.getObject());
+        return Lists.newArrayList(adapterList).toArray(new Object[]{});
+    }
+
+    
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/DebugFacetViaNamingConvention.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/DebugFacetViaNamingConvention.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/DebugFacetViaNamingConvention.java
new file mode 100644
index 0000000..0bf7fcd
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/DebugFacetViaNamingConvention.java
@@ -0,0 +1,31 @@
+/*
+ *  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.metamodel.facets.actions.interaction;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.actions.debug.DebugFacetAbstract;
+
+public class DebugFacetViaNamingConvention extends DebugFacetAbstract {
+
+    public DebugFacetViaNamingConvention(final FacetHolder holder) {
+        super(holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ExplorationFacetViaNamingConvention.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ExplorationFacetViaNamingConvention.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ExplorationFacetViaNamingConvention.java
new file mode 100644
index 0000000..1195dad
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/interaction/ExplorationFacetViaNamingConvention.java
@@ -0,0 +1,31 @@
+/*
+ *  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.metamodel.facets.actions.interaction;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.actions.exploration.ExplorationFacetAbstract;
+
+public class ExplorationFacetViaNamingConvention extends ExplorationFacetAbstract {
+
+    public ExplorationFacetViaNamingConvention(final FacetHolder holder) {
+        super(holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInteractionFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInteractionFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInteractionFacet.java
deleted file mode 100644
index c53bc03..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInteractionFacet.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-public interface ActionInteractionFacet extends ActionInvocationFacet {
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInvocationFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInvocationFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInvocationFacet.java
deleted file mode 100644
index 52082b1..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInvocationFacet.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.services.command.CommandContext;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-
-/**
- * Represents the mechanism by which the action should be invoked.
- * 
- * <p>
- * In the standard Apache Isis Programming Model, corresponds to invoking the
- * actual action method itself (a <tt>public</tt> method that does not represent
- * a property, a collection or any of the supporting methods).
- */
-public interface ActionInvocationFacet extends Facet {
-
-    @Deprecated
-    public ObjectAdapter invoke(ObjectAdapter targetAdapter, ObjectAdapter[] argumentAdapters);
-
-    public ObjectAdapter invoke(ObjectAction owningAction, ObjectAdapter targetAdapter, ObjectAdapter[] argumentAdapters);
-
-    public ObjectSpecification getReturnType();
-
-    public ObjectSpecification getOnType();
-
-    public static class CurrentInvocation {
-
-        private final Command command;
-        
-        private final ObjectAdapter target;
-        private final IdentifiedHolder action;
-        private final List<ObjectAdapter> parameters;
-        private final ObjectAdapter result;
-
-        public CurrentInvocation(
-                final ObjectAdapter target, final IdentifiedHolder action, final ObjectAdapter[] parameters, 
-                final ObjectAdapter result, 
-                final Command command) {
-            this(target, action, Arrays.asList(parameters), result, command);
-        }
-
-        public CurrentInvocation(
-                final ObjectAdapter target, final IdentifiedHolder action, final List<ObjectAdapter> parameters, 
-                final ObjectAdapter result, 
-                final Command command) {
-            this.target = target;
-            this.action = action;
-            this.parameters = parameters;
-            this.result = result;
-            this.command = command;
-        }
-
-        /**
-         * deprecated since part of {@link #getCommand()}
-         */
-        @Deprecated
-        public ObjectAdapter getTarget() {
-            return target;
-        }
-        /**
-         * deprecated since part of {@link #getCommand()}
-         */
-        @Deprecated
-        public IdentifiedHolder getAction() {
-            return action;
-        }
-
-        public List<ObjectAdapter> getParameters() {
-            return parameters;
-        }
-        
-        /**
-         * deprecated since part of {@link #getCommand()}
-         */
-        @Deprecated
-        public ObjectAdapter getResult() {
-            return result;
-        }
-        
-        public Command getCommand() {
-            return command;
-        }
-    }
-    
-    /**
-     * TODO...
-     * @deprecated - should instead use the {@link CommandContext} request.
-     */
-    @Deprecated
-    public static ThreadLocal<CurrentInvocation> currentInvocation = new ThreadLocal<CurrentInvocation>();
-
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInvocationFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInvocationFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInvocationFacetAbstract.java
deleted file mode 100644
index 3f3e930..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ActionInvocationFacetAbstract.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facetapi.FacetAbstract;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-
-/**
- * Language-specific introspectors should implement in order to invoke with the
- * language-specific API.
- * 
- * <p>
- * For example, a Java-based subclass would use
- * <tt>java.lang.reflect.Method</tt> to invoke whereas under .NET it would be
- * <tt>System.Reflect.MethodInfo</tt>.
- */
-public abstract class ActionInvocationFacetAbstract extends FacetAbstract implements ActionInvocationFacet {
-
-    public static Class<? extends Facet> type() {
-        return ActionInvocationFacet.class;
-    }
-
-    public ActionInvocationFacetAbstract(final FacetHolder holder) {
-        super(type(), holder, Derivation.NOT_DERIVED);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/CommandUtil.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/CommandUtil.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/CommandUtil.java
deleted file mode 100644
index 4d127c8..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/CommandUtil.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.List;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.bookmark.BookmarkService;
-import org.apache.isis.applib.services.memento.MementoService;
-import org.apache.isis.core.commons.lang.StringExtensions;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.oid.Oid;
-import org.apache.isis.core.metamodel.adapter.oid.RootOid;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.spec.feature.ObjectActionParameter;
-
-
-/**
- * Factoring out the commonality between {@link ActionInvocationFacetViaMethod} and <tt>BackgroundServiceDefault</tt>.
- */
-public class CommandUtil {
-
-    private CommandUtil(){}
-
-    public static String targetActionNameFor(ObjectAction owningAction) {
-        return owningAction.getName();
-    }
-
-    public static String targetClassNameFor(ObjectAdapter targetAdapter) {
-        return StringExtensions.asNaturalName2(targetAdapter.getSpecification().getSingularName());
-    }
-
-    public static String actionIdentifierFor(ObjectAction owningAction) {
-        return owningAction.getIdentifier().toClassAndNameIdentityString();
-    }
-
-    public static String argDescriptionFor(ObjectAction owningAction, ObjectAdapter[] arguments) {
-        final StringBuilder argsBuf = new StringBuilder();
-        List<ObjectActionParameter> parameters = owningAction.getParameters();
-        if(parameters.size() == arguments.length) {
-            // should be the case
-            int i=0;
-            for (ObjectActionParameter param : parameters) {
-                CommandUtil.appendParamArg(argsBuf, param, arguments[i++]);
-            }
-        }
-        String argsStr = argsBuf.toString();
-        return argsStr;
-    }
-
-    public static Bookmark bookmarkFor(final ObjectAdapter adapter) {
-        final Oid oid = adapter.getOid();
-        if(!(oid instanceof RootOid)) {
-            return null;
-        } 
-        final RootOid rootOid = (RootOid) oid;
-        return rootOid.asBookmark();
-    }
-
-    static void appendParamArg(final StringBuilder buf, ObjectActionParameter param, ObjectAdapter objectAdapter) {
-        String titleOf = objectAdapter != null? objectAdapter.titleString(null): "null";
-        buf.append(param.getName()).append(": ").append(titleOf).append("\n");
-    }
-
-    public static void buildMementoArgLists(MementoService mementoService, BookmarkService bookmarkService, final Method method, final Object[] args, final List<Class<?>> argTypes, final List<Object> argObjs) {
-        for (int i = 0; i < args.length; i++) {
-            Object input = args[i];
-            if (mementoService.canSet(input)) {
-                argTypes.add(method.getParameterTypes()[i]);
-                argObjs.add(input);
-            } else {
-                Bookmark argBookmark = bookmarkService.bookmarkFor(input);
-                argTypes.add(Bookmark.class);
-                argObjs.add(argBookmark);
-            }
-        }
-    }
-    
-    
-    public static ObjectAdapter[] adaptersFor(final Object[] args, final AdapterManager adapterManager) {
-        List<Object> argList = Arrays.asList(args);
-        Iterable<ObjectAdapter> adapterList = 
-                Iterables.transform(
-                        argList, ObjectAdapter.Functions.adapterForUsing(adapterManager));
-        return Lists.newArrayList(adapterList).toArray(new ObjectAdapter[]{});
-    }
-
-    public static Object[] objectsFor(ObjectAdapter[] arguments) {
-        List<ObjectAdapter> argList = Arrays.asList(arguments);
-        Iterable<Object> adapterList = 
-                Iterables.transform(
-                        argList, ObjectAdapter.Functions.getObject());
-        return Lists.newArrayList(adapterList).toArray(new Object[]{});
-    }
-
-    
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/DebugFacetViaNamingConvention.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/DebugFacetViaNamingConvention.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/DebugFacetViaNamingConvention.java
deleted file mode 100644
index 2722adc..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/DebugFacetViaNamingConvention.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.actions.debug.DebugFacetAbstract;
-
-public class DebugFacetViaNamingConvention extends DebugFacetAbstract {
-
-    public DebugFacetViaNamingConvention(final FacetHolder holder) {
-        super(holder);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ExplorationFacetViaNamingConvention.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ExplorationFacetViaNamingConvention.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ExplorationFacetViaNamingConvention.java
deleted file mode 100644
index 6c77893..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/ExplorationFacetViaNamingConvention.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.actions.exploration.ExplorationFacetAbstract;
-
-public class ExplorationFacetViaNamingConvention extends ExplorationFacetAbstract {
-
-    public ExplorationFacetViaNamingConvention(final FacetHolder holder) {
-        super(holder);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetAbstract.java
deleted file mode 100644
index 53913d0..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetAbstract.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.List;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.isis.applib.NonRecoverableException;
-import org.apache.isis.applib.RecoverableException;
-import org.apache.isis.applib.ViewModel;
-import org.apache.isis.applib.annotation.Bulk;
-import org.apache.isis.applib.clock.Clock;
-import org.apache.isis.applib.services.background.ActionInvocationMemento;
-import org.apache.isis.applib.services.background.BackgroundService;
-import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.command.Command;
-import org.apache.isis.applib.services.command.CommandContext;
-import org.apache.isis.applib.services.command.spi.CommandService;
-import org.apache.isis.applib.services.eventbus.AbstractInteractionEvent;
-import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
-import org.apache.isis.core.commons.exceptions.IsisException;
-import org.apache.isis.core.commons.lang.ThrowableExtensions;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facets.ImperativeFacet;
-import org.apache.isis.core.metamodel.facets.InteractionHelper;
-import org.apache.isis.core.metamodel.facets.actions.command.CommandFacet;
-import org.apache.isis.core.metamodel.facets.actions.publish.PublishedActionFacet;
-import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.ElementSpecificationProviderFromTypeOfFacet;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
-import org.apache.isis.core.metamodel.specloader.ReflectiveActionException;
-import org.apache.isis.core.metamodel.facets.actions.bulk.BulkFacet;
-
-public abstract class InteractionWithActionFacetAbstract
-        extends ActionInvocationFacetAbstract
-        implements ImperativeFacet, ActionInteractionFacet {
-
-    private final static Logger LOG = LoggerFactory.getLogger(InteractionWithActionFacetAbstract.class);
-
-    private final Method method;
-    private final ObjectSpecification onType;
-    private final ObjectSpecification returnType;
-
-    private final AdapterManager adapterManager;
-    private final RuntimeContext runtimeContext;
-
-    private final ServicesInjector servicesInjector;
-    private final Class<? extends ActionInteractionEvent<?>> eventType;
-    private final InteractionHelper interactionHelper;
-
-    public InteractionWithActionFacetAbstract(
-            final Method method,
-            final ObjectSpecification onType,
-            final ObjectSpecification returnType,
-            final FacetHolder holder,
-            final RuntimeContext runtimeContext,
-            final AdapterManager adapterManager,
-            final ServicesInjector servicesInjector,
-            final Class<? extends ActionInteractionEvent<?>> eventType) {
-        super(holder);
-        this.method = method;
-        this.onType = onType;
-        this.returnType = returnType;
-        this.runtimeContext = runtimeContext;
-        this.adapterManager = adapterManager;
-        this.servicesInjector = servicesInjector;
-        this.eventType = eventType;
-        this.interactionHelper = new InteractionHelper(servicesInjector);
-    }
-
-    /**
-     * Returns a singleton list of the {@link java.lang.reflect.Method} provided in the
-     * constructor.
-     */
-    @Override
-    public List<Method> getMethods() {
-        return Collections.singletonList(method);
-    }
-
-    @Override
-    public Intent getIntent(final Method method) {
-        return Intent.EXECUTE;
-    }
-
-    @Override
-    public ObjectSpecification getReturnType() {
-        return returnType;
-    }
-
-    @Override
-    public ObjectSpecification getOnType() {
-        return onType;
-    }
-
-    /**
-     * Introduced to disambiguate the meaning of <tt>null</tt> as a return value of
-     * {@link #invoke(org.apache.isis.core.metamodel.adapter.ObjectAdapter, org.apache.isis.core.metamodel.adapter.ObjectAdapter[])}
-     */
-    public static class InvocationResult {
-
-        public static InvocationResult forActionThatReturned(final ObjectAdapter resultAdapter) {
-            return new InvocationResult(true, resultAdapter);
-        }
-
-        public static InvocationResult forActionNotInvoked() {
-            return new InvocationResult(false, null);
-        }
-
-        private final boolean whetherInvoked;
-        private final ObjectAdapter adapter;
-
-        private InvocationResult(final boolean whetherInvoked, final ObjectAdapter result) {
-            this.whetherInvoked = whetherInvoked;
-            this.adapter = result;
-        }
-
-        public boolean getWhetherInvoked() {
-            return whetherInvoked;
-        }
-
-        /**
-         * Returns the result, or null if either the action invocation returned null or
-         * if the action was never invoked in the first place.
-         *
-         * <p>
-         * Use {@link #getWhetherInvoked()} to distinguish between these two cases.
-         */
-        public ObjectAdapter getAdapter() {
-            return adapter;
-        }
-    }
-
-    @Override
-    public ObjectAdapter invoke(final ObjectAdapter targetAdapter, final ObjectAdapter[] argumentAdapters) {
-        return invoke(null, targetAdapter, argumentAdapters);
-    }
-
-    @Override
-    public ObjectAdapter invoke(
-            final ObjectAction owningAction,
-            final ObjectAdapter targetAdapter,
-            final ObjectAdapter[] arguments) {
-
-        final InvocationResult invocationResult = internalInvoke(owningAction, targetAdapter, arguments);
-
-        // Perhaps the Action was not properly invoked (i.e. an exception was raised).
-        if (invocationResult.getWhetherInvoked()) {
-            // If invoked, then send the ActionInteractionEvent to the EventBus.
-            interactionHelper.postEventForAction(eventType, null, AbstractInteractionEvent.Phase.EXECUTE, owningAction, targetAdapter, arguments);
-        }
-
-        return invocationResult.getAdapter();
-    }
-
-    protected InvocationResult internalInvoke(
-            final ObjectAction owningAction,
-            final ObjectAdapter targetAdapter,
-            final ObjectAdapter[] arguments) {
-
-        final Bulk.InteractionContext bulkInteractionContext = getServicesInjector().lookupService(Bulk.InteractionContext.class);
-        final CommandContext commandContext = getServicesInjector().lookupService(CommandContext.class);
-        final Command command = commandContext != null ? commandContext.getCommand() : null;
-
-        try {
-            final Object[] executionParameters = new Object[arguments.length];
-            for (int i = 0; i < arguments.length; i++) {
-                executionParameters[i] = unwrap(arguments[i]);
-            }
-
-            final Object targetPojo = unwrap(targetAdapter);
-
-            final BulkFacet bulkFacet = getFacetHolder().getFacet(BulkFacet.class);
-            if (bulkFacet != null &&
-                    bulkInteractionContext != null &&
-                    bulkInteractionContext.getInvokedAs() == null) {
-
-                bulkInteractionContext.setInvokedAs(Bulk.InteractionContext.InvokedAs.REGULAR);
-                bulkInteractionContext.setDomainObjects(Collections.singletonList(targetPojo));
-            }
-
-            if(command != null && command.getExecutor() == Command.Executor.USER && owningAction != null) {
-
-                if(command.getTarget() != null) {
-                    // already set up by a ObjectActionContributee;
-                    // don't overwrite
-                } else {
-                    command.setTargetClass(CommandUtil.targetClassNameFor(targetAdapter));
-                    command.setTargetAction(CommandUtil.targetActionNameFor(owningAction));
-                    command.setArguments(CommandUtil.argDescriptionFor(owningAction, arguments));
-
-                    final Bookmark targetBookmark = CommandUtil.bookmarkFor(targetAdapter);
-                    command.setTarget(targetBookmark);
-                }
-
-                command.setMemberIdentifier(CommandUtil.actionIdentifierFor(owningAction));
-
-                // the background service is used here merely as a means to capture an invocation memento
-                final BackgroundService backgroundService = getServicesInjector().lookupService(BackgroundService.class);
-                if(backgroundService != null) {
-                    final Object targetObject = unwrap(targetAdapter);
-                    final Object[] args = CommandUtil.objectsFor(arguments);
-                    ActionInvocationMemento aim = backgroundService.asActionInvocationMemento(method, targetObject, args);
-
-                    if(aim != null) {
-                        command.setMemento(aim.asMementoString());
-                    } else {
-                        throw new IsisException(
-                                "Unable to build memento for action " +
-                                        owningAction.getIdentifier().toClassAndNameIdentityString());
-                    }
-                }
-
-                // copy over the command execution 'context' (if available)
-                final CommandFacet commandFacet = getFacetHolder().getFacet(CommandFacet.class);
-                if(commandFacet != null && !commandFacet.isDisabled()) {
-                    command.setExecuteIn(commandFacet.executeIn());
-                    command.setPersistence(commandFacet.persistence());
-                } else {
-                    // if no facet, assume do want to execute right now, but only persist (eventually) if hinted.
-                    command.setExecuteIn(org.apache.isis.applib.annotation.Command.ExecuteIn.FOREGROUND);
-                    command.setPersistence(org.apache.isis.applib.annotation.Command.Persistence.IF_HINTED);
-                }
-            }
-
-
-            if( command != null &&
-                    command.getExecutor() == Command.Executor.USER &&
-                    command.getExecuteIn() == org.apache.isis.applib.annotation.Command.ExecuteIn.BACKGROUND) {
-
-                // persist command so can be this command can be in the 'background'
-                final CommandService commandService = getServicesInjector().lookupService(CommandService.class);
-                if(commandService.persistIfPossible(command)) {
-                    // force persistence, then return the command itself.
-                    final ObjectAdapter resultAdapter = getAdapterManager().adapterFor(command);
-                    return InvocationResult.forActionThatReturned(resultAdapter);
-                } else {
-                    throw new IsisException(
-                            "Unable to schedule action '"
-                                    + owningAction.getIdentifier().toClassAndNameIdentityString() + "' to run in background: "
-                                    + "CommandService does not support persistent commands " );
-                }
-            } else {
-
-                // otherwise, go ahead and execute action in the 'foreground'
-
-                if(command != null) {
-                    command.setStartedAt(Clock.getTimeAsJavaSqlTimestamp());
-                }
-
-                Object result = method.invoke(targetPojo, executionParameters);
-
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(" action result " + result);
-                }
-                if (result == null) {
-                    if(targetAdapter.getSpecification().isViewModelCloneable(null)) {
-                        // if this was a void method on a ViewModel.Cloneable, then (to save boilerplate in the domain)
-                        // automatically do the clone and return the clone instead.
-                        final ViewModel.Cloneable cloneable = (ViewModel.Cloneable) targetAdapter.getObject();
-                        final Object clone = cloneable.clone();
-                        final ObjectAdapter clonedAdapter = getAdapterManager().adapterFor(clone);
-                        return InvocationResult.forActionThatReturned(clonedAdapter);
-                    }
-                    return InvocationResult.forActionThatReturned(null);
-                }
-
-                ObjectAdapter resultAdapter = getAdapterManager().adapterFor(result);
-
-                if(resultAdapter.getSpecification().isViewModelCloneable(resultAdapter)) {
-                    // if the object returned is a ViewModel.Cloneable, then
-                    // (to save boilerplate in the domain) automatically do the clone.
-                    final ViewModel.Cloneable cloneable = (ViewModel.Cloneable) result;
-                    result = cloneable.clone();
-                    resultAdapter = getAdapterManager().adapterFor(result);
-                }
-
-
-                // copy over TypeOfFacet if required
-                final TypeOfFacet typeOfFacet = getFacetHolder().getFacet(TypeOfFacet.class);
-                resultAdapter.setElementSpecificationProvider(ElementSpecificationProviderFromTypeOfFacet.createFrom(typeOfFacet));
-
-                if(command != null) {
-                    if(!resultAdapter.getSpecification().containsDoOpFacet(ViewModelFacet.class)) {
-                        final Bookmark bookmark = CommandUtil.bookmarkFor(resultAdapter);
-                        command.setResult(bookmark);
-                    }
-                }
-
-                final PublishedActionFacet publishedActionFacet = getIdentified().getFacet(PublishedActionFacet.class);
-                ActionInvocationFacet.currentInvocation.set(
-                        publishedActionFacet != null
-                                ? new CurrentInvocation(targetAdapter, getIdentified(), arguments, resultAdapter, command)
-                                :null);
-
-                return InvocationResult.forActionThatReturned(resultAdapter);
-            }
-
-        } catch (final IllegalArgumentException e) {
-            throw e;
-        } catch (final InvocationTargetException e) {
-            final Throwable targetException = e.getTargetException();
-            if (targetException instanceof IllegalStateException) {
-                throw new ReflectiveActionException("IllegalStateException thrown while executing " + method + " " + targetException.getMessage(), targetException);
-            }
-            if(targetException instanceof RecoverableException) {
-                if (!runtimeContext.getTransactionState().canCommit()) {
-                    // something severe has happened to the underlying transaction;
-                    // so escalate this exception to be non-recoverable
-                    final Throwable targetExceptionCause = targetException.getCause();
-                    Throwable nonRecoverableCause = targetExceptionCause != null? targetExceptionCause: targetException;
-                    throw new NonRecoverableException(nonRecoverableCause);
-                }
-            }
-
-            ThrowableExtensions.throwWithinIsisException(e, "Exception executing " + method);
-
-            // Action was not invoked (an Exception was thrown)
-            return InvocationResult.forActionNotInvoked();
-        } catch (final IllegalAccessException e) {
-            throw new ReflectiveActionException("Illegal access of " + method, e);
-        }
-    }
-
-
-
-    private static Object unwrap(final ObjectAdapter adapter) {
-        return adapter == null ? null : adapter.getObject();
-    }
-
-    @Override
-    public boolean impliesResolve() {
-        return true;
-    }
-
-    @Override
-    public boolean impliesObjectChanged() {
-        return false;
-    }
-
-    @Override
-    protected String toStringValues() {
-        return "method=" + method;
-    }
-
-
-    // /////////////////////////////////////////////////////////
-    // Dependencies (from constructor)
-    // /////////////////////////////////////////////////////////
-
-    private AdapterManager getAdapterManager() {
-        return adapterManager;
-    }
-
-    private ServicesInjector getServicesInjector() {
-        return servicesInjector;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetAnnotation.java
deleted file mode 100644
index e34aa43..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetAnnotation.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-import java.lang.reflect.Method;
-import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-public class InteractionWithActionFacetAnnotation
-        extends InteractionWithActionFacetAbstract {
-
-    public InteractionWithActionFacetAnnotation(
-            final Method method,
-            final ObjectSpecification onType,
-            final ObjectSpecification returnType,
-            final FacetHolder holder,
-            final RuntimeContext runtimeContext,
-            final AdapterManager adapterManager,
-            final ServicesInjector servicesInjector,
-            final Class<? extends ActionInteractionEvent<?>> eventType) {
-        super(method, onType, returnType, holder, runtimeContext, adapterManager, servicesInjector, eventType);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetDefault.java
deleted file mode 100644
index b9abcf2..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetDefault.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-import java.lang.reflect.Method;
-import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-public class InteractionWithActionFacetDefault
-        extends InteractionWithActionFacetAbstract {
-
-    public InteractionWithActionFacetDefault(
-            final Method method,
-            final ObjectSpecification onType,
-            final ObjectSpecification returnType,
-            final FacetHolder holder,
-            final RuntimeContext runtimeContext,
-            final AdapterManager adapterManager,
-            final ServicesInjector servicesInjector,
-            final Class<? extends ActionInteractionEvent<?>> eventType) {
-        super(method, onType, returnType, holder, runtimeContext, adapterManager, servicesInjector, eventType);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetFactory.java
deleted file mode 100644
index 19368d4..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetFactory.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-import java.lang.reflect.Method;
-import org.apache.isis.applib.annotation.ActionInteraction;
-import org.apache.isis.applib.annotation.PostsActionInvokedEvent;
-import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
-import org.apache.isis.core.commons.lang.StringExtensions;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManagerAware;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-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.Annotations;
-import org.apache.isis.core.metamodel.facets.actions.debug.DebugFacet;
-import org.apache.isis.core.metamodel.facets.actions.exploration.ExplorationFacet;
-import org.apache.isis.core.metamodel.facets.all.named.NamedFacet;
-import org.apache.isis.core.metamodel.facets.all.named.NamedFacetInferred;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContextAware;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjectorAware;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-import org.apache.isis.core.metamodel.facets.MethodPrefixBasedFacetFactoryAbstract;
-
-/**
- * Sets up {@link ActionInvocationFacet}, along with a number of supporting
- * facets that are based on the action's name.
- * 
- * <p>
- * The supporting methods are: {@link ExecutedFacet}, {@link ExplorationFacet}
- * and {@link DebugFacet}. In addition a {@link NamedFacet} is inferred from the
- * name (taking into account the above well-known prefixes).
- */
-public class InteractionWithActionFacetFactory extends MethodPrefixBasedFacetFactoryAbstract implements AdapterManagerAware, ServicesInjectorAware, RuntimeContextAware {
-
-    private static final String EXPLORATION_PREFIX = "Exploration";
-    private static final String DEBUG_PREFIX = "Debug";
-
-    private static final String[] PREFIXES = { EXPLORATION_PREFIX, DEBUG_PREFIX };
-
-    private AdapterManager adapterManager;
-    private ServicesInjector servicesInjector;
-    private RuntimeContext runtimeContext;
-
-    /**
-     * Note that the {@link Facet}s registered are the generic ones from
-     * noa-architecture (where they exist)
-     */
-    public InteractionWithActionFacetFactory() {
-        super(FeatureType.ACTIONS_ONLY, OrphanValidation.VALIDATE, PREFIXES);
-    }
-
-    // ///////////////////////////////////////////////////////
-    // Actions
-    // ///////////////////////////////////////////////////////
-
-    @Override
-    public void process(final ProcessMethodContext processMethodContext) {
-
-        // InvocationFacet
-        attachInvocationFacet(processMethodContext);
-
-        // DebugFacet, ExplorationFacet
-        attachDebugFacetIfActionMethodNamePrefixed(processMethodContext);
-        attachExplorationFacetIfActionMethodNamePrefixed(processMethodContext);
-
-        // inferred name
-        // (must be called after the attachinvocationFacet methods)
-        attachNamedFacetInferredFromMethodName(processMethodContext); 
-    }
-
-    private void attachInvocationFacet(final ProcessMethodContext processMethodContext) {
-
-        final Method actionMethod = processMethodContext.getMethod();
-
-        try {
-            final Class<?> returnType = actionMethod.getReturnType();
-            final ObjectSpecification returnSpec = getSpecificationLoader().loadSpecification(returnType);
-            if (returnSpec == null) {
-                return;
-            }
-
-            final Class<?> cls = processMethodContext.getCls();
-            final ObjectSpecification typeSpec = getSpecificationLoader().loadSpecification(cls);
-            final FacetHolder holder = processMethodContext.getFacetHolder();
-
-            final ActionInteraction actionInteraction =Annotations.getAnnotation(actionMethod, ActionInteraction.class);
-            final PostsActionInvokedEvent postsActionInvokedEvent = Annotations.getAnnotation(actionMethod, PostsActionInvokedEvent.class);
-
-            if (actionInteraction != null) {
-                Class<? extends ActionInteractionEvent<?>> eventType = actionInteraction.value();
-                FacetUtil.addFacet(new InteractionWithActionFacetAnnotation(actionMethod, typeSpec, returnSpec, holder, getRuntimeContext(), getAdapterManager(), getServicesInjector(), eventType));
-            } else if (postsActionInvokedEvent != null) {
-                Class<? extends ActionInteractionEvent<?>> eventType = postsActionInvokedEvent.value();
-                FacetUtil.addFacet(new InteractionWithActionFacetPostsActionInvokedEventAnnotation(actionMethod, typeSpec, returnSpec, holder, getRuntimeContext(), getAdapterManager(), getServicesInjector(), eventType));
-            } else {
-                Class<? extends ActionInteractionEvent<?>> eventType = ActionInteractionEvent.Default.class;
-                FacetUtil.addFacet(new InteractionWithActionFacetDefault(actionMethod, typeSpec, returnSpec, holder, getRuntimeContext(), getAdapterManager(), getServicesInjector(), eventType));
-            }
-        } finally {
-            processMethodContext.removeMethod(actionMethod);
-        }
-    }
-
-    private void attachDebugFacetIfActionMethodNamePrefixed(final ProcessMethodContext processMethodContext) {
-        final Method actionMethod = processMethodContext.getMethod();
-        final String capitalizedName = StringExtensions.asCapitalizedName(actionMethod.getName());
-        if (!capitalizedName.startsWith(DEBUG_PREFIX)) {
-            return;
-        }
-        final FacetHolder facetedMethod = processMethodContext.getFacetHolder();
-        FacetUtil.addFacet(new DebugFacetViaNamingConvention(facetedMethod));
-    }
-
-    private void attachExplorationFacetIfActionMethodNamePrefixed(final ProcessMethodContext processMethodContext) {
-
-        final Method actionMethod = processMethodContext.getMethod();
-        final String capitalizedName = StringExtensions.asCapitalizedName(actionMethod.getName());
-        if (!capitalizedName.startsWith(EXPLORATION_PREFIX)) {
-            return;
-        }
-        final FacetHolder facetedMethod = processMethodContext.getFacetHolder();
-        FacetUtil.addFacet(new ExplorationFacetViaNamingConvention(facetedMethod));
-    }
-
-    /**
-     * Must be called after added the debug, exploration etc facets.
-     * 
-     * <p>
-     * TODO: remove this hack
-     */
-    private void attachNamedFacetInferredFromMethodName(final ProcessMethodContext processMethodContext) {
-
-        final Method method = processMethodContext.getMethod();
-        final String capitalizedName = StringExtensions.asCapitalizedName(method.getName());
-
-        // this is nasty...
-        String name = capitalizedName;
-        name = StringExtensions.removePrefix(name, DEBUG_PREFIX);
-        name = StringExtensions.removePrefix(name, EXPLORATION_PREFIX);
-        name = StringExtensions.asNaturalName2(name);
-
-        final FacetHolder facetedMethod = processMethodContext.getFacetHolder();
-        FacetUtil.addFacet(new NamedFacetInferred(name, facetedMethod));
-    }
-
-    // ///////////////////////////////////////////////////////////////
-    // Dependencies
-    // ///////////////////////////////////////////////////////////////
-
-    @Override
-    public void setAdapterManager(final AdapterManager adapterManager) {
-        this.adapterManager = adapterManager;
-    }
-
-    private AdapterManager getAdapterManager() {
-        return adapterManager;
-    }
-
-    @Override
-    public void setServicesInjector(final ServicesInjector servicesInjector) {
-        this.servicesInjector = servicesInjector;
-    }
-
-    private ServicesInjector getServicesInjector() {
-        return servicesInjector;
-    }
-
-    private RuntimeContext getRuntimeContext() {
-        return runtimeContext;
-    }
-    
-    @Override
-    public void setRuntimeContext(RuntimeContext runtimeContext) {
-        this.runtimeContext = runtimeContext;
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetPostsActionInvokedEventAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetPostsActionInvokedEventAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetPostsActionInvokedEventAnnotation.java
deleted file mode 100644
index e97b9cf..0000000
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/invoke/InteractionWithActionFacetPostsActionInvokedEventAnnotation.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  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.metamodel.facets.actions.invoke;
-
-import java.lang.reflect.Method;
-import org.apache.isis.applib.services.eventbus.ActionInteractionEvent;
-import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
-import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
-import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
-import org.apache.isis.core.metamodel.spec.ObjectSpecification;
-
-public class InteractionWithActionFacetPostsActionInvokedEventAnnotation
-        extends InteractionWithActionFacetAbstract {
-
-    public InteractionWithActionFacetPostsActionInvokedEventAnnotation(
-            final Method method,
-            final ObjectSpecification onType,
-            final ObjectSpecification returnType,
-            final FacetHolder holder,
-            final RuntimeContext runtimeContext,
-            final AdapterManager adapterManager,
-            final ServicesInjector servicesInjector,
-            final Class<? extends ActionInteractionEvent<?>> eventType) {
-        super(method, onType, returnType, holder, runtimeContext, adapterManager, servicesInjector, eventType);
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/validate/ActionValidationFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/validate/ActionValidationFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/validate/ActionValidationFacet.java
index 302859f..a715cc4 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/validate/ActionValidationFacet.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/validate/ActionValidationFacet.java
@@ -21,7 +21,7 @@ package org.apache.isis.core.metamodel.facets.actions.validate;
 
 import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
 import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facets.actions.invoke.ActionInvocationFacet;
+import org.apache.isis.core.metamodel.facets.actions.interaction.ActionInvocationFacet;
 import org.apache.isis.core.metamodel.interactions.ValidatingInteractionAdvisor;
 
 /**

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForCollectionInteractionAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForCollectionInteractionAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForCollectionInteractionAnnotation.java
index 32c344b..25bb380 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForCollectionInteractionAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForCollectionInteractionAnnotation.java
@@ -33,8 +33,7 @@ public class CollectionAddToFacetForCollectionInteractionAnnotation
             final PropertyOrCollectionAccessorFacet getterFacet,
             final CollectionAddToFacet collectionAddToFacet,
             final CollectionInteractionFacetAbstract collectionInteractionFacet,
-            final ServicesInjector servicesInjector,
-            final FacetHolder holder) {
+            final FacetHolder holder, final ServicesInjector servicesInjector) {
 		super(eventType, getterFacet, collectionAddToFacet, collectionInteractionFacet, servicesInjector, holder);
 	}
 

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForCollectionInteractionDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForCollectionInteractionDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForCollectionInteractionDefault.java
index 30c9016..ad543f4 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForCollectionInteractionDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForCollectionInteractionDefault.java
@@ -33,8 +33,7 @@ public class CollectionAddToFacetForCollectionInteractionDefault
             final PropertyOrCollectionAccessorFacet getterFacet,
             final CollectionAddToFacet collectionAddToFacet,
             final CollectionInteractionFacetAbstract collectionInteractionFacet,
-            final ServicesInjector servicesInjector,
-            final FacetHolder holder) {
+            final FacetHolder holder, final ServicesInjector servicesInjector) {
 		super(eventType, getterFacet, collectionAddToFacet, collectionInteractionFacet, servicesInjector, holder);
 	}
 

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForInteractionAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForInteractionAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForInteractionAbstract.java
index 9f4a16a..984a837 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForInteractionAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForInteractionAbstract.java
@@ -72,28 +72,42 @@ public abstract class CollectionAddToFacetForInteractionAbstract
             return;
         }
 
-        final Object referencedObject = ObjectAdapter.Util.unwrap(referencedObjectAdapter);
+        try {
+            final Object referencedObject = ObjectAdapter.Util.unwrap(referencedObjectAdapter);
+
+            // get hold of underlying collection
+            final Object collection = getterFacet.getProperty(targetAdapter);
+
+            // don't post event if has set semantics and already contains object
+            if(collection instanceof Set) {
+                Set<?> set = (Set<?>) collection;
+                if(set.contains(referencedObject)) {
+                    return;
+                }
+            }
 
-        // get hold of underlying collection
-        final Object collection = getterFacet.getProperty(targetAdapter);
 
-        // don't post event if has set semantics and already contains object
-        if(collection instanceof Set) {
-            Set<?> set = (Set<?>) collection;
-            if(set.contains(referencedObject)) {
-                return;
-            }
-        }
+            // either doesn't contain object, or doesn't have set semantics, so
+            // execute the add wrapped between the executing and executed events ...
 
-        // either doesn't contain object, or doesn't have set semantics, so execute the add...
-        collectionAddToFacet.add(targetAdapter, referencedObjectAdapter);
+            // ... post the executing event
+            final CollectionInteractionEvent<?, ?> existingEvent = collectionInteractionFacet.currentInteraction.get();
+            final CollectionInteractionEvent<?, ?> event = interactionHelper.postEventForCollection(
+                    value(), existingEvent, AbstractInteractionEvent.Phase.EXECUTING,
+                    getIdentified(), targetAdapter, CollectionInteractionEvent.Of.ADD_TO, referencedObject);
 
-        // ... and post the event (reusing existing event if available)
-        final CollectionInteractionEvent<?, ?> event = collectionInteractionFacet.currentInteraction.get();
-        interactionHelper.postEventForCollection(value(), verify(event), AbstractInteractionEvent.Phase.EXECUTE, targetAdapter, getIdentified(), CollectionInteractionEvent.Of.ADD_TO, referencedObject);
+            // ... perform add
+            collectionAddToFacet.add(targetAdapter, referencedObjectAdapter);
+
+            // ... post the executed event
+            interactionHelper.postEventForCollection(
+                    value(), verify(event), AbstractInteractionEvent.Phase.EXECUTED,
+                    getIdentified(), targetAdapter, CollectionInteractionEvent.Of.ADD_TO, referencedObject);
 
-        // clean up
-        collectionInteractionFacet.currentInteraction.set(null);
+        } finally {
+            // clean up
+            collectionInteractionFacet.currentInteraction.set(null);
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForPostsCollectionAddedToEventAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForPostsCollectionAddedToEventAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForPostsCollectionAddedToEventAnnotation.java
index 92c4018..2aa8e7d 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForPostsCollectionAddedToEventAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionAddToFacetForPostsCollectionAddedToEventAnnotation.java
@@ -34,8 +34,7 @@ public class CollectionAddToFacetForPostsCollectionAddedToEventAnnotation
             final PropertyOrCollectionAccessorFacet getterFacet,
             final CollectionAddToFacet collectionAddToFacet,
             final CollectionInteractionFacetAbstract collectionInteractionFacet,
-            final ServicesInjector servicesInjector,
-            final FacetHolder holder) {
+            final FacetHolder holder, final ServicesInjector servicesInjector) {
 		super(eventType, getterFacet, collectionAddToFacet, collectionInteractionFacet, servicesInjector, holder);
 	}
 

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionInteractionFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionInteractionFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionInteractionFacetAbstract.java
index 9e6dc4b..093f0ff 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionInteractionFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionInteractionFacetAbstract.java
@@ -54,7 +54,7 @@ public abstract class CollectionInteractionFacetAbstract extends SingleClassValu
 
         final CollectionInteractionEvent<?, ?> event =
                 interactionHelper.postEventForCollection(
-                        eventType(), null, AbstractInteractionEvent.Phase.HIDE, ic.getTarget(), getIdentified(), CollectionInteractionEvent.Of.ACCESS, null);
+                        eventType(), null, AbstractInteractionEvent.Phase.HIDE, getIdentified(), ic.getTarget(), CollectionInteractionEvent.Of.ACCESS, null);
         if (event == null || !event.isHidden()) {
             // make available for next phase
             currentInteraction.set(event);
@@ -71,7 +71,7 @@ public abstract class CollectionInteractionFacetAbstract extends SingleClassValu
         final CollectionInteractionEvent<?, ?> existingEvent = currentInteraction.get();
         final CollectionInteractionEvent<?, ?> event =
                 interactionHelper.postEventForCollection(
-                    eventType(), existingEvent, AbstractInteractionEvent.Phase.DISABLE, ic.getTarget(), getIdentified(), CollectionInteractionEvent.Of.ACCESS, null);
+                    eventType(), existingEvent, AbstractInteractionEvent.Phase.DISABLE, getIdentified(), ic.getTarget(), CollectionInteractionEvent.Of.ACCESS, null);
         if (event == null || !event.isDisabled()) {
             // make available for next phase
             currentInteraction.set(event);
@@ -93,7 +93,7 @@ public abstract class CollectionInteractionFacetAbstract extends SingleClassValu
 
         final CollectionInteractionEvent<?, ?> event =
                 interactionHelper.postEventForCollection(
-                        eventType(), existingEvent, AbstractInteractionEvent.Phase.VALIDATE, ic.getTarget(), getIdentified(), CollectionInteractionEvent.Of.ADD_TO, proposed);
+                        eventType(), existingEvent, AbstractInteractionEvent.Phase.VALIDATE, getIdentified(), ic.getTarget(), CollectionInteractionEvent.Of.ADD_TO, proposed);
         if(event == null || !event.isInvalid()) {
             // make available for next phase
             currentInteraction.set(event);

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionInteractionFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionInteractionFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionInteractionFacetFactory.java
index 0abc8ab..e55cfc0 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionInteractionFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionInteractionFacetFactory.java
@@ -60,10 +60,12 @@ public class CollectionInteractionFacetFactory extends FacetFactoryAbstract impl
         final CollectionInteractionFacetAbstract collectionInteractionFacet;
         if(collectionInteraction != null) {
             collectionInteractionEventType = collectionInteraction.value();
-            collectionInteractionFacet = new CollectionInteractionFacetAnnotation(collectionInteractionEventType, holder, servicesInjector, getSpecificationLoader());
+            collectionInteractionFacet = new CollectionInteractionFacetAnnotation(
+                    collectionInteractionEventType, holder, servicesInjector, getSpecificationLoader());
         } else {
             collectionInteractionEventType = CollectionInteractionEvent.Default.class;
-            collectionInteractionFacet = new CollectionInteractionFacetDefault(collectionInteractionEventType, holder, servicesInjector, getSpecificationLoader());
+            collectionInteractionFacet = new CollectionInteractionFacetDefault(
+                    collectionInteractionEventType, holder, servicesInjector, getSpecificationLoader());
         }
         FacetUtil.addFacet(collectionInteractionFacet);
 
@@ -87,11 +89,14 @@ public class CollectionInteractionFacetFactory extends FacetFactoryAbstract impl
             // the current collectionAddToFacet will end up as the underlying facet of one of these facets to be created.
             final CollectionAddToFacetForInteractionAbstract replacementFacet;
             if(collectionInteraction != null) {
-                replacementFacet = new CollectionAddToFacetForCollectionInteractionAnnotation(collectionInteractionEventType, getterFacet, collectionAddToFacet, collectionInteractionFacet, servicesInjector, holder);
+                replacementFacet = new CollectionAddToFacetForCollectionInteractionAnnotation(
+                        collectionInteractionEventType, getterFacet, collectionAddToFacet, collectionInteractionFacet, holder, servicesInjector);
             } else if (postsCollectionAddedToEvent != null) {
-                replacementFacet = new CollectionAddToFacetForPostsCollectionAddedToEventAnnotation(postsCollectionAddedToEvent.value(), getterFacet, collectionAddToFacet, collectionInteractionFacet, servicesInjector, holder);
+                replacementFacet = new CollectionAddToFacetForPostsCollectionAddedToEventAnnotation(
+                        postsCollectionAddedToEvent.value(), getterFacet, collectionAddToFacet, collectionInteractionFacet, holder, servicesInjector);
             } else {
-                replacementFacet = new CollectionAddToFacetForCollectionInteractionDefault(collectionInteractionEventType, getterFacet, collectionAddToFacet, collectionInteractionFacet, servicesInjector, holder);
+                replacementFacet = new CollectionAddToFacetForCollectionInteractionDefault(
+                        collectionInteractionEventType, getterFacet, collectionAddToFacet, collectionInteractionFacet, holder, servicesInjector);
             }
             FacetUtil.addFacet(replacementFacet);
         }

http://git-wip-us.apache.org/repos/asf/isis/blob/6422c1db/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionRemoveFromFacetForInteractionAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionRemoveFromFacetForInteractionAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionRemoveFromFacetForInteractionAbstract.java
index fa4192a..d109421 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionRemoveFromFacetForInteractionAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/interaction/CollectionRemoveFromFacetForInteractionAbstract.java
@@ -72,25 +72,40 @@ public abstract class CollectionRemoveFromFacetForInteractionAbstract
             return;
         }
 
-        final Object referencedObject = ObjectAdapter.Util.unwrap(referencedObjectAdapter);
 
-        // get hold of underlying collection
-        final Object collection = getterFacet.getProperty(targetAdapter);
+        try {
 
-        // don't post event if the collections does not contain object
-        if (!((Collection<?>) collection).contains(referencedObject)) {
-            return;
-        }
+            final Object referencedObject = ObjectAdapter.Util.unwrap(referencedObjectAdapter);
+
+            // get hold of underlying collection
+            final Object collection = getterFacet.getProperty(targetAdapter);
 
-        // contains the element, so execute the remove...
-        collectionRemoveFromFacet.remove(targetAdapter, referencedObjectAdapter);
+            // don't post event if the collections does not contain object
+            if (!((Collection<?>) collection).contains(referencedObject)) {
+                return;
+            }
 
-        // ... and post the event (reusing existing event if available)
-        final CollectionInteractionEvent<?, ?> event = collectionInteractionFacet.currentInteraction.get();
-        interactionHelper.postEventForCollection(value(), verify(event), AbstractInteractionEvent.Phase.EXECUTE, targetAdapter, getIdentified(), CollectionInteractionEvent.Of.REMOVE_FROM, referencedObject);
+            // contains the element, so
+            // execute the remove wrapped between the executing and executed events ...
 
-        collectionInteractionFacet.currentInteraction.set(null);
+            // ... post the executing event
+            final CollectionInteractionEvent<?, ?> existingEvent = collectionInteractionFacet.currentInteraction.get();
+            final CollectionInteractionEvent<?, ?> event = interactionHelper.postEventForCollection(
+                    value(), existingEvent, AbstractInteractionEvent.Phase.EXECUTING,
+                    getIdentified(), targetAdapter, CollectionInteractionEvent.Of.REMOVE_FROM, referencedObject);
 
+            // ... perform remove
+            collectionRemoveFromFacet.remove(targetAdapter, referencedObjectAdapter);
+
+            // ... and post the executed event
+            interactionHelper.postEventForCollection(
+                    value(), verify(event), AbstractInteractionEvent.Phase.EXECUTED,
+                    getIdentified(), targetAdapter, CollectionInteractionEvent.Of.REMOVE_FROM, referencedObject);
+
+        } finally {
+            // clean up
+            collectionInteractionFacet.currentInteraction.set(null);
+        }
     }
 
     /**