polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [11/28] zest-java git commit: ZEST-180, ZEST-186, ZEST-187, ZEST-188 Big Identity refactoring UnitOfWorkFactory is auto added to all modules that doesn't declare one IdentityGenerator is auto-added to all modules that deosn't declare one. Removed DCI/DDD
Date Sun, 23 Oct 2016 14:23:52 GMT
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/VisualizeApplicationStructure.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/VisualizeApplicationStructure.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/VisualizeApplicationStructure.java
deleted file mode 100644
index 391ae08..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/VisualizeApplicationStructure.java
+++ /dev/null
@@ -1,59 +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.bootstrap;
-
-import org.apache.zest.api.structure.ApplicationDescriptor;
-import org.apache.zest.bootstrap.Energy4Java;
-import org.apache.zest.envisage.Envisage;
-import org.apache.zest.sample.dcicargo.sample_b.bootstrap.assembly.Assembler;
-
-/**
- * Visualize the application assemblage structure.
- */
-public class VisualizeApplicationStructure
-{
-    public static void main( String[] args )
-        throws Exception
-    {
-        Energy4Java zest = new Energy4Java();
-        Assembler assembler = new Assembler();
-        ApplicationDescriptor applicationModel = zest.newApplicationModel( assembler );
-        applicationModel.newInstance( zest.spi() );
-
-        /*
-       * The Envisage Swing app visualizes the application assemblage structure.
-       *
-       * Tree view:
-       * - Click on elements to expand sub-elements.
-       * - Scroll to change font size.
-       * - Right click on viewer to re-size to fit window.
-       *
-       * Stacked view:
-       * - Scroll to zoom in/out of structure levels - might freeze though :-(
-       *
-       * Click on any element and see details of that element in the upper right pane.
-       *
-       * Pretty cool, eh?
-       * */
-        new Envisage().run( applicationModel );
-        int randomTimeoutMs = 18374140;
-        Thread.sleep( randomTimeoutMs );
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/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
deleted file mode 100644
index 6e3bf76..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/assembly/Assembler.java
+++ /dev/null
@@ -1,281 +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.bootstrap.assembly;
-
-import java.util.function.Function;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.value.ValueSerialization;
-import org.apache.zest.bootstrap.ApplicationAssembler;
-import org.apache.zest.bootstrap.ApplicationAssembly;
-import org.apache.zest.bootstrap.ApplicationAssemblyFactory;
-import org.apache.zest.bootstrap.AssemblyException;
-import org.apache.zest.bootstrap.LayerAssembly;
-import org.apache.zest.bootstrap.ModuleAssembly;
-import org.apache.zest.entitystore.memory.MemoryEntityStoreService;
-import org.apache.zest.index.rdf.RdfIndexingEngineService;
-import org.apache.zest.library.rdf.entity.EntityStateSerializer;
-import org.apache.zest.library.rdf.entity.EntityTypeSerializer;
-import org.apache.zest.library.rdf.repository.MemoryRepositoryService;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.GraphTraversalService;
-import org.apache.zest.sample.dcicargo.pathfinder_b.internal.GraphDAO;
-import org.apache.zest.sample.dcicargo.pathfinder_b.internal.GraphTraversalServiceImpl;
-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.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;
-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.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.spi.uuid.UuidIdentityGeneratorService;
-import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService;
-
-import static org.apache.zest.api.common.Visibility.application;
-import static org.apache.zest.api.structure.Application.Mode.development;
-
-/**
- * Zest assembly of the DCI Sample application (version B)
- *
- * A Zest application structure is declared by an assembly that defines which layers and modules
- * the application has and how they are allowed to depend on each other. Each layer could have it's
- * own assembly file in larger applications.
- *
- * The Zest assembly doesn't strictly map 1-1 to the directory hierarchy and the assembly
- * structures. An example is the Entities:
- *
- * Data objects (Entities and ValuesComposites) can be promoted to Role Players when they are
- * needed to play a Role in a Context. One Role Map is created for each Data object and it lists
- * Roles in different Contexts that the object can play. It then has knowledge about the Context
- * layer and therefore goes into the CONTEXT-RoleMap module.
- *
- * All other Date objects are candidates to play a role if needed by some context and they "stand by"
- * in the CONTEXT-RoleMapCandidates module. Note that there are still no "physical" upward dependencies
- * from the data package (containing entities and values) to layers above.
- *
- * TRY THIS:
- * Run VisualizeApplicationStructure to see a cool visualization of the assembly!
- */
-@SuppressWarnings( "unchecked" )
-public class Assembler
-    implements ApplicationAssembler
-{
-    @Override
-    public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory )
-        throws AssemblyException
-    {
-        // Application assembly
-        ApplicationAssembly assembly = applicationFactory.newApplicationAssembly();
-        assembly.setName( "DCI Sample (version B)" );
-        assembly.setVersion( "B.1.0" );
-        assembly.setMode( development );
-
-        // Layers (adding bottom-up - will be assembled in this order)
-        LayerAssembly infrastructureLayer = assembly.layer( "INFRASTRUCTURE" );
-        LayerAssembly dataLayer = assembly.layer( "DATA" );
-        LayerAssembly contextLayer = assembly.layer( "CONTEXT" );
-        LayerAssembly communicationLayer = assembly.layer( "COMMUNICATION" );
-        LayerAssembly bootstrapLayer = assembly.layer( "BOOTSTRAP" );
-
-        // Layer dependencies
-        bootstrapLayer.uses(
-            communicationLayer,
-            contextLayer,
-            dataLayer,
-            infrastructureLayer );
-
-        communicationLayer.uses(
-            contextLayer,
-            dataLayer,
-            infrastructureLayer );
-
-        contextLayer.uses(
-            dataLayer,
-            infrastructureLayer );
-
-        dataLayer.uses(
-            infrastructureLayer
-        );
-
-        // Assemble
-        assembleBootstrapLayer( bootstrapLayer );
-        assembleCommunicationLayer( communicationLayer );
-        assembleContextLayer( contextLayer );
-        assembleDataLayer( dataLayer );
-        assembleInfrastructureLayer( infrastructureLayer );
-
-        return assembly;
-    }
-
-    private void assembleBootstrapLayer( LayerAssembly bootstrapLayer )
-        throws AssemblyException
-    {
-        ModuleAssembly bootstrapModule = bootstrapLayer.module( "BOOTSTRAP-Bootstrap" );
-        bootstrapModule
-            .objects(
-                DCISampleApplication_b.class );
-
-        bootstrapModule
-            .addServices(
-                BaseDataService.class )
-            .instantiateOnStartup();
-
-        bootstrapModule
-            .addServices(
-                SampleDataService.class )
-            .instantiateOnStartup();
-    }
-
-    private void assembleCommunicationLayer( LayerAssembly communicationLayer )
-        throws AssemblyException
-    {
-        ModuleAssembly queryModule = communicationLayer.module( "COMMUNICATION-Query" );
-        queryModule
-            .values(
-                Cargo.class,
-                Location.class,
-                HandlingEvent.class,
-                Voyage.class );
-
-        queryModule
-            .transients(
-                BookingQueries.class )
-            .visibleIn( application );
-    }
-
-    private void assembleContextLayer( LayerAssembly contextLayer )
-        throws AssemblyException
-    {
-        ModuleAssembly roleMapModule = contextLayer.module( "CONTEXT-RoleMap" );
-        roleMapModule
-            .entities(
-                CargoRoleMap.class,
-                CargosRoleMap.class,
-                HandlingEventsRoleMap.class )
-            .visibleIn( application );
-
-        ModuleAssembly roleMapCandidatesModule = contextLayer.module( "CONTEXT-RoleMapCandidates" );
-        roleMapCandidatesModule
-            .entities(
-                HandlingEvent.class,
-                Location.class,
-                Voyage.class )
-            .visibleIn( application );
-
-        roleMapCandidatesModule
-            .values(
-                Itinerary.class )
-            .visibleIn( application );
-
-        ModuleAssembly interactionModule = contextLayer.module( "CONTEXT-Interaction" );
-        interactionModule
-            .transients(
-                ProcessHandlingEvent.class )
-            .visibleIn( application );
-
-        ModuleAssembly contextServiceModule = contextLayer.module( "CONTEXT-Service" );
-        contextServiceModule
-            .addServices(
-                ParseHandlingEventData.class,
-                RoutingService.class,
-                RouteSpecificationFactoryService.class )
-            .visibleIn( application );
-
-        contextServiceModule
-            .values(
-                ParsedHandlingEventData.class )
-            .visibleIn( application );
-    }
-
-    private void assembleDataLayer( LayerAssembly dataLayer )
-        throws AssemblyException
-    {
-        ModuleAssembly dataModule = dataLayer.module( "DATA-Structure" );
-        dataModule
-            .values(
-                TrackingId.class,
-                RouteSpecification.class,
-                Delivery.class,
-                NextHandlingEvent.class,
-                UnLocode.class,
-                Leg.class,
-                CarrierMovement.class,
-                Schedule.class,
-                VoyageNumber.class )
-            .visibleIn( application );
-    }
-
-    private void assembleInfrastructureLayer( LayerAssembly infrastructureLayer )
-        throws AssemblyException
-    {
-        ModuleAssembly serializationModule = infrastructureLayer.module( "INFRASTRUCTURE-Serialization" );
-        serializationModule
-            .services( OrgJsonValueSerializationService.class )
-            .taggedWith( ValueSerialization.Formats.JSON )
-            .setMetaInfo( (Function<Application, Module>) application -> application.findModule( "CONTEXT", "CONTEXT-RoleMap" ) )
-        .visibleIn( application );
-
-        ModuleAssembly indexingModule = infrastructureLayer.module( "INFRASTRUCTURE-Indexing" );
-        indexingModule
-            .objects(
-                EntityStateSerializer.class,
-                EntityTypeSerializer.class );
-
-        indexingModule
-            .services(
-                MemoryRepositoryService.class,
-                RdfIndexingEngineService.class )
-            .instantiateOnStartup()
-            .visibleIn( application );
-
-        ModuleAssembly entityStoreModule = infrastructureLayer.module( "INFRASTRUCTURE-EntityStore" );
-        entityStoreModule
-            .services(
-                MemoryEntityStoreService.class,
-                UuidIdentityGeneratorService.class )
-            .instantiateOnStartup()
-            .visibleIn( application );
-
-        ModuleAssembly externalServiceModule = infrastructureLayer.module( "INFRASTRUCTURE-ExternalService" );
-        externalServiceModule
-            .importedServices(
-                GraphTraversalService.class )
-            .setMetaInfo( new GraphTraversalServiceImpl( new GraphDAO() ) )
-            .visibleIn( application );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseData.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseData.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseData.java
deleted file mode 100644
index 08a9bb7..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseData.java
+++ /dev/null
@@ -1,196 +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.bootstrap.sampledata;
-
-import java.time.Instant;
-import java.time.LocalDate;
-import java.time.ZoneOffset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Random;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.parsing.dto.ParsedHandlingEventData;
-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.delivery.RoutingStatus;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.TransportStatus;
-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.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.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;
-
-/**
- * Test base class with shared data and factory methods.
- */
-public abstract class BaseData
-{
-    private static Random random = new Random();
-    protected UnLocode AUMEL;
-    protected UnLocode CNHGH;
-    protected UnLocode CNHKG;
-    protected UnLocode CNSHA;
-    protected UnLocode DEHAM;
-    protected UnLocode FIHEL;
-    protected UnLocode JNTKO;
-    protected UnLocode NLRTM;
-    protected UnLocode SEGOT;
-    protected UnLocode SESTO;
-    protected UnLocode SOMGQ;
-    protected UnLocode USCHI;
-    protected UnLocode USDAL;
-    protected UnLocode USNYC;
-    protected ValueBuilderFactory vbf;
-
-    protected BaseData( ValueBuilderFactory vbf )
-    {
-        this.vbf = vbf;
-    }
-
-    protected UnLocode unlocode( String unlocodeString )
-    {
-        ValueBuilder<UnLocode> unlocode = vbf.newValueBuilder( UnLocode.class );
-        unlocode.prototype().code().set( unlocodeString );
-        return unlocode.newInstance();
-    }
-
-    protected CarrierMovement carrierMovement( Location depLoc, Location arrLoc, LocalDate depDate, LocalDate arrDate )
-    {
-        ValueBuilder<CarrierMovement> carrierMovement = vbf.newValueBuilder( CarrierMovement.class );
-        carrierMovement.prototype().departureLocation().set( depLoc );
-        carrierMovement.prototype().arrivalLocation().set( arrLoc );
-        carrierMovement.prototype().departureDate().set( depDate );
-        carrierMovement.prototype().arrivalDate().set( arrDate );
-        return carrierMovement.newInstance();
-    }
-
-    protected Schedule schedule( CarrierMovement... carrierMovements )
-    {
-        ValueBuilder<Schedule> schedule = vbf.newValueBuilder( Schedule.class );
-        List<CarrierMovement> cm = new ArrayList<>();
-        cm.addAll( Arrays.asList( carrierMovements ) );
-        schedule.prototype().carrierMovements().set( cm );
-        return schedule.newInstance();
-    }
-
-    protected Leg leg( Voyage voyage, Location load, Location unload, LocalDate loadDate, LocalDate unloadDate )
-    {
-        ValueBuilder<Leg> leg = vbf.newValueBuilder( Leg.class );
-        leg.prototype().voyage().set( voyage );
-        leg.prototype().loadLocation().set( load );
-        leg.prototype().unloadLocation().set( unload );
-        leg.prototype().loadDate().set( loadDate );
-        leg.prototype().unloadDate().set( unloadDate );
-        return leg.newInstance();
-    }
-
-    protected Itinerary itinerary( Leg... legArray )
-    {
-        ValueBuilder<Itinerary> itinerary = vbf.newValueBuilder( Itinerary.class );
-        List<Leg> legs = new ArrayList<>();
-        legs.addAll( Arrays.asList( legArray ) );
-        itinerary.prototype().legs().set( legs );
-        return itinerary.newInstance();
-    }
-
-    protected Delivery delivery(
-        HandlingEvent lastHandlingEvent,
-        TransportStatus transportStatus,
-        Boolean isUnloadedAtDestination,
-        RoutingStatus routingStatus,
-        Boolean isMisdirected,
-        LocalDate eta,
-        Integer itineraryProgressIndex,
-        NextHandlingEvent nextHandlingEvent
-    )
-    {
-        ValueBuilder<Delivery> delivery = vbf.newValueBuilder( Delivery.class );
-        delivery.prototype().timestamp().set( Instant.now() );
-        delivery.prototype().lastHandlingEvent().set( lastHandlingEvent );
-        delivery.prototype().transportStatus().set( transportStatus );
-        delivery.prototype().isUnloadedAtDestination().set( isUnloadedAtDestination );
-        delivery.prototype().routingStatus().set( routingStatus );
-        delivery.prototype().isMisdirected().set( isMisdirected );
-        delivery.prototype().eta().set( eta );
-        delivery.prototype().itineraryProgressIndex().set( itineraryProgressIndex );
-        delivery.prototype().nextHandlingEvent().set( nextHandlingEvent );
-        return delivery.newInstance();
-    }
-
-    // Delivery with only mandatory values
-    protected Delivery delivery( LocalDate date,
-                                 TransportStatus transportStatus,
-                                 RoutingStatus routingStatus,
-                                 Integer itineraryProgressIndex
-    )
-    {
-        ValueBuilder<Delivery> delivery = vbf.newValueBuilder( Delivery.class );
-        delivery.prototype().timestamp().set( date.atStartOfDay().toInstant( ZoneOffset.UTC ) );
-        delivery.prototype().transportStatus().set( transportStatus );
-        delivery.prototype().routingStatus().set( routingStatus );
-        delivery.prototype().itineraryProgressIndex().set( itineraryProgressIndex );
-        return delivery.newInstance();
-    }
-
-    protected NextHandlingEvent nextHandlingEvent( HandlingEventType handlingEventType,
-                                                   Location location,
-                                                   LocalDate time,
-                                                   Voyage voyage
-    )
-    {
-        ValueBuilder<NextHandlingEvent> nextHandlingEvent = vbf.newValueBuilder( NextHandlingEvent.class );
-        nextHandlingEvent.prototype().handlingEventType().set( handlingEventType );
-        nextHandlingEvent.prototype().location().set( location );
-        nextHandlingEvent.prototype().date().set( time );
-        nextHandlingEvent.prototype().voyage().set( voyage );
-        return nextHandlingEvent.newInstance();
-    }
-
-    protected ParsedHandlingEventData parsedHandlingEventData( LocalDate registrationDate,
-                                                               LocalDate completionDate,
-                                                               String trackingIdString,
-                                                               HandlingEventType handlingEventType,
-                                                               String unLocodeString,
-                                                               String voyageNumberString
-    )
-        throws Exception
-    {
-        ValueBuilder<ParsedHandlingEventData> attempt = vbf.newValueBuilder( ParsedHandlingEventData.class );
-        attempt.prototype().registrationDate().set( registrationDate );
-        attempt.prototype().completionDate().set( completionDate );
-        attempt.prototype().trackingIdString().set( trackingIdString );
-        attempt.prototype().handlingEventType().set( handlingEventType );
-        attempt.prototype().unLocodeString().set( unLocodeString );
-        attempt.prototype().voyageNumberString().set( voyageNumberString );
-
-        return attempt.newInstance();
-    }
-
-    protected static LocalDate day( int days )
-    {
-        return LocalDate.now().plusDays( days );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseDataService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseDataService.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseDataService.java
deleted file mode 100644
index 479326f..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/BaseDataService.java
+++ /dev/null
@@ -1,192 +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.bootstrap.sampledata;
-
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.zest.api.activation.ActivatorAdapter;
-import org.apache.zest.api.activation.Activators;
-import org.apache.zest.api.entity.EntityBuilder;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.service.ServiceReference;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.GraphTraversalService;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.TransitEdge;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.TransitPath;
-import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.CargoAggregateRoot;
-import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.HandlingEventAggregateRoot;
-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.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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.zest.api.usecase.UsecaseBuilder.newUsecase;
-
-/**
- * Create basic sample data on startup of application.
- */
-@Mixins( BaseDataService.Mixin.class )
-@Activators( BaseDataService.Activator.class )
-public interface BaseDataService
-    extends ServiceComposite
-{
-
-    void createBaseData()
-        throws Exception;
-
-    class Activator
-        extends ActivatorAdapter<ServiceReference<BaseDataService>>
-    {
-
-        @Override
-        public void afterActivation( ServiceReference<BaseDataService> activated )
-            throws Exception
-        {
-            activated.get().createBaseData();
-        }
-    }
-
-    public abstract class Mixin
-        extends BaseData
-        implements BaseDataService
-    {
-        @Structure
-        UnitOfWorkFactory uowf;
-
-        @Service
-        GraphTraversalService graphTraversalService;
-
-        private static final Logger logger = LoggerFactory.getLogger( BaseDataService.class );
-
-        protected Mixin( @Structure ValueBuilderFactory vbf )
-        {
-            super( vbf );
-        }
-
-        @Override
-        public void createBaseData()
-            throws Exception
-        {
-            logger.debug( "CREATING BASIC DATA..." );
-
-            UnitOfWork uow = uowf.newUnitOfWork( newUsecase( "Create base data" ) );
-
-            // Create locations
-            location( unlocode( "AUMEL" ), "Melbourne" );
-            location( unlocode( "CNHGH" ), "Hangzhou" );
-            location( unlocode( "CNHKG" ), "Hongkong" );
-            location( unlocode( "CNSHA" ), "Shanghai" );
-            location( unlocode( "DEHAM" ), "Hamburg" );
-            location( unlocode( "FIHEL" ), "Helsinki" );
-            location( unlocode( "JNTKO" ), "Tokyo" );
-            location( unlocode( "NLRTM" ), "Rotterdam" );
-            location( unlocode( "SEGOT" ), "Gothenburg" );
-            location( unlocode( "SESTO" ), "Stockholm" );
-            location( unlocode( "SOMGQ" ), "Mogadishu" );
-            location( unlocode( "USCHI" ), "Chicago" );
-            location( unlocode( "USDAL" ), "Dallas" );
-            location( unlocode( "USNYC" ), "New York" );
-
-            // Create voyages
-            try
-            {
-                for( TransitPath voyagePath : graphTraversalService.getVoyages() )
-                {
-                    String voyageNumber = null;
-                    List<CarrierMovement> carrierMovements = new ArrayList<>();
-                    for( TransitEdge voyageEdge : voyagePath.getTransitEdges() )
-                    {
-                        voyageNumber = voyageEdge.getVoyageNumber();
-                        Location from = uow.get( Location.class, voyageEdge.getFromUnLocode() );
-                        Location to = uow.get( Location.class, voyageEdge.getToUnLocode() );
-                        carrierMovements.add( carrierMovement( from, to, voyageEdge.getFromDate(), voyageEdge.getToDate() ) );
-                    }
-
-                    ValueBuilder<Schedule> schedule = vbf.newValueBuilder( Schedule.class );
-                    schedule.prototype().carrierMovements().set( carrierMovements );
-                    voyage( voyageNumber, schedule.newInstance() );
-                }
-            }
-            catch( RemoteException e )
-            {
-                e.printStackTrace();
-            }
-
-            // Cargo and HandlingEvent aggregate roots
-            uow.newEntity( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
-            uow.newEntity( HandlingEventAggregateRoot.class, HandlingEventAggregateRoot.HANDLING_EVENTS_ID );
-
-            try
-            {
-                uow.complete();
-                logger.debug( "BASIC DATA CREATED" );
-            }
-            catch( UnitOfWorkCompletionException ex )
-            {
-                uow.discard();
-                logger.error( "UNABLE TO CREATE BASIC DATA" );
-                throw ex;
-            }
-        }
-
-        protected UnLocode unlocode( String unlocodeString )
-        {
-            ValueBuilder<UnLocode> unlocode = vbf.newValueBuilder( UnLocode.class );
-            unlocode.prototype().code().set( unlocodeString );
-            return unlocode.newInstance();
-        }
-
-        protected Location location( UnLocode unlocode, String locationStr )
-        {
-            UnitOfWork uow = uowf.currentUnitOfWork();
-            EntityBuilder<Location> location = uow.newEntityBuilder( Location.class, unlocode.code().get() );
-            location.instance().unLocode().set( unlocode );
-            location.instance().name().set( locationStr );
-            return location.newInstance();
-        }
-
-        protected Voyage voyage( String voyageNumberStr, Schedule schedule )
-        {
-            UnitOfWork uow = uowf.currentUnitOfWork();
-            EntityBuilder<Voyage> voyage = uow.newEntityBuilder( Voyage.class, voyageNumberStr );
-
-            // VoyageNumber
-            ValueBuilder<VoyageNumber> voyageNumber = vbf.newValueBuilder( VoyageNumber.class );
-            voyageNumber.prototype().number().set( voyageNumberStr );
-            voyage.instance().voyageNumber().set( voyageNumber.newInstance() );
-
-            // Schedule
-            voyage.instance().schedule().set( schedule );
-            return voyage.newInstance();
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/SampleDataService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/SampleDataService.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/SampleDataService.java
deleted file mode 100644
index aee65fd..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/sampledata/SampleDataService.java
+++ /dev/null
@@ -1,424 +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.bootstrap.sampledata;
-
-import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.UUID;
-import org.apache.zest.api.activation.ActivatorAdapter;
-import org.apache.zest.api.activation.Activators;
-import org.apache.zest.api.composite.TransientBuilderFactory;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.query.Query;
-import org.apache.zest.api.query.QueryBuilder;
-import org.apache.zest.api.query.QueryBuilderFactory;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.service.ServiceReference;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.usecase.Usecase;
-import org.apache.zest.api.usecase.UsecaseBuilder;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.BookNewCargo;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.routing.AssignCargoToRoute;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.ProcessHandlingEvent;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.event.InspectUnhandledCargo;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.parsing.dto.ParsedHandlingEventData;
-import org.apache.zest.sample.dcicargo.sample_b.context.service.routing.RoutingService;
-import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.CargoAggregateRoot;
-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.NextHandlingEvent;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.CarrierMovement;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.apache.zest.api.usecase.UsecaseBuilder.newUsecase;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType.CLAIM;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType.CUSTOMS;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType.LOAD;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType.RECEIVE;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType.UNLOAD;
-import static org.apache.zest.sample.dcicargo.sample_b.infrastructure.dci.Context.prepareContextBaseClass;
-
-/**
- * Create sample cargos in different delivery stages.
- *
- * Add more cases if needed in the loop below.
- */
-@Mixins( SampleDataService.Mixin.class )
-@Activators( SampleDataService.Activator.class )
-public interface SampleDataService
-    extends ServiceComposite
-{
-    void insertSampleData()
-        throws Exception;
-
-    class Activator
-        extends ActivatorAdapter<ServiceReference<SampleDataService>>
-    {
-
-        @Override
-        public void afterActivation( ServiceReference<SampleDataService> activated )
-            throws Exception
-        {
-            activated.get().insertSampleData();
-        }
-    }
-
-    abstract class Mixin
-        implements SampleDataService
-    {
-        @Structure
-        UnitOfWorkFactory uowf;
-
-        @Structure
-        ValueBuilderFactory vbf;
-
-        @Structure
-        QueryBuilderFactory qbf;
-
-        @Structure
-        TransientBuilderFactory tbf;
-
-        @Service
-        RoutingService routingService;
-
-        @Service
-        BaseDataService baseDataService;
-
-        @Service
-        RouteSpecificationFactoryService routeSpecFactory;
-
-        private static final Logger logger = LoggerFactory.getLogger( SampleDataService.class );
-
-        @Override
-        public void insertSampleData()
-            throws Exception
-        {
-            prepareContextBaseClass( uowf, vbf );
-
-            logger.info( "######  CREATING SAMPLE DATA...  ##########################################" );
-
-            // Create cargos
-            populateRandomCargos( 12 );
-
-            // Handle cargos
-            UnitOfWork uow = uowf.newUnitOfWork( newUsecase( "Create sample data" ) );
-            try
-            {
-                int i = 11; // starting at 11 for sortable tracking id prefix in lists
-                QueryBuilder<Cargo> qb = qbf.newQueryBuilder( Cargo.class );
-                for( Cargo cargo : uow.newQuery( qb ) )
-
-                {
-                    final String trackingId = cargo.trackingId().get().id().get();
-                    final RouteSpecification routeSpec = cargo.routeSpecification().get();
-                    routeSpec.print();
-
-                    NextHandlingEvent nextEvent = null;
-                    LocalDate date = null;
-                    String port = null;
-                    String voyageNumber = null;
-                    Voyage voyage;
-                    HandlingEventType type = null;
-                    String wrongPort = null;
-                    String wrongVoyage = null;
-
-                    // First cargo with id 11 is not routed
-
-                    // ROUTE
-                    if( i > 11 )
-                    {
-                        final List<Itinerary> routes = routingService.fetchRoutesForSpecification( routeSpec );
-                        final Itinerary itinerary = routes.get( 0 );
-                        new AssignCargoToRoute( cargo, itinerary ).assign();
-                    }
-
-                    // MISROUTE: Route specification not satisfied with itinerary
-                    if( i == 12 )
-                    {
-                        Location origin = routeSpec.origin().get();
-                        Location dest = routeSpec.destination().get();
-                        Location badDest = null;
-                        Query<Location> locations = uow.newQuery( qbf.newQueryBuilder( Location.class ) );
-                        for( Location loc : locations )
-                        {
-                            if( !origin.equals( loc ) && !dest.equals( loc ) )
-                            {
-                                badDest = loc;
-                                break;
-                            }
-                        }
-
-                        final RouteSpecification unsatisfiedRouteSpec =
-                            routeSpecFactory.build( origin, badDest, LocalDate.now(), LocalDate.now().plusDays( 25 ) );
-                        cargo.routeSpecification().set( unsatisfiedRouteSpec );
-
-                        new InspectUnhandledCargo( cargo ).inspect();
-                    }
-
-                    // RECEIVE
-                    if( i > 13 )
-                    {
-                        nextEvent = cargo.delivery().get().nextHandlingEvent().get();
-                        port = nextEvent.location().get().getCode();
-                        final LocalDate mockTime = LocalDate.now();
-                        registerEvent( mockTime, mockTime, trackingId, RECEIVE, port, null );
-                    }
-
-                    // MISDIRECT: LOAD onto wrong carrier
-                    if( i == 15 )
-                    {
-                        nextEvent = cargo.delivery().get().nextHandlingEvent().get();
-                        date = nextEvent.date().get();
-                        port = nextEvent.location().get().getCode();
-                        voyageNumber = nextEvent.voyage().get().voyageNumber().get().number().get();
-
-                        // Find earliest wrong carrier movement (voyage) with same departure location
-                        final Query<Voyage> voyages = uowf.currentUnitOfWork()
-                            .newQuery( qbf.newQueryBuilder( Voyage.class ) );
-                        int depth = 0;
-                        do
-                        {
-                            for( Voyage voy : voyages )
-                            {
-                                if( voy.voyageNumber().get().number().get().equals( voyageNumber ) )
-                                {
-                                    continue;
-                                }
-
-                                if( depth >= voy.schedule().get().carrierMovements().get().size() )
-                                {
-                                    continue;
-                                }
-
-                                // Carrier movement at current depth
-                                final CarrierMovement movement = voy.schedule()
-                                    .get()
-                                    .carrierMovements()
-                                    .get()
-                                    .get( depth );
-                                final boolean goingFromSamePort = movement.departureLocation()
-                                    .get()
-                                    .getCode()
-                                    .equals( port );
-                                final boolean notGoingToDestination = !movement.arrivalLocation()
-                                    .get()
-                                    .equals( routeSpec.destination().get() );
-
-                                if( goingFromSamePort && notGoingToDestination )
-                                {
-                                    wrongVoyage = voy.voyageNumber().get().number().get();
-                                    break;
-                                }
-                            }
-                        }
-                        while( wrongVoyage == null && depth++ < 10 );
-
-                        registerEvent( date, date, trackingId, LOAD, port, wrongVoyage );
-                    }
-
-                    // LOAD
-                    if( i > 15 )
-                    {
-                        nextEvent = cargo.delivery().get().nextHandlingEvent().get();
-                        date = nextEvent.date().get();
-                        port = nextEvent.location().get().getCode();
-                        voyageNumber = nextEvent.voyage().get().voyageNumber().get().number().get();
-                        registerEvent( date, date, trackingId, LOAD, port, voyageNumber );
-
-                        // Cargo is now on board carrier
-                        nextEvent = cargo.delivery().get().nextHandlingEvent().get();
-                        date = nextEvent.date().get();
-                        type = nextEvent.handlingEventType().get();
-                        port = nextEvent.location().get().getCode();
-                        voyageNumber = nextEvent.voyage().get().voyageNumber().get().number().get();
-                    }
-
-                    // MISDIRECT: UNLOAD from carrier in wrong location
-                    if( i == 17 )
-                    {
-                        voyage = uow.get( Voyage.class, voyageNumber );
-                        for( CarrierMovement movement : voyage.schedule().get().carrierMovements().get() )
-                        {
-                            final String arrivalPort = movement.arrivalLocation().get().getCode();
-
-                            // Take first voyage with different arrival location
-                            if( !arrivalPort.equals( port ) )
-                            {
-                                wrongPort = movement.arrivalLocation().get().unLocode().get().code().get();
-                                break;
-                            }
-                        }
-                        registerEvent( date, date, trackingId, UNLOAD, wrongPort, voyageNumber );
-                    }
-
-                    // UNLOAD
-                    if( i > 17 )
-                    {
-                        nextEvent = cargo.delivery().get().nextHandlingEvent().get();
-                        date = nextEvent.date().get();
-                        port = nextEvent.location().get().getCode();
-                        voyageNumber = nextEvent.voyage().get().voyageNumber().get().number().get();
-                        registerEvent( date, date, trackingId, UNLOAD, port, voyageNumber );
-
-                        // Cargo is now in midpoint location
-                        nextEvent = cargo.delivery().get().nextHandlingEvent().get();
-                        date = nextEvent.date().get();
-                        type = nextEvent.handlingEventType().get();
-                        port = nextEvent.location().get().getCode();
-                    }
-
-                    // CUSTOMS: Customs handling in midpoint location (doesn't affect misdirection status)
-                    if( i == 19 )
-                    {
-                        registerEvent( date, date, trackingId, CUSTOMS, port, null );
-                    }
-
-                    // MISDIRECT: Unexpected claim before reaching destination
-                    if( i == 20 )
-                    {
-                        registerEvent( date, date, trackingId, CLAIM, port, null );
-                    }
-
-                    // Complete all LOAD/UNLOADS
-                    if( i > 20 )
-                    {
-                        do
-                        {
-                            //noinspection ConstantConditions
-                            voyageNumber = nextEvent.voyage().get().voyageNumber().get().number().get();
-                            registerEvent( date, date, trackingId, type, port, voyageNumber );
-
-                            nextEvent = cargo.delivery().get().nextHandlingEvent().get();
-                            date = nextEvent.date().get();
-                            port = nextEvent.location().get().getCode();
-                            type = nextEvent.handlingEventType().get();
-                        }
-                        while( type != HandlingEventType.CLAIM );
-                    }
-
-                    // CLAIM at destination - this ends the life cycle of the cargo delivery
-                    if( i == 22 )
-                    {
-                        registerEvent( date, date, trackingId, CLAIM, port, null );
-                    }
-
-                    // Add more cases if needed...
-                    i++;
-                }
-
-                uow.complete();
-            }
-            catch( Exception e )
-            {
-                uow.discard();
-                logger.error( "Problem handling cargos: " + e.getMessage() );
-                throw e;
-            }
-
-            logger.info( "######  SAMPLE DATA CREATED  ##############################################" );
-        }
-
-        private void populateRandomCargos( int numberOfCargos )
-        {
-            Usecase usecase = UsecaseBuilder.newUsecase( "Populate Random Cargos" );
-            UnitOfWork uow = uowf.newUnitOfWork( usecase );
-
-            CargoAggregateRoot cargos = uow.get( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID );
-
-            Query<Location> allLocations = uow.newQuery( qbf.newQueryBuilder( Location.class ) );
-            int locationSize = (int) allLocations.count();
-
-            // Make array for selection of location with random index
-            final List<Location> locationList = new ArrayList<>();
-            for( Location location : allLocations )
-            {
-                locationList.add( location );
-            }
-
-            Location origin;
-            Location destination;
-            Random random = new Random();
-            LocalDate deadline;
-            String uuid;
-            String id;
-            try
-            {
-                for( int i = 0; i < numberOfCargos; i++ )
-                {
-                    origin = locationList.get( random.nextInt( locationSize ) );
-
-                    // Find destination different from origin
-                    do
-                    {
-                        destination = locationList.get( random.nextInt( locationSize ) );
-                    }
-                    while( destination.equals( origin ) );
-
-                    deadline = LocalDate.now().plusDays( 35 + random.nextInt( 10 ) );
-
-                    // Build sortable random tracking ids
-                    uuid = UUID.randomUUID().toString().toUpperCase();
-                    id = ( i + 11 ) + "-" + uuid.substring( 0, uuid.indexOf( "-" ) );
-
-                    new BookNewCargo( cargos, origin, destination, deadline ).withTrackingId( id );
-                }
-                uow.complete();
-            }
-            catch( Exception e )
-            {
-                uow.discard();
-                logger.error( "Problem booking a new cargo: " + e.getMessage() );
-            }
-        }
-
-        private void registerEvent( LocalDate registrationDate,
-                                    LocalDate completionDate,
-                                    String trackingIdString,
-                                    HandlingEventType handlingEventType,
-                                    String unLocodeString,
-                                    String voyageNumberString
-        )
-            throws Exception
-        {
-            ValueBuilder<ParsedHandlingEventData> event = vbf.newValueBuilder( ParsedHandlingEventData.class );
-            event.prototype().registrationDate().set( registrationDate );
-            event.prototype().completionDate().set( completionDate );
-            event.prototype().trackingIdString().set( trackingIdString );
-            event.prototype().handlingEventType().set( handlingEventType );
-            event.prototype().unLocodeString().set( unLocodeString );
-            event.prototype().voyageNumberString().set( voyageNumberString );
-
-            tbf.newTransient( ProcessHandlingEvent.class ).register( event.newInstance() );
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/BookingQueries.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/BookingQueries.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/BookingQueries.java
deleted file mode 100644
index 633b0ef..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/BookingQueries.java
+++ /dev/null
@@ -1,87 +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;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.wicket.model.IModel;
-import org.apache.zest.api.composite.TransientComposite;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.sample.dcicargo.sample_b.context.service.routing.RoutingService;
-import org.apache.zest.sample.dcicargo.sample_b.context.service.routing.exception.FoundNoRoutesException;
-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.itinerary.Itinerary;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.JSONModel;
-
-/**
- * Booking queries
- *
- * Implemented as a Zest composite since we can then conveniently get the routing service injected.
- * We could choose to implement all query classes like this too.
- *
- * Used by the communication layer only. Can change according to ui needs.
- */
-@Mixins( BookingQueries.Mixin.class )
-public interface BookingQueries
-    extends TransientComposite
-{
-    List<IModel<Itinerary>> routeCandidates( String trackingIdString )
-        throws FoundNoRoutesException;
-
-    List<IModel<Itinerary>> routeCandidates( RouteSpecification routeSpec )
-        throws FoundNoRoutesException;
-
-    abstract class Mixin
-        implements BookingQueries
-    {
-        @Structure
-        UnitOfWorkFactory uowf;
-
-        @Service
-        RoutingService routingService;
-
-        public List<IModel<Itinerary>> routeCandidates( final String trackingIdString )
-            throws FoundNoRoutesException
-        {
-            Cargo cargo = uowf.currentUnitOfWork().get( Cargo.class, trackingIdString );
-            RouteSpecification routeSpec = cargo.routeSpecification().get();
-
-            return routeCandidates( routeSpec );
-        }
-
-        public List<IModel<Itinerary>> routeCandidates( final RouteSpecification routeSpec )
-            throws FoundNoRoutesException
-        {
-            List<Itinerary> routes = routingService.fetchRoutesForSpecification( routeSpec );
-
-            List<IModel<Itinerary>> modelList = new ArrayList<IModel<Itinerary>>();
-            for( Itinerary itinerary : routes )
-            {
-                modelList.add( JSONModel.of( itinerary ) );
-            }
-
-            return modelList;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/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
deleted file mode 100644
index 0b61115..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/CommonQueries.java
+++ /dev/null
@@ -1,76 +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;
-
-import java.util.ArrayList;
-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.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;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.QueryModel;
-
-import static org.apache.zest.api.query.QueryExpressions.orderBy;
-import static org.apache.zest.api.query.QueryExpressions.templateFor;
-
-/**
- * Common queries
- *
- * Queries shared by Contexts in different packages.
- *
- * Used by the communication layer only. Can change freely according to presentation needs.
- */
-public class CommonQueries extends Queries
-{
-    public IModel<Cargo> cargo( String trackingId )
-    {
-        return EntityModel.of( Cargo.class, trackingId, Cargo.class );
-    }
-
-    public IModel<List<Cargo>> cargoList()
-    {
-        return new QueryModel<Cargo>( Cargo.class )
-        {
-            public Query<Cargo> getQuery()
-            {
-                QueryBuilder<Cargo> qb = qbf.newQueryBuilder( Cargo.class );
-                return uowf.currentUnitOfWork().newQuery( qb )
-                    .orderBy( orderBy( templateFor( Cargo.class ).trackingId().get().id() ) );
-            }
-        };
-    }
-
-    public List<String> unLocodes()
-    {
-        QueryBuilder<Location> qb = qbf.newQueryBuilder( Location.class );
-        Query<Location> locations = uowf.currentUnitOfWork().newQuery( qb )
-            .orderBy( orderBy( templateFor( Location.class ).unLocode().get().code() ) );
-        List<String> unLocodeList = new ArrayList<String>();
-        for( Location location : locations )
-        {
-            unLocodeList.add( location.getCode() );
-        }
-
-        return unLocodeList;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/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
deleted file mode 100644
index 3eb9ea2..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/HandlingQueries.java
+++ /dev/null
@@ -1,77 +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;
-
-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.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;
-
-import static org.apache.zest.api.query.QueryExpressions.orderBy;
-import static org.apache.zest.api.query.QueryExpressions.templateFor;
-
-/**
- * Handling queries
- *
- * Used by the communication layer only. Can change freely according to presentation needs.
- */
-public class HandlingQueries extends Queries
-{
-    public List<String> voyages()
-    {
-        QueryBuilder<Voyage> qb = qbf.newQueryBuilder( Voyage.class );
-        Query<Voyage> voyages = uowf.currentUnitOfWork().newQuery( qb )
-            .orderBy( orderBy( templateFor( Voyage.class ).voyageNumber() ) );
-
-        List<String> voyageList = new ArrayList<String>();
-        for( Voyage voyage : voyages )
-        {
-            voyageList.add( voyage.voyageNumber().get().number().get() );
-        }
-        return voyageList;
-    }
-
-    public List<String> cargoIds()
-    {
-        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() );
-        }
-        return cargoList;
-    }
-
-    public List<String> eventTypes()
-    {
-        List<String> eventTypes = new ArrayList<>();
-        for( HandlingEventType eventType : HandlingEventType.values() )
-        {
-            eventTypes.add( eventType.name() );
-        }
-        return eventTypes;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/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
deleted file mode 100644
index fce2557..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/TrackingQueries.java
+++ /dev/null
@@ -1,75 +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;
-
-import java.util.ArrayList;
-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.api.query.QueryExpressions;
-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;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.QueryModel;
-
-import static org.apache.zest.api.query.QueryExpressions.*;
-
-/**
- * Tracking queries
- *
- * Used by the communication layer only. Can change freely according to presentation needs.
- */
-public class TrackingQueries extends Queries
-{
-    public List<String> routedCargos()
-    {
-        Cargo cargoEntity = templateFor( Cargo.class );
-
-        QueryBuilder<Cargo> qb = qbf.newQueryBuilder( Cargo.class )
-            .where( isNotNull( cargoEntity.itinerary() ) );
-        Query<Cargo> cargos = uowf.currentUnitOfWork().newQuery( qb )
-            .orderBy( orderBy( cargoEntity.trackingId().get().id() ) );
-
-        List<String> cargoList = new ArrayList<String>();
-        for( Cargo cargo : cargos )
-        {
-            cargoList.add( cargo.trackingId().get().id().get() );
-        }
-
-        return cargoList;
-    }
-
-    public IModel<List<HandlingEvent>> events( final String trackingIdString )
-    {
-        return new QueryModel<HandlingEvent>( HandlingEvent.class )
-        {
-            public Query<HandlingEvent> getQuery()
-            {
-                HandlingEvent eventTemplate = templateFor( HandlingEvent.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() ) );
-            }
-        };
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/BasePage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/BasePage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/BasePage.java
deleted file mode 100644
index 76ee4b8..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/BasePage.java
+++ /dev/null
@@ -1,78 +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.web;
-
-import com.google.code.joliratools.StatelessAjaxFallbackLink;
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.WicketZestApplication;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.page.BaseWebPage;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.tabs.TabsPanel;
-//import org.wicketstuff.stateless.StatelessAjaxFallbackLink;
-
-/**
- * Base Wicket page of the DCI Sample application
- */
-public class BasePage extends BaseWebPage
-{
-    private final Link toggleLinks;
-    private static boolean showLInks = false;
-    private Fragment links = new Fragment( "links", "linksFragment", this );
-
-    public BasePage( String activeTab )
-    {
-        this( activeTab, null );
-    }
-
-    public BasePage( String activeTab, PageParameters pageParameters )
-    {
-        super( pageParameters );
-
-        toggleLinks = new StatelessAjaxFallbackLink<Void>( "toggleLinks" )
-        {
-            @Override
-            public void onClick( AjaxRequestTarget target )
-            {
-                // Open/close triangle of this toggle link
-                add( new AttributeModifier( "class", Model.of( showLInks ? "closed" : "open" ) ) );
-
-                // Show/hide links
-                links.setVisible( showLInks = !showLInks );
-
-                // Update with ajax if browser allows
-                if( target != null )
-                {
-                    target.add( links, toggleLinks );
-                }
-            }
-        };
-        add( toggleLinks );
-        add( links.setOutputMarkupPlaceholderTag( true ).setVisible( false ) );
-
-        add( new Label( "version", ( (WicketZestApplication) getApplication() ).appVersion() ) );
-
-        add( new TabsPanel( activeTab ) );
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/BookNewCargoPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/BookNewCargoPage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/BookNewCargoPage.java
deleted file mode 100644
index 7c19a97..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/BookNewCargoPage.java
+++ /dev/null
@@ -1,152 +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.web.booking;
-
-import java.time.LocalDate;
-import java.util.List;
-import org.apache.wicket.Session;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.panel.ComponentFeedbackPanel;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.CommonQueries;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.BookNewCargo;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.tracking.TrackingId;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form.AbstractForm;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form.DateTextFieldWithPicker;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form.SelectorInForm;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.prevnext.PrevNext;
-
-/**
- * Book new cargo
- *
- * An example of UI validation:
- * - you can't choose equal locations
- * - earliest deadline you can choose from the date picker is tomorrow (we could set any date that the domain wants).
- *
- * More elaborate validation rules could be enforced in a real domain to avoid even touching
- * the backend with invalid data (of course we would still need backend validation).
- */
-public class BookNewCargoPage extends BookingBasePage
-{
-    public BookNewCargoPage()
-    {
-        add( new BookNewCargoForm() );
-    }
-
-    private final class BookNewCargoForm extends AbstractForm<Void>
-    {
-        // Set by Wicket property resolvers:
-        private String origin, destination;
-        private LocalDate deadline;
-
-        public BookNewCargoForm()
-        {
-            List<String> locations = new CommonQueries().unLocodes();
-
-            final FeedbackPanel feedback = new FeedbackPanel( "feedback" );
-            add( feedback.setOutputMarkupId( true ) );
-
-            final SelectorInForm originSelector = new SelectorInForm(
-                "origin", "Origin", locations, this, "destination" );
-            originSelector.setRequired( true );
-
-            final ComponentFeedbackPanel originFeedback = new ComponentFeedbackPanel(
-                "originFeedback", originSelector );
-            add( originFeedback.setOutputMarkupId( true ) );
-
-            final SelectorInForm destinationSelector = new SelectorInForm(
-                "destination", "Destinatin", locations, this, "origin" );
-            destinationSelector.setRequired( true );
-
-            final ComponentFeedbackPanel destinationFeedback = new ComponentFeedbackPanel(
-                "destinationFeedback", destinationSelector );
-            add( destinationFeedback.setOutputMarkupId( true ) );
-
-            // Disable equal locations
-            originSelector.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
-            {
-                @Override
-                protected void onUpdate( AjaxRequestTarget target )
-                {
-                    // Exclude origin in destination drop down
-                    target.add( originSelector, originFeedback, destinationSelector );
-                    focusFirstError( target );
-                }
-            } );
-
-            destinationSelector.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
-            {
-                @Override
-                protected void onUpdate( AjaxRequestTarget target )
-                {
-                    // Exclude destination in origin drop down
-                    target.add( destinationSelector, destinationFeedback, originSelector );
-                    focusFirstError( target );
-                }
-            } );
-
-            // Deadline
-            final DateTextFieldWithPicker deadlineField = new DateTextFieldWithPicker( "deadline", "Arrival deadline", this );
-            deadlineField.earliestDate( LocalDate.now().plusDays( 1 ) );
-
-            final ComponentFeedbackPanel deadlineFeedback = new ComponentFeedbackPanel(
-                "deadlineFeedback", deadlineField );
-            add( deadlineFeedback.setOutputMarkupId( true ) );
-
-            add( originSelector, destinationSelector, deadlineField );
-
-            add( new AjaxFallbackButton( "book", this )
-            {
-                @Override
-                protected void onSubmit( AjaxRequestTarget target, Form<?> form )
-                {
-                    try
-                    {
-                        // Perform use case
-                        TrackingId trackingId = new BookNewCargo( origin, destination, deadline ).getTrackingId();
-
-                        // Add new tracking id to list in session
-                        PrevNext.addId( Session.get(), trackingId.id().get() );
-
-                        // Show created cargo
-                        setResponsePage( CargoDetailsPage.class, new PageParameters().set( 0, trackingId.id().get() ) );
-                    }
-                    catch( Exception e )
-                    {
-                        logger.warn( "Problem booking a new cargo: " + e.getMessage() );
-                        feedback.error( e.getMessage() );
-                        target.add( feedback );
-                    }
-                }
-
-                @Override
-                protected void onError( final AjaxRequestTarget target, Form<?> form )
-                {
-                    target.add( originFeedback, destinationFeedback, deadlineFeedback );
-                    focusFirstError( target );
-                }
-            } );
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/BookingBasePage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/BookingBasePage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/BookingBasePage.java
deleted file mode 100644
index 3fed83b..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/BookingBasePage.java
+++ /dev/null
@@ -1,39 +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.web.booking;
-
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.BasePage;
-
-/**
- * Booking base page - to control the selected tab
- */
-public class BookingBasePage extends BasePage
-{
-    public BookingBasePage()
-    {
-        super( "booking" );
-    }
-
-    public BookingBasePage( PageParameters pageParameters )
-    {
-        super( "booking", pageParameters );
-    }
-}
\ No newline at end of file


Mime
View raw message