polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [33/50] [abbrv] zest-qi4j git commit: Replaced Joda Time with Java 8 Time API.
Date Fri, 17 Apr 2015 16:08:45 GMT
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/booking/CargoListPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/booking/CargoListPage.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/booking/CargoListPage.java
index 4962a0f..2b5ae33 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/booking/CargoListPage.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/booking/CargoListPage.java
@@ -17,6 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.communication.web.booking;
 
+import java.time.ZonedDateTime;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -70,10 +71,10 @@ public class CargoListPage extends BookingBasePage
 
                 item.add( new Label( "destination", cargo.routeSpecification().get().destination().get().getCode() ) );
 
-                item.add( new Label( "deadline", new Model<Date>( cargo.routeSpecification()
-                                                                      .get()
-                                                                      .arrivalDeadline()
-                                                                      .get() ) ) );
+                ZonedDateTime arrivalDeadline = cargo.routeSpecification().get().arrivalDeadline().get();
+                item.add( new Label( "deadline", new Model<Date>( new Date( arrivalDeadline.plusDays( 1 )
+                                                                                .toInstant()
+                                                                                .toEpochMilli() ) ) ) );
 
                 item.add( new Label( "routingStatus", routingStatus.toString() ).add( new ErrorColor( routingStatus == RoutingStatus.MISROUTED ) ) );
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/booking/RoutePanel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/booking/RoutePanel.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/booking/RoutePanel.java
index 83fd9bd..0ab7478 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/booking/RoutePanel.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/booking/RoutePanel.java
@@ -73,11 +73,13 @@ public class RoutePanel extends Panel
             protected void populateItem( ListItem<Leg> item )
             {
                 Leg leg = item.getModelObject();
+                Date loadTime = new Date( leg.loadTime().get().toInstant().toEpochMilli() );
+                Date unloadTime = new Date( leg.unloadTime().get().toInstant().toEpochMilli() );
                 item.add( new Label( "voyage", leg.voyage().get().toString() ),
                           new Label( "loadLocation", leg.loadLocation().get().getCode() ),
-                          new Label( "loadTime", new Model<Date>( leg.loadTime().get() ) ),
+                          new Label( "loadTime", new Model<Date>( loadTime ) ),
                           new Label( "unloadLocation", leg.unloadLocation().get().getCode() ),
-                          new Label( "unloadTime", new Model<Date>( leg.unloadTime().get() ) )
+                          new Label( "unloadTime", new Model<Date>( unloadTime ) )
                 );
             }
         } );

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/handling/RegisterHandlingEventPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/handling/RegisterHandlingEventPage.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/handling/RegisterHandlingEventPage.java
index cd0a242..f98ec0b 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/handling/RegisterHandlingEventPage.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/handling/RegisterHandlingEventPage.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.communication.web.handling;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
 import org.apache.wicket.markup.html.form.Form;
@@ -25,7 +25,6 @@ import org.apache.wicket.markup.html.panel.FeedbackPanel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.model.StringResourceModel;
 import org.apache.wicket.util.value.ValueMap;
-import org.joda.time.LocalDate;
 import org.qi4j.sample.dcicargo.sample_a.communication.query.CommonQueries;
 import org.qi4j.sample.dcicargo.sample_a.communication.query.HandlingQueries;
 import org.qi4j.sample.dcicargo.sample_a.communication.web.BasePage;
@@ -56,7 +55,7 @@ public class RegisterHandlingEventPage extends BasePage
     private final class RegisterHandlingEventForm extends AbstractForm<Void>
     {
         // Set by Wicket property resolvers:
-        private Date completion;
+        private ZonedDateTime completion;
         private String trackingId, unLocode, voyageNumber, eventType;
 
         private String lastSubmittedData;
@@ -67,7 +66,7 @@ public class RegisterHandlingEventPage extends BasePage
             add( feedback.setOutputMarkupId( true ) );
 
             final DateTextFieldWithPicker completionDateInput = new DateTextFieldWithPicker( "completion", "Completion", this );
-            completionDateInput.earliestDate( new LocalDate() );
+            completionDateInput.earliestDate( ZonedDateTime.now() );
 
             HandlingQueries fetch = new HandlingQueries();
             add( completionDateInput.setLabel( Model.of( "Completion" ) ) );
@@ -91,7 +90,7 @@ public class RegisterHandlingEventPage extends BasePage
 
                         // Perform use case
                         new RegisterHandlingEvent(
-                            new Date(), completion, trackingId, eventType, unLocode, voyageNumber ).register();
+                            ZonedDateTime.now(), completion, trackingId, eventType, unLocode, voyageNumber ).register();
 
                         // We could redirect to Details, but it's more fun to update details in a separate
                         // window to follow the successive handling event registrations you make...

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/tracking/HandlingHistoryPanel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/tracking/HandlingHistoryPanel.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/tracking/HandlingHistoryPanel.java
index 85e01f7..5e0d911 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/tracking/HandlingHistoryPanel.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/tracking/HandlingHistoryPanel.java
@@ -17,6 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.communication.web.tracking;
 
