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 2016/05/02 17:49:31 UTC
[07/14] isis git commit: ISIS-1397: reworked mim.xsd as a
replacement/generalization for aim.xsd. renamed some of the methods in
applib's Interaction class,
to make more consistent with MemberInteractionMementoDto.
ISIS-1397: reworked mim.xsd as a replacement/generalization for aim.xsd. renamed some of the methods in applib's Interaction class, to make more consistent with MemberInteractionMementoDto.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/50937164
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/50937164
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/50937164
Branch: refs/heads/ISIS-1291
Commit: 509371649d66a05370464e8e3beea7c2186e4068
Parents: a29527d
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon May 2 14:31:10 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon May 2 14:31:10 2016 +0100
----------------------------------------------------------------------
.../isis/applib/services/command/Command.java | 4 +-
.../isis/applib/services/iactn/Interaction.java | 82 ++--
.../services/publish/PublisherService.java | 6 +-
.../services/publish/PublishingService.java | 5 +-
.../utils/ActionInvocationMementoDtoUtils.java | 419 ----------------
.../utils/MemberInteractionMementoDtoUtils.java | 482 +++++++++++++++++++
.../org/apache/isis/schema/utils/Roundtrip.java | 327 +++++++------
...onInvocationFacetForDomainEventAbstract.java | 4 +-
...etterOrClearFacetForDomainEventAbstract.java | 2 +-
.../background/BackgroundCommandExecution.java | 22 +-
.../command/CommandMementoServiceDefault.java | 2 +-
.../PublishingServiceInternalDefault.java | 29 +-
core/schema/pom.xml | 10 +-
.../org/apache/isis/schema/cmd/cmd-1.0.xsd | 45 +-
.../org/apache/isis/schema/mim/mim-1.0.xsd | 48 +-
15 files changed, 817 insertions(+), 670 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/50937164/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
index b4f19c6..d4d8821 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/command/Command.java
@@ -339,7 +339,7 @@ public interface Command extends HasTransactionId {
* For an command that has actually been executed, holds the exception stack
* trace if the action invocation/property modification threw an exception.
*
- * @deprecated - see {@link Interaction#getCurrentExecution()} and {@link org.apache.isis.applib.services.iactn.Interaction.Execution#getException()} instead.
+ * @deprecated - see {@link Interaction#getCurrentExecution()} and {@link org.apache.isis.applib.services.iactn.Interaction.Execution#getThrew()} instead.
*/
@Deprecated
@Optional
@@ -358,7 +358,7 @@ public interface Command extends HasTransactionId {
/**
* For an command that has actually been executed, holds a {@link Bookmark} to the object returned by the corresponding action/property modification.
*
- * @deprecated - see {@link Interaction#getCurrentExecution()} and {@link org.apache.isis.applib.services.iactn.Interaction.Execution#getResult()} instead.
+ * @deprecated - see {@link Interaction#getCurrentExecution()} and {@link org.apache.isis.applib.services.iactn.Interaction.Execution#getReturned()} instead.
*/
@Deprecated
Bookmark getResult();
http://git-wip-us.apache.org/repos/asf/isis/blob/50937164/core/applib/src/main/java/org/apache/isis/applib/services/iactn/Interaction.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/iactn/Interaction.java b/core/applib/src/main/java/org/apache/isis/applib/services/iactn/Interaction.java
index 444877f..ac4db35 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/iactn/Interaction.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/iactn/Interaction.java
@@ -24,6 +24,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicInteger;
import com.google.common.collect.Lists;
@@ -38,11 +39,13 @@ import org.apache.isis.applib.services.eventbus.EventBusService;
import org.apache.isis.applib.services.wrapper.WrapperFactory;
/**
- * Represents an action invocation or property modification, resulting in some state change of the system.
+ * Represents an action invocation or property modification, resulting in some state change of the system. It captures
+ * not only the target object and arguments passed, but also builds up the call-graph, and captures metrics, eg
+ * for profiling.
*
* <p>
* The distinction between {@link Command} and this object is perhaps subtle: the former represents the
- * intention to invoke an action/edit a property, whereas this represents the actual invocation itself.
+ * intention to invoke an action/edit a property, whereas this represents the actual invocation/edit itself.
* </p>
*
* <p>
@@ -53,9 +56,10 @@ import org.apache.isis.applib.services.wrapper.WrapperFactory;
* </p>
*
* <p>
- * NOTE: this interface might also be considered as representing the (persistence) transaction. That name was
- * not chosen however because there is also the system-level transaction that also manages the persistence of
- * the {@link Command} object.
+ * NOTE: you could also think of this interface as being analogous to the (database) transaction. The name
+ * "Transaction" has not been used for the interface not chosen however because there is also the
+ * system-level transaction that manages the persistence of
+ * the {@link Command} object itself.
* </p>
*
*/
@@ -74,9 +78,9 @@ public class Interaction implements HasTransactionId {
}
//endregion
- //region > push/pop/current/get/clear (Abstract)DomainEvents
+ //region > push/pop/current/get/clear Execution(s)
- private List<Execution> executionGraphs = Lists.newArrayList();
+ private final List<Execution> executionGraphs = Lists.newArrayList();
private Execution currentExecution;
private Execution priorExecution;
@@ -88,6 +92,11 @@ public class Interaction implements HasTransactionId {
return priorExecution;
}
+ /**
+ * Implemented by the framework (and modelled after {@link Callable}), is the implementation
+ * by which the framework actually performs the interaction.
+ * @param <T>
+ */
public interface MemberCallable<T extends MemberArgs> {
Object call(T args);
}
@@ -96,7 +105,7 @@ public class Interaction implements HasTransactionId {
private final String memberId;
- public enum Type {
+ enum Type {
PROPERTY,
ACTION
}
@@ -206,14 +215,14 @@ public class Interaction implements HasTransactionId {
try {
try {
Object result = memberCallable.call(memberArgs);
- currentExecution.setResult(result);
+ currentExecution.setReturned(result);
return (T)result;
} catch (Exception e) {
// just because an exception has thrown, does not mean it is that significant; it could be that
// it is recognized by an ExceptionRecognizer and is not severe, eg unique index violation in the DB.
RuntimeException re = e instanceof RuntimeException? (RuntimeException) e : new RuntimeException(e);
- currentExecution.setException(re);
+ currentExecution.setThrew(re);
// propagate (as in previous design); caller will need to trap and decide
throw re;
@@ -230,6 +239,7 @@ public class Interaction implements HasTransactionId {
*/
public static class Execution {
+ //region > fields, constructor
private final Timestamp startedAt;
private final MemberArgs memberArgs;
private final Execution parent;
@@ -249,24 +259,31 @@ public class Interaction implements HasTransactionId {
this.memberArgs = memberArgs;
parent.children.add(this);
}
+ //endregion
+ //region > parent
/**
* The action/property that invoked this action/property edit (if any).
*/
public Execution getParent() {
return parent;
}
+ //endregion
+ //region > children
/**
* The actions/property edits made in turn via the {@link WrapperFactory}.
*/
public List<Execution> getChildren() {
return Collections.unmodifiableList(children);
}
+ //endregion
+ //region > memberArgs
public MemberArgs getMemberArgs() {
return memberArgs;
}
+ //endregion
//region > event
@@ -320,27 +337,9 @@ public class Interaction implements HasTransactionId {
//endregion
- //region > exception (property)
-
- private RuntimeException exception;
- @Programmatic
- public RuntimeException getException() {
- return exception;
- }
+ //region > returned (property)
- /**
- * <b>NOT API</b>: intended to be called only by the framework.
- */
- public void setException(RuntimeException exception) {
- this.exception = exception;
- }
-
- //endregion
-
- //region > result (property)
-
-
- private Object result;
+ private Object returned;
/**
* The object returned by the action invocation/property edit.
*
@@ -352,20 +351,35 @@ public class Interaction implements HasTransactionId {
* For <tt>void</tt> methods and for actions returning collections, the value
* will be <tt>null</tt>.
*/
- public Object getResult() {
- return result;
+ public Object getReturned() {
+ return returned;
}
/**
* <b>NOT API</b>: intended to be called only by the framework.
*/
- public void setResult(Object result) {
- this.result = result;
+ public void setReturned(Object returned) {
+ this.returned = returned;
}
//endregion
+ //region > threw (property)
+
+ private RuntimeException threw;
+ @Programmatic
+ public RuntimeException getThrew() {
+ return threw;
+ }
+ /**
+ * <b>NOT API</b>: intended to be called only by the framework.
+ */
+ public void setThrew(RuntimeException threw) {
+ this.threw = threw;
+ }
+
+ //endregion
}
http://git-wip-us.apache.org/repos/asf/isis/blob/50937164/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherService.java b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherService.java
index 40660b5..99c9fe9 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherService.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublisherService.java
@@ -19,7 +19,7 @@
package org.apache.isis.applib.services.publish;
import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.schema.aim.v2.ActionInvocationMementoDto;
+import org.apache.isis.schema.mim.v1.MemberInteractionMementoDto;
/**
* Replaces {@link PublishingService}.
@@ -27,13 +27,13 @@ import org.apache.isis.schema.aim.v2.ActionInvocationMementoDto;
public interface PublisherService {
@Programmatic
- void publish(final ActionInvocationMementoDto aimDto);
+ void publish(final MemberInteractionMementoDto mimDto);
/**
* To support implementations that allow the republishing of commands, eg onto an JMS message bus.
*/
@Programmatic
- void republish(final ActionInvocationMementoDto aimDto);
+ void republish(final MemberInteractionMementoDto mimDto);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/50937164/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService.java b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService.java
index 0f7939b..2f9db8f 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/publish/PublishingService.java
@@ -18,10 +18,9 @@
*/
package org.apache.isis.applib.services.publish;
-
import org.apache.isis.applib.annotation.Hidden;
import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.schema.aim.v2.ActionInvocationMementoDto;
+import org.apache.isis.schema.mim.v1.MemberInteractionMementoDto;
/**
* Will be called whenever an publishable entity has changed its state, or an published action has been invoked.
@@ -45,7 +44,7 @@ public interface PublishingService {
* @param metadata
* @param payload
*
- * @deprecated - use instead {@link PublisherService#publish(ActionInvocationMementoDto)}.
+ * @deprecated - use instead {@link PublisherService#publish(MemberInteractionMementoDto)}.
*/
@Deprecated
@Programmatic
http://git-wip-us.apache.org/repos/asf/isis/blob/50937164/core/applib/src/main/java/org/apache/isis/schema/utils/ActionInvocationMementoDtoUtils.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/schema/utils/ActionInvocationMementoDtoUtils.java b/core/applib/src/main/java/org/apache/isis/schema/utils/ActionInvocationMementoDtoUtils.java
deleted file mode 100644
index 9c96fec..0000000
--- a/core/applib/src/main/java/org/apache/isis/schema/utils/ActionInvocationMementoDtoUtils.java
+++ /dev/null
@@ -1,419 +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.schema.utils;
-
-import java.io.CharArrayWriter;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.Writer;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.sql.Timestamp;
-import java.util.Collections;
-import java.util.List;
-import java.util.UUID;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.io.Resources;
-
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
-import org.joda.time.LocalDateTime;
-import org.joda.time.LocalTime;
-
-import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.applib.services.bookmark.BookmarkService;
-import org.apache.isis.schema.aim.v2.ActionInvocationDto;
-import org.apache.isis.schema.aim.v2.ActionInvocationMementoDto;
-import org.apache.isis.schema.aim.v2.ReturnDto;
-import org.apache.isis.schema.cmd.v1.ActionDto;
-import org.apache.isis.schema.cmd.v1.ParamDto;
-import org.apache.isis.schema.common.v1.OidDto;
-import org.apache.isis.schema.common.v1.PeriodDto;
-import org.apache.isis.schema.common.v1.ValueDto;
-import org.apache.isis.schema.common.v1.ValueType;
-import org.apache.isis.schema.utils.jaxbadapters.JavaSqlTimestampXmlGregorianCalendarAdapter;
-
-public final class ActionInvocationMementoDtoUtils {
-
- //region > marshalling
- static JAXBContext jaxbContext;
- static JAXBContext getJaxbContext() {
- if(jaxbContext == null) {
- try {
- jaxbContext = JAXBContext.newInstance(ActionInvocationMementoDto.class);
- } catch (JAXBException e) {
- throw new RuntimeException(e);
- }
- }
- return jaxbContext;
- }
-
- public static ActionInvocationMementoDto fromXml(final Reader reader) {
- try {
- final Unmarshaller un = getJaxbContext().createUnmarshaller();
- return (ActionInvocationMementoDto) un.unmarshal(reader);
- } catch (JAXBException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static ActionInvocationMementoDto fromXml(final String xml) {
- return fromXml(new StringReader(xml));
- }
-
- public static ActionInvocationMementoDto fromXml(
- final Class<?> contextClass,
- final String resourceName,
- final Charset charset) throws IOException {
- final URL url = Resources.getResource(contextClass, resourceName);
- final String s = Resources.toString(url, charset);
- return fromXml(new StringReader(s));
- }
-
- public static String toXml(final ActionInvocationMementoDto aimDto) {
- final CharArrayWriter caw = new CharArrayWriter();
- toXml(aimDto, caw);
- return caw.toString();
- }
-
- public static void toXml(final ActionInvocationMementoDto aimDto, final Writer writer) {
- try {
- final Marshaller m = getJaxbContext().createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(aimDto, writer);
- } catch (JAXBException e) {
- throw new RuntimeException(e);
- }
- }
- //endregion
-
- //region > newDto
-
- public static ActionInvocationMementoDto newDto(
- final UUID transactionId,
- final int sequence,
- final Bookmark targetBookmark,
- final ActionDto actionDto,
- final String title,
- final String user,
- final Timestamp startedAt, final Timestamp completedAt,
- final ReturnDto returnDto) {
-
- final ActionInvocationMementoDto aim = new ActionInvocationMementoDto();
-
- aim.setMajorVersion("2");
- aim.setMinorVersion("0");
-
- aim.setTransactionId(transactionId.toString());
-
- final ActionInvocationDto invocation = invocationFor(aim);
-
- invocation.setSequence(sequence);
- invocation.setId(aim.getTransactionId() + "." + invocation.getSequence());
-
- final OidDto target = new OidDto();
- target.setObjectType(targetBookmark.getObjectType());
- target.setObjectIdentifier(target.getObjectIdentifier());
- invocation.setTarget(target);
-
- invocation.setTitle(title);
- invocation.setUser(user);
-
- invocation.setAction(actionDto);
- invocation.setReturned(returnDto);
-
- final PeriodDto timings = timingsFor(invocation);
- timings.setStart(JavaSqlTimestampXmlGregorianCalendarAdapter.print(startedAt));
- timings.setComplete(JavaSqlTimestampXmlGregorianCalendarAdapter.print(completedAt));
-
- return aim;
- }
-
- //endregion
-
- //region > invocationFor, actionFor, timingsFor
-
- private static ActionInvocationDto invocationFor(
- final ActionInvocationMementoDto aim) {
- ActionInvocationDto invocation = aim.getInvocation();
- if(invocation == null) {
- invocation = new ActionInvocationDto();
- aim.setInvocation(invocation);
- }
- return invocation;
- }
-
- private static ActionDto actionFor(final ActionInvocationDto invocation) {
- ActionDto action = invocation.getAction();
- if(action == null) {
- action = new ActionDto();
- invocation.setAction(action);
- }
- return action;
- }
-
- private static List<ParamDto> parametersFor(final ActionInvocationMementoDto aim) {
- return parametersFor(invocationFor(aim));
- }
-
- private static List<ParamDto> parametersFor(final ActionInvocationDto invocationDto) {
- final ActionDto actionDto = actionFor(invocationDto);
- return actionDto.getParameters();
- }
-
- private static PeriodDto timingsFor(final ActionInvocationDto invocation) {
- PeriodDto timings = invocation.getTimings();
- if(timings == null) {
- timings = new PeriodDto();
- invocation.setTimings(timings);
- }
- return timings;
- }
-
- //endregion
-
- //region > addParamArg
-
- public static void addParamArg(
- final ActionInvocationMementoDto aim,
- final String parameterName,
- final Class<?> parameterType,
- final Object arg,
- final BookmarkService bookmarkService) {
-
- final List<ParamDto> params = parametersFor(aim);
- CommandMementoDtoUtils.addParamArg(params, parameterName, parameterType, arg, bookmarkService);
- }
-
- //region > addReturn
-
- /**
- *
- * @param aim
- * @param returnType - to determine the value type (if any)
- * @param result - either a value type (possibly boxed primitive), or a reference type
- * @param bookmarkService - used if not a value type
- */
- public static void addReturn(
- final ActionInvocationMementoDto aim,
- final Class<?> returnType,
- final Object result,
- final BookmarkService bookmarkService) {
- boolean isValueType = ActionInvocationMementoDtoUtils.addReturnValue(aim, returnType, result);
- if(!isValueType) {
- ActionInvocationMementoDtoUtils.addReturnReference(aim, bookmarkService.bookmarkFor(result));
- }
- }
-
- public static boolean addReturnValue(
- final ActionInvocationMementoDto aim,
- final Class<?> returnType,
- final Object returnVal) {
- final ReturnDto returnDto = returnValueDtoFor(aim);
- return setValue(returnDto, returnType, returnVal);
- }
-
- public static void addReturnReference(
- final ActionInvocationMementoDto aim,
- final Bookmark bookmark) {
- final ReturnDto returnedDto = returnValueDtoFor(aim);
- OidDto oidDto = CommonDtoUtils.asOidDto(bookmark);
- ValueDto value = new ValueDto();
- value.setReference(oidDto);
- returnedDto.setValue(value);
- returnedDto.setReturnType(ValueType.REFERENCE);
- }
-
- private static ReturnDto returnValueDtoFor(final ActionInvocationMementoDto aim) {
- ActionInvocationDto invocationDto = invocationFor(aim);
- ReturnDto returned = invocationDto.getReturned();
- if(returned == null) {
- returned = new ReturnDto();
- invocationDto.setReturned(returned);
- }
- return returned;
- }
-
- //endregion
-
-
- //region > getParameters, getParameterNames, getParameterTypes
- public static List<ParamDto> getParameters(final ActionInvocationMementoDto aim) {
- final List<ParamDto> params = parametersFor(aim);
- final int parameterNumber = getNumberOfParameters(aim);
- final List<ParamDto> paramDtos = Lists.newArrayList();
- for (int i = 0; i < parameterNumber; i++) {
- final ParamDto paramDto = params.get(i);
- paramDtos.add(paramDto);
- }
- return Collections.unmodifiableList(paramDtos);
- }
-
- private static int getNumberOfParameters(final ActionInvocationMementoDto aim) {
- final List<ParamDto> params = parametersFor(aim);
- return params != null ? params.size() : 0;
- }
-
- public static List<String> getParameterNames(final ActionInvocationMementoDto aim) {
- return immutableList(Iterables.transform(getParameters(aim), CommonDtoUtils.PARAM_DTO_TO_NAME));
- }
- public static List<ValueType> getParameterTypes(final ActionInvocationMementoDto aim) {
- return immutableList(Iterables.transform(getParameters(aim), CommonDtoUtils.PARAM_DTO_TO_TYPE));
- }
- //endregion
-
- //region > getParameter, getParameterName, getParameterType
- public static ParamDto getParameter(final ActionInvocationMementoDto aim, final int paramNum) {
- final int parameterNumber = getNumberOfParameters(aim);
- if(paramNum > parameterNumber) {
- throw new IllegalArgumentException(String.format("No such parameter %d (the memento has %d parameters)", paramNum, parameterNumber));
- }
- final List<ParamDto> parameters = getParameters(aim);
- return parameters.get(paramNum);
- }
-
- public static ValueDto getParameterArg(final ActionInvocationMementoDto aim, final int paramNum) {
- final ParamDto paramDto = getParameter(aim, paramNum);
- return CommandMementoDtoUtils.argumentFor(paramDto);
- }
-
-
- public static String getParameterName(final ActionInvocationMementoDto aim, final int paramNum) {
- return CommonDtoUtils.PARAM_DTO_TO_NAME.apply(getParameter(aim, paramNum));
- }
- public static ValueType getParameterType(final ActionInvocationMementoDto aim, final int paramNum) {
- return CommonDtoUtils.PARAM_DTO_TO_TYPE.apply(getParameter(aim, paramNum));
- }
- public static boolean isNull(final ActionInvocationMementoDto aim, int paramNum) {
- final ParamDto paramDto = getParameter(aim, paramNum);
- return paramDto.isNull();
- }
- //endregion
-
- //region > getArg
- public static <T> T getArg(final ActionInvocationMementoDto aim, int paramNum, Class<T> cls) {
- final ParamDto paramDto = getParameter(aim, paramNum);
- if(paramDto.isNull()) {
- return null;
- }
- final ValueDto valueDto = CommandMementoDtoUtils.argumentFor(paramDto);
- final ValueType parameterType = paramDto.getParameterType();
- return CommonDtoUtils.getValue(valueDto, parameterType);
- }
-
- //endregion
-
-
- private static <T> List<T> immutableList(final Iterable<T> iterable) {
- return Collections.unmodifiableList(Lists.newArrayList(iterable));
- }
-
- public static boolean setValue(
- final ReturnDto returnDto,
- final Class<?> type,
- final Object val) {
- if(val == null) {
- returnDto.setNull(true);
- return true;
- } else {
- returnDto.setNull(false);
- final ValueDto valueDto = new ValueDto();
- returnDto.setValue(valueDto);
- setValueType(returnDto, type);
- return CommonDtoUtils.setValue(valueDto, type, val);
- }
- }
-
- private static boolean setValueType(
- final ReturnDto returnDto,
- final Class<?> type) {
- if(type == String.class) {
- returnDto.setReturnType(ValueType.STRING);
- } else
- if(type == byte.class || type == Byte.class) {
- returnDto.setReturnType(ValueType.BYTE);
- } else
- if(type == short.class || type == Short.class) {
- returnDto.setReturnType(ValueType.SHORT);
- }else
- if(type == int.class || type == Integer.class) {
- returnDto.setReturnType(ValueType.INT);
- }else
- if(type == long.class || type == Long.class) {
- returnDto.setReturnType(ValueType.LONG);
- }else
- if(type == char.class || type == Character.class) {
- returnDto.setReturnType(ValueType.CHAR);
- }else
- if(type == boolean.class || type == Boolean.class) {
- returnDto.setReturnType(ValueType.BOOLEAN);
- }else
- if(type == float.class || type == Float.class) {
- returnDto.setReturnType(ValueType.FLOAT);
- }else
- if(type == double.class || type == Double.class) {
- returnDto.setReturnType(ValueType.DOUBLE);
- }else
- if(type == BigInteger.class) {
- returnDto.setReturnType(ValueType.BIG_INTEGER);
- }else
- if(type == BigDecimal.class) {
- returnDto.setReturnType(ValueType.BIG_DECIMAL);
- }else
- if(type == DateTime.class) {
- returnDto.setReturnType(ValueType.JODA_DATE_TIME);
- }else
- if(type == LocalDateTime.class) {
- returnDto.setReturnType(ValueType.JODA_LOCAL_DATE_TIME);
- }else
- if(type == LocalDate.class) {
- returnDto.setReturnType(ValueType.JODA_LOCAL_DATE);
- }else
- if(type == LocalTime.class) {
- returnDto.setReturnType(ValueType.JODA_LOCAL_TIME);
- }else
- {
- // none of the supported value types
- return false;
- }
- return true;
- }
-
-
- //endregion
-
- //region > debugging
- public static void dump(final ActionInvocationMementoDto aim, final PrintStream out) throws JAXBException {
- out.println(toXml(aim));
- }
- //endregion
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/50937164/core/applib/src/main/java/org/apache/isis/schema/utils/MemberInteractionMementoDtoUtils.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/schema/utils/MemberInteractionMementoDtoUtils.java b/core/applib/src/main/java/org/apache/isis/schema/utils/MemberInteractionMementoDtoUtils.java
new file mode 100644
index 0000000..e1a9c4b
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/schema/utils/MemberInteractionMementoDtoUtils.java
@@ -0,0 +1,482 @@
+/*
+ * 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.schema.utils;
+
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.Writer;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.sql.Timestamp;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
+
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.io.Resources;
+
+import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.LocalTime;
+
+import org.apache.isis.applib.services.bookmark.Bookmark;
+import org.apache.isis.applib.services.bookmark.BookmarkService;
+import org.apache.isis.schema.cmd.v1.ParamDto;
+import org.apache.isis.schema.common.v1.OidDto;
+import org.apache.isis.schema.common.v1.PeriodDto;
+import org.apache.isis.schema.common.v1.ValueDto;
+import org.apache.isis.schema.common.v1.ValueType;
+import org.apache.isis.schema.mim.v1.ActionInvocationDto;
+import org.apache.isis.schema.mim.v1.MemberInteractionDto;
+import org.apache.isis.schema.mim.v1.MemberInteractionMementoDto;
+import org.apache.isis.schema.mim.v1.PropertyModificationDto;
+import org.apache.isis.schema.mim.v1.ReturnDto;
+import org.apache.isis.schema.utils.jaxbadapters.JavaSqlTimestampXmlGregorianCalendarAdapter;
+
+public final class MemberInteractionMementoDtoUtils {
+
+ //region > marshalling
+ static JAXBContext jaxbContext;
+ static JAXBContext getJaxbContext() {
+ if(jaxbContext == null) {
+ try {
+ jaxbContext = JAXBContext.newInstance(MemberInteractionMementoDto.class);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return jaxbContext;
+ }
+
+ public static MemberInteractionMementoDto fromXml(final Reader reader) {
+ try {
+ final Unmarshaller un = getJaxbContext().createUnmarshaller();
+ return (MemberInteractionMementoDto) un.unmarshal(reader);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static MemberInteractionMementoDto fromXml(final String xml) {
+ return fromXml(new StringReader(xml));
+ }
+
+ public static MemberInteractionMementoDto fromXml(
+ final Class<?> contextClass,
+ final String resourceName,
+ final Charset charset) throws IOException {
+ final URL url = Resources.getResource(contextClass, resourceName);
+ final String s = Resources.toString(url, charset);
+ return fromXml(new StringReader(s));
+ }
+
+ public static String toXml(final MemberInteractionMementoDto aimDto) {
+ final CharArrayWriter caw = new CharArrayWriter();
+ toXml(aimDto, caw);
+ return caw.toString();
+ }
+
+ public static void toXml(final MemberInteractionMementoDto aimDto, final Writer writer) {
+ try {
+ final Marshaller m = getJaxbContext().createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(aimDto, writer);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ //endregion
+
+ //region > newDto
+
+ enum Type {
+ ACTION_INVOCATION,
+ PROPERTY_MODIFICATION
+ }
+
+ /**
+ *
+ * @param newValueDto - will be null if clearing the property
+ */
+ public static MemberInteractionMementoDto newPropertyDto(
+ final UUID transactionId,
+ final int sequence,
+ final Bookmark targetBookmark,
+ final String targetTitle,
+ final String propertyIdentifier,
+ final ParamDto newValueDto,
+ final String user,
+ final Timestamp startedAt, final Timestamp completedAt
+ ) {
+
+ return newDto(Type.PROPERTY_MODIFICATION, transactionId, sequence, targetBookmark, targetTitle,
+ propertyIdentifier, null, null, newValueDto,
+ user, startedAt, completedAt);
+
+ }
+
+ public static MemberInteractionMementoDto newActionDto(
+ final UUID transactionId,
+ final int sequence,
+ final Bookmark targetBookmark,
+ final String targetTitle,
+ final String actionIdentifier,
+ final List<ParamDto> parameterDtos,
+ final ReturnDto returnDto,
+ final String user,
+ final Timestamp startedAt, final Timestamp completedAt) {
+
+ return newDto(Type.ACTION_INVOCATION, transactionId, sequence, targetBookmark, targetTitle, actionIdentifier,
+ parameterDtos, returnDto, null,
+ user, startedAt, completedAt);
+ }
+
+ /**
+ * @param parameterDtos - populated only for actions
+ * @param returnDto - populated only for actions (could be null)
+ * @param newValueDto - populated only for property modificaitons
+ */
+ private static MemberInteractionMementoDto newDto(
+ final Type type,
+ final UUID transactionId,
+ final int sequence,
+ final Bookmark targetBookmark,
+ final String targetTitle,
+ final String memberIdentifier,
+ final List<ParamDto> parameterDtos,
+ final ReturnDto returnDto,
+ final ParamDto newValueDto,
+ final String user,
+ final Timestamp startedAt, final Timestamp completedAt) {
+ final MemberInteractionMementoDto mim = new MemberInteractionMementoDto();
+
+ mim.setMajorVersion("1");
+ mim.setMinorVersion("0");
+
+ mim.setTransactionId(transactionId.toString());
+
+ final MemberInteractionDto memberInteraction;
+ if(type == Type.ACTION_INVOCATION) {
+
+ final ActionInvocationDto invocation = actionInvocationFor(mim);
+ final ActionInvocationDto.Parameters parameters = invocation.getParameters();
+ parameters.getParameter().addAll(parameterDtos);
+ invocation.setReturned(returnDto);
+
+ memberInteraction = invocation;
+ } else {
+ final PropertyModificationDto modification = propertyModificationFor(mim);
+ // modification.
+
+ memberInteraction = modification;
+ }
+
+ memberInteraction.setSequence(sequence);
+ memberInteraction.setId(mim.getTransactionId() + "." + sequence);
+
+ final OidDto target = new OidDto();
+ target.setObjectType(targetBookmark.getObjectType());
+ target.setObjectIdentifier(target.getObjectIdentifier());
+ memberInteraction.setTarget(target);
+
+ memberInteraction.setTitle(targetTitle);
+ memberInteraction.setUser(user);
+
+ memberInteraction.setMemberIdentifier(memberIdentifier);
+
+ final PeriodDto timings = timingsFor(memberInteraction);
+ timings.setStart(JavaSqlTimestampXmlGregorianCalendarAdapter.print(startedAt));
+ timings.setComplete(JavaSqlTimestampXmlGregorianCalendarAdapter.print(completedAt));
+
+ return mim;
+ }
+
+ //endregion
+
+ //region > invocationFor, actionFor, timingsFor
+
+ private static ActionInvocationDto actionInvocationFor(
+ final MemberInteractionMementoDto mim) {
+ ActionInvocationDto invocation = (ActionInvocationDto) mim.getInteraction();
+ if(invocation == null) {
+ invocation = new ActionInvocationDto();
+ mim.setInteraction(invocation);
+ }
+ return invocation;
+ }
+
+ private static PropertyModificationDto propertyModificationFor(
+ final MemberInteractionMementoDto mim) {
+ PropertyModificationDto modification = (PropertyModificationDto) mim.getInteraction();
+ if(modification == null) {
+ modification = new PropertyModificationDto();
+ mim.setInteraction(modification);
+ }
+ return modification;
+ }
+
+ private static List<ParamDto> parametersFor(final MemberInteractionMementoDto mim) {
+ return parametersFor(actionInvocationFor(mim));
+ }
+
+ private static List<ParamDto> parametersFor(final ActionInvocationDto invocationDto) {
+ return invocationDto.getParameters().getParameter();
+ }
+
+ private static PeriodDto timingsFor(final MemberInteractionDto invocation) {
+ PeriodDto timings = invocation.getTimings();
+ if(timings == null) {
+ timings = new PeriodDto();
+ invocation.setTimings(timings);
+ }
+ return timings;
+ }
+
+ //endregion
+
+ //region > addParamArg
+
+ public static void addParamArg(
+ final MemberInteractionMementoDto mim,
+ final String parameterName,
+ final Class<?> parameterType,
+ final Object arg,
+ final BookmarkService bookmarkService) {
+
+ final List<ParamDto> params = parametersFor(mim);
+ CommandMementoDtoUtils.addParamArg(params, parameterName, parameterType, arg, bookmarkService);
+ }
+
+ //region > addReturn
+
+ /**
+ *
+ * @param mim
+ * @param returnType - to determine the value type (if any)
+ * @param result - either a value type (possibly boxed primitive), or a reference type
+ * @param bookmarkService - used if not a value type
+ */
+ public static void addReturn(
+ final MemberInteractionMementoDto mim,
+ final Class<?> returnType,
+ final Object result,
+ final BookmarkService bookmarkService) {
+ boolean isValueType = MemberInteractionMementoDtoUtils.addReturnValue(mim, returnType, result);
+ if(!isValueType) {
+ MemberInteractionMementoDtoUtils.addReturnReference(mim, bookmarkService.bookmarkFor(result));
+ }
+ }
+
+ public static boolean addReturnValue(
+ final MemberInteractionMementoDto mim,
+ final Class<?> returnType,
+ final Object returnVal) {
+ final ReturnDto returnDto = returnValueDtoFor(mim);
+ return setValue(returnDto, returnType, returnVal);
+ }
+
+ public static void addReturnReference(
+ final MemberInteractionMementoDto aim,
+ final Bookmark bookmark) {
+ final ReturnDto returnedDto = returnValueDtoFor(aim);
+ OidDto oidDto = CommonDtoUtils.asOidDto(bookmark);
+ ValueDto value = new ValueDto();
+ value.setReference(oidDto);
+ returnedDto.setValue(value);
+ returnedDto.setReturnType(ValueType.REFERENCE);
+ }
+
+ private static ReturnDto returnValueDtoFor(final MemberInteractionMementoDto mim) {
+ ActionInvocationDto invocationDto = actionInvocationFor(mim);
+ ReturnDto returned = invocationDto.getReturned();
+ if(returned == null) {
+ returned = new ReturnDto();
+ invocationDto.setReturned(returned);
+ }
+ return returned;
+ }
+
+ //endregion
+
+
+ //region > getParameters, getParameterNames, getParameterTypes
+ public static List<ParamDto> getParameters(final ActionInvocationDto ai) {
+ final List<ParamDto> params = parametersFor(ai);
+ final int parameterNumber = getNumberOfParameters(ai);
+ final List<ParamDto> paramDtos = Lists.newArrayList();
+ for (int i = 0; i < parameterNumber; i++) {
+ final ParamDto paramDto = params.get(i);
+ paramDtos.add(paramDto);
+ }
+ return Collections.unmodifiableList(paramDtos);
+ }
+
+ private static int getNumberOfParameters(final ActionInvocationDto ai) {
+ final List<ParamDto> params = parametersFor(ai);
+ return params != null ? params.size() : 0;
+ }
+
+ public static List<String> getParameterNames(final ActionInvocationDto ai) {
+ return immutableList(Iterables.transform(getParameters(ai), CommonDtoUtils.PARAM_DTO_TO_NAME));
+ }
+ public static List<ValueType> getParameterTypes(final ActionInvocationDto ai) {
+ return immutableList(Iterables.transform(getParameters(ai), CommonDtoUtils.PARAM_DTO_TO_TYPE));
+ }
+ //endregion
+
+ //region > getParameter, getParameterName, getParameterType
+ public static ParamDto getParameter(final ActionInvocationDto ai, final int paramNum) {
+ final int parameterNumber = getNumberOfParameters(ai);
+ if(paramNum > parameterNumber) {
+ throw new IllegalArgumentException(String.format("No such parameter %d (the memento has %d parameters)", paramNum, parameterNumber));
+ }
+ final List<ParamDto> parameters = getParameters(ai);
+ return parameters.get(paramNum);
+ }
+
+ public static ValueDto getParameterArg(final ActionInvocationDto ai, final int paramNum) {
+ final ParamDto paramDto = getParameter(ai, paramNum);
+ return CommandMementoDtoUtils.argumentFor(paramDto);
+ }
+
+
+ public static String getParameterName(final ActionInvocationDto ai, final int paramNum) {
+ return CommonDtoUtils.PARAM_DTO_TO_NAME.apply(getParameter(ai, paramNum));
+ }
+ public static ValueType getParameterType(final ActionInvocationDto ai, final int paramNum) {
+ return CommonDtoUtils.PARAM_DTO_TO_TYPE.apply(getParameter(ai, paramNum));
+ }
+ public static boolean isNull(final ActionInvocationDto ai, int paramNum) {
+ final ParamDto paramDto = getParameter(ai, paramNum);
+ return paramDto.isNull();
+ }
+ //endregion
+
+ //region > getArg
+ public static <T> T getArg(final ActionInvocationDto ai, int paramNum, Class<T> cls) {
+ final ParamDto paramDto = getParameter(ai, paramNum);
+ if(paramDto.isNull()) {
+ return null;
+ }
+ final ValueDto valueDto = CommandMementoDtoUtils.argumentFor(paramDto);
+ final ValueType parameterType = paramDto.getParameterType();
+ return CommonDtoUtils.getValue(valueDto, parameterType);
+ }
+
+ //endregion
+
+
+ private static <T> List<T> immutableList(final Iterable<T> iterable) {
+ return Collections.unmodifiableList(Lists.newArrayList(iterable));
+ }
+
+ public static boolean setValue(
+ final ReturnDto returnDto,
+ final Class<?> type,
+ final Object val) {
+ if(val == null) {
+ returnDto.setNull(true);
+ return true;
+ } else {
+ returnDto.setNull(false);
+ final ValueDto valueDto = new ValueDto();
+ returnDto.setValue(valueDto);
+ setValueType(returnDto, type);
+ return CommonDtoUtils.setValue(valueDto, type, val);
+ }
+ }
+
+ private static boolean setValueType(
+ final ReturnDto returnDto,
+ final Class<?> type) {
+ if(type == String.class) {
+ returnDto.setReturnType(ValueType.STRING);
+ } else
+ if(type == byte.class || type == Byte.class) {
+ returnDto.setReturnType(ValueType.BYTE);
+ } else
+ if(type == short.class || type == Short.class) {
+ returnDto.setReturnType(ValueType.SHORT);
+ }else
+ if(type == int.class || type == Integer.class) {
+ returnDto.setReturnType(ValueType.INT);
+ }else
+ if(type == long.class || type == Long.class) {
+ returnDto.setReturnType(ValueType.LONG);
+ }else
+ if(type == char.class || type == Character.class) {
+ returnDto.setReturnType(ValueType.CHAR);
+ }else
+ if(type == boolean.class || type == Boolean.class) {
+ returnDto.setReturnType(ValueType.BOOLEAN);
+ }else
+ if(type == float.class || type == Float.class) {
+ returnDto.setReturnType(ValueType.FLOAT);
+ }else
+ if(type == double.class || type == Double.class) {
+ returnDto.setReturnType(ValueType.DOUBLE);
+ }else
+ if(type == BigInteger.class) {
+ returnDto.setReturnType(ValueType.BIG_INTEGER);
+ }else
+ if(type == BigDecimal.class) {
+ returnDto.setReturnType(ValueType.BIG_DECIMAL);
+ }else
+ if(type == DateTime.class) {
+ returnDto.setReturnType(ValueType.JODA_DATE_TIME);
+ }else
+ if(type == LocalDateTime.class) {
+ returnDto.setReturnType(ValueType.JODA_LOCAL_DATE_TIME);
+ }else
+ if(type == LocalDate.class) {
+ returnDto.setReturnType(ValueType.JODA_LOCAL_DATE);
+ }else
+ if(type == LocalTime.class) {
+ returnDto.setReturnType(ValueType.JODA_LOCAL_TIME);
+ }else
+ {
+ // none of the supported value types
+ return false;
+ }
+ return true;
+ }
+
+
+ //endregion
+
+ //region > debugging
+ public static void dump(final MemberInteractionMementoDto mim, final PrintStream out) throws JAXBException {
+ out.println(toXml(mim));
+ }
+ //endregion
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/50937164/core/applib/src/test/java/org/apache/isis/schema/utils/Roundtrip.java
----------------------------------------------------------------------
diff --git a/core/applib/src/test/java/org/apache/isis/schema/utils/Roundtrip.java b/core/applib/src/test/java/org/apache/isis/schema/utils/Roundtrip.java
index b2a5cc7..b8d16f5 100644
--- a/core/applib/src/test/java/org/apache/isis/schema/utils/Roundtrip.java
+++ b/core/applib/src/test/java/org/apache/isis/schema/utils/Roundtrip.java
@@ -21,6 +21,7 @@ import java.io.CharArrayWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
+import java.util.Arrays;
import java.util.Date;
import java.util.UUID;
@@ -32,11 +33,12 @@ import org.joda.time.LocalTime;
import org.junit.Test;
import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.schema.aim.v2.ActionInvocationMementoDto;
-import org.apache.isis.schema.aim.v2.ReturnDto;
-import org.apache.isis.schema.cmd.v1.ActionDto;
+import org.apache.isis.schema.cmd.v1.ParamDto;
import org.apache.isis.schema.common.v1.OidDto;
import org.apache.isis.schema.common.v1.ValueType;
+import org.apache.isis.schema.mim.v1.ActionInvocationDto;
+import org.apache.isis.schema.mim.v1.MemberInteractionMementoDto;
+import org.apache.isis.schema.mim.v1.ReturnDto;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -49,8 +51,6 @@ public class Roundtrip {
public void happyCase() throws Exception {
// given
- final ActionDto actionDto = new ActionDto();
- actionDto.setActionIdentifier("com.mycompany.Customer#placeOrder");
final Timestamp startedAt = new Timestamp(new Date().getTime());
final Timestamp completedAt = new Timestamp(startedAt.getTime() + 1000);
@@ -59,257 +59,264 @@ public class Roundtrip {
returnDto.setReturnType(ValueType.BOOLEAN);
returnDto.setNull(true);
- final ActionInvocationMementoDto aim = ActionInvocationMementoDtoUtils.newDto(
+ final MemberInteractionMementoDto mim = MemberInteractionMementoDtoUtils.newActionDto(
UUID.randomUUID(),
1,
- new Bookmark("CUS", "12345"), actionDto, "John Customer", "freddyUser",
- startedAt, completedAt, returnDto);
+ new Bookmark("CUS", "12345"), "John Customer", "com.mycompany.Customer#placeOrder", Arrays.<ParamDto>asList(), returnDto, "freddyUser",
+ startedAt, completedAt);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aString", String.class, "Fred", null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullString", String.class, (String) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aString", String.class, "Fred", null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullString", String.class, (String) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aByte", Byte.class, (Byte) (byte) 123, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullByte", Byte.class, (Byte) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aByte", Byte.class, (Byte) (byte) 123, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullByte", Byte.class, (Byte) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aShort", Short.class, (Short) (short) 32123, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullShort", Short.class, (Short) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aShort", Short.class, (Short) (short) 32123, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullShort", Short.class, (Short) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "anInt", Integer.class, 123454321, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullInt", Integer.class, (Integer) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "anInt", Integer.class, 123454321, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullInt", Integer.class, (Integer) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aLong", Long.class, 1234567654321L, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullLong", Long.class, (Long) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aLong", Long.class, 1234567654321L, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullLong", Long.class, (Long) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aFloat", Float.class, 12345.6789F, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullFloat", Float.class, (Float) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aFloat", Float.class, 12345.6789F, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullFloat", Float.class, (Float) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aDouble", Double.class, 12345678.90123, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullDouble", Double.class, (Double) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aDouble", Double.class, 12345678.90123, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullDouble", Double.class, (Double) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aBoolean", Boolean.class, true, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullBoolean", Boolean.class, (Boolean) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aBoolean", Boolean.class, true, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullBoolean", Boolean.class, (Boolean) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aChar", Character.class, 'x', null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullChar", Character.class, (Character) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aChar", Character.class, 'x', null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullChar", Character.class, (Character) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aBigInteger", java.math.BigInteger.class, new java.math.BigInteger("12345678901234567890"), null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullBigInteger", java.math.BigInteger.class, (java.math.BigInteger) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aBigInteger", java.math.BigInteger.class, new java.math.BigInteger("12345678901234567890"), null);
+ MemberInteractionMementoDtoUtils
+ .addParamArg(mim, "nullBigInteger", java.math.BigInteger.class, (java.math.BigInteger) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aBigDecimal", java.math.BigDecimal.class, new java.math.BigDecimal("12345678901234567890"), null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullBigDecimal", java.math.BigDecimal.class, (java.math.BigDecimal) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aBigDecimal", java.math.BigDecimal.class, new java.math.BigDecimal("12345678901234567890"), null);
+ MemberInteractionMementoDtoUtils
+ .addParamArg(mim, "nullBigDecimal", java.math.BigDecimal.class, (java.math.BigDecimal) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aJodaDateTime", org.joda.time.DateTime.class, new org.joda.time.DateTime(2015, 5, 23, 9, 54, 1), null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullJodaDateTime", org.joda.time.DateTime.class, (org.joda.time.DateTime) null, null);
+ MemberInteractionMementoDtoUtils
+ .addParamArg(mim, "aJodaDateTime", org.joda.time.DateTime.class, new org.joda.time.DateTime(2015, 5, 23, 9, 54, 1), null);
+ MemberInteractionMementoDtoUtils
+ .addParamArg(mim, "nullJodaDateTime", org.joda.time.DateTime.class, (org.joda.time.DateTime) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aJodaLocalDate", org.joda.time.LocalDate.class, new org.joda.time.LocalDate(2015, 5, 23), null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullJodaLocalDate", org.joda.time.LocalDate.class, (org.joda.time.LocalDate) null, null);
+ MemberInteractionMementoDtoUtils
+ .addParamArg(mim, "aJodaLocalDate", org.joda.time.LocalDate.class, new org.joda.time.LocalDate(2015, 5, 23), null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullJodaLocalDate", org.joda.time.LocalDate.class, (org.joda.time.LocalDate) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aJodaLocalDateTime", org.joda.time.LocalDateTime.class, new org.joda.time.LocalDateTime(2015, 5, 23, 9, 54, 1), null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullJodaLocalDateTime", org.joda.time.LocalDateTime.class, (org.joda.time.LocalDateTime) null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aJodaLocalDateTime", org.joda.time.LocalDateTime.class, new org.joda.time.LocalDateTime(2015, 5, 23, 9, 54, 1), null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullJodaLocalDateTime", org.joda.time.LocalDateTime.class, (org.joda.time.LocalDateTime) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aJodaLocalTime", org.joda.time.LocalTime.class, new org.joda.time.LocalTime(9, 54, 1), null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullJodaLocalTime", org.joda.time.LocalTime.class, (org.joda.time.LocalTime) null, null);
+ MemberInteractionMementoDtoUtils
+ .addParamArg(mim, "aJodaLocalTime", org.joda.time.LocalTime.class, new org.joda.time.LocalTime(9, 54, 1), null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullJodaLocalTime", org.joda.time.LocalTime.class, (org.joda.time.LocalTime) null, null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "aReference", null, new Bookmark("ORD", "12345"), null);
- ActionInvocationMementoDtoUtils.addParamArg(aim, "nullReference", null, null, null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "aReference", null, new Bookmark("ORD", "12345"), null);
+ MemberInteractionMementoDtoUtils.addParamArg(mim, "nullReference", null, null, null);
// when
final CharArrayWriter caw = new CharArrayWriter();
- ActionInvocationMementoDtoUtils.toXml(aim, caw);
+ MemberInteractionMementoDtoUtils.toXml(mim, caw);
- ActionInvocationMementoDtoUtils.dump(aim, System.out);
+ MemberInteractionMementoDtoUtils.dump(mim, System.out);
final CharArrayReader reader = new CharArrayReader(caw.toCharArray());
- final ActionInvocationMementoDto recreated = ActionInvocationMementoDtoUtils.fromXml(reader);
+ final MemberInteractionMementoDto recreated = MemberInteractionMementoDtoUtils.fromXml(reader);
// then
- assertThat(recreated.getInvocation().getAction().getActionIdentifier(), Matchers.is(aim.getInvocation().getAction().getActionIdentifier()));
- assertThat(recreated.getInvocation().getTarget().getObjectType(), Matchers.is(aim.getInvocation().getTarget().getObjectType()));
- assertThat(recreated.getInvocation().getTarget().getObjectIdentifier(), Matchers.is(aim.getInvocation().getTarget().getObjectIdentifier()));
+ assertThat(recreated.getInteraction().getMemberIdentifier(), Matchers.is(mim.getInteraction().getMemberIdentifier()));
+ assertThat(recreated.getInteraction().getTarget().getObjectType(), Matchers.is(mim.getInteraction().getTarget().getObjectType()));
+ assertThat(recreated.getInteraction().getTarget().getObjectIdentifier(), Matchers.is(mim.getInteraction().getTarget().getObjectIdentifier()));
+ final ActionInvocationDto invocationDto = (ActionInvocationDto) recreated.getInteraction();
int param = 0;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aString"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.STRING));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, String.class), is("Fred"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aString"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.STRING));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, String.class), is("Fred"));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullString"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.STRING));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, String.class), is(nullValue()));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullString"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.STRING));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, String.class), is(nullValue()));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aByte"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.BYTE));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, Byte.class), is((byte) 123));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aByte"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BYTE));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, Byte.class), is((byte) 123));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.BYTE));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullByte"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BYTE));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullByte"));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aShort"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.SHORT));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, Short.class), is((short) 32123));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aShort"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.SHORT));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, Short.class), is((short) 32123));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullShort"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.SHORT));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullShort"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.SHORT));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("anInt"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.INT));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, int.class), is((int) 123454321));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("anInt"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.INT));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, int.class), is((int) 123454321));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullInt"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.INT));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullInt"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.INT));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aLong"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.LONG));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, long.class), is((long) 1234567654321L));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aLong"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.LONG));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, long.class), is((long) 1234567654321L));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullLong"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.LONG));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullLong"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.LONG));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aFloat"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.FLOAT));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, float.class), is((float) 12345.6789F));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aFloat"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.FLOAT));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, float.class), is((float) 12345.6789F));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullFloat"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.FLOAT));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullFloat"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.FLOAT));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aDouble"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.DOUBLE));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, double.class), is(12345678.90123));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aDouble"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.DOUBLE));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, double.class), is(12345678.90123));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullDouble"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.DOUBLE));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullDouble"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.DOUBLE));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aBoolean"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.BOOLEAN));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, boolean.class), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aBoolean"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BOOLEAN));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, boolean.class), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullBoolean"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.BOOLEAN));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullBoolean"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BOOLEAN));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aChar"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.CHAR));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, char.class), is('x'));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aChar"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.CHAR));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, char.class), is('x'));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullChar"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.CHAR));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullChar"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.CHAR));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aBigInteger"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.BIG_INTEGER));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, BigInteger.class), is(new java.math.BigInteger("12345678901234567890")));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aBigInteger"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BIG_INTEGER));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, BigInteger.class), is(new java.math.BigInteger("12345678901234567890")));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullBigInteger"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.BIG_INTEGER));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullBigInteger"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BIG_INTEGER));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aBigDecimal"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.BIG_DECIMAL));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, BigDecimal.class), is(new java.math.BigDecimal("12345678901234567890")));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aBigDecimal"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BIG_DECIMAL));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, BigDecimal.class), is(new java.math.BigDecimal("12345678901234567890")));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullBigDecimal"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.BIG_DECIMAL));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullBigDecimal"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BIG_DECIMAL));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aJodaDateTime"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.JODA_DATE_TIME));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aJodaDateTime"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_DATE_TIME));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
// bit hacky... regular comparison fails but toString() works... must be some additional data that differs, not sure what tho'
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, DateTime.class).toString(), is(new DateTime(2015, 5, 23, 9, 54, 1).toString()));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, DateTime.class).toString(), is(new DateTime(2015, 5, 23, 9, 54, 1).toString()));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullJodaDateTime"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.JODA_DATE_TIME));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));;
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullJodaDateTime"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_DATE_TIME));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));;
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aJodaLocalDate"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.JODA_LOCAL_DATE));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- final LocalDate actual = ActionInvocationMementoDtoUtils.getArg(recreated, param, LocalDate.class);
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aJodaLocalDate"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_DATE));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ final LocalDate actual = MemberInteractionMementoDtoUtils.getArg(invocationDto, param, LocalDate.class);
final LocalDate expected = new LocalDate(2015, 5, 23);
assertThat(actual, equalTo(expected));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullJodaLocalDate"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.JODA_LOCAL_DATE));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullJodaLocalDate"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_DATE));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aJodaLocalDateTime"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.JODA_LOCAL_DATE_TIME));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, LocalDateTime.class), is(new org.joda.time.LocalDateTime(2015, 5, 23, 9, 54, 1)));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aJodaLocalDateTime"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_DATE_TIME));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, LocalDateTime.class), is(new org.joda.time.LocalDateTime(2015, 5, 23, 9, 54, 1)));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullJodaLocalDateTime"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.JODA_LOCAL_DATE_TIME));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullJodaLocalDateTime"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_DATE_TIME));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aJodaLocalTime"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.JODA_LOCAL_TIME));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, LocalTime.class), is(new org.joda.time.LocalTime(9, 54, 1)));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aJodaLocalTime"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_TIME));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, LocalTime.class), is(new org.joda.time.LocalTime(9, 54, 1)));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullJodaLocalTime"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.JODA_LOCAL_TIME));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullJodaLocalTime"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_TIME));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("aReference"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.REFERENCE));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(false));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, OidDto.class).getObjectType(), is("ORD"));
- assertThat(ActionInvocationMementoDtoUtils.getArg(recreated, param, OidDto.class).getObjectIdentifier(), is("12345"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("aReference"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.REFERENCE));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, OidDto.class).getObjectType(), is("ORD"));
+ assertThat(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, OidDto.class).getObjectIdentifier(), is("12345"));
param++;
- assertThat(ActionInvocationMementoDtoUtils.getParameterName(recreated, param), is("nullReference"));
- assertThat(ActionInvocationMementoDtoUtils.getParameterType(recreated, param), Matchers.is(ValueType.REFERENCE));
- assertThat(ActionInvocationMementoDtoUtils.isNull(recreated, param), is(true));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullReference"));
+ assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.REFERENCE));
+ assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
param++;
// final int expected = param;
http://git-wip-us.apache.org/repos/asf/isis/blob/50937164/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionInvocationFacetForDomainEventAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionInvocationFacetForDomainEventAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionInvocationFacetForDomainEventAbstract.java
index f40cd95..c0d4346 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionInvocationFacetForDomainEventAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionInvocationFacetForDomainEventAbstract.java
@@ -355,12 +355,12 @@ public abstract class ActionInvocationFacetForDomainEventAbstract
final Interaction.Execution priorExecution = interaction.getPriorExecution();
- final RuntimeException executionExceptionIfAny = priorExecution.getException();
+ final RuntimeException executionExceptionIfAny = priorExecution.getThrew();
if(executionExceptionIfAny != null) {
throw executionExceptionIfAny;
}
- resultAdapter = getAdapterManager().adapterFor(priorExecution.getResult());
+ resultAdapter = getAdapterManager().adapterFor(priorExecution.getReturned());
setCommandResultIfEntity(command, resultAdapter);
final PublishedActionFacet publishedActionFacet = getIdentified().getFacet(PublishedActionFacet.class);