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 10:45:53 UTC
[isis] branch ISIS-1569-replay-commands updated: ISIS-1569: removes
unused import is all
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
The following commit(s) were added to refs/heads/ISIS-1569-replay-commands by this push:
new 4b2d3ae ISIS-1569: removes unused import is all
4b2d3ae is described below
commit 4b2d3aedf2bf09b263cf156dc56bd8966d22a0ab
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Wed Jan 24 10:44:57 2018 +0000
ISIS-1569: removes unused import is all
---
...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.