+import java.time.ZoneOffset;
 import java.util.Date;
 import java.util.List;
 import org.apache.wicket.behavior.AttributeAppender;
@@ -63,7 +64,8 @@ public class HandlingHistoryPanel extends Panel
                 item.add( new WebMarkupContainer( "onTrackIcon" ).add( new AttributeAppender( "src", iconName, "" ) ) );
 
                 // Date
-                item.add( new Label( "completion", new Model<Date>( event.completionTime().get() ) ) );
+                Date completeTime = new Date( event.completionTime().get().toInstant().toEpochMilli() );
+                item.add( new Label( "completion", new Model<Date>( completeTime ) ) );
 
                 // Event description (data substitution in strings from HandlingHistoryPanel.properties)
                 ValueMap map = new ValueMap();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/tracking/TrackCargoPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/tracking/TrackCargoPage.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/tracking/TrackCargoPage.java
index a8b4bcc..79719d5 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/tracking/TrackCargoPage.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/communication/web/tracking/TrackCargoPage.java
@@ -17,8 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.communication.web.tracking;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.time.ZonedDateTime;
 import java.util.List;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
@@ -166,10 +165,9 @@ public class TrackCargoPage extends BasePage
 
                 // ETA ----------------------------------------------------------------------
                 String destination = cargo.routeSpecification().get().destination().get().getString();
