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:33 UTC
[09/14] isis git commit: ISIS-1397: bringing applib Interaction and
MemberInteractionMementoDto closer into line; to whit...
ISIS-1397: bringing applib Interaction and MemberInteractionMementoDto closer into line; to whit...
- renamed mim.xsd to ixn.xsd
- renamed MemberInteractionMementoDto to just InteractionDto (cf applib's Interaction)
- renamed MemberInteractionDto to just InteractionExecutionDto (cf applib's Interaction.Execution)
- moved subExecutions to InteractionExecutionDto
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/1222341a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/1222341a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/1222341a
Branch: refs/heads/ISIS-1291
Commit: 1222341ab50976d3baf37f94a16b014cb475fa87
Parents: 5093716
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon May 2 15:00:16 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon May 2 15:00:16 2016 +0100
----------------------------------------------------------------------
.../services/publish/PublisherService.java | 12 +-
.../services/publish/PublishingService.java | 3 +-
.../isis/schema/utils/InteractionDtoUtils.java | 479 ++++++++++++++++++
.../utils/MemberInteractionMementoDtoUtils.java | 482 -------------------
.../org/apache/isis/schema/utils/Roundtrip.java | 328 ++++++-------
.../PublishingServiceInternalDefault.java | 16 +-
core/schema/pom.xml | 10 +-
.../apache/isis/schema/ixn/ixn-1.0-binding.xml | 66 +++
.../org/apache/isis/schema/ixn/ixn-1.0.xsd | 197 ++++++++
.../apache/isis/schema/mim/mim-1.0-binding.xml | 66 ---
.../org/apache/isis/schema/mim/mim-1.0.xsd | 191 --------
11 files changed, 926 insertions(+), 924 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/1222341a/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 99c9fe9..6bc5ba7 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,22 +19,20 @@
package org.apache.isis.applib.services.publish;
import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.schema.mim.v1.MemberInteractionMementoDto;
+import org.apache.isis.schema.ixn.v1.InteractionDto;
/**
* Replaces {@link PublishingService}.
*/
public interface PublisherService {
- @Programmatic
- void publish(final MemberInteractionMementoDto mimDto);
-
/**
- * To support implementations that allow the republishing of commands, eg onto an JMS message bus.
+ * Can also be used for republishing.
*/
@Programmatic
- void republish(final MemberInteractionMementoDto mimDto);
-
+ void publish(final InteractionDto interactionDto);
+
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1222341a/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 2f9db8f..e223d10 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
@@ -20,7 +20,6 @@ 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.mim.v1.MemberInteractionMementoDto;
/**
* Will be called whenever an publishable entity has changed its state, or an published action has been invoked.
@@ -44,7 +43,7 @@ public interface PublishingService {
* @param metadata
* @param payload
*
- * @deprecated - use instead {@link PublisherService#publish(MemberInteractionMementoDto)}.
+ * @deprecated - use instead {@link PublisherService#publish(org.apache.isis.schema.ixn.v1.InteractionDto)}.
*/
@Deprecated
@Programmatic
http://git-wip-us.apache.org/repos/asf/isis/blob/1222341a/core/applib/src/main/java/org/apache/isis/schema/utils/InteractionDtoUtils.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/schema/utils/InteractionDtoUtils.java b/core/applib/src/main/java/org/apache/isis/schema/utils/InteractionDtoUtils.java
new file mode 100644
index 0000000..6459b4a
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/schema/utils/InteractionDtoUtils.java
@@ -0,0 +1,479 @@
+/*
+ * 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.ixn.v1.ActionInvocationDto;
+import org.apache.isis.schema.ixn.v1.InteractionDto;
+import org.apache.isis.schema.ixn.v1.InteractionExecutionDto;
+import org.apache.isis.schema.ixn.v1.PropertyModificationDto;
+import org.apache.isis.schema.ixn.v1.ReturnDto;
+import org.apache.isis.schema.utils.jaxbadapters.JavaSqlTimestampXmlGregorianCalendarAdapter;
+
+public final class InteractionDtoUtils {
+
+ //region > marshalling
+ static JAXBContext jaxbContext;
+ static JAXBContext getJaxbContext() {
+ if(jaxbContext == null) {
+ try {
+ jaxbContext = JAXBContext.newInstance(InteractionDto.class);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return jaxbContext;
+ }
+
+ public static InteractionDto fromXml(final Reader reader) {
+ try {
+ final Unmarshaller un = getJaxbContext().createUnmarshaller();
+ return (InteractionDto) un.unmarshal(reader);
+ } catch (JAXBException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static InteractionDto fromXml(final String xml) {
+ return fromXml(new StringReader(xml));
+ }
+
+ public static InteractionDto 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 InteractionDto interactionDto) {
+ final CharArrayWriter caw = new CharArrayWriter();
+ toXml(interactionDto, caw);
+ return caw.toString();
+ }
+
+ public static void toXml(final InteractionDto interactionDto, final Writer writer) {
+ try {
+ final Marshaller m = getJaxbContext().createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(interactionDto, 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 InteractionDto 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 InteractionDto 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 InteractionDto 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 InteractionDto interactionDto = new InteractionDto();
+
+ interactionDto.setMajorVersion("1");
+ interactionDto.setMinorVersion("0");
+
+ interactionDto.setTransactionId(transactionId.toString());
+
+ final InteractionExecutionDto executionDto;
+ if(type == Type.ACTION_INVOCATION) {
+
+ final ActionInvocationDto invocation = actionInvocationFor(interactionDto);
+ final ActionInvocationDto.Parameters parameters = invocation.getParameters();
+ parameters.getParameter().addAll(parameterDtos);
+ invocation.setReturned(returnDto);
+
+ executionDto = invocation;
+ } else {
+ final PropertyModificationDto modification = propertyModificationFor(interactionDto);
+ // modification.
+
+ executionDto = modification;
+ }
+
+ executionDto.setSequence(sequence);
+ executionDto.setId(interactionDto.getTransactionId() + "." + sequence);
+
+ final OidDto target = new OidDto();
+ target.setObjectType(targetBookmark.getObjectType());
+ target.setObjectIdentifier(target.getObjectIdentifier());
+ executionDto.setTarget(target);
+
+ executionDto.setTitle(targetTitle);
+ executionDto.setUser(user);
+
+ executionDto.setMemberIdentifier(memberIdentifier);
+
+ final PeriodDto timings = timingsFor(executionDto);
+ timings.setStart(JavaSqlTimestampXmlGregorianCalendarAdapter.print(startedAt));
+ timings.setComplete(JavaSqlTimestampXmlGregorianCalendarAdapter.print(completedAt));
+
+ return interactionDto;
+ }
+
+ //endregion
+
+ //region > invocationFor, actionFor, timingsFor
+
+ private static ActionInvocationDto actionInvocationFor(final InteractionDto interactionDto) {
+ ActionInvocationDto invocation = (ActionInvocationDto) interactionDto.getExecution();
+ if(invocation == null) {
+ invocation = new ActionInvocationDto();
+ interactionDto.setExecution(invocation);
+ }
+ return invocation;
+ }
+
+ private static PropertyModificationDto propertyModificationFor(final InteractionDto interactionDto) {
+ PropertyModificationDto modification = (PropertyModificationDto) interactionDto.getExecution();
+ if(modification == null) {
+ modification = new PropertyModificationDto();
+ interactionDto.setExecution(modification);
+ }
+ return modification;
+ }
+
+ private static List<ParamDto> parametersFor(final InteractionDto ixnDto) {
+ return parametersFor(actionInvocationFor(ixnDto));
+ }
+
+ private static List<ParamDto> parametersFor(final ActionInvocationDto invocationDto) {
+ return invocationDto.getParameters().getParameter();
+ }
+
+ private static PeriodDto timingsFor(final InteractionExecutionDto executionDto) {
+ PeriodDto timings = executionDto.getTimings();
+ if(timings == null) {
+ timings = new PeriodDto();
+ executionDto.setTimings(timings);
+ }
+ return timings;
+ }
+
+ //endregion
+
+ //region > addParamArg
+
+ public static void addParamArg(
+ final InteractionDto ixn,
+ final String parameterName,
+ final Class<?> parameterType,
+ final Object arg,
+ final BookmarkService bookmarkService) {
+
+ final List<ParamDto> params = parametersFor(ixn);
+ CommandMementoDtoUtils.addParamArg(params, parameterName, parameterType, arg, bookmarkService);
+ }
+
+ //region > addReturn
+
+ /**
+ *
+ * @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 InteractionDto interactionDto,
+ final Class<?> returnType,
+ final Object result,
+ final BookmarkService bookmarkService) {
+ boolean isValueType = InteractionDtoUtils.addReturnValue(interactionDto, returnType, result);
+ if(!isValueType) {
+ InteractionDtoUtils.addReturnReference(interactionDto, bookmarkService.bookmarkFor(result));
+ }
+ }
+
+ public static boolean addReturnValue(
+ final InteractionDto interactionDto,
+ final Class<?> returnType,
+ final Object returnVal) {
+ final ReturnDto returnDto = returnValueDtoFor(interactionDto);
+ return setValue(returnDto, returnType, returnVal);
+ }
+
+ public static void addReturnReference(
+ final InteractionDto interactionDto,
+ final Bookmark bookmark) {
+ final ReturnDto returnedDto = returnValueDtoFor(interactionDto);
+ OidDto oidDto = CommonDtoUtils.asOidDto(bookmark);
+ ValueDto value = new ValueDto();
+ value.setReference(oidDto);
+ returnedDto.setValue(value);
+ returnedDto.setReturnType(ValueType.REFERENCE);
+ }
+
+ private static ReturnDto returnValueDtoFor(final InteractionDto ixnDto) {
+ ActionInvocationDto invocationDto = actionInvocationFor(ixnDto);
+ 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 InteractionDto ixnDto, final PrintStream out) throws JAXBException {
+ out.println(toXml(ixnDto));
+ }
+ //endregion
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/1222341a/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
deleted file mode 100644
index e1a9c4b..0000000
--- a/core/applib/src/main/java/org/apache/isis/schema/utils/MemberInteractionMementoDtoUtils.java
+++ /dev/null
@@ -1,482 +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.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/1222341a/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 b8d16f5..22b0c68 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
@@ -36,9 +36,9 @@ import org.apache.isis.applib.services.bookmark.Bookmark;
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 org.apache.isis.schema.ixn.v1.ActionInvocationDto;
+import org.apache.isis.schema.ixn.v1.InteractionDto;
+import org.apache.isis.schema.ixn.v1.ReturnDto;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
@@ -59,264 +59,266 @@ public class Roundtrip {
returnDto.setReturnType(ValueType.BOOLEAN);
returnDto.setNull(true);
- final MemberInteractionMementoDto mim = MemberInteractionMementoDtoUtils.newActionDto(
+ final InteractionDto interactionDto = InteractionDtoUtils.newActionDto(
UUID.randomUUID(),
1,
new Bookmark("CUS", "12345"), "John Customer", "com.mycompany.Customer#placeOrder", Arrays.<ParamDto>asList(), returnDto, "freddyUser",
startedAt, completedAt);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "aString", String.class, "Fred", null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "nullString", String.class, (String) null, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "aString", String.class, "Fred", null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullString", String.class, (String) null, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "aByte", Byte.class, (Byte) (byte) 123, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "nullByte", Byte.class, (Byte) null, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "aByte", Byte.class, (Byte) (byte) 123, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullByte", Byte.class, (Byte) null, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "aShort", Short.class, (Short) (short) 32123, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "nullShort", Short.class, (Short) null, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "aShort", Short.class, (Short) (short) 32123, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullShort", Short.class, (Short) null, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "anInt", Integer.class, 123454321, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "nullInt", Integer.class, (Integer) null, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "anInt", Integer.class, 123454321, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullInt", Integer.class, (Integer) null, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "aLong", Long.class, 1234567654321L, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "nullLong", Long.class, (Long) null, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "aLong", Long.class, 1234567654321L, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullLong", Long.class, (Long) null, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "aFloat", Float.class, 12345.6789F, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "nullFloat", Float.class, (Float) null, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "aFloat", Float.class, 12345.6789F, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullFloat", Float.class, (Float) null, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "aDouble", Double.class, 12345678.90123, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "nullDouble", Double.class, (Double) null, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "aDouble", Double.class, 12345678.90123, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullDouble", Double.class, (Double) null, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "aBoolean", Boolean.class, true, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "nullBoolean", Boolean.class, (Boolean) null, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "aBoolean", Boolean.class, true, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullBoolean", Boolean.class, (Boolean) null, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "aChar", Character.class, 'x', null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "nullChar", Character.class, (Character) null, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "aChar", Character.class, 'x', null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullChar", Character.class, (Character) 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);
+ InteractionDtoUtils.addParamArg(interactionDto, "aBigInteger", java.math.BigInteger.class, new java.math.BigInteger("12345678901234567890"), null);
+ InteractionDtoUtils
+ .addParamArg(interactionDto, "nullBigInteger", java.math.BigInteger.class, (java.math.BigInteger) 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);
+ InteractionDtoUtils.addParamArg(interactionDto, "aBigDecimal", java.math.BigDecimal.class, new java.math.BigDecimal("12345678901234567890"), null);
+ InteractionDtoUtils
+ .addParamArg(interactionDto, "nullBigDecimal", java.math.BigDecimal.class, (java.math.BigDecimal) 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);
+ InteractionDtoUtils
+ .addParamArg(interactionDto, "aJodaDateTime", org.joda.time.DateTime.class, new org.joda.time.DateTime(2015, 5, 23, 9, 54, 1), null);
+ InteractionDtoUtils
+ .addParamArg(interactionDto, "nullJodaDateTime", org.joda.time.DateTime.class, (org.joda.time.DateTime) 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);
+ InteractionDtoUtils
+ .addParamArg(interactionDto, "aJodaLocalDate", org.joda.time.LocalDate.class, new org.joda.time.LocalDate(2015, 5, 23), null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullJodaLocalDate", org.joda.time.LocalDate.class, (org.joda.time.LocalDate) 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);
+ InteractionDtoUtils.addParamArg(interactionDto, "aJodaLocalDateTime", org.joda.time.LocalDateTime.class, new org.joda.time.LocalDateTime(2015, 5, 23, 9, 54, 1), null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullJodaLocalDateTime", org.joda.time.LocalDateTime.class, (org.joda.time.LocalDateTime) 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);
+ InteractionDtoUtils
+ .addParamArg(interactionDto, "aJodaLocalTime", org.joda.time.LocalTime.class, new org.joda.time.LocalTime(9, 54, 1), null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullJodaLocalTime", org.joda.time.LocalTime.class, (org.joda.time.LocalTime) null, null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "aReference", null, new Bookmark("ORD", "12345"), null);
- MemberInteractionMementoDtoUtils.addParamArg(mim, "nullReference", null, null, null);
+ InteractionDtoUtils.addParamArg(interactionDto, "aReference", null, new Bookmark("ORD", "12345"), null);
+ InteractionDtoUtils.addParamArg(interactionDto, "nullReference", null, null, null);
// when
final CharArrayWriter caw = new CharArrayWriter();
- MemberInteractionMementoDtoUtils.toXml(mim, caw);
+ InteractionDtoUtils.toXml(interactionDto, caw);
- MemberInteractionMementoDtoUtils.dump(mim, System.out);
+ InteractionDtoUtils.dump(interactionDto, System.out);
final CharArrayReader reader = new CharArrayReader(caw.toCharArray());
- final MemberInteractionMementoDto recreated = MemberInteractionMementoDtoUtils.fromXml(reader);
+ final InteractionDto recreated = InteractionDtoUtils.fromXml(reader);
// then
- 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()));
+ assertThat(recreated.getExecution().getMemberIdentifier(), Matchers.is(interactionDto.getExecution().getMemberIdentifier()));
+ assertThat(recreated.getExecution().getTarget().getObjectType(), Matchers.is(interactionDto.getExecution().getTarget().getObjectType()));
+ assertThat(recreated.getExecution().getTarget().getObjectIdentifier(), Matchers.is(interactionDto.getExecution().getTarget().getObjectIdentifier()));
- final ActionInvocationDto invocationDto = (ActionInvocationDto) recreated.getInteraction();
+ final ActionInvocationDto invocationDto = (ActionInvocationDto) recreated.getExecution();
int param = 0;
- 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"));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aString"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.STRING));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, String.class), is("Fred"));
param++;
- 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()));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullString"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.STRING));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, String.class), is(nullValue()));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aByte"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BYTE));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, Byte.class), is((byte) 123));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BYTE));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullByte"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BYTE));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullByte"));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aShort"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.SHORT));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, Short.class), is((short) 32123));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullShort"));
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.SHORT));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullShort"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.SHORT));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("anInt"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.INT));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, int.class), is((int) 123454321));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullInt"));
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.INT));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullInt"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.INT));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aLong"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.LONG));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, long.class), is((long) 1234567654321L));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullLong"));
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.LONG));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullLong"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.LONG));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aFloat"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.FLOAT));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, float.class), is((float) 12345.6789F));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullFloat"));
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.FLOAT));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullFloat"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.FLOAT));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aDouble"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.DOUBLE));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, double.class), is(12345678.90123));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullDouble"));
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.DOUBLE));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullDouble"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.DOUBLE));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aBoolean"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BOOLEAN));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, boolean.class), is(true));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullBoolean"));
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BOOLEAN));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullBoolean"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BOOLEAN));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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'));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aChar"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.CHAR));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, char.class), is('x'));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullChar"));
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.CHAR));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullChar"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.CHAR));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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")));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aBigInteger"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BIG_INTEGER));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, BigInteger.class), is(new java.math.BigInteger("12345678901234567890")));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullBigInteger"));
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BIG_INTEGER));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullBigInteger"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BIG_INTEGER));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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")));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aBigDecimal"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BIG_DECIMAL));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, BigDecimal.class), is(new java.math.BigDecimal("12345678901234567890")));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullBigDecimal"));
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BIG_DECIMAL));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullBigDecimal"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.BIG_DECIMAL));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aJodaDateTime"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_DATE_TIME));
+ assertThat(InteractionDtoUtils.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(MemberInteractionMementoDtoUtils.getArg(invocationDto, param, DateTime.class).toString(), is(new DateTime(2015, 5, 23, 9, 54, 1).toString()));
+ assertThat(
+ InteractionDtoUtils.getArg(invocationDto, param, DateTime.class).toString(), is(new DateTime(2015, 5, 23, 9, 54, 1).toString()));
param++;
- 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));;
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullJodaDateTime"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_DATE_TIME));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));;
param++;
- 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);
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aJodaLocalDate"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_DATE));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ final LocalDate actual = InteractionDtoUtils.getArg(invocationDto, param, LocalDate.class);
final LocalDate expected = new LocalDate(2015, 5, 23);
assertThat(actual, equalTo(expected));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullJodaLocalDate"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_DATE));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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)));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aJodaLocalDateTime"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_DATE_TIME));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, LocalDateTime.class), is(new org.joda.time.LocalDateTime(2015, 5, 23, 9, 54, 1)));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullJodaLocalDateTime"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_DATE_TIME));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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)));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aJodaLocalTime"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_TIME));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(
+ InteractionDtoUtils.getArg(invocationDto, param, LocalTime.class), is(new org.joda.time.LocalTime(9, 54, 1)));
param++;
- 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));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullJodaLocalTime"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.JODA_LOCAL_TIME));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
- 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"));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("aReference"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.REFERENCE));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(false));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, OidDto.class).getObjectType(), is("ORD"));
+ assertThat(InteractionDtoUtils.getArg(invocationDto, param, OidDto.class).getObjectIdentifier(), is("12345"));
param++;
- assertThat(MemberInteractionMementoDtoUtils.getParameterName(invocationDto, param), is("nullReference"));
- assertThat(MemberInteractionMementoDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.REFERENCE));
- assertThat(MemberInteractionMementoDtoUtils.isNull(invocationDto, param), is(true));
+ assertThat(InteractionDtoUtils.getParameterName(invocationDto, param), is("nullReference"));
+ assertThat(InteractionDtoUtils.getParameterType(invocationDto, param), Matchers.is(ValueType.REFERENCE));
+ assertThat(InteractionDtoUtils.isNull(invocationDto, param), is(true));
param++;
// final int expected = param;
http://git-wip-us.apache.org/repos/asf/isis/blob/1222341a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publishing/PublishingServiceInternalDefault.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publishing/PublishingServiceInternalDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publishing/PublishingServiceInternalDefault.java
index f63da20..9064bb8 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publishing/PublishingServiceInternalDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/publishing/PublishingServiceInternalDefault.java
@@ -72,9 +72,9 @@ import org.apache.isis.core.runtime.system.context.IsisContext;
import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
import org.apache.isis.schema.cmd.v1.ActionDto;
-import org.apache.isis.schema.mim.v1.MemberInteractionMementoDto;
-import org.apache.isis.schema.mim.v1.ReturnDto;
-import org.apache.isis.schema.utils.MemberInteractionMementoDtoUtils;
+import org.apache.isis.schema.ixn.v1.InteractionDto;
+import org.apache.isis.schema.ixn.v1.ReturnDto;
+import org.apache.isis.schema.utils.InteractionDtoUtils;
/**
* Wrapper around {@link PublishingService}. Is a no-op if there is no injected service.
@@ -364,11 +364,11 @@ public class PublishingServiceInternalDefault implements PublishingServiceIntern
final Object resultPojo = argAdapter != null? argAdapter.getObject(): null;
final ReturnDto returnDto = new ReturnDto();
- MemberInteractionMementoDtoUtils.setValue(returnDto, returnType, resultPojo);
+ InteractionDtoUtils.setValue(returnDto, returnType, resultPojo);
for (PublisherService publisherService : publisherServices) {
- final MemberInteractionMementoDto aimDto =
- MemberInteractionMementoDtoUtils.newActionDto(
+ final InteractionDto interactionDto =
+ InteractionDtoUtils.newActionDto(
transactionId,
nextEventSequence,
targetBookmark,
@@ -379,9 +379,9 @@ public class PublishingServiceInternalDefault implements PublishingServiceIntern
startedAt, completedAt
);
- MemberInteractionMementoDtoUtils.addReturn(aimDto, returnType, resultPojo, bookmarkService);
+ InteractionDtoUtils.addReturn(interactionDto, returnType, resultPojo, bookmarkService);
- publisherService.publish(aimDto);
+ publisherService.publish(interactionDto);
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/1222341a/core/schema/pom.xml
----------------------------------------------------------------------
diff --git a/core/schema/pom.xml b/core/schema/pom.xml
index 465b3eb..9455642 100644
--- a/core/schema/pom.xml
+++ b/core/schema/pom.xml
@@ -68,19 +68,19 @@
<artifactId>maven-jaxb2-plugin</artifactId>
<executions>
<execution>
- <id>generate-mim-xsd</id>
+ <id>generate-ixn-xsd</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
- <schemaDirectory>src/main/resources/org/apache/isis/schema/mim</schemaDirectory>
+ <schemaDirectory>src/main/resources/org/apache/isis/schema/ixn</schemaDirectory>
<schemaIncludes>
- <schemaInclude>mim-1.0.xsd</schemaInclude>
+ <schemaInclude>ixn-1.0.xsd</schemaInclude>
</schemaIncludes>
- <bindingDirectory>src/main/resources/org/apache/isis/schema/mim</bindingDirectory>
+ <bindingDirectory>src/main/resources/org/apache/isis/schema/ixn</bindingDirectory>
<bindingIncludes>
- <bindingInclude>mim-1.0-binding.xml</bindingInclude>
+ <bindingInclude>ixn-1.0-binding.xml</bindingInclude>
</bindingIncludes>
<args>
<arg>-extension</arg>
http://git-wip-us.apache.org/repos/asf/isis/blob/1222341a/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0-binding.xml
----------------------------------------------------------------------
diff --git a/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0-binding.xml b/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0-binding.xml
new file mode 100644
index 0000000..851c866
--- /dev/null
+++ b/core/schema/src/main/resources/org/apache/isis/schema/ixn/ixn-1.0-binding.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ jaxb:version="2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
+ http://jaxb2-commons.dev.java.net/namespace-prefix http://java.net/projects/jaxb2-commons/sources/svn/content/namespace-prefix/trunk/src/main/resources/prefix-namespace-schema.xsd"
+>
+ <jaxb:bindings schemaLocation="ixn-1.0.xsd">
+ <jaxb:schemaBindings>
+ <!--
+ we don't include the minor version, because the
+ generated Java class will be backwards compatible
+ -->
+ <jaxb:package name="org.apache.isis.schema.ixn.v1"/>
+ </jaxb:schemaBindings>
+ <jaxb:bindings>
+ <namespace:prefix name="ixn" />
+ </jaxb:bindings>
+ </jaxb:bindings>
+ <!-- since ixn-1.0.xsd does an xs:import of common-1.0.xsd, we need to specify common's package bindings -->
+ <jaxb:bindings schemaLocation="../common/common-1.0.xsd">
+ <jaxb:schemaBindings>
+ <!--
+ we don't include the minor version, because the
+ generated Java class will be backwards compatible
+ -->
+ <jaxb:package name="org.apache.isis.schema.common.v1"/>
+ </jaxb:schemaBindings>
+ <jaxb:bindings>
+ <namespace:prefix name="common" />
+ </jaxb:bindings>
+ </jaxb:bindings>
+ <!-- since ixn-1.0.xsd does an xs:import of cmd-1.0.xsd, we need to specify common's package bindings -->
+ <jaxb:bindings schemaLocation="../cmd/cmd-1.0.xsd">
+ <jaxb:schemaBindings>
+ <!--
+ we don't include the minor version, because the
+ generated Java class will be backwards compatible
+ -->
+ <jaxb:package name="org.apache.isis.schema.cmd.v1"/>
+ </jaxb:schemaBindings>
+ <jaxb:bindings>
+ <namespace:prefix name="cmd" />
+ </jaxb:bindings>
+ </jaxb:bindings>
+</jaxb:bindings>
\ No newline at end of file