You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2016/10/23 14:23:51 UTC
[10/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
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/CargoDetailsPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoDetailsPage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoDetailsPage.java
deleted file mode 100644
index 4840154..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoDetailsPage.java
+++ /dev/null
@@ -1,215 +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.Instant;
-import java.util.List;
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.devutils.stateless.StatelessComponent;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.basic.MultiLineLabel;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-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.communication.web.tracking.HandlingHistoryPanel;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.tracking.NextHandlingEventPanel;
-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.RoutingStatus;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.TransportStatus;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Leg;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.color.CorrectColor;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.color.ErrorColor;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.link.LinkPanel;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.prevnext.PrevNext;
-
-import static java.time.ZoneOffset.UTC;
-import static java.util.Date.from;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.RoutingStatus.MISROUTED;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.RoutingStatus.NOT_ROUTED;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.TransportStatus.CLAIMED;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.TransportStatus.UNKNOWN;
-
-/**
- * Cargo details - an overview of all data available about a cargo.
- *
- * Wicket-comment:
- * The StatelessComponent annotation verifies that this component is not saved in session (remains stateless).
- */
-@StatelessComponent
-public class CargoDetailsPage extends BookingBasePage
-{
- // Standard constructor for Prev/Next links...
- public CargoDetailsPage( PageParameters parameters )
- {
- this( parameters.get( 0 ).toString() );
- }
-
- public CargoDetailsPage( String trackingId )
- {
- super( new PageParameters().set( 0, trackingId ) );
-
- IModel<Cargo> cargoModel = new CommonQueries().cargo( trackingId );
- Cargo cargo = cargoModel.getObject();
- Delivery delivery = cargo.delivery().get();
- TransportStatus transportStatus = delivery.transportStatus().get();
- RouteSpecification routeSpecification = cargo.routeSpecification().get();
- final RoutingStatus routingStatus = delivery.routingStatus().get();
- boolean isMisrouted = routingStatus == MISROUTED;
- boolean isReRouted = !cargo.origin().get().getCode().equals( routeSpecification.origin().get().getCode() );
-
- add( new PrevNext( "prevNext", CargoDetailsPage.class, trackingId ) );
-
- add( new Label( "trackingId", trackingId ) );
-
- // Show both cargo origin and new route spec origin when re-routed during transport
- if( isReRouted )
- {
- Fragment originFragment = new Fragment( "origin", "re-routed-originFragment", this );
- originFragment.add( new Label( "cargoOrigin", cargo.origin().get().getString() ) );
- originFragment.add( new Label( "routeOrigin", routeSpecification.origin()
- .get()
- .getString() ).add( new CorrectColor( isMisrouted ) ) );
- add( originFragment );
- }
- else
- {
- Fragment originFragment = new Fragment( "origin", "originFragment", this );
- originFragment.add( new Label( "cargoOrigin", cargo.origin().get().getString() ) );
- add( originFragment );
- }
-
- add( new Label( "departure", Model.of( routeSpecification.earliestDeparture().get() ) ) );
- add( new Label( "destination", routeSpecification.destination()
- .get()
- .getString() ).add( new CorrectColor( isMisrouted ) ) );
- add( new Label( "deadline", Model.of( routeSpecification.arrivalDeadline().get() ) ) );
- add( new Label( "routingStatus", routingStatus.toString() ).add( new ErrorColor( isMisrouted ) ) );
- add( new LinkPanel( "changeDestination", ChangeDestinationPage.class, trackingId, "Change destination" ) );
-
- if( transportStatus.equals( CLAIMED ) )
- {
- // Can't re-route claimed cargo
- add( new Label( "routingAction" ) );
- add( new DeliveryFragment( delivery ) );
- add( new ItineraryFragment( cargoModel, routingStatus ) );
- }
- else if( routingStatus.equals( NOT_ROUTED ) )
- {
- add( new LinkPanel( "routingAction", RouteCargoPage.class, trackingId, "Route" ) );
- add( new Label( "delivery" ) );
- add( new Label( "itinerary" ) );
- }
- else
- {
- add( new LinkPanel( "routingAction", ReRouteCargoPage.class, trackingId, "Re-route" ) );
- add( new DeliveryFragment( delivery ) );
- add( new ItineraryFragment( cargoModel, routingStatus ) );
- }
-
- if( delivery.lastHandlingEvent().get() == null )
- {
- add( new Label( "handlingHistoryPanel" ) );
- }
- else
- {
- add( new HandlingHistoryPanel( "handlingHistoryPanel", cargoModel, trackingId ) );
- }
-
- add( new NextHandlingEventPanel( "nextHandlingEventPanel", cargoModel ) );
- }
-
- private class ItineraryFragment extends Fragment
- {
- public ItineraryFragment( final IModel<Cargo> cargoModel, final RoutingStatus routingStatus )
- {
- super( "itinerary", "itineraryFragment", CargoDetailsPage.this );
-
- IModel<List<Leg>> legListModel = new LoadableDetachableModel<List<Leg>>()
- {
- @Override
- protected List<Leg> load()
- {
- return cargoModel.getObject().itinerary().get().legs().get();
- }
- };
-
- add( new ListView<Leg>( "legs", legListModel )
- {
- @Override
- protected void populateItem( ListItem<Leg> item )
- {
- Leg leg = item.getModelObject();
-
- item.add( new Label( "loadLocation", leg.loadLocation().get().getCode() ) );
- Instant loadTime = leg.loadDate().get().atStartOfDay().toInstant( UTC );
- item.add( new Label( "loadDate", new Model<>( from( loadTime ) ) ) );
- item.add( new Label( "voyage", leg.voyage().get().voyageNumber().get().number().get() ) );
-
- Boolean isMisrouted = routingStatus == MISROUTED && item.getIndex() == ( getList().size() - 1 );
- item.add( new Label( "unloadLocation",
- leg.unloadLocation().get().getCode() ).add( new ErrorColor( isMisrouted ) ) );
-
- Instant unloadTime = leg.unloadDate().get().atStartOfDay().toInstant( UTC );
- item.add( new Label( "unloadDate", new Model<>( from( unloadTime ) ) ) );
- }
- } );
- }
- }
-
- private class DeliveryFragment extends Fragment
- {
- public DeliveryFragment( Delivery delivery )
- {
- super( "delivery", "deliveryFragment", CargoDetailsPage.this );
-
- if( delivery.transportStatus().get().equals( UNKNOWN ) )
- {
- String msg = "UNKNOWN \n(Could be hi-jacked)";
- add( new MultiLineLabel( "transportStatus", msg ).add( new AttributeModifier( "class", "errorColor" ) ) );
- }
- else
- {
- add( new Label( "transportStatus", delivery.transportStatus().get().toString() ) );
- }
-
- if( delivery.isMisdirected().get() )
- {
- String msg = "Cargo is misdirected \nPlease reroute cargo";
- if( delivery.transportStatus().get().equals( CLAIMED ) )
- {
- msg = "Cargo is misdirected \n(Can't re-route claimed cargo)";
- }
-
- add( new MultiLineLabel( "deliveryStatus", msg ).add( new AttributeModifier( "class", "errorColor" ) ) );
- }
- else
- {
- add( new Label( "deliveryStatus", "On track" ) );
- }
- }
- }
-}
\ 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/CargoListPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoListPage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoListPage.java
deleted file mode 100644
index 4b17a9f..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/CargoListPage.java
+++ /dev/null
@@ -1,117 +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.ArrayList;
-import java.util.List;
-import org.apache.wicket.Session;
-import org.apache.wicket.devutils.stateless.StatelessComponent;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.CommonQueries;
-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.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.infrastructure.wicket.color.ErrorColor;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.link.LinkPanel;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.prevnext.PrevNext;
-
-import static java.time.ZoneOffset.UTC;
-import static java.util.Date.from;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.TransportStatus.UNKNOWN;
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType.CUSTOMS;
-
-/**
- * List of Cargos
- */
-@StatelessComponent
-public class CargoListPage extends BookingBasePage
-{
- public CargoListPage()
- {
- IModel<List<Cargo>> cargoList = new CommonQueries().cargoList();
-
- // Save current trackingIds in session (for prev/next buttons on details page)
- ArrayList<String> ids = new ArrayList<String>();
- for( Cargo cargo : cargoList.getObject() )
- {
- ids.add( cargo.trackingId().get().id().get() );
- }
- PrevNext.registerIds( Session.get(), ids );
-
- add( new ListView<Cargo>( "list", cargoList )
- {
- @Override
- protected void populateItem( ListItem<Cargo> item )
- {
- // Cargo
- Cargo cargo = item.getModelObject();
- String trackingId = cargo.trackingId().get().id().get();
- String origin = cargo.origin().get().getCode();
-
- // Route specification
- RouteSpecification routeSpec = cargo.routeSpecification().get();
- String destination = routeSpec.destination().get().getCode();
- LocalDate deadline = routeSpec.arrivalDeadline().get();
-
- // Routing status
- Delivery delivery = cargo.delivery().get();
- RoutingStatus routingStatus = cargo.delivery().get().routingStatus().get();
- boolean isMisrouted = routingStatus == RoutingStatus.MISROUTED;
-
- // Transport status
- TransportStatus transportStatus = delivery.transportStatus().get();
- boolean isHiJacked = transportStatus.equals( UNKNOWN );
-
- // Delivery status
- boolean isMisdirected = delivery.isMisdirected().get();
- HandlingEvent event = delivery.lastHandlingEvent().get();
- boolean inCustoms = event != null && event.handlingEventType().get() == CUSTOMS;
-
- // Output
-
- item.add( new LinkPanel( "trackingId", CargoDetailsPage.class, trackingId ) );
-
- item.add( new Label( "origin", origin ) );
-
- item.add( new Label( "destination", destination ) );
-
- item.add( new Label( "deadline",
- new Model<>( from( deadline.atStartOfDay().plusDays( 1 ).toInstant( UTC ) ) ) ) );
-
- item.add( new Label( "routingStatus",
- routingStatus.toString() ).add( new ErrorColor( isMisrouted ) ) );
-
- String customsLabel = transportStatus.name() + ( inCustoms ? " (CUSTOMS)" : "" );
- item.add( new Label( "transportStatus", customsLabel ).add( new ErrorColor( isHiJacked ) ) );
-
- String directed = isMisdirected ? "Misdirected" : "On track";
- item.add( new Label( "deliveryStatus", directed ).add( new ErrorColor( isMisdirected ) ) );
- }
- } );
- }
-}
\ 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/ChangeDestinationPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/ChangeDestinationPage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/ChangeDestinationPage.java
deleted file mode 100644
index 3dd9fe1..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/ChangeDestinationPage.java
+++ /dev/null
@@ -1,113 +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.util.List;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
-import org.apache.wicket.markup.html.basic.Label;
-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.routing.RegisterNewDestination;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.exception.CargoMisroutedException;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form.AbstractForm;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form.SelectorInForm;
-
-/**
- * Change destination of Cargo
- */
-public class ChangeDestinationPage extends BookingBasePage
-{
- public ChangeDestinationPage( PageParameters parameters )
- {
- String trackingId = parameters.get( 0 ).toString();
- add( new Label( "trackingId", trackingId ) );
- add( new CargoEditForm( trackingId ) );
- }
-
- private class CargoEditForm extends AbstractForm<Void>
- {
- private String trackingId; // Set by Wicket property resolver
- private String origin, destination, oldDestination;
-
- public CargoEditForm( final String trackingId )
- {
- CommonQueries fetch = new CommonQueries();
- Cargo cargo = fetch.cargo( trackingId ).getObject();
- List<String> locations = fetch.unLocodes();
-
- origin = cargo.routeSpecification().get().origin().get().getCode();
- oldDestination = destination = cargo.routeSpecification().get().destination().get().getCode();
-
- final FeedbackPanel feedback = new FeedbackPanel( "usecaseFeedback" );
- final SelectorInForm destinationSelector = new SelectorInForm(
- "destination", "Destination", locations, this, "origin" );
- final ComponentFeedbackPanel destinationFeedback = new ComponentFeedbackPanel(
- "destinationFeedback", destinationSelector.setRequired( true ) );
-
- add( feedback.setOutputMarkupId( true ) );
- add( new Label( "origin", origin ) );
- add( new Label( "destination", destination ) );
- add( destinationFeedback.setOutputMarkupId( true ) );
- add( destinationSelector );
- add( new AjaxFallbackButton( "submit", this )
- {
- @Override
- protected void onSubmit( AjaxRequestTarget target, Form<?> form )
- {
- try
- {
- if( oldDestination.equals( destination ) )
- {
- throw new IllegalArgumentException( "Please select a new destination." );
- }
-
- new RegisterNewDestination( trackingId ).to( destination );
-
- // Show updated cargo
- setResponsePage( CargoDetailsPage.class, new PageParameters().set( 0, trackingId ) );
- }
- catch( CargoMisroutedException e )
- {
- // If re-routed, we expect it to be misrouted - show updated cargo
- setResponsePage( CargoDetailsPage.class, new PageParameters().set( 0, trackingId ) );
- }
- catch( Exception e )
- {
- logger.warn( "Problem changing destination of cargo " + trackingId + ": " + e.getMessage() );
- feedback.error( e.getMessage() );
- target.add( feedback );
- }
- }
-
- @Override
- protected void onError( final AjaxRequestTarget target, Form<?> form )
- {
- target.add( destinationFeedback );
- target.focusComponent( destinationSelector );
- }
- } );
- }
- }
-}
\ 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/ReRouteCargoPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/ReRouteCargoPage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/ReRouteCargoPage.java
deleted file mode 100644
index a2cefcf..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/ReRouteCargoPage.java
+++ /dev/null
@@ -1,74 +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.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.BookingQueries;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.specification.DeriveUpdatedRouteSpecification;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.RouteSpecification;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
-
-/**
- * Re-route page
- *
- * Presents a list of possible routes a cargo can take that the user can choose from.
- *
- * Each route candidate is presented by a {@link RoutePanel}.
- */
-public class ReRouteCargoPage extends BookingBasePage
-{
- private FeedbackPanel feedback = new FeedbackPanel( "feedback" );
-
- public ReRouteCargoPage( PageParameters parameters )
- {
- final String trackingIdString = parameters.get( 0 ).toString();
-
- add( new Label( "trackingId", trackingIdString ) );
-
- add( new FeedbackPanel( "feedback" ) );
-
- try
- {
- // Temporary routeSpec to get correct route candidates
- RouteSpecification tempRouteSpec = new DeriveUpdatedRouteSpecification( trackingIdString ).getRouteSpec();
-
- add( new ListView<IModel<Itinerary>>( "routes", query( BookingQueries.class ).routeCandidates( tempRouteSpec ) )
- {
- @Override
- protected void populateItem( ListItem<IModel<Itinerary>> item )
- {
- item.add( new RoutePanel( "route", trackingIdString, item.getModelObject(), item.getIndex() + 1 ) );
- }
- } );
- }
- catch( Exception e )
- {
- logger.info( e.getMessage() );
- error( e.getMessage() );
- add( new WebMarkupContainer( "routes" ).add( new Label( "route" ) ) );
- }
- }
-}
\ 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/RouteCargoPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RouteCargoPage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RouteCargoPage.java
deleted file mode 100644
index 6bd5626..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RouteCargoPage.java
+++ /dev/null
@@ -1,67 +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.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.BookingQueries;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
-
-/**
- * Re-route page - presents a list of possible routes a cargo can take that the user can choose from.
- *
- * Each route candidate is presented by a {@link RoutePanel}.
- */
-public class RouteCargoPage extends BookingBasePage
-{
- private FeedbackPanel feedback = new FeedbackPanel( "feedback" );
-
- public RouteCargoPage( PageParameters parameters )
- {
- final String trackingIdString = parameters.get( 0 ).toString();
-
- add( new Label( "trackingId", trackingIdString ) );
-
- add( new FeedbackPanel( "feedback" ) );
-
- try
- {
- add( new ListView<IModel<Itinerary>>( "routes", query( BookingQueries.class ).routeCandidates( trackingIdString ) )
- {
- @Override
- protected void populateItem( ListItem<IModel<Itinerary>> item )
- {
- item.add( new RoutePanel( "route", trackingIdString, item.getModelObject(), item.getIndex() + 1 ) );
- }
- } );
- }
- catch( Exception e )
- {
- logger.info( e.getMessage() );
- error( "Unexpected error happened." );
- add( new WebMarkupContainer( "routes" ).add( new Label( "route" ) ) );
- }
- }
-}
\ 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/RoutePanel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RoutePanel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RoutePanel.java
deleted file mode 100644
index 0ed3bb7..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/booking/RoutePanel.java
+++ /dev/null
@@ -1,124 +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.util.List;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.StatelessForm;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.routing.AssignCargoToRoute;
-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 static java.time.ZoneOffset.UTC;
-import static java.util.Date.from;
-
-/**
- * Route Panel
- *
- * Shows a suggested route that a Cargo can take.
- *
- * If the user chooses this candidate route, all route data (a value object) is attached by the
- * RegisterNewDestination context as an Itinerary to the Cargo. To see the result, the user is
- * then redirected to the details page of the cargo.
- */
-public class RoutePanel extends Panel
-{
- public RoutePanel( String id,
- final String trackingIdString,
- final IModel<Itinerary> candidateRouteModel,
- int index
- )
- {
- super( id, candidateRouteModel );
- Itinerary itinerary = candidateRouteModel.getObject();
-
- IModel<String> header = Model.of( "Route candidate " + index + " - duration: " + itinerary.days() + " days." );
- add( new Label( "routeHeader", header ) );
-
- final FeedbackPanel routeFeedback = new FeedbackPanel( "routeFeedback" );
- add( routeFeedback.setOutputMarkupId( true ).setEscapeModelStrings( true ) );
-
- IModel<List<Leg>> legListModel = new LoadableDetachableModel<List<Leg>>()
- {
- @Override
- protected List<Leg> load()
- {
- return candidateRouteModel.getObject().legs().get();
- }
- };
-
- add( new ListView<Leg>( "legs", legListModel )
- {
- @Override
- protected void populateItem( ListItem<Leg> item )
- {
- Leg leg = item.getModelObject();
- item.add( new Label( "voyage", leg.voyage().get().toString() ),
- new Label( "loadLocation", leg.loadLocation().get().getCode() ),
- new Label( "loadDate",
- new Model<>( from( leg.loadDate().get().atStartOfDay().toInstant( UTC ) ) ) ),
- new Label( "unloadLocation", leg.unloadLocation().get().getCode() ),
- new Label( "unloadDate",
- new Model<>( from( leg.unloadDate().get().atStartOfDay().toInstant( UTC ) ) ) )
- );
- }
- } );
-
- StatelessForm form = new StatelessForm<Void>( "form" );
- form.add( new AjaxFallbackButton( "assign", form )
- {
- @Override
- protected void onSubmit( AjaxRequestTarget target, Form<?> form )
- {
- try
- {
- Itinerary itinerary = candidateRouteModel.getObject();
- new AssignCargoToRoute( trackingIdString, itinerary ).assign();
- setResponsePage( CargoDetailsPage.class, new PageParameters().set( 0, trackingIdString ) );
- }
- catch( Exception e )
- {
- String msg = "Problem assigning this route to cargo: " + e.getMessage();
- routeFeedback.error( msg );
- target.add( routeFeedback );
- }
- }
-
- @Override
- protected void onError( final AjaxRequestTarget target, Form<?> form )
- {
- routeFeedback.error( "Unexpected error - all routes are expected to be valid." );
- target.add( routeFeedback );
- }
- } );
- add( form );
- }
-}
\ 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/handling/IncidentLoggingApplicationMockupPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/handling/IncidentLoggingApplicationMockupPage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/handling/IncidentLoggingApplicationMockupPage.java
deleted file mode 100644
index 9d3d753..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/handling/IncidentLoggingApplicationMockupPage.java
+++ /dev/null
@@ -1,268 +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.handling;
-
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-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.DropDownChoice;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.StringResourceModel;
-import org.apache.wicket.util.value.ValueMap;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.CommonQueries;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.HandlingQueries;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.BasePage;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.ProcessHandlingEvent;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form.AbstractForm;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form.DateTextFieldWithPicker;
-
-/**
- * Incident Logging Application mockup page
- *
- * This is a mockup of an Incident Logging Application interface that external handling
- * authorities would use to send us handling event data for cargos that they have handled.
- *
- * For simplicity we don't create a separate Incident Logging Application for now but instead
- * let it reside inside our booking application. We act as a handling authority entering handling
- * event data, and in the lower half of the page we mock the receipt of the data and show the
- * validation results from our own validation of the incoming data.
- *
- * We could also instead (in future versions?) implement a web service endpoint receiving
- * asynchronous messages from a separate incident logging application. We have prepared for
- * this by separating the processing in three steps, with ProcessHandlingEvent coordinating
- * the following steps:
- *
- * {@link ProcessHandlingEvent}
- * 1. parsedHandlingEventData = parse( completion, trackingId, eventType, unLocode, voyage )
- * 2. handlingEvent = register( parsedHandlingEventData )
- * 3. inspect( handlingEvent )
- *
- * The last step updates the delivery status of the cargo.
- *
- * On this page we act as a handling authority sending handling event data to our booking
- * application. We perform basic validation and parsing of incoming data, and in case of a
- * valid registration attempt, synchronously send the data to the booking application for
- * processing there.
- */
-public class IncidentLoggingApplicationMockupPage extends BasePage
-{
- public IncidentLoggingApplicationMockupPage()
- {
- super( "handling" ); // Selects the Handling tab
- add( new ReportHandlingEventForm() );
- }
-
- private final class ReportHandlingEventForm extends AbstractForm<Void>
- {
- FeedbackPanel feedback;
-
- // Form values
- LocalDateTime completion;
- String trackingId, unLocode, voyageNumber, eventType;
-
- // Input
- TextField<String> trackingIdInput, eventTypeInput, voyageInput, locationInput;
- String trackingIdSelected, eventTypeSelected, voyageSelected, locationSelected;
- DropDownChoice<String> trackingIdSelector, eventTypeSelector, voyageSelector, locationSelector;
-
- // To avoid re-submitting same data
- String lastSubmittedData;
-
- public ReportHandlingEventForm()
- {
- final FeedbackPanel feedback = new FeedbackPanel( "feedback" );
- add( feedback.setOutputMarkupId( true ) );
-
- // Completion time
-
- final DateTextFieldWithPicker completionDateInput = new DateTextFieldWithPicker( "completion", "Completion", this );
- completionDateInput.earliestDate( LocalDate.now() );
- add( completionDateInput.setLabel( Model.of( "Completion" ) ) );
-
- HandlingQueries fetch = new HandlingQueries();
-
- // Tracking id
-
- trackingIdInput = new TextField<String>( "trackingIdInput", new PropertyModel<String>( this, "trackingId" ) );
- add( trackingIdInput.setRequired( true ).setLabel( Model.of( "Cargo" ) ).setOutputMarkupId( true ) );
-
- trackingIdSelector = new DropDownChoice<String>( "trackingIdSelector",
- new PropertyModel<String>( this, "trackingIdSelected" ),
- fetch.cargoIds() );
- trackingIdSelector.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
- {
- @Override
- protected void onUpdate( AjaxRequestTarget target )
- {
- trackingId = trackingIdSelected;
- target.add( feedback, trackingIdInput, trackingIdSelector );
- }
- } );
- add( trackingIdSelector.setOutputMarkupId( true ) );
-
- // Event Type
-
- eventTypeInput = new TextField<String>( "eventTypeInput", new PropertyModel<String>( this, "eventType" ) );
- add( eventTypeInput.setRequired( true ).setLabel( Model.of( "Event Type" ) ).setOutputMarkupId( true ) );
-
- eventTypeSelector = new DropDownChoice<String>( "eventTypeSelector",
- new PropertyModel<String>( this, "eventTypeSelected" ),
- fetch.eventTypes() );
- eventTypeSelector.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
- {
- @Override
- protected void onUpdate( AjaxRequestTarget target )
- {
- eventType = eventTypeSelected;
- target.add( feedback, eventTypeInput, eventTypeSelector );
- }
- } );
- add( eventTypeSelector.setOutputMarkupId( true ) );
-
- // Voyage (optional in some cases)
-
- voyageInput = new TextField<String>( "voyageInput", new PropertyModel<String>( this, "voyageNumber" ) );
- add( voyageInput.setLabel( Model.of( "Voyage" ) ).setOutputMarkupId( true ) );
-
- voyageSelector = new DropDownChoice<String>( "voyageSelector",
- new PropertyModel<String>( this, "voyageSelected" ),
- fetch.voyages() );
- voyageSelector.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
- {
- @Override
- protected void onUpdate( AjaxRequestTarget target )
- {
- voyageNumber = voyageSelected;
- target.add( feedback, voyageInput, voyageSelector );
- }
- } );
- add( voyageSelector.setOutputMarkupId( true ) );
-
- // Location
-
- locationInput = new TextField<String>( "locationInput", new PropertyModel<String>( this, "unLocode" ) );
- add( locationInput.setRequired( true ).setLabel( Model.of( "Location" ) ).setOutputMarkupId( true ) );
-
- locationSelector = new DropDownChoice<String>( "locationSelector",
- new PropertyModel<String>( this, "locationSelected" ),
- new CommonQueries().unLocodes() );
- locationSelector.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
- {
- @Override
- protected void onUpdate( AjaxRequestTarget target )
- {
- unLocode = locationSelected;
- target.add( feedback, locationInput, locationSelector );
- }
- } );
- add( locationSelector.setOutputMarkupId( true ) );
-
- // Submit and process
-
- add( new AjaxFallbackButton( "register", this )
- {
- @Override
- protected void onSubmit( AjaxRequestTarget target, Form<?> form )
- {
- try
- {
- // We want to allow making multiple _unique_ handling event registrations
- if( sameDataIsSubmitted() )
- {
- throw new Exception( "Can't re-submit the same data." );
- }
-
- // We simulate receiving raw text data from incident logging applications
- // Add current time to date to have same-dates in processing order (would register full time in real app)
- String completionDateString = DateTimeFormatter.ofPattern( "yyyy-MM-dd HH:mm" ).format( completion );
-
- // Parse "incoming" data (step 1 of ProcessHandlingEvent use case)
- tbf.newTransient( ProcessHandlingEvent.class ).parse(
- completionDateString, trackingId, eventType, unLocode, voyageNumber );
-
- /**
- * 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...
- * */
-// setResponsePage( CargoDetailsPage.class, new PageParameters().set( 0, trackingId ) );
-
- try
- {
- HandlingEventType.valueOf( eventType );
- }
- catch( Exception e )
- {
- throw new Exception( "'" + eventType + "' is not a valid handling event type" );
- }
-
- ValueMap map = new ValueMap();
- map.put( "type", eventType );
- map.put( "location", unLocode );
- if( voyageNumber != null )
- {
- map.put( "voyage", voyageNumber );
- }
- String msg = new StringResourceModel( "handlingEvent.${type}", this, new Model<ValueMap>( map ) )
- .getObject();
-
- feedback.info( "Registered handling event for cargo '" + trackingId + "': " + msg );
- target.add( feedback );
- }
- catch( Exception e )
- {
- logger.warn( "Problem registering handling event: " + e.getMessage() );
- feedback.error( e.getMessage() );
- target.add( feedback );
- }
- }
-
- @Override
- protected void onError( final AjaxRequestTarget target, Form<?> form )
- {
- target.add( feedback );
- focusFirstError( target );
- }
- } );
- }
-
- private boolean sameDataIsSubmitted()
- {
- String submittedData = completion.toString() + trackingId + unLocode + voyageNumber + eventType;
-
- if( submittedData.equals( lastSubmittedData ) )
- {
- return true;
- }
-
- // Valid new data submitted
- lastSubmittedData = submittedData;
-
- return false;
- }
- }
-}
\ 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/tracking/HandlingHistoryPanel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/tracking/HandlingHistoryPanel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/tracking/HandlingHistoryPanel.java
deleted file mode 100644
index 6b672c1..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/tracking/HandlingHistoryPanel.java
+++ /dev/null
@@ -1,92 +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.tracking;
-
-import java.time.ZoneOffset;
-import java.util.List;
-import org.apache.wicket.behavior.AttributeAppender;
-import org.apache.wicket.devutils.stateless.StatelessComponent;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.StringResourceModel;
-import org.apache.wicket.util.value.ValueMap;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.TrackingQueries;
-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.wicket.color.ErrorColor;
-
-import static java.util.Date.from;
-
-/**
- * Handling history
- *
- * Shows a list of handling events for a cargo.
- *
- * A tracking id string is passed in to retrieve all events matching that cargo.
- */
-@StatelessComponent
-public class HandlingHistoryPanel extends Panel
-{
- public HandlingHistoryPanel( String id, final IModel<Cargo> cargoModel, String trackingId )
- {
- super( id );
-
- IModel<List<HandlingEvent>> handlingEventsModel = new TrackingQueries().events( trackingId );
-
- add( new ListView<HandlingEvent>( "handlingEvents", handlingEventsModel )
- {
- @Override
- protected void populateItem( ListItem<HandlingEvent> item )
- {
- HandlingEvent event = item.getModelObject();
- Boolean isLast = item.getIndex() == getList().size() - 1;
- Boolean isMisdirected = cargoModel.getObject().delivery().get().isMisdirected().get();
-
- // Status icon
- IModel iconName = Model.of( isLast && isMisdirected ? "cross.png" : "tick.png" );
- item.add( new WebMarkupContainer( "onTrackIcon" ).add( new AttributeAppender( "src", iconName, "" ) ) );
-
- // Date
- item.add( new Label( "completion", new Model<>(
- from( event.completionDate().get().atStartOfDay().toInstant( ZoneOffset.UTC ) ) )
- ));
-
- // Event description (data substitution in strings from HandlingHistoryPanel.properties)
- ValueMap map = new ValueMap();
- map.put( "type", event.handlingEventType().get().name() );
- map.put( "location", event.location().get().getString() );
- if( event.voyage().get() != null )
- {
- map.put( "voyage", event.voyage().get().voyageNumber().get().number().get() );
- }
- IModel text = new StringResourceModel( "handlingEvent.${type}", this, new Model<>( map ) );
- item.add( new Label( "event", text )
- .add( new ErrorColor( isLast && isMisdirected ) )
- .setEscapeModelStrings( false ) );
- }
- } );
- }
-}
-
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/tracking/NextHandlingEventPanel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/tracking/NextHandlingEventPanel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/tracking/NextHandlingEventPanel.java
deleted file mode 100644
index 0b7d701..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/tracking/NextHandlingEventPanel.java
+++ /dev/null
@@ -1,100 +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.tracking;
-
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.devutils.stateless.StatelessComponent;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.StringResourceModel;
-import org.apache.wicket.util.value.ValueMap;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo;
-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.handling.HandlingEventType;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
-
-/**
- * Next handling event
- *
- * Quite some presentation logic to render 1 line of information!
- */
-@StatelessComponent
-public class NextHandlingEventPanel extends Panel
-{
- public NextHandlingEventPanel( String id, IModel<Cargo> cargoModel )
- {
- super( id );
-
- ValueMap map = new ValueMap();
- Label label = new Label( "text", new StringResourceModel(
- "nextEvent.${nextEvent}", this, new Model<ValueMap>( map ) ) );
- add( label );
-
- Cargo cargo = cargoModel.getObject();
- Location destination = cargo.routeSpecification().get().destination().get();
-
- if( cargo.itinerary().get() == null )
- {
- map.put( "nextEvent", "ROUTE" );
- return;
- }
-
- HandlingEvent previousEvent = cargo.delivery().get().lastHandlingEvent().get();
- if( previousEvent == null )
- {
- map.put( "nextEvent", "RECEIVE" );
- map.put( "location", cargo.routeSpecification().get().origin().get().getString() );
- return;
- }
-
- Location lastLocation = previousEvent.location().get();
- if( previousEvent.handlingEventType().get() == HandlingEventType.CLAIM && lastLocation == destination )
- {
- map.put( "nextEvent", "END_OF_CYCLE" );
- map.put( "location", destination.getString() );
- label.add( new AttributeModifier( "class", "correctColor" ) );
- return;
- }
-
- NextHandlingEvent nextEvent = cargo.delivery().get().nextHandlingEvent().get();
- if( nextEvent == null )
- {
- map.put( "nextEvent", "UNKNOWN" );
- label.add( new AttributeModifier( "class", "errorColor" ) );
- return;
- }
-
- map.put( "nextEvent", nextEvent.handlingEventType().get().name() );
- map.put( "location", nextEvent.location().get().getString() );
-
- if( nextEvent.date() != null )
- {
- map.put( "time", nextEvent.date().get().toString() );
- }
-
- if( nextEvent.voyage().get() != null )
- {
- map.put( "voyage", nextEvent.voyage().get().voyageNumber().get().number().get() );
- }
- }
-}
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/tracking/TrackCargoPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/tracking/TrackCargoPage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/tracking/TrackCargoPage.java
deleted file mode 100644
index f810d8d..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/web/tracking/TrackCargoPage.java
+++ /dev/null
@@ -1,201 +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.tracking;
-
-import java.time.LocalDate;
-import java.util.List;
-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.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.markup.html.panel.Fragment;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.StringResourceModel;
-import org.apache.wicket.util.value.ValueMap;
-import org.apache.zest.api.unitofwork.NoSuchEntityException;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.CommonQueries;
-import org.apache.zest.sample.dcicargo.sample_b.communication.query.TrackingQueries;
-import org.apache.zest.sample.dcicargo.sample_b.communication.web.BasePage;
-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.data.structure.handling.HandlingEventType;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form.AbstractForm;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form.SelectorInForm;
-
-/**
- * Track a cargo
- *
- * For convenience during testing, routed (non-received) cargos can be chosen from the dropdown list.
- */
-public class TrackCargoPage extends BasePage
-{
- public TrackCargoPage()
- {
- super( "tracking" ); // Selects the Tracking tab
- add( new TrackingForm() );
- }
-
- private final class TrackingForm extends AbstractForm<Void>
- {
- private String trackingId;
- private String selectedTrackingId; // Set by Wicket property resolver
-
- private TextField<String> trackingIdInput;
- private SelectorInForm selectedTrackingIdSelector;
-
- private FeedbackPanel feedback = new FeedbackPanel( "feedback" );
- private Fragment statusFragment = new Fragment( "status", "statusFragment", new WebMarkupContainer( "mock" ) );
-
- private TrackingForm()
- {
- // Manual input
- trackingIdInput = new TextField<String>( "trackingId", new PropertyModel<String>( this, "trackingId" ) );
- add( trackingIdInput.setRequired( true ).setOutputMarkupId( true ) );
-
- // Submit button
- add( new AjaxFallbackButton( "track", this )
- {
- @Override
- protected void onSubmit( AjaxRequestTarget target, Form<?> form )
- {
- updateStatusFragment( target );
- }
-
- @Override
- protected void onError( final AjaxRequestTarget target, Form<?> form )
- {
- updateStatusFragment( target );
- target.add( feedback, trackingIdInput, selectedTrackingIdSelector, statusFragment.setVisible( false ) );
- }
- } );
-
- // Drop down selector (for convenience)
- List<String> cargoIds = new TrackingQueries().routedCargos();
- add( selectedTrackingIdSelector = new SelectorInForm(
- "selectedTrackingId", "Selected Tracking id", cargoIds, this ) );
- selectedTrackingIdSelector.add( new AjaxFormComponentUpdatingBehavior( "onchange" )
- {
- @Override
- protected void onUpdate( AjaxRequestTarget target )
- {
- trackingId = selectedTrackingId;
- updateStatusFragment( target );
- }
- } );
-
- add( feedback.setOutputMarkupId( true ) );
- add( statusFragment.setOutputMarkupId( true ).setOutputMarkupPlaceholderTag( true ).setVisible( false ) );
- }
-
- private void updateStatusFragment( final AjaxRequestTarget target )
- {
- try
- {
- IModel<Cargo> cargoModel = new CommonQueries().cargo( trackingId );
- statusFragment = (Fragment) statusFragment.replaceWith( new StatusFragment( cargoModel, false ) );
- target.add( feedback, trackingIdInput, selectedTrackingIdSelector, statusFragment.setVisible( true ) );
- }
- catch( NoSuchEntityException e )
- {
- e.printStackTrace();
- error( "Cargo '" + trackingId + "' wasn't found in the system. Please check the tracking number." );
-
- target.add( feedback, trackingIdInput, selectedTrackingIdSelector, statusFragment.setVisible( false ) );
- }
- catch( Exception e )
- {
- e.printStackTrace();
- error( "Problem retrieving status for cargo '" + trackingId + "': " + e.getMessage() );
- target.add( feedback, trackingIdInput, selectedTrackingIdSelector, statusFragment.setVisible( false ) );
- }
- }
-
- private class StatusFragment extends Fragment
- {
- public StatusFragment( IModel<Cargo> cargoModel, Boolean visible )
- {
- super( "status", "statusFragment", TrackingForm.this );
- setVisible( visible );
-
- Cargo cargo = cargoModel.getObject();
-
- // Status ----------------------------------------------------------------------
- ValueMap map = new ValueMap();
- map.put( "status", cargo.delivery().get().transportStatus().get().name() );
- map.put( "trackingId", trackingId );
- HandlingEvent lastEvent = cargo.delivery().get().lastHandlingEvent().get();
- if( lastEvent != null )
- {
- String voyageString = lastEvent.voyage().get() != null ?
- lastEvent.voyage()
- .get()
- .voyageNumber()
- .get()
- .number()
- .get() : "UNKNOWN_VOYAGE";
- map.put( "voyage", voyageString );
- map.put( "location", lastEvent.location().get().getString() );
- }
- else
- {
- map.put( "voyage", "UNKNOWN_VOYAGE" );
- map.put( "location", cargo.origin().get().getString() );
- }
- add( new Label( "transportStatus", new StringResourceModel(
- "transportStatus.${status}", this, new Model<ValueMap>( map ) ) ) );
-
- // ETA ----------------------------------------------------------------------
- String destination = cargo.routeSpecification().get().destination().get().getString();
- LocalDate eta = cargo.delivery().get().eta().get();
- String etaString = eta == null ? "?" : eta.toString();
- add( new Label( "eta", new StringResourceModel(
- "eta", this, null, Model.of( destination ), Model.of( etaString ) ) ) );
-
- // Warning/Notifier ----------------------------------------------------------------------
- add( new WebMarkupContainer( "isMisdirected" ).setVisible( cargo.delivery()
- .get()
- .isMisdirected()
- .get() ) );
- add( new WebMarkupContainer( "isClaimed" ).setVisible(
- !cargo.delivery().get().isMisdirected().get()
- && cargo.delivery().get().isUnloadedAtDestination().get()
- && lastEvent != null
- && lastEvent.handlingEventType().get() == HandlingEventType.CLAIM
- ) );
-
- // Handling history ----------------------------------------------------------------------
- if( cargo.delivery().get().lastHandlingEvent().get() == null )
- {
- add( new Label( "handlingHistoryPanel" ) );
- }
- else
- {
- add( new HandlingHistoryPanel( "handlingHistoryPanel", cargoModel, trackingId ) );
- }
- }
- }
- }
-}
\ 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/context/interaction/booking/BookNewCargo.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/BookNewCargo.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/BookNewCargo.java
deleted file mode 100644
index bdbfd39..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/BookNewCargo.java
+++ /dev/null
@@ -1,137 +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.context.interaction.booking;
-
-import java.time.Instant;
-import java.time.LocalDate;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.This;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.CargoAggregateRoot;
-import org.apache.zest.sample.dcicargo.sample_b.data.factory.CargoFactory;
-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.delivery.RoutingStatus;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.TransportStatus;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.tracking.TrackingId;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.dci.Context;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.dci.RoleMixin;
-
-import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType.RECEIVE;
-
-/**
- * Book New Cargo (use case)
- *
- * Cargo Owner starts with the 1st step in the overall Ship Cargo use case by booking a cargo shipment
- * in our shipping application.
- *
- * The Cargo Owner provides an origin and destination location and a arrival deadline to the booking
- * application. A route specification is created from the input and attached to a new cargo with
- * a unique tracking id.
- */
-public class BookNewCargo extends Context
-{
- private BookingSystemRole bookingSystem;
-
- private Location origin;
- private Location destination;
- private LocalDate arrivalDeadline;
-
- public BookNewCargo( CargoFactory cargoFactory, Location origin, Location destination, LocalDate arrivalDeadline )
- throws Exception
- {
- bookingSystem = rolePlayer( BookingSystemRole.class, cargoFactory );
- this.origin = origin;
- this.destination = destination;
- this.arrivalDeadline = arrivalDeadline;
- }
-
- public BookNewCargo( String originId, String destinationId, LocalDate deadline )
- throws Exception
- {
- this( loadEntity( CargoAggregateRoot.class, CargoAggregateRoot.CARGOS_ID ),
- loadEntity( Location.class, originId ),
- loadEntity( Location.class, destinationId ),
- deadline );
- }
-
- public TrackingId getTrackingId()
- throws Exception
- {
- return bookingSystem.createCargo( null );
- }
-
- public TrackingId withTrackingId( String trackingIdString )
- throws Exception
- {
- return bookingSystem.createCargo( trackingIdString );
- }
-
- @Mixins( BookingSystemRole.Mixin.class )
- public interface BookingSystemRole
- {
- void setContext( BookNewCargo context );
-
- TrackingId createCargo( @Optional String trackingIdString )
- throws Exception;
-
- class Mixin
- extends RoleMixin<BookNewCargo>
- implements BookingSystemRole
- {
- @This
- CargoFactory cargoFactory;
-
- @Service
- RouteSpecificationFactoryService routeSpecFactory;
-
- public TrackingId createCargo( String trackingIdString )
- throws Exception
- {
- LocalDate earliestDeparture = LocalDate.now();
- RouteSpecification routeSpec = routeSpecFactory.build( c.origin,
- c.destination,
- earliestDeparture,
- c.arrivalDeadline );
-
- ValueBuilder<Delivery> delivery = vbf.newValueBuilder( Delivery.class );
- delivery.prototype().timestamp().set( Instant.now() );
- delivery.prototype().transportStatus().set( TransportStatus.NOT_RECEIVED );
- delivery.prototype().routingStatus().set( RoutingStatus.NOT_ROUTED );
-
- // Expect receipt in origin (time unknown / no voyage yet)
- ValueBuilder<NextHandlingEvent> nextEvent = vbf.newValueBuilder( NextHandlingEvent.class );
- nextEvent.prototype().handlingEventType().set( RECEIVE );
- nextEvent.prototype().location().set( routeSpec.origin().get() );
- delivery.prototype().nextHandlingEvent().set( nextEvent.newInstance() );
-
- Cargo cargo = cargoFactory.createCargo( routeSpec, delivery.newInstance(), trackingIdString );
-
- return cargo.trackingId().get();
- }
- }
- }
-}
\ 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/context/interaction/booking/exception/ChangeDestinationException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/exception/ChangeDestinationException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/exception/ChangeDestinationException.java
deleted file mode 100644
index ba4f225..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/exception/ChangeDestinationException.java
+++ /dev/null
@@ -1,63 +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.context.interaction.booking.exception;
-
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.RouteSpecification;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
-
-/**
- * Javadoc
- */
-public class ChangeDestinationException extends Exception
-{
-
- // private RouteSpecification routeSpec;
-// private Itinerary itinerary;
- protected String msg = "";
-
- public ChangeDestinationException( String s, RouteSpecification routeSpec, Itinerary itinerary )
- {
- msg = s;
-// this.routeSpec = routeSpec;
-// this.itinerary = itinerary;
- }
-
- @Override
- public String getMessage()
- {
- return msg;
-// return "Couldn't change destination of cargo: " + msg;
- }
-
- public ChangeDestinationException( Throwable e )
- {
- super( e );
- }
-
- public ChangeDestinationException()
- {
- super();
- }
-
- public ChangeDestinationException( String s )
- {
- msg = s;
- }
-}
\ 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/context/interaction/booking/exception/RoutingException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/exception/RoutingException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/exception/RoutingException.java
deleted file mode 100644
index 3d6d965..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/exception/RoutingException.java
+++ /dev/null
@@ -1,31 +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.context.interaction.booking.exception;
-
-/**
- * Javadoc
- */
-public class RoutingException extends Exception
-{
- public RoutingException( String s )
- {
- super( s );
- }
-}
\ 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/context/interaction/booking/exception/UnsatisfyingRouteException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/exception/UnsatisfyingRouteException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/exception/UnsatisfyingRouteException.java
deleted file mode 100644
index 257a3de..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/exception/UnsatisfyingRouteException.java
+++ /dev/null
@@ -1,47 +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.context.interaction.booking.exception;
-
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.RouteSpecification;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
-
-/**
- * Javadoc
- */
-public class UnsatisfyingRouteException extends Exception
-{
- private RouteSpecification routeSpec;
- private Itinerary itinerary;
-
- public UnsatisfyingRouteException( RouteSpecification routeSpec, Itinerary itinerary )
- {
- this.routeSpec = routeSpec;
- this.itinerary = itinerary;
- }
-
- @Override
- public String getMessage()
- {
-// return "Route specification was not satisfied with itinerary.";
-
- // When testing:
- return "Route specification was not satisfied with itinerary:\n" + routeSpec.print() + "\n" + itinerary.print();
- }
-}
\ No newline at end of file