-                Date eta = cargo.delivery().get().eta().get();
-                String etaString = eta == null ? "?" : new SimpleDateFormat( "yyyy-MM-dd" ).format( eta );
+                ZonedDateTime eta = cargo.delivery().get().eta().get();
                 add( new Label( "eta", new StringResourceModel(
-                    "eta", this, null, Model.of( destination ), Model.of( etaString ) ) ) );
+                    "eta", this, null, Model.of( destination ), Model.of( eta.toString() ) ) ) );
 
                 // Warning/Notifier ----------------------------------------------------------------------
                 add( new WebMarkupContainer( "isMisdirected" ).setVisible( cargo.delivery()

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargo.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargo.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargo.java
index bf86b64..37f2a7a 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargo.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargo.java
@@ -17,9 +17,9 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.context.shipping.booking;
 
-import java.util.Date;
+import java.time.LocalTime;
+import java.time.ZonedDateTime;
 import java.util.List;
-import org.joda.time.DateMidnight;
 import org.qi4j.api.common.Optional;
 import org.qi4j.api.injection.scope.Service;
 import org.qi4j.api.injection.scope.This;
@@ -55,7 +55,7 @@ public class BookNewCargo extends Context
     // Methodless Roles
     private Location origin;
     private Location destination;
-    private Date arrivalDeadline;
+    private ZonedDateTime arrivalDeadline;
     private Itinerary itinerary;
 
     // CONTEXT CONSTRUCTORS ------------------------------------------------------
@@ -63,7 +63,7 @@ public class BookNewCargo extends Context
     public BookNewCargo( Cargos cargos,
                          Location origin,
                          Location destination,
-                         Date arrivalDeadline
+                         ZonedDateTime arrivalDeadline
     )
         throws Exception
     {
@@ -86,7 +86,7 @@ public class BookNewCargo extends Context
 
     // Constructor proxies for communication layer
 
-    public BookNewCargo( String originId, String destinationId, Date deadline )
+    public BookNewCargo( String originId, String destinationId, ZonedDateTime deadline )
         throws Exception
     {
         this( loadEntity( CargosEntity.class, CargosEntity.CARGOS_ID ),
@@ -135,7 +135,7 @@ public class BookNewCargo extends Context
 
     // METHODFUL ROLE IMPLEMENTATIONS --------------------------------------------
 
-    @Mixins( CargoFactoryRole.Mixin.class )
+    @Mixins(CargoFactoryRole.Mixin.class)
     public interface CargoFactoryRole
     {
         void setContext( BookNewCargo context );
@@ -166,7 +166,7 @@ public class BookNewCargo extends Context
         }
     }
 
-    @Mixins( RoutingFacadeRole.Mixin.class )
+    @Mixins(RoutingFacadeRole.Mixin.class)
     public interface RoutingFacadeRole
     {
         void setContext( BookNewCargo context );
@@ -212,7 +212,7 @@ public class BookNewCargo extends Context
             public void changeDestination( Location newDestination )
             {
                 Location currentOrigin = cargo.routeSpecification().get().origin().get();
-                Date currentDeadline = cargo.routeSpecification().get().arrivalDeadline().get();
+                ZonedDateTime currentDeadline = cargo.routeSpecification().get().arrivalDeadline().get();
 
                 RouteSpecification newRouteSpecification =
                     context.buildRouteSpecification( vbf, currentOrigin, newDestination, currentDeadline );
@@ -226,7 +226,7 @@ public class BookNewCargo extends Context
     }
 
     public RouteSpecification buildRouteSpecification(
-        ValueBuilderFactory vbf, Location origin, Location destination, Date deadline
+        ValueBuilderFactory vbf, Location origin, Location destination, ZonedDateTime deadline
     )
     {
         if( origin == destination )
@@ -239,12 +239,9 @@ public class BookNewCargo extends Context
             throw new RouteException( "Arrival deadline cannot be null." );
         }
 
-        Date endOfToday = new DateMidnight().plusDays( 1 ).toDate();
-        if( deadline.before( endOfToday ) )
+        if( deadline.isBefore( ZonedDateTime.now().plusDays( 1 ).with( LocalTime.MIDNIGHT ) ) )
         {
-            throw new RouteException( "Arrival deadline is in the past or Today." +
-                                        "\nDeadline           " + deadline +
-                                        "\nToday (midnight)   " + endOfToday );
+            throw new RouteException( "Arrival deadline is in the past or Today: " + deadline );
         }
 
         ValueBuilder<RouteSpecification> routeSpec = vbf.newValueBuilder( RouteSpecification.class );

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshot.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshot.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshot.java
index 54741b6..e9a5c57 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshot.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BuildDeliverySnapshot.java
@@ -17,7 +17,8 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.context.shipping.booking;
 
-import java.util.Date;
+import java.time.Instant;
+import java.time.ZonedDateTime;
 import java.util.Iterator;
 import org.qi4j.api.injection.scope.This;
 import org.qi4j.api.mixin.Mixins;
@@ -80,11 +81,10 @@ public class BuildDeliverySnapshot extends Context
         }
 
         // Deviation 2b
-        if( routeSpecification.arrivalDeadline().get().before( new Date() ) )
+        ZonedDateTime deadline = routeSpecification.arrivalDeadline().get();
+        if( deadline.isBefore( ZonedDateTime.now() ) )
         {
-            throw new RouteException( "Arrival deadline is in the past or Today." +
-                                        "\nDeadline " + routeSpecification.arrivalDeadline().get() +
-                                        "\nToday    " + new Date() );
+            throw new RouteException( "Arrival deadline is in the past or Today: " + deadline );
         }
 
         factory = rolePlayer( FactoryRole.class, routeSpecification );
@@ -121,7 +121,7 @@ public class BuildDeliverySnapshot extends Context
      * When the Cargo has a delivery history the FactoryRole delegates to the LastHandlingEventRole
      * to derive data from the last HandlingEvent.
      */
-    @Mixins( FactoryRole.Mixin.class )
+    @Mixins(FactoryRole.Mixin.class)
     public interface FactoryRole
     {
         void setContext( BuildDeliverySnapshot context );
@@ -155,7 +155,7 @@ public class BuildDeliverySnapshot extends Context
                 // Build delivery snapshot object
                 deliveryBuilder = vbf.newValueBuilder( Delivery.class );
                 context.newDeliverySnapshot = deliveryBuilder.prototype();
-                context.newDeliverySnapshot.timestamp().set( new Date() );
+                context.newDeliverySnapshot.timestamp().set( Instant.now() );
 
                 // Deviation 2c: Cargo is not routed yet
                 if( context.itinerary == null )
@@ -232,7 +232,7 @@ public class BuildDeliverySnapshot extends Context
      *
      * The HandlingEventRole uses the ItineraryRole heavily to calculate values based on Itinerary data.
      */
-    @Mixins( HandlingEventRole.Mixin.class )
+    @Mixins(HandlingEventRole.Mixin.class)
     public interface HandlingEventRole
     {
         void setContext( BuildDeliverySnapshot context );
@@ -412,12 +412,12 @@ public class BuildDeliverySnapshot extends Context
     /**
      * The ItineraryRole supports the HandlingEventRole with calculated results derived from Itinerary Legs.
      */
-    @Mixins( ItineraryRole.Mixin.class )
+    @Mixins(ItineraryRole.Mixin.class)
     public interface ItineraryRole
     {
         void setContext( BuildDeliverySnapshot context );
 
-        Date eta();
+        ZonedDateTime eta();
 
         boolean expectsOrigin( Location location );
 
@@ -440,7 +440,7 @@ public class BuildDeliverySnapshot extends Context
             @This
             Itinerary itinerary;
 
-            public Date eta()
+            public ZonedDateTime eta()
             {
                 return itinerary.lastLeg().unloadTime().get();
             }
@@ -490,8 +490,8 @@ public class BuildDeliverySnapshot extends Context
             {
                 // After RECEIVE, expect LOAD location and voyage of first itinerary leg
                 final Leg firstLeg = itinerary.legs().get().iterator().next();
-                return buildEvent( HandlingEventType.LOAD, firstLeg.loadLocation().get(), firstLeg.loadTime()
-                    .get(), firstLeg.voyage().get() );
+                return buildEvent( HandlingEventType.LOAD, firstLeg.loadLocation().get(),
+                                   firstLeg.loadTime().get(), firstLeg.voyage().get() );
             }
 
             public ExpectedHandlingEvent expectedEventAfterLoadAt( Location lastLoadLocation )
@@ -542,7 +542,7 @@ public class BuildDeliverySnapshot extends Context
 
             private ExpectedHandlingEvent buildEvent( HandlingEventType eventType,
                                                       Location location,
-                                                      Date time,
+                                                      ZonedDateTime time,
                                                       Voyage voyage
             )
             {

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEvent.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEvent.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEvent.java
index 64665d7..effcb6f 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEvent.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEvent.java
@@ -17,8 +17,8 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.context.shipping.handling;
 
+import java.time.ZonedDateTime;
 import java.util.Arrays;
-import java.util.Date;
 import org.qi4j.api.injection.scope.Service;
 import org.qi4j.api.injection.scope.This;
 import org.qi4j.api.mixin.Mixins;
@@ -51,8 +51,8 @@ public class RegisterHandlingEvent extends Context
 
     private HandlingEventFactoryRole handlingEventFactory;
 
-    private Date registrationTime;
-    private Date completionTime;
+    private ZonedDateTime registrationTime;
+    private ZonedDateTime completionTime;
     private String trackingIdString;
     private String eventTypeString;
     private String unLocodeString;
@@ -60,8 +60,8 @@ public class RegisterHandlingEvent extends Context
 
     // CONTEXT CONSTRUCTORS ------------------------------------------------------
 
-    public RegisterHandlingEvent( Date registrationTime,
-                                  Date completionTime,
+    public RegisterHandlingEvent( ZonedDateTime registrationTime,
+                                  ZonedDateTime completionTime,
                                   String trackingIdString,
                                   String eventTypeString,
                                   String unLocodeString,

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/ApplicationEvents.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/ApplicationEvents.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/ApplicationEvents.java
index eb951fa..6b49074 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/ApplicationEvents.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/ApplicationEvents.java
@@ -18,7 +18,6 @@
 package org.qi4j.sample.dcicargo.sample_a.context.support;
 
 import java.text.SimpleDateFormat;
-import java.util.Date;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.service.ServiceComposite;
 import org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.Cargo;
@@ -83,7 +82,7 @@ public interface ApplicationEvents
         public void cargoWasHandled( HandlingEvent registeredHandlingEvent )
         {
             id = registeredHandlingEvent.trackingId().get().id().get();
-            time = parseDate( registeredHandlingEvent.completionTime().get() );
+            time = registeredHandlingEvent.completionTime().get().toString();
             type = registeredHandlingEvent.handlingEventType().get().name();
             unloc = registeredHandlingEvent.location().get().getCode();
             loc = registeredHandlingEvent.location().get().name().get();
@@ -119,7 +118,7 @@ public interface ApplicationEvents
 
         public void receivedHandlingEventRegistrationAttempt( RegisterHandlingEventAttemptDTO attempt )
         {
-            time = parseDate( attempt.completionTime().get() );
+            time = attempt.completionTime().get().toString();
             id = parse( attempt.trackingIdString().get() );
             type = parse( attempt.eventTypeString().get() );
             unloc = parse( attempt.unLocodeString().get() );
@@ -144,9 +143,5 @@ public interface ApplicationEvents
             return str == null ? "null" : str;
         }
 
-        private String parseDate( Date date )
-        {
-            return date == null ? "null" : new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format( date );
-        }
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/FoundNoRoutesException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/FoundNoRoutesException.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/FoundNoRoutesException.java
index fde107a..ba2c595 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/FoundNoRoutesException.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/FoundNoRoutesException.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.context.support;
 
-import org.joda.time.LocalDate;
+import java.time.ZonedDateTime;
 
 /**
  * Custom messages when the deadline is too close and we can't find a route.
@@ -25,9 +25,9 @@ import org.joda.time.LocalDate;
 public class FoundNoRoutesException extends Exception
 {
     private final String city;
-    private final LocalDate deadline;
+    private final ZonedDateTime deadline;
 
-    public FoundNoRoutesException( String city, LocalDate deadline )
+    public FoundNoRoutesException( String city, ZonedDateTime deadline )
     {
         this.city = city;
         this.deadline = deadline;
@@ -36,17 +36,17 @@ public class FoundNoRoutesException extends Exception
     @Override
     public String getMessage()
     {
-        if( deadline.isBefore( new LocalDate().plusDays( 2 ) ) )
+        if( deadline.isBefore( ZonedDateTime.now().plusDays( 2 ) ) )
         {
             return "Impossible to get the cargo to " + city + " before " + deadline
                    + "! Make a new booking with a deadline 2-3 weeks ahead in time.";
         }
-        else if( deadline.isBefore( new LocalDate().plusDays( 4 ) ) )
+        else if( deadline.isBefore( ZonedDateTime.now().plusDays( 4 ) ) )
         {
             return "Couldn't find any routes arriving in " + city + " before " + deadline
                    + ". Please try again or make a new booking with a deadline 2-3 weeks ahead in time.";
         }
-        else if( deadline.isBefore( new LocalDate().plusDays( 6 ) ) )
+        else if( deadline.isBefore( ZonedDateTime.now().plusDays( 6 ) ) )
         {
             return "Sorry, our system couldn't immediately find a route arriving in " + city + " before " + deadline
                    + ". Please try again, and we should hopefully be able to find a new route for you.";

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/RegisterHandlingEventAttemptDTO.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/RegisterHandlingEventAttemptDTO.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/RegisterHandlingEventAttemptDTO.java
index c37930b..90c4869 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/RegisterHandlingEventAttemptDTO.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/RegisterHandlingEventAttemptDTO.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.context.support;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import org.qi4j.api.common.Optional;
 import org.qi4j.api.property.Immutable;
 import org.qi4j.api.property.Property;
@@ -30,10 +30,10 @@ import org.qi4j.sample.dcicargo.sample_a.infrastructure.conversion.DTO;
 public interface RegisterHandlingEventAttemptDTO extends DTO
 {
     @Optional
-    Property<Date> registrationTime();
+    Property<ZonedDateTime> registrationTime();
 
     @Optional
-    Property<Date> completionTime();
+    Property<ZonedDateTime> completionTime();
 
     @Optional
     Property<String> trackingIdString();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/RoutingService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/RoutingService.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/RoutingService.java
index 694322c..09dcc4f 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/RoutingService.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/context/support/RoutingService.java
@@ -21,7 +21,6 @@ import java.rmi.RemoteException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import org.joda.time.LocalDate;
 import org.qi4j.api.injection.scope.Service;
 import org.qi4j.api.injection.scope.Structure;
 import org.qi4j.api.mixin.Mixins;
@@ -117,7 +116,7 @@ public interface RoutingService
             if( itineraries.size() == 0 )
             {
                 throw new FoundNoRoutesException( destination.name().get(),
-                                                  new LocalDate( routeSpecification.arrivalDeadline().get() ) );
+                                                  routeSpecification.arrivalDeadline().get() );
             }
 
             return itineraries;

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/cargo/RouteSpecification.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/cargo/RouteSpecification.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/cargo/RouteSpecification.java
index 582d633..d5ead11 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/cargo/RouteSpecification.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/cargo/RouteSpecification.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import org.qi4j.api.association.Association;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.property.Property;
@@ -51,7 +51,7 @@ public interface RouteSpecification
 
     Association<Location> destination();
 
-    Property<Date> arrivalDeadline();
+    Property<ZonedDateTime> arrivalDeadline();
 
     // Can we accept to have this "intelligent" logic here?
     // DCI Data is supposed to be dumb, but it's really convenient to have this logic here,
@@ -67,7 +67,7 @@ public interface RouteSpecification
                    !itinerary.legs().get().isEmpty() &&
                    origin().get().equals( itinerary.firstLeg().loadLocation().get() ) &&
                    destination().get().equals( itinerary.lastLeg().unloadLocation().get() ) &&
-                   arrivalDeadline().get().after( itinerary.finalArrivalDate() );
+                   arrivalDeadline().get().isAfter( itinerary.finalArrivalDate() );
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/delivery/Delivery.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/delivery/Delivery.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/delivery/Delivery.java
index 4d46fbe..af7555a 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/delivery/Delivery.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/delivery/Delivery.java
@@ -17,7 +17,8 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.data.shipping.delivery;
 
-import java.util.Date;
+import java.time.Instant;
+import java.time.ZonedDateTime;
 import org.qi4j.api.association.Association;
 import org.qi4j.api.common.Optional;
 import org.qi4j.api.common.UseDefaults;
@@ -76,7 +77,7 @@ import org.qi4j.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
 public interface Delivery
     extends ValueComposite
 {
-    Property<Date> timestamp();
+    Property<Instant> timestamp();
 
     /*
    * NOT_ROUTED
@@ -120,7 +121,7 @@ public interface Delivery
     Association<Voyage> currentVoyage();
 
     @Optional
-    Property<Date> eta();
+    Property<ZonedDateTime> eta();
 
     @UseDefaults
     Property<Boolean> isUnloadedAtDestination();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/delivery/ExpectedHandlingEvent.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/delivery/ExpectedHandlingEvent.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/delivery/ExpectedHandlingEvent.java
index 194ea24..bb44e01 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/delivery/ExpectedHandlingEvent.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/delivery/ExpectedHandlingEvent.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.data.shipping.delivery;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import org.qi4j.api.association.Association;
 import org.qi4j.api.common.Optional;
 import org.qi4j.api.property.Property;
@@ -39,7 +39,7 @@ public interface ExpectedHandlingEvent
 
     // Added expected time for the event to happen (compared to the original DDD sample)
     @Optional
-    Property<Date> time();
+    Property<ZonedDateTime> time();
 
     @Optional
     Association<Voyage> voyage();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvent.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvent.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvent.java
index c256201..da19296 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvent.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvent.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.data.shipping.handling;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import org.qi4j.api.association.Association;
 import org.qi4j.api.common.Optional;
 import org.qi4j.api.common.UseDefaults;
@@ -47,10 +47,10 @@ import org.qi4j.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
 public interface HandlingEvent
 {
     @Immutable
-    Property<Date> registrationTime();
+    Property<ZonedDateTime> registrationTime();
 
     @Immutable
-    Property<Date> completionTime();
+    Property<ZonedDateTime> completionTime();
 
     @Immutable
     Property<TrackingId> trackingId();

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvents.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvents.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvents.java
index d267b3f..c4a3296 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvents.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/handling/HandlingEvents.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.data.shipping.handling;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import org.qi4j.api.common.Optional;
 import org.qi4j.api.entity.EntityBuilder;
 import org.qi4j.api.injection.scope.Structure;
@@ -32,11 +32,11 @@ import org.qi4j.sample.dcicargo.sample_a.data.shipping.voyage.Voyage;
  * HandlingEvent "collection" - could have had a many-association to
  * Handling Events if it was part of the domain model.
  */
-@Mixins( HandlingEvents.Mixin.class )
+@Mixins(HandlingEvents.Mixin.class)
 public interface HandlingEvents
 {
-    HandlingEvent createHandlingEvent( Date registrationTime,
-                                       Date completionTime,
+    HandlingEvent createHandlingEvent( ZonedDateTime registrationTime,
+                                       ZonedDateTime completionTime,
                                        TrackingId trackingId,
                                        HandlingEventType handlingEventType,
                                        Location location,
@@ -50,8 +50,8 @@ public interface HandlingEvents
         @Structure
         UnitOfWorkFactory uowf;
 
-        public HandlingEvent createHandlingEvent( Date registrationTime,
-                                                  Date completionTime,
+        public HandlingEvent createHandlingEvent( ZonedDateTime registrationTime,
+                                                  ZonedDateTime completionTime,
                                                   TrackingId trackingId,
                                                   HandlingEventType handlingEventType,
                                                   Location location,

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/itinerary/Itinerary.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/itinerary/Itinerary.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/itinerary/Itinerary.java
index 329cc7a..f3e3749 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/itinerary/Itinerary.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/itinerary/Itinerary.java
@@ -17,10 +17,10 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.data.shipping.itinerary;
 
-import java.util.Date;
+import java.time.LocalDate;
+import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
 import java.util.List;
-import org.joda.time.Days;
-import org.joda.time.LocalDate;
 import org.qi4j.api.mixin.Mixins;
 import org.qi4j.api.property.Property;
 import org.qi4j.library.constraints.annotation.NotEmpty;
@@ -33,7 +33,7 @@ import org.qi4j.library.constraints.annotation.NotEmpty;
  *
  * List of legs is mandatory and immutable.
  */
-@Mixins( Itinerary.Mixin.class )
+@Mixins(Itinerary.Mixin.class)
 public interface Itinerary
 {
     @NotEmpty
@@ -44,7 +44,7 @@ public interface Itinerary
 
     Leg lastLeg();
 
-    Date finalArrivalDate();
+    ZonedDateTime finalArrivalDate();
 
     int days();
 
@@ -71,21 +71,21 @@ public interface Itinerary
             return legs().get().get( legs().get().size() - 1 );
         }
 
-        public Date finalArrivalDate()
+        public ZonedDateTime finalArrivalDate()
         {
             if( lastLeg() == null )
             {
-                return new Date( new Date( Long.MAX_VALUE ).getTime() );
+                return ZonedDateTime.from( LocalDate.MAX );
             }
 
-            return new Date( lastLeg().unloadTime().get().getTime() );
+            return lastLeg().unloadTime().get();
         }
 
         public int days()
         {
-            Date dep = firstLeg().loadTime().get();
-            Date arr = lastLeg().unloadTime().get();
-            return Days.daysBetween( new LocalDate( dep ), new LocalDate( arr ) ).getDays();
+            ZonedDateTime dep = firstLeg().loadTime().get();
+            ZonedDateTime arr = lastLeg().unloadTime().get();
+            return (int) arr.until( dep, ChronoUnit.DAYS );
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/itinerary/Leg.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/itinerary/Leg.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/itinerary/Leg.java
index 8978a05..cd6736e 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/itinerary/Leg.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/itinerary/Leg.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.data.shipping.itinerary;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import org.qi4j.api.association.Association;
 import org.qi4j.api.property.Property;
 import org.qi4j.api.value.ValueComposite;
@@ -36,11 +36,11 @@ public interface Leg
 {
     Association<Location> loadLocation();
 
-    Property<Date> loadTime();
+    Property<ZonedDateTime> loadTime();
 
     Association<Voyage> voyage();
 
-    Property<Date> unloadTime();
+    Property<ZonedDateTime> unloadTime();
 
     Association<Location> unloadLocation();
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/voyage/CarrierMovement.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/voyage/CarrierMovement.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/voyage/CarrierMovement.java
index 41c1b2a..d14ce61 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/voyage/CarrierMovement.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/data/shipping/voyage/CarrierMovement.java
@@ -17,7 +17,7 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.data.shipping.voyage;
 
-import java.util.Date;
+import java.time.ZonedDateTime;
 import org.qi4j.api.association.Association;
 import org.qi4j.api.property.Property;
 import org.qi4j.api.value.ValueComposite;
@@ -35,7 +35,7 @@ public interface CarrierMovement
 
     Association<Location> arrivalLocation();
 
-    Property<Date> departureTime();
+    Property<ZonedDateTime> departureTime();
 
-    Property<Date> arrivalTime();
+    Property<ZonedDateTime> arrivalTime();
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/infrastructure/wicket/form/DateTextFieldWithPicker.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/infrastructure/wicket/form/DateTextFieldWithPicker.java b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/infrastructure/wicket/form/DateTextFieldWithPicker.java
index fc5d172..7ae9f39 100644
--- a/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/infrastructure/wicket/form/DateTextFieldWithPicker.java
+++ b/samples/dci-cargo/dcisample_a/src/main/java/org/qi4j/sample/dcicargo/sample_a/infrastructure/wicket/form/DateTextFieldWithPicker.java
@@ -18,6 +18,10 @@
 package org.qi4j.sample.dcicargo.sample_a.infrastructure.wicket.form;
 
 import com.google.code.joliratools.StatelessAjaxEventBehavior;
+import java.time.LocalTime;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.Date;
 import java.util.Map;
 import org.apache.wicket.Component;
@@ -33,9 +37,6 @@ import org.apache.wicket.model.Model;
 import org.apache.wicket.model.PropertyModel;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.validation.validator.DateValidator;
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
-import org.joda.time.LocalTime;
 
 //import org.wicketstuff.stateless.StatelessAjaxEventBehavior;
 
@@ -48,8 +49,8 @@ public class DateTextFieldWithPicker extends DateTextField
     DatePicker datePicker;
 
     // Configurable widget options
-    LocalDate earliestDate;
-    LocalDate selectedDate;
+    ZonedDateTime earliestDate;
+    ZonedDateTime selectedDate;
 
     final static String YUI_DATE_FORMAT = "MM/dd/yyyy";
 
@@ -176,7 +177,7 @@ public class DateTextFieldWithPicker extends DateTextField
         widgetProperties.put( "selected", getSelectedDateStr() );
     }
 
-    public DateTextFieldWithPicker earliestDate( LocalDate newEarliestDate )
+    public DateTextFieldWithPicker earliestDate( ZonedDateTime newEarliestDate )
     {
         if( selectedDate != null && newEarliestDate.isAfter( selectedDate ) )
         {
@@ -186,8 +187,8 @@ public class DateTextFieldWithPicker extends DateTextField
         earliestDate = newEarliestDate;
 
         // Input field validation - date should be _after_ minimumDate (not the same)
-        LocalDate minimumDate = newEarliestDate.minusDays( 1 );
-        Date convertedMinimumDate = new DateTime( minimumDate.toDateTime( new LocalTime() ) ).toDate();
+        ZonedDateTime minimumDate = newEarliestDate.minusDays( 1 );
+        Date convertedMinimumDate = new Date( minimumDate.with( LocalTime.MAX ).toInstant().toEpochMilli() );
         add( DateValidator.minimum( convertedMinimumDate ) );
 
         return this;
@@ -195,7 +196,7 @@ public class DateTextFieldWithPicker extends DateTextField
 
     // Add latestDate(..) + other configuration options if needed..
 
-    public DateTextFieldWithPicker selectedDate( LocalDate newSelectedDate )
+    public DateTextFieldWithPicker selectedDate( ZonedDateTime newSelectedDate )
     {
         if( earliestDate != null && newSelectedDate.isBefore( earliestDate ) )
         {
@@ -211,17 +212,22 @@ public class DateTextFieldWithPicker extends DateTextField
     {
         if( selectedDate != null )
         {
-            return selectedDate.toString( YUI_DATE_FORMAT );
+            return formatDate( selectedDate );
         }
 
         // Select today or earliest date (if later) as default
         return earliestDate == null ?
-               new LocalDate().toString( YUI_DATE_FORMAT ) :
-               earliestDate.toString( YUI_DATE_FORMAT );
+               formatDate( ZonedDateTime.now() ) :
+               formatDate( earliestDate );
+    }
+
+    private String formatDate( ZonedDateTime date )
+    {
+        return date.format( DateTimeFormatter.ofPattern( YUI_DATE_FORMAT ) );
     }
 
     private String getEarliestDateStr()
     {
-        return earliestDate == null ? "" : earliestDate.toString( YUI_DATE_FORMAT );
+        return earliestDate == null ? "" : formatDate( earliestDate );
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/b71c878d/samples/dci-cargo/dcisample_a/src/test/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java b/samples/dci-cargo/dcisample_a/src/test/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
index dbb3ea3..4baeda9 100644
--- a/samples/dci-cargo/dcisample_a/src/test/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
+++ b/samples/dci-cargo/dcisample_a/src/test/java/org/qi4j/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java
@@ -17,7 +17,9 @@
  */
 package org.qi4j.sample.dcicargo.sample_a.context.shipping.booking;
 
-import java.util.Date;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.ZonedDateTime;
 import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
@@ -37,6 +39,7 @@ import org.qi4j.sample.dcicargo.sample_a.data.shipping.location.Location;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.*;
 
 /**
@@ -51,7 +54,7 @@ public class BookNewCargoTest
       extends TestApplication
 {
 
-    private static final Date TODAY = new Date();
+    private static final Instant TODAY = Instant.now();
 
     @Before
     public void prepareTest()
@@ -126,18 +129,18 @@ public class BookNewCargoTest
 
         // Test derived delivery snapshot
         Delivery delivery = cargo.delivery().get();
-        assertThat( delivery.timestamp().get().after( TODAY ), is( equalTo( true ) ) ); // TODAY is set first
+        assertThat( delivery.timestamp().get().isAfter( TODAY ), is( equalTo( true ) ) ); // TODAY is set first
         assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.NOT_ROUTED ) ) );
         assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.NOT_RECEIVED ) ) );
         assertThat( delivery.nextExpectedHandlingEvent().get().handlingEventType().get(), is( equalTo( HandlingEventType.RECEIVE ) ) );
         assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( HONGKONG ) ) );
-        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.lastHandlingEvent().get(), is( equalTo( null ) ) );
-        assertThat( delivery.lastKnownLocation().get(), is( equalTo( null ) ) );
-        assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) );
-        assertThat( delivery.eta().get(), is( equalTo( null ) ) ); // Is set when itinerary is assigned
-        assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) );
-        assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) );
+        assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), nullValue() );
+        assertThat( delivery.lastHandlingEvent().get(), nullValue() );
+        assertThat( delivery.lastKnownLocation().get(), nullValue() );
+        assertThat( delivery.currentVoyage().get(), nullValue() );
+        assertThat( delivery.eta().get(), nullValue() ); // Is set when itinerary is assigned
+        assertThat( delivery.isMisdirected().get(), equalTo( false ) );
+        assertThat( delivery.isUnloadedAtDestination().get(), equalTo( false ) );
     }
 
     @Test( expected = FoundNoRoutesException.class )
@@ -179,7 +182,10 @@ public class BookNewCargoTest
                         itinerary.lastLeg().unloadLocation().get(),
                         is( equalTo( cargo.routeSpecification().get().destination().get() ) ) );
             assertThat( "Cargo will be delivered in time.",
-                        itinerary.finalArrivalDate().before( cargo.routeSpecification().get().arrivalDeadline().get() ),
+                        itinerary.finalArrivalDate().isBefore( cargo.routeSpecification()
+                                                                   .get()
+                                                                   .arrivalDeadline()
+                                                                   .get() ),
                         is( equalTo( true ) ) );
         }
     }
@@ -193,7 +199,7 @@ public class BookNewCargoTest
         Cargos CARGOS = uow.get( Cargos.class, CargosEntity.CARGOS_ID );
 
         // Create valid cargo
-        Date deadline = day( 30 );
+        ZonedDateTime deadline = day( 60 );
         TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, deadline ).book();
         Cargo cargo = uow.get( Cargo.class, trackingId.id().get() );
 
@@ -215,6 +221,6 @@ public class BookNewCargoTest
         assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) );
 
         // ETA (= Unload time of last Leg) is before Deadline (set in previous test)
-        assertTrue( delivery.eta().get().before( deadline ) );
+        assertTrue( delivery.eta().get().isBefore( deadline ) );
     }
 }


Mime
View raw message