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/01/31 16:34:06 UTC
[2/3] ISIS-671, ISIS-672: renames, also @Reified annotation
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/applib/src/main/java/org/apache/isis/applib/services/interaction/InteractionContext.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/interaction/InteractionContext.java b/core/applib/src/main/java/org/apache/isis/applib/services/interaction/InteractionContext.java
deleted file mode 100644
index b2ae710..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/services/interaction/InteractionContext.java
+++ /dev/null
@@ -1,50 +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.applib.services.interaction;
-
-import javax.enterprise.context.RequestScoped;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.isis.applib.annotation.Programmatic;
-
-/**
- * Register this as a service in order to access context information about any {@link Interaction}.
- */
-@RequestScoped
-public class InteractionContext {
-
- @SuppressWarnings("unused")
- private static final Logger LOG = LoggerFactory.getLogger(InteractionContext.class);
-
- private Interaction interaction;
-
- @Programmatic
- public Interaction getInteraction() {
- return interaction;
- }
-
- /**
- * <b>NOT API</b>: intended to be called only by the framework.
- * @param interaction
- */
- public void setInteraction(Interaction interaction) {
- this.interaction = interaction;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/applib/src/main/java/org/apache/isis/applib/services/interaction/InteractionDefault.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/interaction/InteractionDefault.java b/core/applib/src/main/java/org/apache/isis/applib/services/interaction/InteractionDefault.java
deleted file mode 100644
index 2396ca2..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/services/interaction/InteractionDefault.java
+++ /dev/null
@@ -1,228 +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.applib.services.interaction;
-
-import java.sql.Timestamp;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import com.google.common.collect.Maps;
-
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.interaction.spi.InteractionService;
-import org.apache.isis.applib.util.ObjectContracts;
-
-public class InteractionDefault implements Interaction {
-
- public InteractionDefault() {
- setNature(Interaction.Nature.RENDERING);
- }
-
- // //////////////////////////////////////
- // actionIdentifier (property)
- // //////////////////////////////////////
-
- private String actionIdentifier;
- public String getActionIdentifier() {
- return actionIdentifier;
- }
- @Override
- public void setActionIdentifier(String actionIdentifier) {
- this.actionIdentifier = actionIdentifier;
- }
-
- // //////////////////////////////////////
- // targetClass (property)
- // //////////////////////////////////////
-
- private String targetClass;
- public String getTargetClass() {
- return targetClass;
- }
-
- @Override
- public void setTargetClass(String targetClass) {
- this.targetClass = targetClass;
- }
-
- // //////////////////////////////////////
- // targetAction (property)
- // //////////////////////////////////////
-
- private String targetAction;
- public String getTargetAction() {
- return targetAction;
- }
-
- @Override
- public void setTargetAction(String targetAction) {
- this.targetAction = targetAction;
- }
-
- // //////////////////////////////////////
- // arguments (property)
- // //////////////////////////////////////
-
- private String arguments;
- public String getArguments() {
- return arguments;
- }
-
- @Override
- public void setArguments(String arguments) {
- this.arguments = arguments;
- }
-
- // //////////////////////////////////////
- // target (property)
- // //////////////////////////////////////
-
- private Bookmark target;
- public Bookmark getTarget() {
- return target;
- }
- @Override
- public void setTarget(Bookmark target) {
- this.target = target;
- }
-
-
- // //////////////////////////////////////
- // startedAt (property)
- // //////////////////////////////////////
-
- private Timestamp startedAt;
- public Timestamp getTimestamp() {
- return startedAt;
- }
-
- @Override
- public void setTimestamp(Timestamp startedAt) {
- this.startedAt = startedAt;
- }
-
- // //////////////////////////////////////
- // user (property)
- // //////////////////////////////////////
-
- private String user;
- public String getUser() {
- return user;
- }
-
- @Override
- public void setUser(String user) {
- this.user = user;
- }
-
-
- // //////////////////////////////////////
- // nature (property)
- // //////////////////////////////////////
-
- private Nature nature;
-
- @Override
- public Nature getNature() {
- return nature;
- }
-
- /**
- * <b>NOT API</b>: intended to be called only by the framework.
- *
- * <p>
- * Implementation notes: populated by the viewer as hint to {@link InteractionService} implementation.
- */
- @Override
- public void setNature(Nature nature) {
- this.nature = nature;
- }
-
- // //////////////////////////////////////
- // result (property)
- // //////////////////////////////////////
-
- private Bookmark result;
-
- @Override
- public Bookmark getResult() {
- return result;
- }
- @Override
- public void setResult(final Bookmark result) {
- this.result = result;
- }
-
-
- // //////////////////////////////////////
- // exceptionStackTrace (property)
- // //////////////////////////////////////
-
- private String exceptionStackTrace;
-
- @Override
- public String getException() {
- return exceptionStackTrace;
- }
- @Override
- public void setException(final String exceptionStackTrace) {
- this.exceptionStackTrace = exceptionStackTrace;
- }
-
- // //////////////////////////////////////
-
- @Override
- public String toString() {
- return ObjectContracts.toString(this, "startedAt,user,actionIdentifier,target,guid");
- }
-
-
- // //////////////////////////////////////
-
- private UUID transactionId;
-
- @Override
- public UUID getTransactionId() {
- return transactionId;
- }
- @Override
- public void setTransactionId(UUID transactionId) {
- this.transactionId = transactionId;
- }
-
-
- // //////////////////////////////////////
-
- private final Map<String, AtomicInteger> sequenceByName = Maps.newHashMap();
-
- @Programmatic
- @Override
- public int next(String sequenceName) {
- AtomicInteger next = sequenceByName.get(sequenceName);
- if(next == null) {
- next = new AtomicInteger(0);
- sequenceByName.put(sequenceName, next);
- } else {
- next.incrementAndGet();
- }
- return next.get();
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/applib/src/main/java/org/apache/isis/applib/services/interaction/spi/InteractionService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/interaction/spi/InteractionService.java b/core/applib/src/main/java/org/apache/isis/applib/services/interaction/spi/InteractionService.java
deleted file mode 100644
index 749b162..0000000
--- a/core/applib/src/main/java/org/apache/isis/applib/services/interaction/spi/InteractionService.java
+++ /dev/null
@@ -1,55 +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.applib.services.interaction.spi;
-
-import java.util.UUID;
-
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.interaction.Interaction;
-
-/**
- * Intended for service to implement, providing a different implementation of
- * {@link Interaction}.
- *
- * <p>
- * The default implementation (provided automatically by the framework) will
- * instantiate an in-memory implementation of {@link Interaction}. However, other
- * services (eg as provided by the JDO objectstore) might provide a persistable
- * {@link Interaction} object.
- */
-public interface InteractionService {
-
- @Programmatic
- Interaction create();
-
- /**
- * Although the transactionId is also provided via {@link InteractionOutcome} in the
- * {@link #complete(Interaction)} callback, it is passed in here as well
- * so that an implementation can ensure that the {@link Interaction} is fully populated in order
- * to persist if required.
- *
- * <p>
- * One case where this may be supported (for example, by the <tt>InteractionServiceJdo</tt> implementation)
- * is to flush still-running {@link Interaction}s to the database on-demand.
- */
- @Programmatic
- void startTransaction(final Interaction interaction, final UUID transactionId);
-
- @Programmatic
- void complete(final Interaction interaction);
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableAction.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableAction.java b/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableAction.java
new file mode 100644
index 0000000..70af531
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableAction.java
@@ -0,0 +1,245 @@
+/**
+ * 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.applib.services.reifiableaction;
+
+import java.sql.Timestamp;
+
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.annotation.Disabled;
+import org.apache.isis.applib.annotation.Reified;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.clock.Clock;
+import org.apache.isis.applib.services.HasTransactionId;
+import org.apache.isis.applib.services.background.BackgroundTaskService;
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.bookmark.BookmarkService;
+import org.apache.isis.applib.services.reifiableaction.spi.ReifiableActionService;
+
+public interface ReifiableAction extends HasTransactionId {
+
+ /**
+ * The user that initiated the action.
+ */
+ @Disabled
+ public abstract String getUser();
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Implementation notes: set when the Isis PersistenceSession is opened.
+ */
+ public abstract void setUser(String user);
+
+ // //////////////////////////////////////
+
+ /**
+ * The date/time at which the action was invoked.
+ */
+ @Disabled
+ public abstract Timestamp getTimestamp();
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Implementation notes: set when the Isis PersistenceSession is opened. Uses the applib {@link Clock}.
+ */
+ public abstract void setTimestamp(Timestamp startedAt);
+
+
+ // //////////////////////////////////////
+
+
+ /**
+ * {@link Bookmark} of the target object (entity or service) on which this action was performed.
+ *
+ * <p>
+ * Will only be populated if a {@link BookmarkService} has been configured.
+ */
+ @Disabled
+ public abstract Bookmark getTarget();
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Implementation notes: set when the action is invoked (in the ActionInvocationFacet).
+ */
+ public abstract void setTarget(Bookmark target);
+
+ // //////////////////////////////////////
+
+ /**
+ * Holds a string representation of the invoked action, equivalent to
+ * {@link Identifier#toClassAndNameIdentityString()}.
+ *
+ * <p>
+ * Returns <tt>null</tt> otherwise.
+ */
+ @Disabled
+ public abstract String getActionIdentifier();
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Implementation notes: set when the action is invoked (in the <tt>ActionInvocationFacet</tt>).
+ */
+ public abstract void setActionIdentifier(String actionIdentifier);
+
+ // //////////////////////////////////////
+
+ /**
+ * A human-friendly description of the class of the target object.
+ */
+ @Disabled
+ public abstract String getTargetClass();
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Implementation notes: set when the action is invoked (in the <tt>ActionInvocationFacet</t>).
+ */
+ public abstract void setTargetClass(String targetClass);
+
+ // //////////////////////////////////////
+
+ /**
+ * The human-friendly name of the action invoked on the target object.
+ */
+ @Disabled
+ public abstract String getTargetAction();
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Implementation notes: set when the action is invoked (in the <tt>ActionInvocationFacet</tt>).
+ */
+ public abstract void setTargetAction(String targetAction);
+
+ // //////////////////////////////////////
+
+ /**
+ * A human-friendly description of the arguments with which the action was invoked.
+ */
+ public String getArguments();
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Implementation notes: set when the action is invoked (in the ActionInvocationFacet).
+ */
+ public void setArguments(final String arguments);
+
+ // //////////////////////////////////////
+
+ public static enum Nature {
+ /**
+ * Indicates that the {@link UserAction} has occurred as the result of an explicit action invocation
+ * on the part of the user.
+ */
+ USER_INITIATED,
+ INDIRECT
+ }
+
+ /**
+ * The nature of this action, for example whether it was
+ * {@link #USER_INITIATED user initiated} on the part of the user, or merely as
+ * a {@link #INDIRECT indirect} side-effect, eg the re-rendering of an entity in a viewer (such as the
+ * Wicket viewer) that uses the <a href="http://en.wikipedia.org/wiki/Post/Redirect/Get">post/redirect/get</a>
+ * to avoid duplicate submissions.
+ *
+ * <p>
+ * The Isis implementations uses this field as to a hint as to whether to populate the interaction's
+ * {@link ReifiableAction#setActionIdentifier(String) action identifier} and related properties. The expectation
+ * is that implementations of {@link ReifiableActionService} will only persist interactions that were explicitly started
+ * by the user.
+ */
+ public Nature getNature();
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ */
+ public void setNature(final Nature nature);
+
+
+ // //////////////////////////////////////
+
+ @Disabled
+ public String getException();
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ */
+ public void setException(String stackTrace);
+
+ // //////////////////////////////////////
+
+
+ /**
+ * A {@link Bookmark} to the object returned by the action.
+ *
+ * <p>
+ * If the action returned either a domain entity or a simple value (and did not throw an
+ * exception) then this object is provided here.
+ *
+ * <p>
+ * For <tt>void</tt> methods and for actions returning collections, the value
+ * will be <tt>null</tt>.
+ */
+ public Bookmark getResult();
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ */
+ public void setResult(Bookmark resultBookmark);
+
+
+ // //////////////////////////////////////
+
+
+ /**
+ * Hint that this {@link ReifiableAction} should be persisted.
+ *
+ * <p>
+ * This is most commonly done if the action being invoked has been explicitly annotated to be reified, eg
+ * using the {@link Reified} annotation. But it might also happen as a hint from another domain service.
+ * For example, a {@link BackgroundTaskService} implementations that creates persisted background tasks ought to be
+ * associated (via the {@link ReifiableAction#getTransactionId() transactionId}) to a persisted
+ * {@link ReifiableAction}. The app can then provide a mechanism for the end-user to query for their
+ * running background actions from this original {@link ReifiableAction}.
+ *
+ * <p>
+ * <b>NOT API</b>: intended to be called only by the framework.
+ */
+ @Programmatic
+ public void setReify(boolean reifyHint);
+
+ // //////////////////////////////////////
+
+ /**
+ * Generates numbers in a named sequence
+ *
+ * <p>
+ * Used to support <tt>BackgroundTaskServiceJdo</tt> and <tt>PublishingServiceJdo</tt> implementations whose
+ * persisted entities are uniquely identified by a ({@link #getTransactionId() transactionId}, <tt>sequence</tt>)
+ * tuple.
+ */
+ @Programmatic
+ public int next(final String sequenceName);
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableActionContext.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableActionContext.java b/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableActionContext.java
new file mode 100644
index 0000000..27ad878
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableActionContext.java
@@ -0,0 +1,50 @@
+/**
+ * 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.applib.services.reifiableaction;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.applib.annotation.Programmatic;
+
+/**
+ * Register this as a service in order to access context information about any {@link ReifiableAction}.
+ */
+@RequestScoped
+public class ReifiableActionContext {
+
+ @SuppressWarnings("unused")
+ private static final Logger LOG = LoggerFactory.getLogger(ReifiableActionContext.class);
+
+ private ReifiableAction reifiableAction;
+
+ @Programmatic
+ public ReifiableAction getReifiableAction() {
+ return reifiableAction;
+ }
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ * @param interaction
+ */
+ public void setReifiableAction(ReifiableAction interaction) {
+ this.reifiableAction = interaction;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableActionDefault.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableActionDefault.java b/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableActionDefault.java
new file mode 100644
index 0000000..bb8b64f
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/ReifiableActionDefault.java
@@ -0,0 +1,233 @@
+/**
+ * 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.applib.services.reifiableaction;
+
+import java.sql.Timestamp;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import com.google.common.collect.Maps;
+
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.reifiableaction.spi.ReifiableActionService;
+import org.apache.isis.applib.util.ObjectContracts;
+
+public class ReifiableActionDefault implements ReifiableAction {
+
+ public ReifiableActionDefault() {
+ setNature(ReifiableAction.Nature.INDIRECT);
+ }
+
+ // //////////////////////////////////////
+ // actionIdentifier (property)
+ // //////////////////////////////////////
+
+ private String actionIdentifier;
+ public String getActionIdentifier() {
+ return actionIdentifier;
+ }
+ @Override
+ public void setActionIdentifier(String actionIdentifier) {
+ this.actionIdentifier = actionIdentifier;
+ }
+
+ // //////////////////////////////////////
+ // targetClass (property)
+ // //////////////////////////////////////
+
+ private String targetClass;
+ public String getTargetClass() {
+ return targetClass;
+ }
+
+ @Override
+ public void setTargetClass(String targetClass) {
+ this.targetClass = targetClass;
+ }
+
+ // //////////////////////////////////////
+ // targetAction (property)
+ // //////////////////////////////////////
+
+ private String targetAction;
+ public String getTargetAction() {
+ return targetAction;
+ }
+
+ @Override
+ public void setTargetAction(String targetAction) {
+ this.targetAction = targetAction;
+ }
+
+ // //////////////////////////////////////
+ // arguments (property)
+ // //////////////////////////////////////
+
+ private String arguments;
+ public String getArguments() {
+ return arguments;
+ }
+
+ @Override
+ public void setArguments(String arguments) {
+ this.arguments = arguments;
+ }
+
+ // //////////////////////////////////////
+ // target (property)
+ // //////////////////////////////////////
+
+ private Bookmark target;
+ public Bookmark getTarget() {
+ return target;
+ }
+ @Override
+ public void setTarget(Bookmark target) {
+ this.target = target;
+ }
+
+
+ // //////////////////////////////////////
+ // startedAt (property)
+ // //////////////////////////////////////
+
+ private Timestamp startedAt;
+ public Timestamp getTimestamp() {
+ return startedAt;
+ }
+
+ @Override
+ public void setTimestamp(Timestamp startedAt) {
+ this.startedAt = startedAt;
+ }
+
+ // //////////////////////////////////////
+ // user (property)
+ // //////////////////////////////////////
+
+ private String user;
+ public String getUser() {
+ return user;
+ }
+
+ @Override
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+
+ // //////////////////////////////////////
+ // nature (property)
+ // //////////////////////////////////////
+
+ private Nature nature;
+
+ @Override
+ public Nature getNature() {
+ return nature;
+ }
+
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ *
+ * <p>
+ * Implementation notes: populated by the viewer as hint to {@link ReifiableActionService} implementation.
+ */
+ @Override
+ public void setNature(Nature nature) {
+ this.nature = nature;
+ }
+
+ // //////////////////////////////////////
+ // result (property)
+ // //////////////////////////////////////
+
+ private Bookmark result;
+
+ @Override
+ public Bookmark getResult() {
+ return result;
+ }
+ @Override
+ public void setResult(final Bookmark result) {
+ this.result = result;
+ }
+
+
+ // //////////////////////////////////////
+ // exceptionStackTrace (property)
+ // //////////////////////////////////////
+
+ private String exceptionStackTrace;
+
+ @Override
+ public String getException() {
+ return exceptionStackTrace;
+ }
+ @Override
+ public void setException(final String exceptionStackTrace) {
+ this.exceptionStackTrace = exceptionStackTrace;
+ }
+
+ // //////////////////////////////////////
+
+ @Override
+ public String toString() {
+ return ObjectContracts.toString(this, "startedAt,user,actionIdentifier,target,guid");
+ }
+
+
+ // //////////////////////////////////////
+
+ private UUID transactionId;
+
+ @Override
+ public UUID getTransactionId() {
+ return transactionId;
+ }
+ @Override
+ public void setTransactionId(UUID transactionId) {
+ this.transactionId = transactionId;
+ }
+
+
+ // //////////////////////////////////////
+
+ private final Map<String, AtomicInteger> sequenceByName = Maps.newHashMap();
+
+ @Override
+ public int next(String sequenceName) {
+ AtomicInteger next = sequenceByName.get(sequenceName);
+ if(next == null) {
+ next = new AtomicInteger(0);
+ sequenceByName.put(sequenceName, next);
+ } else {
+ next.incrementAndGet();
+ }
+ return next.get();
+ }
+
+
+ // //////////////////////////////////////
+
+ public void setReify(boolean reifyHint) {
+ // no-op
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/spi/ReifiableActionService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/spi/ReifiableActionService.java b/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/spi/ReifiableActionService.java
new file mode 100644
index 0000000..4eaee48
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/reifiableaction/spi/ReifiableActionService.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.applib.services.reifiableaction.spi;
+
+import java.util.UUID;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.services.reifiableaction.ReifiableAction;
+
+/**
+ * Intended for service to implement, providing a different implementation of
+ * {@link ReifiableAction}.
+ *
+ * <p>
+ * The default implementation (provided automatically by the framework) will
+ * instantiate an in-memory implementation of {@link ReifiableAction}. However, other
+ * services (eg as provided by the JDO objectstore) might provide a persistable
+ * {@link ReifiableAction} object.
+ */
+public interface ReifiableActionService {
+
+ @Programmatic
+ ReifiableAction create();
+
+ /**
+ * Although the transactionId is also provided in the
+ * {@link #complete(ReifiableAction)} callback, it is passed in here as well
+ * so that an implementation can ensure that the {@link ReifiableAction} is fully populated in order
+ * to persist if required.
+ *
+ * <p>
+ * One case where this may be supported (for example, by the <tt>ReifiableActionServiceJdo</tt> implementation)
+ * is to flush still-running {@link ReifiableAction}s to the database on-demand.
+ */
+ @Programmatic
+ void startTransaction(final ReifiableAction reifiableAction, final UUID transactionId);
+
+ @Programmatic
+ void complete(final ReifiableAction reifiableAction);
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/Scratchpad.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/Scratchpad.java b/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/Scratchpad.java
index d3b351a..a736397 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/Scratchpad.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/scratchpad/Scratchpad.java
@@ -24,7 +24,6 @@ import javax.enterprise.context.RequestScoped;
import com.google.common.collect.Maps;
-import org.apache.isis.applib.annotation.Bulk.InteractionContext;
import org.apache.isis.applib.annotation.Programmatic;
@RequestScoped
@@ -53,11 +52,6 @@ public class Scratchpad {
/**
* Clear any user data.
- *
- * <p>
- * Note that a new instance of {@link InteractionContext} is created for
- * any given bulk action, and so it isn't required for the user data to be
- * cleared down.
*/
@Programmatic
public void clear() {
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/applib/src/test/java/org/apache/isis/applib/services/interaction/InteractionDefaultTest_next.java
----------------------------------------------------------------------
diff --git a/core/applib/src/test/java/org/apache/isis/applib/services/interaction/InteractionDefaultTest_next.java b/core/applib/src/test/java/org/apache/isis/applib/services/interaction/InteractionDefaultTest_next.java
index ca27ad9..68ecee8 100644
--- a/core/applib/src/test/java/org/apache/isis/applib/services/interaction/InteractionDefaultTest_next.java
+++ b/core/applib/src/test/java/org/apache/isis/applib/services/interaction/InteractionDefaultTest_next.java
@@ -24,11 +24,13 @@ import static org.junit.Assert.assertThat;
import org.junit.Test;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionDefault;
+
public class InteractionDefaultTest_next {
@Test
public void test() {
- InteractionDefault interaction = new InteractionDefault();
+ ReifiableActionDefault interaction = new ReifiableActionDefault();
assertThat(interaction.next("foo"), is(0));
assertThat(interaction.next("foo"), is(1));
assertThat(interaction.next("bar"), is(0));
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/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
index 8943f3a..297fa7a 100644
--- 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
@@ -24,8 +24,8 @@ import java.util.List;
import java.util.UUID;
import org.apache.isis.applib.services.HasTransactionId;
-import org.apache.isis.applib.services.interaction.InteractionContext;
-import org.apache.isis.applib.services.interaction.spi.InteractionService;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionContext;
+import org.apache.isis.applib.services.reifiableaction.spi.ReifiableActionService;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facetapi.IdentifiedHolder;
@@ -89,7 +89,7 @@ public interface ActionInvocationFacet extends Facet {
/**
* TODO...
- * @deprecated - should instead use the InteractionContext request.
+ * @deprecated - should instead use the {@link ReifiableActionContext} request.
*/
@Deprecated
public static ThreadLocal<CurrentInvocation> currentInvocation = new ThreadLocal<CurrentInvocation>();
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/reified/ReifiedActionFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/reified/ReifiedActionFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/reified/ReifiedActionFacet.java
new file mode 100644
index 0000000..0c5cb0b
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/reified/ReifiedActionFacet.java
@@ -0,0 +1,35 @@
+/*
+ * 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.reified;
+
+import org.apache.isis.applib.services.reifiableaction.ReifiableAction;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+
+/**
+ * Indicates that details of the action should be reified as a persistent
+ * {@link ReifiableAction}, if possible.
+ *
+ * <p>
+ * In the standard Apache Isis Programming Model, corresponds to annotating the
+ * action method using <tt>@PersistedInteraction</tt>.
+ */
+public interface ReifiedActionFacet extends Facet {
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/invoke/ActionInvocationFacetViaMethod.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/invoke/ActionInvocationFacetViaMethod.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/invoke/ActionInvocationFacetViaMethod.java
index 08eb2aa..ddf7efb 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/invoke/ActionInvocationFacetViaMethod.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/invoke/ActionInvocationFacetViaMethod.java
@@ -30,8 +30,8 @@ import org.slf4j.LoggerFactory;
import org.apache.isis.applib.annotation.Bulk;
import org.apache.isis.applib.annotation.Bulk.InteractionContext.InvokedAs;
import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.interaction.Interaction;
-import org.apache.isis.applib.services.interaction.InteractionContext;
+import org.apache.isis.applib.services.reifiableaction.ReifiableAction;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionContext;
import org.apache.isis.core.commons.lang.StringExtensions;
import org.apache.isis.core.commons.lang.ThrowableExtensions;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -43,6 +43,7 @@ import org.apache.isis.core.metamodel.facets.ImperativeFacet;
import org.apache.isis.core.metamodel.facets.actions.invoke.ActionInvocationFacet;
import org.apache.isis.core.metamodel.facets.actions.invoke.ActionInvocationFacetAbstract;
import org.apache.isis.core.metamodel.facets.actions.publish.PublishedActionFacet;
+import org.apache.isis.core.metamodel.facets.actions.reified.ReifiedActionFacet;
import org.apache.isis.core.metamodel.facets.object.viewmodel.ViewModelFacet;
import org.apache.isis.core.metamodel.facets.typeof.ElementSpecificationProviderFromTypeOfFacet;
import org.apache.isis.core.metamodel.facets.typeof.TypeOfFacet;
@@ -112,8 +113,8 @@ public class ActionInvocationFacetViaMethod extends ActionInvocationFacetAbstrac
}
final Bulk.InteractionContext bulkInteractionContext = getServicesInjector().lookupService(Bulk.InteractionContext.class);
- final InteractionContext interactionContext = getServicesInjector().lookupService(InteractionContext.class);
- final Interaction interaction = interactionContext != null ? interactionContext.getInteraction() : null;
+ final ReifiableActionContext reifiableActionContext = getServicesInjector().lookupService(ReifiableActionContext.class);
+ final ReifiableAction reifiableAction = reifiableActionContext != null ? reifiableActionContext.getReifiableAction() : null;
try {
final Object[] executionParameters = new Object[arguments.length];
@@ -127,20 +128,22 @@ public class ActionInvocationFacetViaMethod extends ActionInvocationFacetAbstrac
if (bulkFacet != null &&
bulkInteractionContext != null &&
bulkInteractionContext.getInvokedAs() == null) {
+
bulkInteractionContext.setInvokedAs(InvokedAs.REGULAR);
bulkInteractionContext.setDomainObjects(Collections.singletonList(object));
}
-
- if(interaction != null) {
- if(interaction.getNature() == Interaction.Nature.ACTION_INVOCATION && owningAction != null) {
+
+
+ if(reifiableAction != null) {
+ if(reifiableAction.getNature() == ReifiableAction.Nature.USER_INITIATED && owningAction != null) {
final String actionIdentifier = owningAction.getIdentifier().toClassAndNameIdentityString();
- interaction.setActionIdentifier(actionIdentifier);
+ reifiableAction.setActionIdentifier(actionIdentifier);
String targetClassName = StringExtensions.asNaturalName2(targetAdapter.getSpecification().getSingularName());
String actionName = owningAction.getName();
- interaction.setTargetClass(targetClassName);
- interaction.setTargetAction(actionName);
+ reifiableAction.setTargetClass(targetClassName);
+ reifiableAction.setTargetAction(actionName);
final StringBuilder argsBuf = new StringBuilder();
List<ObjectActionParameter> parameters = owningAction.getParameters();
@@ -151,11 +154,14 @@ public class ActionInvocationFacetViaMethod extends ActionInvocationFacetAbstrac
appendParamArg(argsBuf, param, arguments[i++]);
}
}
- interaction.setArguments(argsBuf.toString());
+ reifiableAction.setArguments(argsBuf.toString());
+
+ final boolean reifiable = getFacetHolder().containsDoOpFacet(ReifiedActionFacet.class);
+ reifiableAction.setReify(reifiable);
}
final Bookmark bookmark = bookmarkFor(targetAdapter);
- interaction.setTarget(bookmark);
+ reifiableAction.setTarget(bookmark);
}
final Object result = method.invoke(object, executionParameters);
@@ -174,10 +180,10 @@ public class ActionInvocationFacetViaMethod extends ActionInvocationFacetAbstrac
resultAdapter.setElementSpecificationProvider(ElementSpecificationProviderFromTypeOfFacet.createFrom(typeOfFacet));
- if(interaction != null) {
+ if(reifiableAction != null) {
if(!resultAdapter.getSpecification().containsDoOpFacet(ViewModelFacet.class)) {
final Bookmark bookmark = bookmarkFor(resultAdapter);
- interaction.setResult(bookmark);
+ reifiableAction.setResult(bookmark);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/ReifiedActionFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/ReifiedActionFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/ReifiedActionFacetAbstract.java
new file mode 100644
index 0000000..aafcacc
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/ReifiedActionFacetAbstract.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.actions.reified;
+
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.MarkerFacetAbstract;
+import org.apache.isis.core.metamodel.facets.actions.reified.ReifiedActionFacet;
+
+public abstract class ReifiedActionFacetAbstract extends MarkerFacetAbstract implements ReifiedActionFacet {
+
+ public static Class<? extends Facet> type() {
+ return ReifiedActionFacet.class;
+ }
+
+ public ReifiedActionFacetAbstract(final FacetHolder holder) {
+ super(type(), holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/annotation/ReifiedActionAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/annotation/ReifiedActionAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/annotation/ReifiedActionAnnotationFacetFactory.java
new file mode 100644
index 0000000..014b3e7
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/annotation/ReifiedActionAnnotationFacetFactory.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.actions.reified.annotation;
+
+import org.apache.isis.applib.annotation.Reified;
+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.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.actions.reified.ReifiedActionFacet;
+import org.apache.isis.core.progmodel.facets.actions.invoke.ActionInvocationFacetFactory;
+
+/**
+ * {@link ReifiableFacet} can also be installed via a naming convention, see
+ * {@link ActionInvocationFacetFactory}.
+ */
+public class ReifiedActionAnnotationFacetFactory extends FacetFactoryAbstract {
+
+ public ReifiedActionAnnotationFacetFactory() {
+ super(FeatureType.ACTIONS_ONLY);
+ }
+
+ @Override
+ public void process(final ProcessMethodContext processMethodContext) {
+ final Reified annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Reified.class);
+ FacetUtil.addFacet(create(annotation, processMethodContext.getFacetHolder()));
+ }
+
+ private ReifiedActionFacet create(final Reified annotation, final FacetHolder holder) {
+ return annotation == null ? null : new ReifiedActionFacetAnnotation(holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/annotation/ReifiedActionFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/annotation/ReifiedActionFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/annotation/ReifiedActionFacetAnnotation.java
new file mode 100644
index 0000000..0669417
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/actions/reified/annotation/ReifiedActionFacetAnnotation.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.progmodel.facets.actions.reified.annotation;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.progmodel.facets.actions.reified.ReifiedActionFacetAbstract;
+
+public class ReifiedActionFacetAnnotation extends ReifiedActionFacetAbstract {
+
+ public ReifiedActionFacetAnnotation(final FacetHolder holder) {
+ super(holder);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
index f3fc8f8..f6c79e8 100644
--- a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
+++ b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
@@ -33,6 +33,7 @@ import org.apache.isis.core.progmodel.facets.actions.notinservicemenu.annotation
import org.apache.isis.core.progmodel.facets.actions.notinservicemenu.method.NotInServiceMenuMethodFacetFactory;
import org.apache.isis.core.progmodel.facets.actions.prototype.annotation.PrototypeAnnotationFacetFactory;
import org.apache.isis.core.progmodel.facets.actions.publish.PublishedActionAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.actions.reified.annotation.ReifiedActionAnnotationFacetFactory;
import org.apache.isis.core.progmodel.facets.actions.semantics.ActionSemanticsAnnotationFacetFactory;
import org.apache.isis.core.progmodel.facets.actions.semantics.ActionSemanticsFallbackFacetFactory;
import org.apache.isis.core.progmodel.facets.actions.semantics.IdempotentAnnotationFacetFactory;
@@ -345,6 +346,7 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
addFactory(NotInServiceMenuAnnotationFacetFactory.class);
addFactory(NotInServiceMenuMethodFacetFactory.class);
addFactory(BulkAnnotationFacetFactory.class);
+ addFactory(ReifiedActionAnnotationFacetFactory.class);
addFactory(HiddenAnnotationForTypeFacetFactory.class);
// must come after the TitleAnnotationFacetFactory, because can act as an override
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/reified/ReifiedActionAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/reified/ReifiedActionAnnotationFacetFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/reified/ReifiedActionAnnotationFacetFactoryTest.java
new file mode 100644
index 0000000..07b5180
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/actions/reified/ReifiedActionAnnotationFacetFactoryTest.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.actions.reified;
+
+import java.lang.reflect.Method;
+
+import org.apache.isis.applib.annotation.Reified;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessMethodContext;
+import org.apache.isis.core.metamodel.facets.actions.reified.ReifiedActionFacet;
+import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
+import org.apache.isis.core.progmodel.facets.actions.reified.ReifiedActionFacetAbstract;
+import org.apache.isis.core.progmodel.facets.actions.reified.annotation.ReifiedActionAnnotationFacetFactory;
+
+public class ReifiedActionAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
+
+ private ReifiedActionAnnotationFacetFactory facetFactory;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ facetFactory = new ReifiedActionAnnotationFacetFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ facetFactory = null;
+ super.tearDown();
+ }
+
+ public void testExplorationAnnotationPickedUp() {
+ class Customer {
+ @Reified
+ public void someAction() {
+ }
+ }
+ final Method actionMethod = findMethod(Customer.class, "someAction");
+
+ facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
+
+ final Facet facet = facetedMethod.getFacet(ReifiedActionFacet.class);
+ assertNotNull(facet);
+ assertTrue(facet instanceof ReifiedActionFacetAbstract);
+
+ assertNoMethodsRemoved();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundServiceDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundServiceDefault.java
index 39e0491..b247ddf 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundServiceDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/background/BackgroundServiceDefault.java
@@ -25,8 +25,8 @@ import org.apache.isis.applib.services.background.BackgroundService;
import org.apache.isis.applib.services.background.BackgroundTaskService;
import org.apache.isis.applib.services.bookmark.Bookmark;
import org.apache.isis.applib.services.bookmark.BookmarkService;
-import org.apache.isis.applib.services.interaction.Interaction;
-import org.apache.isis.applib.services.interaction.InteractionContext;
+import org.apache.isis.applib.services.reifiableaction.ReifiableAction;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionContext;
import org.apache.isis.core.commons.ensure.Ensure;
import org.apache.isis.core.commons.exceptions.IsisException;
import org.apache.isis.core.commons.lang.ArrayExtensions;
@@ -63,7 +63,7 @@ public class BackgroundServiceDefault implements BackgroundService {
private void ensureDependenciesInjected() {
Ensure.ensureThatState(this.bookmarkService, is(not(nullValue())), "bookmark service required");
Ensure.ensureThatState(this.backgroundTaskService, is(not(nullValue())), "background task service required");
- Ensure.ensureThatState(this.interactionContext, is(not(nullValue())), "interaction context service required");
+ Ensure.ensureThatState(this.reifiableActionContext, is(not(nullValue())), "reifiable action context service required");
}
@@ -166,15 +166,14 @@ public class BackgroundServiceDefault implements BackgroundService {
}
}
- final Interaction interaction = interactionContext.getInteraction();
+ final ReifiableAction reifiableAction = reifiableActionContext.getReifiableAction();
final ActionInvocationMemento aim =
- new ActionInvocationMemento(mementoService, interaction.getUser(),
+ new ActionInvocationMemento(mementoService, reifiableAction.getUser(),
actionId, domainObjectBookmark, argTypes, argObjs);
- final UUID transactionId = interaction.getTransactionId();
- Integer sequence = interaction.next("backgroundTaskServiceSequence");
- backgroundTaskService.execute(aim, transactionId, sequence);
+
+ backgroundTaskService.execute(aim, reifiableAction);
return null;
}
@@ -199,12 +198,12 @@ public class BackgroundServiceDefault implements BackgroundService {
this.backgroundTaskService = backgroundTaskService;
}
- private InteractionContext interactionContext;
+ private ReifiableActionContext reifiableActionContext;
/**
* Mandatory service.
*/
- public void injectInteractionContext(InteractionContext interactionContext) {
- this.interactionContext = interactionContext;
+ public void injectReifiableActionContext(ReifiableActionContext reifiableActionContext) {
+ this.reifiableActionContext = reifiableActionContext;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
index e59ed38..080f4a7 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/persistence/PersistenceSession.java
@@ -41,10 +41,10 @@ import org.apache.isis.applib.clock.Clock;
import org.apache.isis.applib.query.Query;
import org.apache.isis.applib.query.QueryDefault;
import org.apache.isis.applib.query.QueryFindAllInstances;
-import org.apache.isis.applib.services.interaction.Interaction;
-import org.apache.isis.applib.services.interaction.InteractionContext;
-import org.apache.isis.applib.services.interaction.InteractionDefault;
-import org.apache.isis.applib.services.interaction.spi.InteractionService;
+import org.apache.isis.applib.services.reifiableaction.ReifiableAction;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionContext;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionDefault;
+import org.apache.isis.applib.services.reifiableaction.spi.ReifiableActionService;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.commons.components.ApplicationScopedComponent;
import org.apache.isis.core.commons.components.SessionScopedComponent;
@@ -302,13 +302,13 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
}
private void createInteractionIfConfigured() {
- final InteractionContext ic = getServiceOrNull(InteractionContext.class);
+ final ReifiableActionContext ic = getServiceOrNull(ReifiableActionContext.class);
if(ic == null) {
return;
}
- final InteractionService interactionFactory = getServiceOrNull(InteractionService.class);
- final Interaction interaction = interactionFactory != null ? interactionFactory.create() : new InteractionDefault();
- ic.setInteraction(interaction);
+ final ReifiableActionService interactionFactory = getServiceOrNull(ReifiableActionService.class);
+ final ReifiableAction interaction = interactionFactory != null ? interactionFactory.create() : new ReifiableActionDefault();
+ ic.setReifiableAction(interaction);
if(interaction.getTimestamp() == null) {
interaction.setTimestamp(Clock.getTimeAsJavaSqlTimestamp());
@@ -330,16 +330,16 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
* Called by IsisTransactionManager on start
*/
public void startInteractionIfConfigured(final UUID transactionId) {
- final InteractionContext interactionContext = getServiceOrNull(InteractionContext.class);
- if(interactionContext == null) {
+ final ReifiableActionContext reifiableActionContext = getServiceOrNull(ReifiableActionContext.class);
+ if(reifiableActionContext == null) {
return;
}
- final InteractionService interactionFactory = getServiceOrNull(InteractionService.class);
- if(interactionFactory == null) {
+ final ReifiableActionService reifiableActionService = getServiceOrNull(ReifiableActionService.class);
+ if(reifiableActionService == null) {
return;
}
- final Interaction interaction = interactionContext.getInteraction();
- interactionFactory.startTransaction(interaction, transactionId);
+ final ReifiableAction reifiableAction = reifiableActionContext.getReifiableAction();
+ reifiableActionService.startTransaction(reifiableAction, transactionId);
}
@@ -415,11 +415,11 @@ public class PersistenceSession implements Persistor, EnlistedObjectDirtying, To
}
private void completeInteractionIfConfigured() {
- final InteractionContext interactionContext = getServiceOrNull(InteractionContext.class);
- if(interactionContext != null) {
- final InteractionService interactionFactory = getServiceOrNull(InteractionService.class);
+ final ReifiableActionContext reifiableActionContext = getServiceOrNull(ReifiableActionContext.class);
+ if(reifiableActionContext != null) {
+ final ReifiableActionService interactionFactory = getServiceOrNull(ReifiableActionService.class);
if(interactionFactory != null) {
- final Interaction interaction = interactionContext.getInteraction();
+ final ReifiableAction interaction = reifiableActionContext.getReifiableAction();
interactionFactory.complete(interaction);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
index 25c21e2..55abdc5 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
@@ -49,11 +49,11 @@ import org.apache.isis.applib.clock.Clock;
import org.apache.isis.applib.services.HasTransactionId;
import org.apache.isis.applib.services.audit.AuditingService3;
import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.interaction.Interaction;
-import org.apache.isis.applib.services.interaction.InteractionContext;
import org.apache.isis.applib.services.publish.EventMetadata;
import org.apache.isis.applib.services.publish.EventType;
import org.apache.isis.applib.services.publish.ObjectStringifier;
+import org.apache.isis.applib.services.reifiableaction.ReifiableAction;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionContext;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.commons.components.TransactionScopedComponent;
import org.apache.isis.core.commons.ensure.Ensure;
@@ -191,7 +191,7 @@ public class IsisTransaction implements TransactionScopedComponent {
/**
* the 'owning' interaction, if configured.
*/
- private final Interaction interaction;
+ private final ReifiableAction reifiableAction;
/**
* could be null if none has been registered.
@@ -203,11 +203,11 @@ public class IsisTransaction implements TransactionScopedComponent {
private final PublishingServiceWithDefaultPayloadFactories publishingService;
/**
- * Will be that of the {@link #interaction} if not <tt>null</tt>, otherwise will be randomly created.
+ * Will be that of the {@link #reifiableAction} if not <tt>null</tt>, otherwise will be randomly created.
*/
private final UUID transactionId;
/**
- * Only used if {@link #interaction} is <tt>null</tt>; generates sequence within the {@link #transactionId}
+ * Only used if {@link #reifiableAction} is <tt>null</tt>; generates sequence within the {@link #transactionId}
*/
private int publishedEventSequence;
@@ -220,7 +220,7 @@ public class IsisTransaction implements TransactionScopedComponent {
final org.apache.isis.core.commons.authentication.MessageBroker messageBroker,
final UpdateNotifier updateNotifier,
final TransactionalResource objectStore,
- final InteractionContext interactionContext,
+ final ReifiableActionContext reifiableActionContext,
final AuditingService3 auditingService3,
final PublishingServiceWithDefaultPayloadFactories publishingService) {
@@ -237,15 +237,15 @@ public class IsisTransaction implements TransactionScopedComponent {
// determine whether this xactn is taking place in the context of an
// existing interaction in which a previous xactn has already occurred.
// if so, reuse that transactionId.
- UUID previousTransactionIdWithinSameInteraction = null;
- if(interactionContext != null) {
- interaction = interactionContext.getInteraction();
- previousTransactionIdWithinSameInteraction = interaction.getTransactionId();
+ UUID previousTransactionId = null;
+ if(reifiableActionContext != null) {
+ reifiableAction = reifiableActionContext.getReifiableAction();
+ previousTransactionId = reifiableAction.getTransactionId();
} else {
- interaction = null;
+ reifiableAction = null;
}
- this.transactionId = previousTransactionIdWithinSameInteraction != null
- ? previousTransactionIdWithinSameInteraction
+ this.transactionId = previousTransactionId != null
+ ? previousTransactionId
: UUID.randomUUID();
this.state = State.IN_PROGRESS;
@@ -561,8 +561,8 @@ public class IsisTransaction implements TransactionScopedComponent {
}
private int nextEventSequence() {
- if(interaction != null) {
- return interaction.next("publishedEvent");
+ if(reifiableAction != null) {
+ return reifiableAction.next("publishedEvent");
} else {
return publishedEventSequence++;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
index 195f712..068f890 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionManager.java
@@ -36,12 +36,12 @@ import org.apache.isis.applib.annotation.PublishedAction;
import org.apache.isis.applib.annotation.PublishedObject;
import org.apache.isis.applib.annotation.PublishedObject.ChangeKind;
import org.apache.isis.applib.services.audit.AuditingService3;
-import org.apache.isis.applib.services.interaction.InteractionContext;
import org.apache.isis.applib.services.publish.EventPayload;
import org.apache.isis.applib.services.publish.EventPayloadForActionInvocation;
import org.apache.isis.applib.services.publish.EventPayloadForObjectChanged;
import org.apache.isis.applib.services.publish.EventSerializer;
import org.apache.isis.applib.services.publish.PublishingService;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionContext;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.commons.components.SessionScopedComponent;
import org.apache.isis.core.commons.debug.DebugBuilder;
@@ -67,7 +67,7 @@ public class IsisTransactionManager implements SessionScopedComponent {
/**
* Could be null if not configured as a domain service.
*/
- private final InteractionContext interactionContext;
+ private final ReifiableActionContext reifiableActionContext;
/**
* Could be null if not configured as a domain service.
*/
@@ -95,7 +95,7 @@ public class IsisTransactionManager implements SessionScopedComponent {
this.persistenceSession = persistenceSession;
this.transactionalResource = transactionalResource;
- this.interactionContext = servicesInjectorSpi.lookupService(InteractionContext.class);
+ this.reifiableActionContext = servicesInjectorSpi.lookupService(ReifiableActionContext.class);
this.auditingService3 = servicesInjectorSpi.lookupService(AuditingService3.class);
this.publishingService = getPublishingServiceIfAny(servicesInjectorSpi);
}
@@ -270,7 +270,7 @@ public class IsisTransactionManager implements SessionScopedComponent {
ensureThatArg(messageBroker, is(not(nullValue())));
ensureThatArg(updateNotifier, is(not(nullValue())));
- return new IsisTransaction(this, messageBroker, updateNotifier, transactionalResource, interactionContext, auditingService3, publishingService);
+ return new IsisTransaction(this, messageBroker, updateNotifier, transactionalResource, reifiableActionContext, auditingService3, publishingService);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/runtime/src/test/java/org/apache/isis/core/runtime/services/background/BackgroundServiceDefaultTest_execute.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/services/background/BackgroundServiceDefaultTest_execute.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/services/background/BackgroundServiceDefaultTest_execute.java
index 57a3a2f..c1df087 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/services/background/BackgroundServiceDefaultTest_execute.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/services/background/BackgroundServiceDefaultTest_execute.java
@@ -37,9 +37,9 @@ import org.apache.isis.applib.services.background.ActionInvocationMemento;
import org.apache.isis.applib.services.background.BackgroundTaskService;
import org.apache.isis.applib.services.bookmark.Bookmark;
import org.apache.isis.applib.services.bookmark.BookmarkService;
-import org.apache.isis.applib.services.interaction.Interaction;
-import org.apache.isis.applib.services.interaction.InteractionContext;
-import org.apache.isis.applib.services.interaction.InteractionDefault;
+import org.apache.isis.applib.services.reifiableaction.ReifiableAction;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionContext;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionDefault;
import org.apache.isis.core.commons.matchers.IsisMatchers;
import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
import org.apache.isis.core.metamodel.spec.feature.ObjectAction;
@@ -64,11 +64,10 @@ public class BackgroundServiceDefaultTest_execute {
private Identifier actionIdentifier;
@Mock
- private InteractionContext mockInteractionContext;
+ private ReifiableActionContext mockReifiableActionContext;
- private Interaction interaction;
- private UUID transactionId = UUID.fromString("1231231231");
- private int sequence = 2;
+ private ReifiableAction reifiableAction;
+ private UUID transactionId = UUID.randomUUID();
@Mock
private BackgroundTaskService mockBackgroundTaskService;
@@ -105,12 +104,13 @@ public class BackgroundServiceDefaultTest_execute {
}
};
backgroundService.injectBookmarkService(mockBookmarkService);
- backgroundService.injectInteractionContext(mockInteractionContext);
+ backgroundService.injectReifiableActionContext(mockReifiableActionContext);
backgroundService.injectBackgroundTaskService(mockBackgroundTaskService);
- interaction = new InteractionDefault();
- interaction.setTransactionId(transactionId);
- interaction.setUser("fbloggs");
+ reifiableAction = new ReifiableActionDefault();
+ reifiableAction.setTransactionId(transactionId);
+ reifiableAction.setUser("fbloggs");
+ reifiableAction.setTransactionId(transactionId);
context.checking(new Expectations() {
{
@@ -120,8 +120,8 @@ public class BackgroundServiceDefaultTest_execute {
allowing(mockSpec).getFullIdentifier();
will(returnValue(Customer.class.getName()));
- allowing(mockInteractionContext).getInteraction();
- will(returnValue(interaction));
+ allowing(mockReifiableActionContext).getReifiableAction();
+ will(returnValue(reifiableAction));
}
});
customer = new Customer();
@@ -150,8 +150,7 @@ public class BackgroundServiceDefaultTest_execute {
oneOf(mockBackgroundTaskService).execute(
with(x()),
- with(equalTo(transactionId)),
- with(equalTo(sequence)));
+ with(equalTo(reifiableAction)));
}
protected Matcher<ActionInvocationMemento> x() {
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
index 2ccfb64..41f2986 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/transaction/IsisTransactionTest.java
@@ -30,7 +30,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.apache.isis.applib.services.audit.AuditingService3;
-import org.apache.isis.applib.services.interaction.InteractionContext;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionContext;
import org.apache.isis.core.commons.authentication.AuthenticationSession;
import org.apache.isis.core.commons.matchers.IsisMatchers;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -72,7 +72,7 @@ public class IsisTransactionTest {
@Mock
private UpdateNotifier mockUpdateNotifier;
@Mock
- private InteractionContext mockInteractionContext;
+ private ReifiableActionContext mockReifiableActionContext;
@Mock
private AuditingService3 mockAuditingService3;
@Mock
@@ -161,7 +161,7 @@ public class IsisTransactionTest {
public void setUp() throws Exception {
org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
- context.ignoring(mockInteractionContext);
+ context.ignoring(mockReifiableActionContext);
context.ignoring(mockAuditingService3);
context.checking(new Expectations(){{
@@ -174,7 +174,7 @@ public class IsisTransactionTest {
will(returnValue("sven"));
}});
- transaction = new IsisTransaction(mockTransactionManager, mockMessageBroker, mockUpdateNotifier, mockObjectStore, mockInteractionContext, mockAuditingService3, mockPublishingService);
+ transaction = new IsisTransaction(mockTransactionManager, mockMessageBroker, mockUpdateNotifier, mockObjectStore, mockReifiableActionContext, mockAuditingService3, mockPublishingService);
transientAdapter1 = PojoAdapterBuilder.create().with(Persistence.TRANSIENT).withIdentifier("1").build();
transientAdapter2 = PojoAdapterBuilder.create().with(Persistence.TRANSIENT).withIdentifier("2").build();
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
index f165b9f..a416a21 100644
--- a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
@@ -60,11 +60,12 @@ import org.apache.isis.applib.annotation.Prototype;
import org.apache.isis.applib.annotation.PublishedAction;
import org.apache.isis.applib.annotation.PublishedObject;
import org.apache.isis.applib.annotation.RegEx;
+import org.apache.isis.applib.annotation.Reified;
import org.apache.isis.applib.annotation.SortedBy;
import org.apache.isis.applib.annotation.TypicalLength;
import org.apache.isis.applib.clock.Clock;
import org.apache.isis.applib.services.background.BackgroundService;
-import org.apache.isis.applib.services.interaction.InteractionContext;
+import org.apache.isis.applib.services.reifiableaction.ReifiableActionContext;
import org.apache.isis.applib.services.scratchpad.Scratchpad;
import org.apache.isis.applib.util.ObjectContracts;
import org.apache.isis.applib.util.TitleBuffer;
@@ -309,6 +310,7 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
this.complete = complete;
}
+ @Reified
@PublishedAction
@Bulk
public ToDoItem completed() {
@@ -335,6 +337,7 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
return isComplete() ? "Already completed" : null;
}
+ @Reified
@PublishedAction
@Bulk
public ToDoItem notYetCompleted() {
@@ -807,7 +810,7 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
@SuppressWarnings("unused")
@javax.inject.Inject
- private InteractionContext interactionContext;
+ private ReifiableActionContext reifiableActionContext;
@javax.inject.Inject
http://git-wip-us.apache.org/repos/asf/isis/blob/2463dc18/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/admin/Admin.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/admin/Admin.java b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/admin/Admin.java
index 9422758..1d50dd4 100644
--- a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/admin/Admin.java
+++ b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/admin/Admin.java
@@ -30,10 +30,10 @@ import org.apache.isis.objectstore.jdo.applib.service.audit.AuditEntryJdo;
import org.apache.isis.objectstore.jdo.applib.service.audit.AuditingServiceJdoRepository;
import org.apache.isis.objectstore.jdo.applib.service.background.BackgroundTaskJdo;
import org.apache.isis.objectstore.jdo.applib.service.background.BackgroundTaskServiceJdoRepository;
-import org.apache.isis.objectstore.jdo.applib.service.interaction.InteractionJdo;
-import org.apache.isis.objectstore.jdo.applib.service.interaction.InteractionServiceJdoRepository;
import org.apache.isis.objectstore.jdo.applib.service.publish.PublishedEventJdo;
import org.apache.isis.objectstore.jdo.applib.service.publish.PublishingServiceJdoRepository;
+import org.apache.isis.objectstore.jdo.applib.service.reifiableaction.ReifiableActionJdo;
+import org.apache.isis.objectstore.jdo.applib.service.reifiableaction.ReifiableActionServiceJdoRepository;
public class Admin extends AbstractService {
@@ -41,7 +41,7 @@ public class Admin extends AbstractService {
@MemberOrder(sequence="10.1")
@ActionSemantics(Of.SAFE)
@Prototype
- public InteractionJdo lookup(final @Named("Transaction Id") UUID transactionId) {
+ public ReifiableActionJdo lookup(final @Named("Transaction Id") UUID transactionId) {
return interactionRepository.findByTransactionId(transactionId);
}
public boolean hideLookup() {
@@ -51,7 +51,7 @@ public class Admin extends AbstractService {
@ActionSemantics(Of.SAFE)
@Bookmarkable
@MemberOrder(sequence="10.2")
- public List<InteractionJdo> currentlyRunning() {
+ public List<ReifiableActionJdo> currentlyRunning() {
return interactionRepository.findCurrent();
}
public boolean hideCurrentlyRunning() {
@@ -60,7 +60,7 @@ public class Admin extends AbstractService {
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence="10.3")
- public List<InteractionJdo> previouslyRan() {
+ public List<ReifiableActionJdo> previouslyRan() {
return interactionRepository.findCompleted();
}
public boolean hidePreviouslyRan() {
@@ -125,7 +125,7 @@ public class Admin extends AbstractService {
// //////////////////////////////////////
@javax.inject.Inject
- private InteractionServiceJdoRepository interactionRepository;
+ private ReifiableActionServiceJdoRepository interactionRepository;
@javax.inject.Inject
private BackgroundTaskServiceJdoRepository backgroundTaskRepository;