Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 2.65 KB

ContentMappingService_010-implementation.adoc

File metadata and controls

32 lines (20 loc) · 2.65 KB

Implementation

The framework provides two implementations of this service, both to allow objects implementing HasCommandDto to be converted into serializable CommandDtos, in other words XML. This is used by the Command Log and Command Replay extensions to allow commands to be replicated from a primary to secondary system, for regression testing.

The implementations are:

  • o.a.i.applib.services.commanddto.conmap.ContentMappingServiceForCommandDto will map any single instance of a HasCommandDto into a CommandDto XML document

  • o.a.i.applib.services.commanddto.conmap.ContentMappingServiceForCommandsDto will map a list of HasCommandDtos 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.

If the action invocation or property edit represent provides an implementation of a CommandDtoProcessor (by way of @Action#commandDtoProcessor() or @Property#commandDtoProcessor()) then this is also called to post-process the persisted CommandDto if required. A typical use case for this is to dynamically add in serialized Blobs or Clobs, the values of which are not captured by default in CommandDto.

To support the writing of custom implementations of this interface, the framework also provides ContentMappingService.Util which includes a couple of convenience utilities:

public static class Util {
    public static String determineDomainType(
        final List<MediaType> acceptableMediaTypes) { /* ... */ }
    public static boolean isSupported(
            final Class<?> clazz,
            final List<MediaType> acceptableMediaTypes) { /* ... */ }
}