polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [15/25] zest-java git commit: ZEST-151 : Ooops, there were dependencies. Took the time to refactor some of the DCI Cargo demo code in the process. Tests passes, but somehow I doubt that it still works in actual runtime. Need to spend time on that later.
Date Fri, 19 Aug 2016 12:18:49 GMT
http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/VoyageEntity.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/VoyageEntity.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/VoyageEntity.java
deleted file mode 100644
index 7530162..0000000
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/VoyageEntity.java
+++ /dev/null
@@ -1,36 +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.zest.sample.dcicargo.sample_a.data.entity;
-
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
-
-/**
- * Voyage entity
- *
- * Voyages have been created outside the shipping application context so we don't have any
- * separate aggregate root to create those from.
- */
-public interface VoyageEntity
-    extends EntityComposite,
-
-            Voyage
-{
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/Cargo.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/Cargo.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/Cargo.java
index 24a3186..1d6e78f 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/Cargo.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/Cargo.java
@@ -21,6 +21,7 @@ package org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo;
 
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.common.Optional;
+import org.apache.zest.api.entity.Identity;
 import org.apache.zest.api.property.Immutable;
 import org.apache.zest.api.property.Property;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery;
@@ -36,7 +37,7 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location;
  * {@link Delivery}             A calculated snapshot of the current delivery status (created by system)
  * {@link Itinerary}            Description of chosen route (optional)
  */
-public interface Cargo
+public interface Cargo extends Identity
 {
     @Immutable
     Property<TrackingId> trackingId();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/Cargos.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/Cargos.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/Cargos.java
index d15ee65..2165575 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/Cargos.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/Cargos.java
@@ -36,6 +36,8 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery;
 @Mixins( Cargos.Mixin.class )
 public interface Cargos
 {
+    String CARGOS_ID = "Cargos_id";
+
     Cargo createCargo( RouteSpecification routeSpecification, Delivery delivery, @Optional String id );
 
     class Mixin

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/TrackingId.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/TrackingId.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/TrackingId.java
index 2c199c2..f2dd4cc 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/TrackingId.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/cargo/TrackingId.java
@@ -27,8 +27,7 @@ import org.apache.zest.library.constraints.annotation.NotEmpty;
  * A TrackingId uniquely identifies a particular cargo.
  * Automatically generated by the application.
  */
-public interface TrackingId
-    extends ValueComposite
+public interface TrackingId extends ValueComposite
 {
     @NotEmpty
     Property<String> id();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/delivery/Delivery.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/delivery/Delivery.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/delivery/Delivery.java
index c12d495..759227a 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/delivery/Delivery.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/delivery/Delivery.java
@@ -77,7 +77,6 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
  * The life cycle of a cargo ends when the cargo is claimed by the customer.
  */
 public interface Delivery
-    extends ValueComposite
 {
     Property<Instant> timestamp();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/delivery/ExpectedHandlingEvent.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/delivery/ExpectedHandlingEvent.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/delivery/ExpectedHandlingEvent.java
index 7969659..063eb2b 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/delivery/ExpectedHandlingEvent.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/delivery/ExpectedHandlingEvent.java
@@ -33,7 +33,6 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
  * is expected to be handled next.
  */
 public interface ExpectedHandlingEvent
-    extends ValueComposite
 {
     Property<HandlingEventType> handlingEventType();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvent.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvent.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvent.java
index 83a9ab5..057ea23 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvent.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvent.java
@@ -23,6 +23,7 @@ import java.time.LocalDate;
 import org.apache.zest.api.association.Association;
 import org.apache.zest.api.common.Optional;
 import org.apache.zest.api.common.UseDefaults;
+import org.apache.zest.api.entity.Identity;
 import org.apache.zest.api.property.Immutable;
 import org.apache.zest.api.property.Property;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId;
@@ -46,7 +47,7 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
  * {@link HandlingEventType#CLAIM} or {@link HandlingEventType#CUSTOMS}.
  * (Handling event type is mandatory).
  */
-public interface HandlingEvent
+public interface HandlingEvent extends Identity
 {
     @Immutable
     Property<LocalDate> registrationDate();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvents.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvents.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvents.java
index 578a54e..2a11e11 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvents.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvents.java
@@ -37,6 +37,8 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
 @Mixins( HandlingEvents.Mixin.class )
 public interface HandlingEvents
 {
+    String HANDLING_EVENTS_ID = "Handling_events_id";
+
     HandlingEvent createHandlingEvent( LocalDate registrationDate,
                                        LocalDate completionDate,
                                        TrackingId trackingId,

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/itinerary/Leg.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/itinerary/Leg.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/itinerary/Leg.java
index ca0f9fc..8c985a2 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/itinerary/Leg.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/itinerary/Leg.java
@@ -35,7 +35,6 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
  * All properties are mandatory and immutable.
  */
 public interface Leg
-    extends ValueComposite
 {
     Association<Location> loadLocation();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/location/UnLocode.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/location/UnLocode.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/location/UnLocode.java
index 8abdba6..f0ee71f 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/location/UnLocode.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/location/UnLocode.java
@@ -32,7 +32,6 @@ import org.apache.zest.library.constraints.annotation.Matches;
  * UnLocode is mandatory and immutable.
  */
 public interface UnLocode
-    extends ValueComposite
 {
     // Country code is exactly two letters.
     // Location code is usually three letters, but may contain the numbers 2-9 as well

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/CarrierMovement.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/CarrierMovement.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/CarrierMovement.java
index 5391319..b48b5fd 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/CarrierMovement.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/CarrierMovement.java
@@ -31,7 +31,6 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location;
  * All properties are mandatory and immutable.
  */
 public interface CarrierMovement
-    extends ValueComposite
 {
     Association<Location> departureLocation();
 

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/Schedule.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/Schedule.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/Schedule.java
index 01ec211..f13c682 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/Schedule.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/Schedule.java
@@ -29,7 +29,6 @@ import org.apache.zest.api.value.ValueComposite;
  * List of carrier movements is mandatory and immutable.
  */
 public interface Schedule
-    extends ValueComposite
 {
     Property<List<CarrierMovement>> carrierMovements();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/VoyageNumber.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/VoyageNumber.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/VoyageNumber.java
index 408c31d..9571cb1 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/VoyageNumber.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/shipping/voyage/VoyageNumber.java
@@ -28,7 +28,6 @@ import org.apache.zest.api.value.ValueComposite;
  * Voyage number is mandatory and immutable.
  */
 public interface VoyageNumber
-    extends ValueComposite
 {
     Property<String> number();
 }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/WicketZestApplication.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/WicketZestApplication.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/WicketZestApplication.java
index 62fb7af..696a67f 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/WicketZestApplication.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/WicketZestApplication.java
@@ -39,7 +39,6 @@ import org.apache.zest.api.usecase.UsecaseBuilder;
 import org.apache.zest.api.value.ValueBuilderFactory;
 import org.apache.zest.bootstrap.ApplicationAssembler;
 import org.apache.zest.bootstrap.Energy4Java;
-import org.apache.zest.sample.dcicargo.sample_a.infrastructure.conversion.EntityToDTOService;
 import org.apache.zest.sample.dcicargo.sample_a.infrastructure.dci.Context;
 import org.apache.zest.sample.dcicargo.sample_a.infrastructure.model.Queries;
 import org.apache.zest.sample.dcicargo.sample_a.infrastructure.model.ReadOnlyModel;
@@ -73,9 +72,6 @@ public class WicketZestApplication
     @Structure
     protected ZestAPI api;
 
-    @Service
-    protected EntityToDTOService valueConverter;
-
     /**
      * Zest Assembler
      *
@@ -133,7 +129,7 @@ public class WicketZestApplication
 
         Context.prepareContextBaseClass( uowf );
         BaseWebPage.prepareBaseWebPageClass( tbf );
-        ReadOnlyModel.prepareModelBaseClass( zestModule, api, valueConverter );
+        ReadOnlyModel.prepareModelBaseClass( zestModule, api );
         Queries.prepareQueriesBaseClass( uowf, qbf );
 
         wicketInit();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
deleted file mode 100644
index 063fcda..0000000
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/conversion/EntityToDTOService.java
+++ /dev/null
@@ -1,327 +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.zest.sample.dcicargo.sample_a.infrastructure.conversion;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import org.apache.zest.api.association.AssociationDescriptor;
-import org.apache.zest.api.association.AssociationStateHolder;
-import org.apache.zest.api.association.ManyAssociation;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.entity.EntityDescriptor;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.entity.Identity;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.PropertyDescriptor;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.structure.ModuleDescriptor;
-import org.apache.zest.api.type.CollectionType;
-import org.apache.zest.api.value.NoSuchValueException;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.api.value.ValueDescriptor;
-import org.apache.zest.functional.Iterables;
-import org.apache.zest.library.conversion.values.Unqualified;
-import org.apache.zest.spi.ZestSPI;
-
-/**
- * Conversion of Entity objects to DTO's
- *
- * Value composites that extend {@link DTO} will have association properties converted recursively.
- *
- * Modification of {org.apache.zest.library.conversion.values.EntityToValue}
- * WARN No support of NamedAssociations
- */
-@SuppressWarnings( "unchecked" )
-@Mixins( EntityToDTOService.Mixin.class )
-public interface EntityToDTOService
-    extends ServiceComposite
-{
-    <T> T convert( Class<T> valueType, Object entity );
-
-    static abstract class Mixin
-        implements EntityToDTOService
-    {
-        @Structure
-        private ValueBuilderFactory vbf;
-
-        @Structure
-        private ZestSPI spi;
-
-        @Structure
-        private ModuleDescriptor module;
-
-        @Override
-        public <T> T convert( final Class<T> valueType, Object entity )
-        {
-            ValueDescriptor valueDescriptor = module.valueDescriptor( valueType.getName() );
-            if( valueDescriptor == null )
-            {
-                throw new NoSuchValueException( valueType.getName(), module.name(), module.typeLookup() );
-            }
-            Unqualified unqualified = valueDescriptor.metaInfo( Unqualified.class );
-            final EntityComposite composite = (EntityComposite) entity;
-            final EntityDescriptor entityDescriptor = spi.entityDescriptorFor( composite );
-            final AssociationStateHolder associationState = spi.stateOf( composite );
-            ValueBuilder<?> builder;
-
-            if( unqualified == null || !unqualified.value() )
-            {
-                // Copy state using qualified names
-                builder = vbf.newValueBuilderWithState( valueType, new Function<PropertyDescriptor, Object>()
-                {
-                    @Override
-                    public Object apply( PropertyDescriptor descriptor )
-                    {
-                        try
-                        {
-                            return associationState.propertyFor( descriptor.accessor() ).get();
-                        }
-                        catch( IllegalArgumentException e )
-                        {
-                            if( descriptor.valueType().mainType().equals( String.class ) )
-                            {
-                                // Find Association and convert to string
-                                AssociationDescriptor associationDescriptor;
-                                try
-                                {
-                                    associationDescriptor = entityDescriptor.state()
-                                        .getAssociationByName( descriptor.qualifiedName().name() );
-                                }
-                                catch( IllegalArgumentException e1 )
-                                {
-                                    return null;
-                                }
-                                Object entity = associationState.associationFor( associationDescriptor.accessor() ).get();
-                                if( entity != null )
-                                {
-                                    return ( (Identity) entity ).identity().get();
-                                }
-                                return null;
-                            }
-                            else if( descriptor.valueType() instanceof CollectionType
-                                     && ( (CollectionType) descriptor.valueType() ).collectedType().mainType().equals( String.class ) )
-                            {
-                                AssociationDescriptor associationDescriptor;
-                                try
-                                {
-                                    associationDescriptor = entityDescriptor.state()
-                                        .getManyAssociationByName( descriptor.qualifiedName().name() );
-                                }
-                                catch( IllegalArgumentException e1 )
-                                {
-                                    return Collections.emptyList();
-                                }
-
-                                ManyAssociation<?> state = associationState.manyAssociationFor( associationDescriptor.accessor() );
-                                List<String> entities = new ArrayList<>( state.count() );
-                                for( Object entity : state )
-                                {
-                                    entities.add( ( (Identity) entity ).identity().get() );
-                                }
-                                return entities;
-                            }
-
-                            // No NamedAssociation support
-
-                            return null;
-                        }
-                    }
-                }, new Function<AssociationDescriptor, EntityReference>()
-                {
-                    @Override
-                    public EntityReference apply( AssociationDescriptor associationDescriptor )
-                    {
-                        return EntityReference.entityReferenceFor(
-                            associationState.associationFor( associationDescriptor.accessor() ).get() );
-                    }
-                }, new Function<AssociationDescriptor, Iterable<EntityReference>>()
-                {
-                    @Override
-                    public Iterable<EntityReference> apply( AssociationDescriptor associationDescriptor )
-                    {
-                        ManyAssociation<?> state = associationState.manyAssociationFor( associationDescriptor.accessor() );
-                        List<EntityReference> refs = new ArrayList<>( state.count() );
-                        for( Object entity : state )
-                        {
-                            refs.add( EntityReference.entityReferenceFor( entity ) );
-                        }
-                        return refs;
-                    }
-                }, new Function<AssociationDescriptor, Map<String, EntityReference>>()
-                {
-                    @Override
-                    public Map<String, EntityReference> apply( AssociationDescriptor from )
-                    {
-                        // No NamedAssociation support
-                        return Collections.emptyMap();
-                    }
-                } );
-            }
-            else
-            {
-                builder = vbf.newValueBuilderWithState( valueType, new Function<PropertyDescriptor, Object>()
-                {
-                    @Override
-                    public Object apply( PropertyDescriptor descriptor )
-                    {
-                        try
-                        {
-                            PropertyDescriptor propertyDescriptor = entityDescriptor.state()
-                                .findPropertyModelByName( descriptor.qualifiedName().name() );
-                            return associationState.propertyFor( propertyDescriptor.accessor() ).get();
-                        }
-                        catch( IllegalArgumentException e )
-                        {
-                            if( descriptor.valueType().mainType().equals( String.class ) )
-                            {
-                                // Find Association and convert to string
-                                AssociationDescriptor associationDescriptor;
-                                try
-                                {
-                                    associationDescriptor = entityDescriptor.state()
-                                        .getAssociationByName( descriptor.qualifiedName().name() );
-                                }
-                                catch( IllegalArgumentException e1 )
-                                {
-                                    return null;
-                                }
-
-                                Object entity = associationState.associationFor( associationDescriptor.accessor() ).get();
-                                if( entity != null )
-                                {
-                                    return ( (Identity) entity ).identity().get();
-                                }
-                                return null;
-                            }
-                            else if( descriptor.valueType() instanceof CollectionType
-                                     && ( (CollectionType) descriptor.valueType() ).collectedType().mainType().equals( String.class ) )
-                            {
-                                AssociationDescriptor associationDescriptor;
-                                try
-                                {
-                                    associationDescriptor = entityDescriptor.state()
-                                        .getManyAssociationByName( descriptor.qualifiedName().name() );
-                                }
-                                catch( IllegalArgumentException e1 )
-                                {
-                                    return null;
-                                }
-
-                                ManyAssociation<?> state = associationState.manyAssociationFor( associationDescriptor.accessor() );
-                                List<String> entities = new ArrayList<>( state.count() );
-                                for( Object entity : state )
-                                {
-                                    entities.add( ( (Identity) entity ).identity().get() );
-                                }
-                                return entities;
-                            }
-
-                            // No NamedAssociation support
-
-                            // DTO
-                            Class<?> type = descriptor.valueType().mainType();
-                            if( DTO.class.isAssignableFrom( type ) )
-                            {
-                                AssociationDescriptor associationDescriptor;
-                                try
-                                {
-                                    associationDescriptor = entityDescriptor.state()
-                                        .getAssociationByName( descriptor.qualifiedName().name() );
-                                }
-                                catch( IllegalArgumentException e1 )
-                                {
-                                    return null;
-                                }
-
-                                Object entity = associationState.associationFor( associationDescriptor.accessor() ).get();
-                                if( entity != null )
-                                {
-                                    return convert( type, entity );
-                                }
-                            }
-
-                            return null;
-                        }
-                    }
-                }, new Function<AssociationDescriptor, EntityReference>()
-                {
-                    @Override
-                    public EntityReference apply( AssociationDescriptor descriptor )
-                    {
-                        AssociationDescriptor associationDescriptor;
-                        try
-                        {
-                            associationDescriptor = entityDescriptor.state()
-                                .getAssociationByName( descriptor.qualifiedName().name() );
-                        }
-                        catch( IllegalArgumentException e )
-                        {
-                            return null;
-                        }
-
-                        return EntityReference.entityReferenceFor( associationState
-                            .associationFor( associationDescriptor.accessor() ).get() );
-                    }
-                }, new Function<AssociationDescriptor, Iterable<EntityReference>>()
-                {
-                    @Override
-                    public Iterable<EntityReference> apply( AssociationDescriptor descriptor )
-                    {
-                        AssociationDescriptor associationDescriptor;
-                        try
-                        {
-                            associationDescriptor = entityDescriptor.state()
-                                .getManyAssociationByName( descriptor.qualifiedName().name() );
-                        }
-                        catch( IllegalArgumentException e )
-                        {
-                            return Iterables.empty();
-                        }
-
-                        ManyAssociation<?> state = associationState.manyAssociationFor( associationDescriptor.accessor() );
-                        List<EntityReference> refs = new ArrayList<>( state.count() );
-                        for( Object entity : state )
-                        {
-                            refs.add( EntityReference.entityReferenceFor( entity ) );
-                        }
-                        return refs;
-                    }
-                }, new Function<AssociationDescriptor, Map<String, EntityReference>>()
-                {
-                    @Override
-                    public Map<String, EntityReference> apply( AssociationDescriptor from )
-                    {
-                        // No NamedAssociations support
-                        return Collections.emptyMap();
-                    }
-                } );
-            }
-
-            return (T) builder.newInstance();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/EntityModel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/EntityModel.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/EntityModel.java
index f056c66..fdf1e9b 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/EntityModel.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/EntityModel.java
@@ -20,43 +20,45 @@
 package org.apache.zest.sample.dcicargo.sample_a.infrastructure.model;
 
 import org.apache.wicket.model.IModel;
-import org.apache.zest.api.entity.EntityComposite;
 import org.apache.zest.api.entity.EntityReference;
+import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.unitofwork.NoSuchEntityException;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.api.usecase.Usecase;
-import org.apache.zest.sample.dcicargo.sample_a.infrastructure.conversion.DTO;
 
 /**
  * Javadoc
  */
-public class EntityModel<T extends DTO, U extends EntityComposite>
+public class EntityModel<T extends Identity>
     extends ReadOnlyModel<T>
 {
-    private Class<U> entityClass;
+    private Class<T> entityClass;
     private String identity;
     private Class<T> dtoClass;
 
     private transient T dtoComposite;
 
-    public EntityModel( Class<U> entityClass, String identity, Class<T> dtoClass )
+    @Structure
+    private UnitOfWorkFactory uowf;
+
+    public EntityModel( Class<T> entityClass, String identity, Class<T> dtoClass )
     {
         this.entityClass = entityClass;
         this.identity = identity;
         this.dtoClass = dtoClass;
     }
 
-    public static <T extends DTO, U extends EntityComposite> IModel<T> of(
-        Class<U> entityClass, String identity, Class<T> dtoClass
-    )
+    public static <T extends Identity> IModel<T> of( Class<T> entityClass, String identity, Class<T> dtoClass )
     {
-        return new EntityModel<T, U>( entityClass, identity, dtoClass );
+        return new EntityModel<>( entityClass, identity, dtoClass );
     }
 
     public T getObject()
     {
         if( dtoComposite == null && identity != null )
         {
-            dtoComposite = valueConverter.convert( dtoClass, loadEntity() );
+            dtoComposite = uowf.currentUnitOfWork().toValue( dtoClass, loadEntity() );
         }
         return dtoComposite;
     }
@@ -66,9 +68,9 @@ public class EntityModel<T extends DTO, U extends EntityComposite>
         dtoComposite = null;
     }
 
-    private U loadEntity()
+    private T loadEntity()
     {
-        U entity = module.unitOfWorkFactory().currentUnitOfWork().get( entityClass, identity );
+        T entity = module.unitOfWorkFactory().currentUnitOfWork().get( entityClass, identity );
         if( entity == null )
         {
             Usecase usecase = module.unitOfWorkFactory().currentUnitOfWork().usecase();

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/QueryModel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/QueryModel.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/QueryModel.java
index 25e6c5e..b2ee967 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/QueryModel.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/QueryModel.java
@@ -22,18 +22,24 @@ package org.apache.zest.sample.dcicargo.sample_a.infrastructure.model;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.zest.api.entity.EntityComposite;
+import org.apache.zest.api.entity.Identity;
+import org.apache.zest.api.injection.scope.Structure;
 import org.apache.zest.api.query.Query;
+import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 
 /**
  * Callback Wicket model that holds a Zest Query object that can be called when needed to
  * retrieve fresh data.
  */
-public abstract class QueryModel<T, U extends EntityComposite>
+public abstract class QueryModel<T extends Identity>
     extends ReadOnlyModel<List<T>>
 {
     private Class<T> dtoClass;
     private transient List<T> dtoList;
 
+    @Structure
+    private UnitOfWorkFactory uowf;
+
     public QueryModel( Class<T> dtoClass )
     {
         this.dtoClass = dtoClass;
@@ -46,8 +52,8 @@ public abstract class QueryModel<T, U extends EntityComposite>
             return dtoList;
         }
 
-        dtoList = new ArrayList<T>();
-        for( U entity : getQuery() )
+        dtoList = new ArrayList<>();
+        for( T entity : getQuery() )
         {
             dtoList.add( getValue( entity ) );
         }
@@ -56,11 +62,11 @@ public abstract class QueryModel<T, U extends EntityComposite>
     }
 
     // Callback to retrieve the (unserializable) Zest Query object
-    public abstract Query<U> getQuery();
+    public abstract Query<T> getQuery();
 
-    public T getValue( U entity )
+    public T getValue( T entity )
     {
-        return valueConverter.convert( dtoClass, entity );
+        return uowf.currentUnitOfWork().toValue( dtoClass, entity );
     }
 
     public void detach()

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/ReadOnlyModel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/ReadOnlyModel.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/ReadOnlyModel.java
index 28d721b..34593fb 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/ReadOnlyModel.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/infrastructure/model/ReadOnlyModel.java
@@ -22,7 +22,6 @@ package org.apache.zest.sample.dcicargo.sample_a.infrastructure.model;
 import org.apache.wicket.model.IModel;
 import org.apache.zest.api.ZestAPI;
 import org.apache.zest.api.structure.Module;
-import org.apache.zest.sample.dcicargo.sample_a.infrastructure.conversion.EntityToDTOService;
 
 /**
  * Abstract base model for Wicket model objects taking Zest objects.
@@ -32,7 +31,6 @@ public abstract class ReadOnlyModel<T>
 {
     private static final long serialVersionUID = 1L;
 
-    static protected EntityToDTOService valueConverter;
     static protected ZestAPI api;
     static protected Module module;
 
@@ -60,12 +58,10 @@ public abstract class ReadOnlyModel<T>
     }
 
     public static void prepareModelBaseClass( Module m,
-                                              ZestAPI api,
-                                              EntityToDTOService entityToDTO
+                                              ZestAPI api
     )
     {
         module = m;
         ReadOnlyModel.api = api;
-        valueConverter = entityToDTO;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java
index 0f472d1..214fcc4 100644
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java
+++ b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java
@@ -47,15 +47,15 @@ import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.RouteSpecificati
 import org.apache.zest.sample.dcicargo.sample_a.context.support.ApplicationEvents;
 import org.apache.zest.sample.dcicargo.sample_a.context.support.RegisterHandlingEventAttemptDTO;
 import org.apache.zest.sample.dcicargo.sample_a.context.support.RoutingService;
-import org.apache.zest.sample.dcicargo.sample_a.data.entity.LocationEntity;
-import org.apache.zest.sample.dcicargo.sample_a.data.entity.VoyageEntity;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.ExpectedHandlingEvent;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.itinerary.Leg;
+import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.UnLocode;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.CarrierMovement;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Schedule;
+import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.VoyageNumber;
 import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;
 import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService;
@@ -164,8 +164,8 @@ public class TestAssembler
         ModuleAssembly entityModule = domainLayer.module( "DOMAIN-Entity" ).withDefaultUnitOfWorkFactory();
         entityModule
             .entities(
-                LocationEntity.class,
-                VoyageEntity.class )
+                Location.class,
+                Voyage.class )
             .visibleIn( application );
 
         // Non-role-playing values
@@ -191,14 +191,7 @@ public class TestAssembler
         serializationModule
             .services( OrgJsonValueSerializationService.class )
             .taggedWith( ValueSerialization.Formats.JSON )
-            .setMetaInfo( new Function<Application, Module>()
-            {
-                @Override
-                public Module apply( Application application )
-                {
-                    return application.findModule( "CONTEXT", "CONTEXT-ContextSupport" );
-                }
-            } )
+            .setMetaInfo( (Function<Application, Module>) application1 -> application1.findModule( "CONTEXT", "CONTEXT-ContextSupport" ) )
             .visibleIn( application );
 
         ModuleAssembly indexingModule = infrastructureLayer.module( "INFRASTRUCTURE-Indexing" )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
index 2256c1a..70f4056 100644
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
+++ b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
@@ -26,7 +26,6 @@ import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.sample.dcicargo.sample_a.bootstrap.test.TestApplication;
 import org.apache.zest.sample.dcicargo.sample_a.context.support.FoundNoRoutesException;
-import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargosEntity;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId;
@@ -73,7 +72,7 @@ public class BookNewCargoTest
     {
         UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
         new BookNewCargo( CARGOS, HONGKONG, HONGKONG, day( 17 ) ).book();
     }
 
@@ -84,7 +83,7 @@ public class BookNewCargoTest
         UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
         new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( -1 ) ).book();
     }
 
@@ -95,7 +94,7 @@ public class BookNewCargoTest
         UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
         new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 0 ) ).book();
     }
 
@@ -106,7 +105,7 @@ public class BookNewCargoTest
         UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
         new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 1 ) ).book();
     }
 
@@ -117,7 +116,7 @@ public class BookNewCargoTest
         UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
         // Create cargo with valid input from customer
         TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 17 ) ).book();
 
@@ -164,7 +163,7 @@ public class BookNewCargoTest
         UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
         TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 1 ) ).book();
         Cargo cargo = uow.get( Cargo.class, trackingId.id().get() );
 
@@ -179,7 +178,7 @@ public class BookNewCargoTest
         UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
 
         // Create valid cargo
         TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 30 ) ).book();
@@ -211,7 +210,7 @@ public class BookNewCargoTest
         UnitOfWork uow = uowf.currentUnitOfWork();
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
 
         // Create valid cargo
         LocalDate deadline = day( 30 );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshotTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshotTest.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshotTest.java
index a5455c8..9693d87 100644
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshotTest.java
+++ b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshotTest.java
@@ -24,8 +24,6 @@ import java.time.ZoneOffset;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
 import org.apache.zest.sample.dcicargo.sample_a.bootstrap.test.TestApplication;
-import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargosEntity;
-import org.apache.zest.sample.dcicargo.sample_a.data.entity.HandlingEventsEntity;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.RouteSpecification;
@@ -35,6 +33,7 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.RoutingSt
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.TransportStatus;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType;
+import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvents;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
@@ -109,7 +108,7 @@ public class BuildDeliverySnapshotTest
         V400S = uow.get( Voyage.class, "V400S" );
         V500S = uow.get( Voyage.class, "V500S" );
 
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
         trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 17 ) ).createCargo( "ABC" );
         cargo = uow.get( Cargo.class, trackingId.id().get() );
 
@@ -172,7 +171,7 @@ public class BuildDeliverySnapshotTest
 
         UnitOfWork uow = uowf.currentUnitOfWork();
         RouteSpecification routeSpec = routeSpecification( HONGKONG, STOCKHOLM, day( 20 ) );
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
         Delivery delivery = new BuildDeliverySnapshot( routeSpec ).get();
         CARGOS.createCargo( routeSpec, delivery, "ABCD" );
 
@@ -296,7 +295,7 @@ public class BuildDeliverySnapshotTest
         deviation_3a_CargoHasNoHandlingHistory();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
         // Unexpected receipt in Shanghai
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, HandlingEventType.RECEIVE, SHANGHAI, null );
         Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
@@ -323,7 +322,7 @@ public class BuildDeliverySnapshotTest
         deviation_4a_RECEIVE_1a_UnexpectedPort();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
         // Expected receipt in Hong Kong
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, HandlingEventType.RECEIVE, HONGKONG, null );
         Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
@@ -347,7 +346,7 @@ public class BuildDeliverySnapshotTest
         deviation_4a_RECEIVE_1b_ExpectedPort();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
         // Unexpected load in Tokyo
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, LOAD, TOKYO, V100S );
         Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
@@ -370,7 +369,7 @@ public class BuildDeliverySnapshotTest
         deviation_4b_LOAD_2a_UnexpectedPort();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
         // Expected load in Hong Kong
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, LOAD, HONGKONG, V100S );
         Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
@@ -395,7 +394,7 @@ public class BuildDeliverySnapshotTest
         deviation_4b_LOAD_2b_ExpectedPort();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
         // Load onto unexpected voyage
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 1 ), trackingId, LOAD, HONGKONG, V400S );
         Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
@@ -418,7 +417,7 @@ public class BuildDeliverySnapshotTest
         deviation_4b_LOAD_2c_UnexpectedVoyageNotFromItinerary();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
 
         // The system doesn't currently check if handling events happen in the right order, so
         // a cargo can now suddenly load in New York, even though it hasn't got there yet.
@@ -447,7 +446,7 @@ public class BuildDeliverySnapshotTest
         deviation_4b_LOAD_2c_ExpectedButLaterVoyageInItinerary();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
 
         // Unexpected unload in Tokyo
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 5 ), day( 5 ), trackingId, UNLOAD, TOKYO, V100S );
@@ -541,7 +540,7 @@ public class BuildDeliverySnapshotTest
         deviation_4c_UNLOAD_1a_UnexpectedPort();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
 
         // Unload at midpoint location of itinerary
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 8 ), day( 8 ), trackingId, UNLOAD, HAMBURG, V400S );
@@ -568,7 +567,7 @@ public class BuildDeliverySnapshotTest
         deviation_4c_UNLOAD_1b_ExpectedMidpointLocation();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
 
         // Unload at destination
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 16 ), day( 16 ), trackingId, UNLOAD, STOCKHOLM, V500S );
@@ -597,7 +596,7 @@ public class BuildDeliverySnapshotTest
         deviation_4c_UNLOAD_1c_Destination();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
 
         // Cargo was handled by the customs authorities
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 16 ), day( 16 ), trackingId, CUSTOMS, STOCKHOLM, null );
@@ -624,7 +623,7 @@ public class BuildDeliverySnapshotTest
         deviation_4d_CUSTOMS_1a_CargoIsInDestinationPort();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
 
         // Cargo was claimed but not at destination location
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 1 ), day( 16 ), trackingId, CLAIM, HELSINKI, null );
@@ -651,7 +650,7 @@ public class BuildDeliverySnapshotTest
         deviation_4e_CLAIM_1a_CargoIsNotInDestinationPort();
 
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
 
         // Cargo was claimed by customer at destination location
         HandlingEvent handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 16 ), day( 16 ), trackingId, CLAIM, STOCKHOLM, null );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/InspectCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/InspectCargoTest.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/InspectCargoTest.java
index 2e5fba3..0a05b2d 100644
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/InspectCargoTest.java
+++ b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/InspectCargoTest.java
@@ -20,14 +20,13 @@
 package org.apache.zest.sample.dcicargo.sample_a.context.shipping.handling;
 
 import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
+import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvents;
 import org.junit.Before;
 import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.sample.dcicargo.sample_a.bootstrap.test.TestApplication;
 import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo;
 import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BuildDeliverySnapshot;
-import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargosEntity;
-import org.apache.zest.sample.dcicargo.sample_a.data.entity.HandlingEventsEntity;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId;
@@ -66,7 +65,7 @@ public class InspectCargoTest
     {
         uowf = module.unitOfWorkFactory();
         UnitOfWork uow = uowf.currentUnitOfWork();
-        Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
+        Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID );
         Location HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         SHANGHAI = uow.get( Location.class, CNSHA.code().get() );
         STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
@@ -95,7 +94,7 @@ public class InspectCargoTest
     {
         // Create misdirected handling event for cargo (receipt in Shanghai is unexpected)
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
         handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 0 ), day( 0 ), trackingId, HandlingEventType.RECEIVE, SHANGHAI, null );
         Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
         cargo.delivery().set( delivery );
@@ -112,7 +111,7 @@ public class InspectCargoTest
         throws Exception
     {
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
         handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 15 ), day( 15 ), trackingId, HandlingEventType.UNLOAD, STOCKHOLM, V300A );
         Delivery delivery = new BuildDeliverySnapshot( cargo, handlingEvent ).get();
         cargo.delivery().set( delivery );
@@ -130,7 +129,7 @@ public class InspectCargoTest
     {
         logger.info( "  Handling cargo 'ABC' (unloaded in Dallas):" );
         UnitOfWork uow = uowf.currentUnitOfWork();
-        HandlingEventsEntity HANDLING_EVENTS = uow.get( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID );
+        HandlingEvents HANDLING_EVENTS = uow.get( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID );
         handlingEvent = HANDLING_EVENTS.createHandlingEvent( day( 12 ), day( 12 ), trackingId, HandlingEventType.UNLOAD, DALLAS, V200T );
         cargo.delivery().set( new BuildDeliverySnapshot( cargo, handlingEvent ).get() );
         assertThat( cargo.delivery().get().isMisdirected().get(), is( equalTo( false ) ) );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEventTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEventTest.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEventTest.java
index 416c3ab..0f3e992 100644
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEventTest.java
+++ b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEventTest.java
@@ -25,7 +25,6 @@ import org.junit.Test;
 import org.apache.zest.api.unitofwork.UnitOfWork;
 import org.apache.zest.sample.dcicargo.sample_a.bootstrap.test.TestApplication;
 import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo;
-import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargosEntity;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos;
 import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId;
@@ -67,7 +66,7 @@ public class RegisterHandlingEventTest
     @Before
     public void beforeEachTest() throws Exception {
         UnitOfWork uow = module.unitOfWorkFactory().currentUnitOfWork();
-        CARGOS = uow.get(Cargos.class,  CargosEntity.CARGOS_ID );
+        CARGOS = uow.get(Cargos.class,  Cargos.CARGOS_ID );
         HONGKONG = uow.get( Location.class, CNHKG.code().get() );
         STOCKHOLM = uow.get( Location.class, SESTO.code().get() );
         NEWYORK = uow.get( Location.class, USNYC.code().get() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_b/build.gradle
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/build.gradle b/samples/dci-cargo/dcisample_b/build.gradle
index 4ea96e4..3b7b63c 100644
--- a/samples/dci-cargo/dcisample_b/build.gradle
+++ b/samples/dci-cargo/dcisample_b/build.gradle
@@ -26,7 +26,6 @@ dependencies {
 
   compile project( ':org.apache.zest.core:org.apache.zest.core.bootstrap' )
   compile project( ':org.apache.zest.libraries:org.apache.zest.library.constraints' )
-  compile project( ':org.apache.zest.libraries:org.apache.zest.library.conversion' )
   compile project( ':org.apache.zest.extensions:org.apache.zest.extension.valueserialization-orgjson' )
   compile project( ':org.apache.zest.extensions:org.apache.zest.extension.indexing-rdf' )
   compile project( ':org.apache.zest.tools:org.apache.zest.tool.envisage' )

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/assembly/Assembler.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/assembly/Assembler.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/assembly/Assembler.java
index 6e1a15c..6e3bf76 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/assembly/Assembler.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/assembly/Assembler.java
@@ -41,10 +41,6 @@ import org.apache.zest.sample.dcicargo.sample_b.bootstrap.DCISampleApplication_b
 import org.apache.zest.sample.dcicargo.sample_b.bootstrap.sampledata.BaseDataService;
 import org.apache.zest.sample.dcicargo.sample_b.bootstrap.sampledata.SampleDataService;
 import org.apache.zest.sample.dcicargo.sample_b.communication.query.BookingQueries;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.dto.CargoDTO;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.dto.HandlingEventDTO;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.dto.LocationDTO;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.dto.VoyageDTO;
 import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.ProcessHandlingEvent;
 import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.parsing.ParseHandlingEventData;
 import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.parsing.dto.ParsedHandlingEventData;
@@ -52,21 +48,21 @@ import org.apache.zest.sample.dcicargo.sample_b.context.rolemap.CargoRoleMap;
 import org.apache.zest.sample.dcicargo.sample_b.context.rolemap.CargosRoleMap;
 import org.apache.zest.sample.dcicargo.sample_b.context.rolemap.HandlingEventsRoleMap;
 import org.apache.zest.sample.dcicargo.sample_b.context.service.routing.RoutingService;
-import org.apache.zest.sample.dcicargo.sample_b.data.entity.HandlingEventEntity;
-import org.apache.zest.sample.dcicargo.sample_b.data.entity.LocationEntity;
-import org.apache.zest.sample.dcicargo.sample_b.data.entity.VoyageEntity;
 import org.apache.zest.sample.dcicargo.sample_b.data.factory.RouteSpecificationFactoryService;
+import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.RouteSpecification;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.Delivery;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.NextHandlingEvent;
+import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEvent;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Leg;
+import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.UnLocode;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.tracking.TrackingId;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.CarrierMovement;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Schedule;
+import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.VoyageNumber;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.EntityToDTOService;
 import org.apache.zest.spi.uuid.UuidIdentityGeneratorService;
 import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService;
 
@@ -171,21 +167,15 @@ public class Assembler
         ModuleAssembly queryModule = communicationLayer.module( "COMMUNICATION-Query" );
         queryModule
             .values(
-                CargoDTO.class,
-                LocationDTO.class,
-                HandlingEventDTO.class,
-                VoyageDTO.class );
+                Cargo.class,
+                Location.class,
+                HandlingEvent.class,
+                Voyage.class );
 
         queryModule
             .transients(
                 BookingQueries.class )
             .visibleIn( application );
-
-        queryModule
-            .addServices(
-                EntityToDTOService.class,
-                OrgJsonValueSerializationService.class )
-            .visibleIn( application );
     }
 
     private void assembleContextLayer( LayerAssembly contextLayer )
@@ -202,9 +192,9 @@ public class Assembler
         ModuleAssembly roleMapCandidatesModule = contextLayer.module( "CONTEXT-RoleMapCandidates" );
         roleMapCandidatesModule
             .entities(
-                HandlingEventEntity.class,
-                LocationEntity.class,
-                VoyageEntity.class )
+                HandlingEvent.class,
+                Location.class,
+                Voyage.class )
             .visibleIn( application );
 
         roleMapCandidatesModule

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/CommonQueries.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/CommonQueries.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/CommonQueries.java
index a4c61ca..0b61115 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/CommonQueries.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/CommonQueries.java
@@ -24,8 +24,7 @@ import java.util.List;
 import org.apache.wicket.model.IModel;
 import org.apache.zest.api.query.Query;
 import org.apache.zest.api.query.QueryBuilder;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.dto.CargoDTO;
-import org.apache.zest.sample.dcicargo.sample_b.data.entity.CargoEntity;
+import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
 import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.EntityModel;
 import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.Queries;
@@ -43,20 +42,20 @@ import static org.apache.zest.api.query.QueryExpressions.templateFor;
  */
 public class CommonQueries extends Queries
 {
-    public IModel<CargoDTO> cargo( String trackingId )
+    public IModel<Cargo> cargo( String trackingId )
     {
-        return EntityModel.of( CargoEntity.class, trackingId, CargoDTO.class );
+        return EntityModel.of( Cargo.class, trackingId, Cargo.class );
     }
 
-    public IModel<List<CargoDTO>> cargoList()
+    public IModel<List<Cargo>> cargoList()
     {
-        return new QueryModel<CargoDTO, CargoEntity>( CargoDTO.class )
+        return new QueryModel<Cargo>( Cargo.class )
         {
-            public Query<CargoEntity> getQuery()
+            public Query<Cargo> getQuery()
             {
-                QueryBuilder<CargoEntity> qb = qbf.newQueryBuilder( CargoEntity.class );
+                QueryBuilder<Cargo> qb = qbf.newQueryBuilder( Cargo.class );
                 return uowf.currentUnitOfWork().newQuery( qb )
-                    .orderBy( orderBy( templateFor( CargoEntity.class ).trackingId().get().id() ) );
+                    .orderBy( orderBy( templateFor( Cargo.class ).trackingId().get().id() ) );
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/HandlingQueries.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/HandlingQueries.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/HandlingQueries.java
index e3285a6..3eb9ea2 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/HandlingQueries.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/HandlingQueries.java
@@ -23,7 +23,7 @@ import java.util.ArrayList;
 import java.util.List;
 import org.apache.zest.api.query.Query;
 import org.apache.zest.api.query.QueryBuilder;
-import org.apache.zest.sample.dcicargo.sample_b.data.entity.CargoEntity;
+import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage;
 import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.Queries;
@@ -54,11 +54,11 @@ public class HandlingQueries extends Queries
 
     public List<String> cargoIds()
     {
-        QueryBuilder<CargoEntity> qb = qbf.newQueryBuilder( CargoEntity.class );
-        Query<CargoEntity> cargos = uowf.currentUnitOfWork().newQuery( qb )
-            .orderBy( orderBy( templateFor( CargoEntity.class ).trackingId().get().id() ) );
-        List<String> cargoList = new ArrayList<String>();
-        for( CargoEntity cargo : cargos )
+        QueryBuilder<Cargo> qb = qbf.newQueryBuilder( Cargo.class );
+        Query<Cargo> cargos = uowf.currentUnitOfWork().newQuery( qb )
+            .orderBy( orderBy( templateFor( Cargo.class ).trackingId().get().id() ) );
+        List<String> cargoList = new ArrayList<>();
+        for( Cargo cargo : cargos )
         {
             cargoList.add( cargo.trackingId().get().id().get() );
         }
@@ -67,7 +67,7 @@ public class HandlingQueries extends Queries
 
     public List<String> eventTypes()
     {
-        List<String> eventTypes = new ArrayList<String>();
+        List<String> eventTypes = new ArrayList<>();
         for( HandlingEventType eventType : HandlingEventType.values() )
         {
             eventTypes.add( eventType.name() );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/TrackingQueries.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/TrackingQueries.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/TrackingQueries.java
index ae4a1e8..fce2557 100644
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/TrackingQueries.java
+++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/TrackingQueries.java
@@ -25,9 +25,6 @@ import org.apache.wicket.model.IModel;
 import org.apache.zest.api.query.Query;
 import org.apache.zest.api.query.QueryBuilder;
 import org.apache.zest.api.query.QueryExpressions;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.dto.HandlingEventDTO;
-import org.apache.zest.sample.dcicargo.sample_b.data.entity.CargoEntity;
-import org.apache.zest.sample.dcicargo.sample_b.data.entity.HandlingEventEntity;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo;
 import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEvent;
 import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.Queries;
@@ -44,15 +41,15 @@ public class TrackingQueries extends Queries
 {
     public List<String> routedCargos()
     {
-        Cargo cargoEntity = templateFor( CargoEntity.class );
+        Cargo cargoEntity = templateFor( Cargo.class );
 
-        QueryBuilder<CargoEntity> qb = qbf.newQueryBuilder( CargoEntity.class )
+        QueryBuilder<Cargo> qb = qbf.newQueryBuilder( Cargo.class )
             .where( isNotNull( cargoEntity.itinerary() ) );
-        Query<CargoEntity> cargos = uowf.currentUnitOfWork().newQuery( qb )
+        Query<Cargo> cargos = uowf.currentUnitOfWork().newQuery( qb )
             .orderBy( orderBy( cargoEntity.trackingId().get().id() ) );
 
         List<String> cargoList = new ArrayList<String>();
-        for( CargoEntity cargo : cargos )
+        for( Cargo cargo : cargos )
         {
             cargoList.add( cargo.trackingId().get().id().get() );
         }
@@ -60,15 +57,15 @@ public class TrackingQueries extends Queries
         return cargoList;
     }
 
-    public IModel<List<HandlingEventDTO>> events( final String trackingIdString )
+    public IModel<List<HandlingEvent>> events( final String trackingIdString )
     {
-        return new QueryModel<HandlingEventDTO, HandlingEventEntity>( HandlingEventDTO.class )
+        return new QueryModel<HandlingEvent>( HandlingEvent.class )
         {
-            public Query<HandlingEventEntity> getQuery()
+            public Query<HandlingEvent> getQuery()
             {
                 HandlingEvent eventTemplate = templateFor( HandlingEvent.class );
 
-                QueryBuilder<HandlingEventEntity> qb = qbf.newQueryBuilder( HandlingEventEntity.class )
+                QueryBuilder<HandlingEvent> qb = qbf.newQueryBuilder( HandlingEvent.class )
                     .where( QueryExpressions.eq( eventTemplate.trackingId().get().id(), trackingIdString ) );
                 return uowf.currentUnitOfWork().newQuery( qb )
                     .orderBy( orderBy( eventTemplate.completionDate() ) );

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/CargoDTO.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/CargoDTO.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/CargoDTO.java
deleted file mode 100644
index 955c3fc..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/CargoDTO.java
+++ /dev/null
@@ -1,56 +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.zest.sample.dcicargo.sample_b.communication.query.dto;
-
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.library.conversion.values.Unqualified;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.RouteSpecification;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.Delivery;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.tracking.TrackingId;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.DTO;
-
-/**
- * Cargo DTO
- *
- * Zest-comment:
- * We need the @Unqualified annotation since the CargoDTO interface has other properties than {@link Cargo}
- * so that properties can not be directly mapped when we convert from entity to immutable value DTO.
- * With the annotation, property access methods are compared by name instead.
- *
- * @see Cargo
- */
-@Unqualified
-public interface CargoDTO extends DTO
-{
-    Property<TrackingId> trackingId();
-
-    // Associated Location entity in Cargo is converted to an immutable LocationDTO value object
-    Property<LocationDTO> origin();
-
-    Property<RouteSpecification> routeSpecification();
-
-    Property<Delivery> delivery();
-
-    @Optional
-    Property<Itinerary> itinerary();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/4275718c/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/HandlingEventDTO.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/HandlingEventDTO.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/HandlingEventDTO.java
deleted file mode 100644
index 8f96aed..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/HandlingEventDTO.java
+++ /dev/null
@@ -1,52 +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.zest.sample.dcicargo.sample_b.communication.query.dto;
-
-import java.time.LocalDate;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.library.conversion.values.Unqualified;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEvent;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.tracking.TrackingId;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.DTO;
-
-/**
- * HandlingEvent DTO
- *
- * Zest-comment:
- * We need the @Unqualified annotation since the HandlingEventDTO interface has other properties than
- * {@link HandlingEvent} so that properties can not be directly mapped when we convert from entity to
- * immutable value DTO. With the annotation, property access methods are compared by name instead.
- */
-@Unqualified
-public interface HandlingEventDTO extends DTO
-{
-    Property<LocalDate> completionDate();
-
-    Property<TrackingId> trackingId();
-
-    Property<HandlingEventType> handlingEventType();
-
-    Property<LocationDTO> location();
-
-    @Optional
-    Property<VoyageDTO> voyage();
-}


Mime
View raw message