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 2018/01/24 11:03:43 UTC

[isis] branch ISIS-1569-replay-commands updated (4b2d3ae -> ea6d19a)

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a change to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git.


 discard 4b2d3ae  ISIS-1569: removes unused import is all
     new ea6d19a  ISIS-1569: updates docs for ContentMappingService, default implementations for Command(s)Dto

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (4b2d3ae)
            \
             N -- N -- N   refs/heads/ISIS-1569-replay-commands (ea6d19a)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:

-- 
To stop receiving notification emails like this one, please contact
danhaywood@apache.org.

[isis] 01/01: ISIS-1569: updates docs for ContentMappingService, default implementations for Command(s)Dto

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch ISIS-1569-replay-commands
in repository https://gitbox.apache.org/repos/asf/isis.git

commit ea6d19a0859df2f4ebf9e673192cda0c083b8dee
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Jan 24 10:44:57 2018 +0000

    ISIS-1569: updates docs for ContentMappingService, default implementations for Command(s)Dto
    
    also removes unused import.
---
 ...esentation-layer-spi_ContentMappingService.adoc | 44 +++++++++-------------
 .../services/command/CommandServiceDefault.java    |  1 -
 2 files changed, 17 insertions(+), 28 deletions(-)

diff --git a/adocs/documentation/src/main/asciidoc/guides/rgsvc/_rgsvc_presentation-layer-spi_ContentMappingService.adoc b/adocs/documentation/src/main/asciidoc/guides/rgsvc/_rgsvc_presentation-layer-spi_ContentMappingService.adoc
index 791fd9c..f87bf23 100644
--- a/adocs/documentation/src/main/asciidoc/guides/rgsvc/_rgsvc_presentation-layer-spi_ContentMappingService.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/rgsvc/_rgsvc_presentation-layer-spi_ContentMappingService.adoc
@@ -43,37 +43,27 @@ public interface ContentMappingService {
 
 == Implementations
 
-No default implementations are provided by Apache Isis framework itself.
+The framework provides two implementations of this service, both in support of the xref:../rgsvc/rgsvc.adoc#_rgsvc_application-layer-spi_CommandService[`CommandService`] SPI.
 
-However, the (non-ASF) http://github.com/isisaddons/isis-app-todoapp[Isis addons' todoapp] includes a sample implementation to convert its `ToDoItem` entity into a (JAXB annotated) `ToDoItemDto`.  The source code is:
+By way of background: implementations of the SPI `CommandService` work with custom implementations of the `Command` interface, typically being persisted to a datastore.
+The `CommandWithDto` interface is a subtype of `Command` for implementations that can be reified into xref:../rgcms/rgcms.adoc#_rgcms_schema-cmd[`CommandDto`] XML instances.
+One implementation that does this is the (non-ASF) link:http://platform.incode.org[Incode Platform^]'s command module.
+
+For framework implementations of `ContentMappingService` allow domain service actions that return ``CommandDto``s (either singularly or in a list) to be converted into XML documents:
+
+* `o.a.i.applib.conmap.ContentMappingServiceForCommandDto` will map any single instnce of a `CommandWithDto` into a `CommandDto` XML document
+* `o.a.i.applib.conmap.ContentMappingServiceForCommandsDto` will map list of ``CommandWithDto``s into a `CommandsDto` XML document, and will wrap any single instance of a `CommandWithDto` into a singleton list and thence into a `CommandsDto` XML document.
+
+The framework also provides `ContentMappingService.Util` which includes a couple of convenience utilities for implementations:
 
 [source,java]
 ----
-@DomainService(nature = NatureOfService.DOMAIN)
-public class ContentMappingServiceForToDoItem implements ContentMappingService {
-    @Override
-    public Object map(
-            final Object object,
-            final List<MediaType> acceptableMediaTypes) {
-        if(object instanceof ToDoItem) {
-            for (MediaType acceptableMediaType : acceptableMediaTypes) {
-                final Map<String, String> parameters = acceptableMediaType.getParameters();
-                final String className = parameters.get("x-ro-domain-type");
-                if(className.eqausl(ToDoItemV1_1.class.getName())) {
-                    return newToDoItemV1_1((ToDoItem) object);
-                }
-            }
-        }
-        return null;
-    }
-    private ToDoItemV1_1 newToDoItemV1_1(final ToDoItem toDoItem) {
-        final ToDoItemV1_1 dto = new ToDoItemV1_1();
-        dto.setToDoItem(toDoItem);
-        dto.setDescription(toDoItem.getDescription());
-        ...
-        return dto;
-    }
-    ...
+public static class Util {
+    public static String determineDomainType(
+        final List<MediaType> acceptableMediaTypes) { ... }
+    public static boolean isSupported(
+            final Class<?> clazz,
+            final List<MediaType> acceptableMediaTypes) { ... }
 }
 ----
 
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandServiceDefault.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandServiceDefault.java
index ce6ec12..8076f16 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandServiceDefault.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/command/CommandServiceDefault.java
@@ -21,7 +21,6 @@ import java.util.UUID;
 import org.apache.isis.applib.annotation.DomainService;
 import org.apache.isis.applib.annotation.NatureOfService;
 import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.clock.ClockService;
 import org.apache.isis.applib.services.command.Command;
 import org.apache.isis.applib.services.command.CommandDefault;
 import org.apache.isis.applib.services.command.spi.CommandService;

-- 
To stop receiving notification emails like this one, please contact
danhaywood@apache.org.