Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id B8BE8200B12 for ; Sun, 12 Jun 2016 14:54:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id B7465160A5D; Sun, 12 Jun 2016 12:54:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7E3DA160A06 for ; Sun, 12 Jun 2016 14:54:02 +0200 (CEST) Received: (qmail 60127 invoked by uid 500); 12 Jun 2016 12:54:01 -0000 Mailing-List: contact commits-help@zest.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zest.apache.org Delivered-To: mailing list commits@zest.apache.org Received: (qmail 60111 invoked by uid 99); 12 Jun 2016 12:54:01 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 12 Jun 2016 12:54:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7A01DE07F6; Sun, 12 Jun 2016 12:54:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: niclas@apache.org To: commits@zest.apache.org Date: Sun, 12 Jun 2016 12:54:01 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/3] zest-java git commit: ZEST-151 : Ooops, there were dependencies. Took the time to refactor some of the DCI Cargo demo code in the process. Tests passes, but somehow I doubt that it still works in actual runtime. Need to spend time on that later. archived-at: Sun, 12 Jun 2016 12:54:04 -0000 Repository: zest-java Updated Branches: refs/heads/develop 1ead13389 -> 21baf180e http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/LocationDTO.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/LocationDTO.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/LocationDTO.java deleted file mode 100644 index 3a29269..0000000 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/LocationDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.sample.dcicargo.sample_b.communication.query.dto; - -import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location; -import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.DTO; - -/** - * Location DTO - * - * Since all properties of Location are immutable, we can simply re-use the same interface. - * We need the Location as a DTO when we do entity to value conversions. - */ -public interface LocationDTO extends Location, DTO -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/VoyageDTO.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/VoyageDTO.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/VoyageDTO.java deleted file mode 100644 index 1635577..0000000 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/communication/query/dto/VoyageDTO.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.sample.dcicargo.sample_b.communication.query.dto; - -import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage; -import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.DTO; - -/** - * Voyage DTO - * - * Since all properties of Voyage are immutable, we can simply re-use the same interface. - * We need the Voyage as a DTO when we do entity to value conversions. - */ -public interface VoyageDTO extends Voyage, DTO -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/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 index 65f568f..4840154 100644 --- 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 @@ -33,9 +33,9 @@ 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.query.dto.CargoDTO; 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; @@ -72,8 +72,8 @@ public class CargoDetailsPage extends BookingBasePage { super( new PageParameters().set( 0, trackingId ) ); - IModel cargoModel = new CommonQueries().cargo( trackingId ); - CargoDTO cargo = cargoModel.getObject(); + IModel cargoModel = new CommonQueries().cargo( trackingId ); + Cargo cargo = cargoModel.getObject(); Delivery delivery = cargo.delivery().get(); TransportStatus transportStatus = delivery.transportStatus().get(); RouteSpecification routeSpecification = cargo.routeSpecification().get(); @@ -144,7 +144,7 @@ public class CargoDetailsPage extends BookingBasePage private class ItineraryFragment extends Fragment { - public ItineraryFragment( final IModel cargoModel, final RoutingStatus routingStatus ) + public ItineraryFragment( final IModel cargoModel, final RoutingStatus routingStatus ) { super( "itinerary", "itineraryFragment", CargoDetailsPage.this ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/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 index 1d6b887..4b17a9f 100644 --- 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 @@ -30,7 +30,7 @@ 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.communication.query.dto.CargoDTO; +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; @@ -53,23 +53,23 @@ public class CargoListPage extends BookingBasePage { public CargoListPage() { - IModel> cargoList = new CommonQueries().cargoList(); + IModel> cargoList = new CommonQueries().cargoList(); // Save current trackingIds in session (for prev/next buttons on details page) ArrayList ids = new ArrayList(); - for( CargoDTO cargo : cargoList.getObject() ) + for( Cargo cargo : cargoList.getObject() ) { ids.add( cargo.trackingId().get().id().get() ); } PrevNext.registerIds( Session.get(), ids ); - add( new ListView( "list", cargoList ) + add( new ListView( "list", cargoList ) { @Override - protected void populateItem( ListItem item ) + protected void populateItem( ListItem item ) { // Cargo - CargoDTO cargo = item.getModelObject(); + Cargo cargo = item.getModelObject(); String trackingId = cargo.trackingId().get().id().get(); String origin = cargo.origin().get().getCode(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/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 index 956ec78..3dd9fe1 100644 --- 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 @@ -28,9 +28,9 @@ 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.communication.query.dto.CargoDTO; 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; @@ -54,7 +54,7 @@ public class ChangeDestinationPage extends BookingBasePage public CargoEditForm( final String trackingId ) { CommonQueries fetch = new CommonQueries(); - CargoDTO cargo = fetch.cargo( trackingId ).getObject(); + Cargo cargo = fetch.cargo( trackingId ).getObject(); List locations = fetch.unLocodes(); origin = cargo.routeSpecification().get().origin().get().getCode(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/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 index 55d8935..6b672c1 100644 --- 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 @@ -33,8 +33,8 @@ 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.communication.query.dto.CargoDTO; -import org.apache.zest.sample.dcicargo.sample_b.communication.query.dto.HandlingEventDTO; +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; @@ -49,18 +49,18 @@ import static java.util.Date.from; @StatelessComponent public class HandlingHistoryPanel extends Panel { - public HandlingHistoryPanel( String id, final IModel cargoModel, String trackingId ) + public HandlingHistoryPanel( String id, final IModel cargoModel, String trackingId ) { super( id ); - IModel> handlingEventsModel = new TrackingQueries().events( trackingId ); + IModel> handlingEventsModel = new TrackingQueries().events( trackingId ); - add( new ListView( "handlingEvents", handlingEventsModel ) + add( new ListView( "handlingEvents", handlingEventsModel ) { @Override - protected void populateItem( ListItem item ) + protected void populateItem( ListItem item ) { - HandlingEventDTO event = item.getModelObject(); + HandlingEvent event = item.getModelObject(); Boolean isLast = item.getIndex() == getList().size() - 1; Boolean isMisdirected = cargoModel.getObject().delivery().get().isMisdirected().get(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/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 index 1bc8c13..0b7d701 100644 --- 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 @@ -27,7 +27,7 @@ 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.dto.CargoDTO; +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; @@ -41,7 +41,7 @@ import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location @StatelessComponent public class NextHandlingEventPanel extends Panel { - public NextHandlingEventPanel( String id, IModel cargoModel ) + public NextHandlingEventPanel( String id, IModel cargoModel ) { super( id ); @@ -50,7 +50,7 @@ public class NextHandlingEventPanel extends Panel "nextEvent.${nextEvent}", this, new Model( map ) ) ); add( label ); - CargoDTO cargo = cargoModel.getObject(); + Cargo cargo = cargoModel.getObject(); Location destination = cargo.routeSpecification().get().destination().get(); if( cargo.itinerary().get() == null ) http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/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 index 26f3c11..f810d8d 100644 --- 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 @@ -38,8 +38,8 @@ 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.query.dto.CargoDTO; 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; @@ -114,7 +114,7 @@ public class TrackCargoPage extends BasePage { try { - IModel cargoModel = new CommonQueries().cargo( trackingId ); + IModel cargoModel = new CommonQueries().cargo( trackingId ); statusFragment = (Fragment) statusFragment.replaceWith( new StatusFragment( cargoModel, false ) ); target.add( feedback, trackingIdInput, selectedTrackingIdSelector, statusFragment.setVisible( true ) ); } @@ -135,12 +135,12 @@ public class TrackCargoPage extends BasePage private class StatusFragment extends Fragment { - public StatusFragment( IModel cargoModel, Boolean visible ) + public StatusFragment( IModel cargoModel, Boolean visible ) { super( "status", "statusFragment", TrackingForm.this ); setVisible( visible ); - CargoDTO cargo = cargoModel.getObject(); + Cargo cargo = cargoModel.getObject(); // Status ---------------------------------------------------------------------- ValueMap map = new ValueMap(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/specification/DeriveUpdatedRouteSpecification.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/specification/DeriveUpdatedRouteSpecification.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/specification/DeriveUpdatedRouteSpecification.java index 36be860..f6a201c 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/specification/DeriveUpdatedRouteSpecification.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/booking/specification/DeriveUpdatedRouteSpecification.java @@ -51,12 +51,12 @@ import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.T */ public class DeriveUpdatedRouteSpecification extends Context { - CargoInspectorRole cargoInspector; + private CargoInspectorRole cargoInspector; - RouteSpecification routeSpecification; - TransportStatus transportStatus; - HandlingEvent lastHandlingEvent; - Location newDestination; + private RouteSpecification routeSpecification; + private TransportStatus transportStatus; + private HandlingEvent lastHandlingEvent; + private Location newDestination; public DeriveUpdatedRouteSpecification( Cargo cargo ) { http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectCargoInCustoms.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectCargoInCustoms.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectCargoInCustoms.java index 7e68fb8..421e634 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectCargoInCustoms.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectCargoInCustoms.java @@ -55,14 +55,14 @@ import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.H */ public class InspectCargoInCustoms extends Context { - DeliveryInspectorRole deliveryInspector; + private DeliveryInspectorRole deliveryInspector; - HandlingEvent customsEvent; + private HandlingEvent customsEvent; - RouteSpecification routeSpecification; - Itinerary itinerary; - Integer itineraryProgressIndex; - TransportStatus transportStatus; + private RouteSpecification routeSpecification; + private Itinerary itinerary; + private Integer itineraryProgressIndex; + private TransportStatus transportStatus; public InspectCargoInCustoms( Cargo cargo, HandlingEvent handlingEvent ) { http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectClaimedCargo.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectClaimedCargo.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectClaimedCargo.java index 0c91f0f..5f93b13 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectClaimedCargo.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectClaimedCargo.java @@ -51,14 +51,14 @@ import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.H */ public class InspectClaimedCargo extends Context { - DeliveryInspectorRole deliveryInspector; + private DeliveryInspectorRole deliveryInspector; - HandlingEvent claimEvent; - Location claimLocation; + private HandlingEvent claimEvent; + private Location claimLocation; - RouteSpecification routeSpecification; - Itinerary itinerary; - Integer itineraryProgressIndex; + private RouteSpecification routeSpecification; + private Itinerary itinerary; + private Integer itineraryProgressIndex; public InspectClaimedCargo( Cargo cargo, HandlingEvent handlingEvent ) { http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectUnhandledCargo.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectUnhandledCargo.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectUnhandledCargo.java index 69d8312..2694e55 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectUnhandledCargo.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/inspection/event/InspectUnhandledCargo.java @@ -34,7 +34,9 @@ import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinera 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.delivery.RoutingStatus.*; +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.RoutingStatus.ROUTED; import static org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.TransportStatus.NOT_RECEIVED; import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType.RECEIVE; @@ -47,12 +49,13 @@ import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.H */ public class InspectUnhandledCargo extends Context { - DeliveryInspectorRole deliveryInspector; + private DeliveryInspectorRole deliveryInspector; - HandlingEvent noEvent; + private HandlingEvent noEvent; - RouteSpecification routeSpecification; - Itinerary itinerary; + private RouteSpecification routeSpecification; + + private Itinerary itinerary; public InspectUnhandledCargo( Cargo cargo ) { http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/parsing/dto/ParsedHandlingEventData.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/parsing/dto/ParsedHandlingEventData.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/parsing/dto/ParsedHandlingEventData.java index ff1ef7a..d1909d9 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/parsing/dto/ParsedHandlingEventData.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/parsing/dto/ParsedHandlingEventData.java @@ -32,7 +32,7 @@ import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.DTO; */ @Immutable @Mixins( ParsedHandlingEventData.Mixin.class ) -public interface ParsedHandlingEventData extends DTO +public interface ParsedHandlingEventData { Property registrationDate(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/RegisterHandlingEvent.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/RegisterHandlingEvent.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/RegisterHandlingEvent.java index da83223..17e159b 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/RegisterHandlingEvent.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/RegisterHandlingEvent.java @@ -35,7 +35,6 @@ import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.reg import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.registration.exception.UnknownLocationException; import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.registration.exception.UnknownVoyageException; import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.HandlingEventAggregateRoot; -import org.apache.zest.sample.dcicargo.sample_b.data.entity.HandlingEventEntity; import org.apache.zest.sample.dcicargo.sample_b.data.factory.HandlingEventFactory; import org.apache.zest.sample.dcicargo.sample_b.data.factory.exception.CannotCreateHandlingEventException; import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo; @@ -79,13 +78,13 @@ import static org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.H */ public class RegisterHandlingEvent extends Context { - EventRegistrarRole eventRegistrar; + private EventRegistrarRole eventRegistrar; - ParsedHandlingEventData eventData; - HandlingEventType eventType; - String trackingIdString; - String unLocodeString; - String voyageNumberString; + private ParsedHandlingEventData eventData; + private HandlingEventType eventType; + private String trackingIdString; + private String unLocodeString; + private String voyageNumberString; public RegisterHandlingEvent( ParsedHandlingEventData parsedEventData ) { @@ -171,14 +170,14 @@ public class RegisterHandlingEvent extends Context if( c.eventType.equals( RECEIVE ) || c.eventType.equals( CUSTOMS ) || c.eventType.equals( CLAIM ) ) { - QueryBuilder qb = qbf.newQueryBuilder( HandlingEventEntity.class ) + QueryBuilder qb = qbf.newQueryBuilder( HandlingEvent.class ) .where( and( eq( templateFor( HandlingEvent.class ).trackingId().get().id(), c.trackingIdString ), eq( templateFor( HandlingEvent.class ).handlingEventType(), c.eventType ) ) ); - Query duplicates = uowf.currentUnitOfWork().newQuery( qb ); + Query duplicates = uowf.currentUnitOfWork().newQuery( qb ); if( duplicates.count() > 0 ) { throw new DuplicateEventException( c.eventData ); @@ -190,14 +189,14 @@ public class RegisterHandlingEvent extends Context if( !c.eventType.equals( CLAIM ) ) { HandlingEvent eventTemplate = templateFor( HandlingEvent.class ); - QueryBuilder qb = qbf.newQueryBuilder( HandlingEventEntity.class ) + QueryBuilder qb = qbf.newQueryBuilder( HandlingEvent.class ) .where( and( eq( eventTemplate.trackingId().get().id(), c.trackingIdString ), eq( eventTemplate.handlingEventType(), CLAIM ) ) ); - Query alreadyClaimed = uowf.currentUnitOfWork().newQuery( qb ); + Query alreadyClaimed = uowf.currentUnitOfWork().newQuery( qb ); if( alreadyClaimed.count() > 0 ) { throw new AlreadyClaimedException( c.eventData ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/CargoRoleMap.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/CargoRoleMap.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/CargoRoleMap.java index aa61125..c56addb 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/CargoRoleMap.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/CargoRoleMap.java @@ -19,6 +19,7 @@ */ package org.apache.zest.sample.dcicargo.sample_b.context.rolemap; +import org.apache.zest.api.entity.EntityComposite; import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.routing.AssignCargoToRoute; import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.routing.RegisterNewDestination; import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.specification.DeriveUpdatedRouteSpecification; @@ -30,7 +31,7 @@ import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.ins import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.event.InspectReceivedCargo; import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.event.InspectUnhandledCargo; import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.event.InspectUnloadedCargo; -import org.apache.zest.sample.dcicargo.sample_b.data.entity.CargoEntity; +import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo; /** * Cargo Role Map @@ -40,20 +41,20 @@ import org.apache.zest.sample.dcicargo.sample_b.data.entity.CargoEntity; * Note that the CargoEntity knows nothing about this map (and that Cargo (Data) knows nothing about CargoEntity). */ public interface CargoRoleMap - extends CargoEntity, + extends - RegisterNewDestination.CargoInspectorRole, - AssignCargoToRoute.CargoInspectorRole, - DeriveUpdatedRouteSpecification.CargoInspectorRole, + RegisterNewDestination.CargoInspectorRole, + AssignCargoToRoute.CargoInspectorRole, + DeriveUpdatedRouteSpecification.CargoInspectorRole, - InspectCargoDeliveryStatus.DeliveryInspectorRole, + InspectCargoDeliveryStatus.DeliveryInspectorRole, - InspectUnhandledCargo.DeliveryInspectorRole, - InspectReceivedCargo.DeliveryInspectorRole, - InspectLoadedCargo.DeliveryInspectorRole, - InspectUnloadedCargo.DeliveryInspectorRole, - InspectArrivedCargo.DeliveryInspectorRole, - InspectCargoInCustoms.DeliveryInspectorRole, - InspectClaimedCargo.DeliveryInspectorRole + InspectUnhandledCargo.DeliveryInspectorRole, + InspectReceivedCargo.DeliveryInspectorRole, + InspectLoadedCargo.DeliveryInspectorRole, + InspectUnloadedCargo.DeliveryInspectorRole, + InspectArrivedCargo.DeliveryInspectorRole, + InspectCargoInCustoms.DeliveryInspectorRole, + InspectClaimedCargo.DeliveryInspectorRole, EntityComposite, Cargo { } http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/CargoEntity.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/CargoEntity.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/CargoEntity.java deleted file mode 100644 index 86175ae..0000000 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/CargoEntity.java +++ /dev/null @@ -1,33 +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.data.entity; - -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo; - -/** - * Cargo entity - */ -public interface CargoEntity - extends EntityComposite, - - Cargo -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/HandlingEventEntity.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/HandlingEventEntity.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/HandlingEventEntity.java deleted file mode 100644 index 187506e..0000000 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/HandlingEventEntity.java +++ /dev/null @@ -1,33 +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.data.entity; - -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEvent; - -/** - * Handling Event entity - */ -public interface HandlingEventEntity - extends EntityComposite, - - HandlingEvent -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/LocationEntity.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/LocationEntity.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/LocationEntity.java deleted file mode 100644 index 2c2d680..0000000 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/LocationEntity.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.sample.dcicargo.sample_b.data.entity; - -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location; - -/** - * Location entity - * - * Locations have been created outside the shipping application context so we don't have any - * separate aggregate root to create those from. - */ -public interface LocationEntity - extends EntityComposite, - - Location -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/VoyageEntity.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/VoyageEntity.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/VoyageEntity.java deleted file mode 100644 index 842cf41..0000000 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/entity/VoyageEntity.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.sample.dcicargo.sample_b.data.entity; - -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage; - -/** - * Voyage entity - * - * Voyages have been created outside the shipping application context so we don't have any - * separate aggregate root to create those from. - */ -public interface VoyageEntity - extends EntityComposite, - - Voyage -{ -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/cargo/Cargo.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/cargo/Cargo.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/cargo/Cargo.java index 69a13ef..86efe72 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/cargo/Cargo.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/cargo/Cargo.java @@ -21,6 +21,7 @@ package org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo; import org.apache.zest.api.association.Association; import org.apache.zest.api.common.Optional; +import org.apache.zest.api.entity.Identity; import org.apache.zest.api.property.Immutable; import org.apache.zest.api.property.Property; import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.Delivery; @@ -39,7 +40,7 @@ import org.apache.zest.sample.dcicargo.sample_b.data.structure.tracking.Tracking * {@link Itinerary} Description of chosen route (optional) * {@link Delivery} Snapshot of the current delivery status (automatically created by the system) */ -public interface Cargo +public interface Cargo extends Identity { @Immutable Property trackingId(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java index a905caf..35f84b8 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java @@ -22,6 +22,7 @@ package org.apache.zest.sample.dcicargo.sample_b.data.structure.handling; import java.time.LocalDate; import org.apache.zest.api.association.Association; import org.apache.zest.api.common.Optional; +import org.apache.zest.api.entity.Identity; import org.apache.zest.api.mixin.Mixins; import org.apache.zest.api.property.Immutable; import org.apache.zest.api.property.Property; @@ -54,13 +55,13 @@ import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage; */ @Immutable @Mixins( HandlingEvent.Mixin.class ) -public interface HandlingEvent +public interface HandlingEvent extends Identity { - Property registrationDate(); + Property trackingId(); Property completionDate(); - Property trackingId(); + Property registrationDate(); Property handlingEventType(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java index 73c6fbf..c6c5281 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java @@ -38,7 +38,6 @@ import org.apache.zest.api.usecase.UsecaseBuilder; import org.apache.zest.api.value.ValueBuilderFactory; import org.apache.zest.bootstrap.ApplicationAssembler; import org.apache.zest.bootstrap.Energy4Java; -import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.EntityToDTOService; import org.apache.zest.sample.dcicargo.sample_b.infrastructure.dci.Context; import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.Queries; import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.ReadOnlyModel; @@ -74,9 +73,6 @@ public class WicketZestApplication @Structure protected ZestAPI api; - @Service - protected EntityToDTOService valueConverter; - /** * Zest Assembler * @@ -135,7 +131,7 @@ public class WicketZestApplication Context.prepareContextBaseClass( uowf, vbf ); BaseWebPage.prepareBaseWebPageClass( tbf ); - ReadOnlyModel.prepareModelBaseClass( zestModule, api, valueConverter ); + ReadOnlyModel.prepareModelBaseClass( zestModule, api); Queries.prepareQueriesBaseClass( uowf, qbf ); wicketInit(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/DTO.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/DTO.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/DTO.java index ddd84c1..511f346 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/DTO.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/DTO.java @@ -19,6 +19,7 @@ */ package org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion; +import org.apache.zest.api.entity.Identity; import org.apache.zest.api.property.Immutable; import org.apache.zest.api.value.ValueComposite; @@ -32,6 +33,6 @@ import org.apache.zest.api.value.ValueComposite; * assigned in the EntityToDTOService. */ @Immutable -public interface DTO extends ValueComposite +public interface DTO extends ValueComposite, Identity { } http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java deleted file mode 100644 index 88089a9..0000000 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/EntityToDTOService.java +++ /dev/null @@ -1,335 +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.infrastructure.conversion; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import org.apache.zest.api.association.AssociationDescriptor; -import org.apache.zest.api.association.AssociationStateHolder; -import org.apache.zest.api.association.ManyAssociation; -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.api.entity.EntityDescriptor; -import org.apache.zest.api.entity.EntityReference; -import org.apache.zest.api.entity.Identity; -import org.apache.zest.api.injection.scope.Structure; -import org.apache.zest.api.mixin.Mixins; -import org.apache.zest.api.property.PropertyDescriptor; -import org.apache.zest.api.service.ServiceComposite; -import org.apache.zest.api.structure.ModuleDescriptor; -import org.apache.zest.api.type.CollectionType; -import org.apache.zest.api.value.NoSuchValueException; -import org.apache.zest.api.value.ValueBuilder; -import org.apache.zest.api.value.ValueBuilderFactory; -import org.apache.zest.api.value.ValueDescriptor; -import org.apache.zest.functional.Iterables; -import org.apache.zest.library.conversion.values.Unqualified; -import org.apache.zest.spi.ZestSPI; - -/** - * Conversion of Entity objects to DTO's - * - * Value composites that extend {@link DTO} will have association properties converted recursively. - * - * Modification of {org.apache.zest.library.conversion.values.EntityToValue} - * WARN No support of NamedAssociations - */ -@SuppressWarnings( "unchecked" ) -@Mixins( EntityToDTOService.Mixin.class ) -public interface EntityToDTOService - extends ServiceComposite -{ - T convert( Class valueType, Object entity ); - - static abstract class Mixin - implements EntityToDTOService - { - @Structure - private ValueBuilderFactory vbf; - - @Structure - private ZestSPI spi; - - @Structure - private ModuleDescriptor module; - - @Override - public T convert( final Class valueType, Object entity ) - { - ValueDescriptor valueDescriptor = module.valueDescriptor( valueType.getName() ); - if( valueDescriptor == null ) - { - throw new NoSuchValueException( valueType.getName(), module.name(), module.typeLookup() ); - } - Unqualified unqualified = valueDescriptor.metaInfo( Unqualified.class ); - final EntityComposite composite = (EntityComposite) entity; - final EntityDescriptor entityDescriptor = spi.entityDescriptorFor( composite ); - final AssociationStateHolder associationState = spi.stateOf( composite ); - ValueBuilder builder; - - if( unqualified == null || !unqualified.value() ) - { - // Copy state using qualified names - builder = vbf.newValueBuilderWithState( valueType, new Function() - { - @Override - public Object apply( PropertyDescriptor descriptor ) - { - try - { - return associationState.propertyFor( descriptor.accessor() ).get(); - } - catch( IllegalArgumentException e ) - { - if( descriptor.valueType().mainType().equals( String.class ) ) - { - // Find Association and convert to string - AssociationDescriptor associationDescriptor; - try - { - associationDescriptor = entityDescriptor.state() - .getAssociationByName( descriptor.qualifiedName().name() ); - } - catch( IllegalArgumentException e1 ) - { - return null; - } - Object entity = associationState.associationFor( associationDescriptor.accessor() ) - .get(); - if( entity != null ) - { - return ( (Identity) entity ).identity().get(); - } - else - { - return null; - } - } - else if( descriptor.valueType() instanceof CollectionType - && ( (CollectionType) descriptor.valueType() ).collectedType() - .mainType() - .equals( String.class ) ) - { - AssociationDescriptor associationDescriptor; - try - { - associationDescriptor = entityDescriptor.state() - .getManyAssociationByName( descriptor.qualifiedName().name() ); - } - catch( IllegalArgumentException e1 ) - { - return Collections.emptyList(); - } - - ManyAssociation state = associationState.manyAssociationFor( associationDescriptor.accessor() ); - List entities = new ArrayList<>( state.count() ); - for( Object entity : state ) - { - entities.add( ( (Identity) entity ).identity().get() ); - } - return entities; - } - - // No NamedAssociation support - - return null; - } - } - }, new Function() - { - @Override - public EntityReference apply( AssociationDescriptor associationDescriptor ) - { - return EntityReference.entityReferenceFor( - associationState.associationFor( associationDescriptor.accessor() ).get() ); - } - }, new Function>() - { - @Override - public Iterable apply( AssociationDescriptor associationDescriptor ) - { - ManyAssociation state = associationState.manyAssociationFor( associationDescriptor.accessor() ); - List refs = new ArrayList<>( state.count() ); - for( Object entity : state ) - { - refs.add( EntityReference.entityReferenceFor( entity ) ); - } - return refs; - } - }, new Function>() - { - @Override - public Map apply( AssociationDescriptor from ) - { - throw new UnsupportedOperationException( "NamedAssociations are not supported." ); - } - } ); - } - else - { - builder = vbf.newValueBuilderWithState( valueType, new Function() - { - @Override - public Object apply( PropertyDescriptor descriptor ) - { - try - { - PropertyDescriptor propertyDescriptor = entityDescriptor.state() - .findPropertyModelByName( descriptor.qualifiedName().name() ); - return associationState.propertyFor( propertyDescriptor.accessor() ).get(); - } - catch( IllegalArgumentException e ) - { - if( descriptor.valueType().mainType().equals( String.class ) ) - { - // Find Association and convert to string - AssociationDescriptor associationDescriptor; - try - { - associationDescriptor = entityDescriptor.state() - .getAssociationByName( descriptor.qualifiedName().name() ); - } - catch( IllegalArgumentException e1 ) - { - return null; - } - - Object entity = associationState.associationFor( associationDescriptor.accessor() ) - .get(); - if( entity != null ) - { - return ( (Identity) entity ).identity().get(); - } - return null; - } - else if( descriptor.valueType() instanceof CollectionType - && ( (CollectionType) descriptor.valueType() ).collectedType() - .mainType() - .equals( String.class ) ) - { - AssociationDescriptor associationDescriptor; - try - { - associationDescriptor = entityDescriptor.state() - .getManyAssociationByName( descriptor.qualifiedName().name() ); - } - catch( IllegalArgumentException e1 ) - { - return null; - } - - ManyAssociation state = associationState.manyAssociationFor( associationDescriptor.accessor() ); - List entities = new ArrayList<>( state.count() ); - for( Object entity : state ) - { - entities.add( ( (Identity) entity ).identity().get() ); - } - return entities; - } - - // No NamedAssociation support - - // DTO - Class type = descriptor.valueType().mainType(); - if( DTO.class.isAssignableFrom( type ) ) - { - AssociationDescriptor associationDescriptor; - try - { - associationDescriptor = entityDescriptor.state() - .getAssociationByName( descriptor.qualifiedName().name() ); - } - catch( IllegalArgumentException e1 ) - { - return null; - } - - Object entity = associationState.associationFor( associationDescriptor.accessor() ) - .get(); - if( entity != null ) - { - return convert( type, entity ); - } - } - - return null; - } - } - }, new Function() - { - @Override - public EntityReference apply( AssociationDescriptor descriptor ) - { - AssociationDescriptor associationDescriptor; - try - { - associationDescriptor = entityDescriptor.state() - .getAssociationByName( descriptor.qualifiedName().name() ); - } - catch( IllegalArgumentException e ) - { - return null; - } - - return EntityReference.entityReferenceFor( associationState - .associationFor( associationDescriptor.accessor() ) - .get() ); - } - }, new Function>() - { - @Override - public Iterable apply( AssociationDescriptor descriptor ) - { - AssociationDescriptor associationDescriptor; - try - { - associationDescriptor = entityDescriptor.state() - .getManyAssociationByName( descriptor.qualifiedName().name() ); - } - catch( IllegalArgumentException e ) - { - return Iterables.empty(); - } - - ManyAssociation state = associationState.manyAssociationFor( associationDescriptor.accessor() ); - List refs = new ArrayList<>( state.count() ); - for( Object entity : state ) - { - refs.add( EntityReference.entityReferenceFor( entity ) ); - } - return refs; - } - }, new Function>() - { - @Override - public Map apply( AssociationDescriptor from ) - { - throw new UnsupportedOperationException( "NamedAssociations are not supported." ); - } - } ); - } - - return (T) builder.newInstance(); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java index e15e921..4191630 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java @@ -22,6 +22,7 @@ package org.apache.zest.sample.dcicargo.sample_b.infrastructure.model; import org.apache.wicket.model.IModel; import org.apache.zest.api.entity.EntityComposite; import org.apache.zest.api.entity.EntityReference; +import org.apache.zest.api.entity.Identity; import org.apache.zest.api.unitofwork.NoSuchEntityException; import org.apache.zest.api.usecase.Usecase; import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.DTO; @@ -35,34 +36,34 @@ import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.DTO; * Zest entities are therefore lazy loaded with a class and identity through our UnitOfWork * and then converted to a DTO ValueComposite. */ -public class EntityModel +public class EntityModel extends ReadOnlyModel { - private Class entityClass; + private Class entityClass; private String identity; private Class dtoClass; private transient T dtoComposite; - public EntityModel( Class entityClass, String identity, Class dtoClass ) + public EntityModel( Class entityClass, String identity, Class dtoClass ) { this.entityClass = entityClass; this.identity = identity; this.dtoClass = dtoClass; } - public static IModel of( - Class entityClass, String identity, Class dtoClass + public static IModel of( + Class entityClass, String identity, Class dtoClass ) { - return new EntityModel( entityClass, identity, dtoClass ); + return new EntityModel( entityClass, identity, dtoClass ); } public T getObject() { if( dtoComposite == null && identity != null ) { - dtoComposite = valueConverter.convert( dtoClass, loadEntity() ); + dtoComposite = uowf.currentUnitOfWork().toValue( dtoClass, loadEntity() ); } return dtoComposite; } @@ -72,9 +73,9 @@ public class EntityModel dtoComposite = null; } - private U loadEntity() + private T loadEntity() { - U entity = uowf.currentUnitOfWork().get( entityClass, identity ); + T entity = uowf.currentUnitOfWork().get( entityClass, identity ); if( entity == null ) { Usecase usecase = uowf.currentUnitOfWork().usecase(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/QueryModel.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/QueryModel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/QueryModel.java index f320893..96a132d 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/QueryModel.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/QueryModel.java @@ -21,7 +21,7 @@ package org.apache.zest.sample.dcicargo.sample_b.infrastructure.model; import java.util.ArrayList; import java.util.List; -import org.apache.zest.api.entity.EntityComposite; +import org.apache.zest.api.entity.Identity; import org.apache.zest.api.query.Query; /** @@ -30,7 +30,7 @@ import org.apache.zest.api.query.Query; * Callback Wicket model that holds a Zest Query object that can be called when needed to * retrieve fresh data. */ -public abstract class QueryModel +public abstract class QueryModel extends ReadOnlyModel> { private Class dtoClass; @@ -49,7 +49,7 @@ public abstract class QueryModel } dtoList = new ArrayList(); - for( U entity : getQuery() ) + for( T entity : getQuery() ) { dtoList.add( getValue( entity ) ); } @@ -58,11 +58,12 @@ public abstract class QueryModel } // Callback to retrieve the (unserializable) Zest Query object - public abstract Query getQuery(); + public abstract Query getQuery(); - public T getValue( U entity ) + public T getValue( T entity ) { - return valueConverter.convert( dtoClass, entity ); + Class dtoClass = this.dtoClass; + return uowf.currentUnitOfWork().toValue( dtoClass, entity ); } public void detach() http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java index 7e0bf8c..bbb0d1f 100644 --- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java +++ b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java @@ -25,7 +25,6 @@ import org.apache.zest.api.service.ServiceFinder; import org.apache.zest.api.structure.Module; import org.apache.zest.api.unitofwork.UnitOfWorkFactory; import org.apache.zest.api.value.ValueBuilderFactory; -import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.EntityToDTOService; /** * ReadOnlyModel @@ -37,7 +36,6 @@ public abstract class ReadOnlyModel { private static final long serialVersionUID = 1L; - static protected EntityToDTOService valueConverter; static protected ZestAPI api; static protected ServiceFinder serviceFinder; static protected UnitOfWorkFactory uowf; @@ -67,14 +65,12 @@ public abstract class ReadOnlyModel } public static void prepareModelBaseClass( Module m, - ZestAPI api, - EntityToDTOService entityToDTO + ZestAPI api ) { uowf = m.unitOfWorkFactory(); serviceFinder = m; vbf = m; ReadOnlyModel.api = api; - valueConverter = entityToDTO; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestAssembler.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestAssembler.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestAssembler.java index 17097d3..bf33911 100644 --- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestAssembler.java +++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/bootstrap/test/TestAssembler.java @@ -45,19 +45,19 @@ import org.apache.zest.sample.dcicargo.sample_b.context.rolemap.CargoRoleMap; import org.apache.zest.sample.dcicargo.sample_b.context.rolemap.CargosRoleMap; import org.apache.zest.sample.dcicargo.sample_b.context.rolemap.HandlingEventsRoleMap; import org.apache.zest.sample.dcicargo.sample_b.context.service.routing.RoutingService; -import org.apache.zest.sample.dcicargo.sample_b.data.entity.HandlingEventEntity; -import org.apache.zest.sample.dcicargo.sample_b.data.entity.LocationEntity; -import org.apache.zest.sample.dcicargo.sample_b.data.entity.VoyageEntity; import org.apache.zest.sample.dcicargo.sample_b.data.factory.RouteSpecificationFactoryService; import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.RouteSpecification; import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.Delivery; import org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery.NextHandlingEvent; +import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEvent; import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary; import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Leg; +import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location; import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.UnLocode; import org.apache.zest.sample.dcicargo.sample_b.data.structure.tracking.TrackingId; import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.CarrierMovement; import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Schedule; +import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage; import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.VoyageNumber; import org.apache.zest.spi.uuid.UuidIdentityGeneratorService; import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService; @@ -140,9 +140,9 @@ public class TestAssembler // Non-role-playing entities roleMapModule .entities( - HandlingEventEntity.class, - LocationEntity.class, - VoyageEntity.class ) + HandlingEvent.class, + Location.class, + Voyage.class ) .visibleIn( application ); ModuleAssembly interactionModule = contextLayer.module( "CONTEXT-Interaction" ).withDefaultUnitOfWorkFactory(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/BookNewCargoTest.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/BookNewCargoTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/BookNewCargoTest.java index 38f5687..58c8e42 100644 --- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/BookNewCargoTest.java +++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/booking/BookNewCargoTest.java @@ -19,6 +19,7 @@ */ package org.apache.zest.sample.dcicargo.sample_b.context.test.booking; +import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.Cargo; import org.junit.Before; import org.junit.Test; import org.apache.zest.api.constraint.ConstraintViolationException; @@ -26,7 +27,6 @@ import org.apache.zest.api.unitofwork.UnitOfWork; import org.apache.zest.sample.dcicargo.sample_b.bootstrap.test.TestApplication; import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.BookNewCargo; import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.CargoAggregateRoot; -import org.apache.zest.sample.dcicargo.sample_b.data.entity.CargoEntity; import org.apache.zest.sample.dcicargo.sample_b.data.factory.exception.CannotCreateCargoException; import org.apache.zest.sample.dcicargo.sample_b.data.factory.exception.CannotCreateRouteSpecificationException; @@ -105,7 +105,7 @@ public class BookNewCargoTest extends TestApplication deviation_2b_DeadlineTomorrowIsOkay(); UnitOfWork uow = uowf.currentUnitOfWork(); trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).getTrackingId(); - cargo = uow.get( CargoEntity.class, trackingId.id().get() ); + cargo = uow.get( Cargo.class, trackingId.id().get() ); assertThat( cargo.routeSpecification().get().origin().get(), is( equalTo( HONGKONG ) ) ); assertThat( cargo.routeSpecification().get().destination().get(), is( equalTo( STOCKHOLM ) ) ); assertThat( cargo.routeSpecification().get().arrivalDeadline().get(), is( equalTo( DAY24 ) ) ); @@ -118,7 +118,7 @@ public class BookNewCargoTest extends TestApplication step_2_CanCreateRouteSpecification(); UnitOfWork uow = uowf.currentUnitOfWork(); trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).getTrackingId(); - cargo = uow.get( CargoEntity.class, trackingId.id().get() ); + cargo = uow.get( Cargo.class, trackingId.id().get() ); assertDelivery( null, null, null, null, NOT_RECEIVED, notArrived, NOT_ROUTED, directed, unknownETA, unknownLeg, @@ -141,7 +141,7 @@ public class BookNewCargoTest extends TestApplication deviation_4a_TrackingIdTooShort(); UnitOfWork uow = uowf.currentUnitOfWork(); trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "yes" ); - cargo = uow.get( CargoEntity.class, trackingId.id().get() ); + cargo = uow.get( Cargo.class, trackingId.id().get() ); assertThat( cargo.trackingId().get().id().get(), is( equalTo( "yes" ) ) ); } @@ -161,7 +161,7 @@ public class BookNewCargoTest extends TestApplication deviation_4a_TrackingIdTooLong(); UnitOfWork uow = uowf.currentUnitOfWork(); trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "123456789012345678901234567890" ); - cargo = uow.get( CargoEntity.class, trackingId.id().get() ); + cargo = uow.get( Cargo.class, trackingId.id().get() ); assertThat( cargo.trackingId().get().id().get(), is( equalTo( "123456789012345678901234567890" ) ) ); } @@ -206,7 +206,7 @@ public class BookNewCargoTest extends TestApplication step_4_CanAutoCreateTrackingIdFromNull(); UnitOfWork uow = uowf.currentUnitOfWork(); trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "ABC" ); - cargo = uow.get( CargoEntity.class, trackingId.id().get() ); + cargo = uow.get( Cargo.class, trackingId.id().get() ); assertThat( cargo.trackingId().get(), is( equalTo( trackingId ) ) ); assertThat( cargo.trackingId().get().id().get(), is( equalTo( "ABC" ) ) ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/registration/RegisterHandlingEventTest.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/registration/RegisterHandlingEventTest.java b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/registration/RegisterHandlingEventTest.java index acf47e6..394c418 100644 --- a/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/registration/RegisterHandlingEventTest.java +++ b/samples/dci-cargo/dcisample_b/src/test/java/org/apache/zest/sample/dcicargo/sample_b/context/test/handling/registration/RegisterHandlingEventTest.java @@ -33,7 +33,6 @@ import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.reg import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.registration.exception.UnknownVoyageException; import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.CargoAggregateRoot; import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.HandlingEventAggregateRoot; -import org.apache.zest.sample.dcicargo.sample_b.data.entity.HandlingEventEntity; import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEvent; import org.junit.Before; import org.junit.Test; @@ -203,7 +202,7 @@ public class RegisterHandlingEventTest extends TestApplication // Delete handling events from memory tempUow = uowf.newUnitOfWork(); - Query events = tempUow.newQuery( qbf.newQueryBuilder( HandlingEventEntity.class ) ); + Query events = tempUow.newQuery( qbf.newQueryBuilder( HandlingEvent.class ) ); for( HandlingEvent event : events ) { tempUow.remove( event );