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:48 UTC
[07/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/context/interaction/handling/registration/exception/NonRoutedCargoException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/NonRoutedCargoException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/NonRoutedCargoException.java
deleted file mode 100644
index 6ae82da..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/NonRoutedCargoException.java
+++ /dev/null
@@ -1,45 +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.handling.registration.exception;
-
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.parsing.dto.ParsedHandlingEventData;
-
-/**
- * Thrown when trying to register a handling event for an nonRouted cargo.
- */
-public class NonRoutedCargoException extends CannotRegisterHandlingEventException
-{
- public NonRoutedCargoException( ParsedHandlingEventData parsedHandlingEventData )
- {
- super( parsedHandlingEventData );
- }
-
- @Override
- public String getMessage()
- {
- msg = "\nUnsuccessful handling event registration for cargo '" + id +
- "' (handling event '" + type + "' in '" + unloc + "'). Cargo is not routed!";
-
- msg += "\nMOCKUP NOTIFICATION TO HANDLING AUTHORITY: Please check submitted invalid handling event data:";
- msg += getParsedHandlingEventData();
-
- return msg;
- }
-}
\ 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/handling/registration/exception/UnknownCargoException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownCargoException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownCargoException.java
deleted file mode 100644
index 2c71eb6..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownCargoException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.registration.exception;
-
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.parsing.dto.ParsedHandlingEventData;
-
-/**
- * Thrown when trying to register a handling event with an unknown tracking id.
- */
-public final class UnknownCargoException extends CannotRegisterHandlingEventException
-{
- public UnknownCargoException( ParsedHandlingEventData parsedHandlingEventData )
- {
- super( parsedHandlingEventData );
- }
-
- @Override
- public String getMessage()
- {
- return "Found no cargo with tracking id '" + id + "'.";
- }
-}
\ 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/handling/registration/exception/UnknownEventTypeException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownEventTypeException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownEventTypeException.java
deleted file mode 100644
index b5a43d6..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownEventTypeException.java
+++ /dev/null
@@ -1,42 +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.handling.registration.exception;
-
-import java.util.Arrays;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.parsing.dto.ParsedHandlingEventData;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType;
-
-/**
- * Thrown when trying to register a handling event with an unknown handling event type.
- */
-public final class UnknownEventTypeException extends CannotRegisterHandlingEventException
-{
- public UnknownEventTypeException( ParsedHandlingEventData parsedHandlingEventData )
- {
- super( parsedHandlingEventData );
- }
-
- @Override
- public String getMessage()
- {
- return "'" + type + "' is not a valid handling event type. Valid types are: "
- + Arrays.toString( HandlingEventType.values() );
- }
-}
\ 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/handling/registration/exception/UnknownLocationException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownLocationException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownLocationException.java
deleted file mode 100644
index 38fc98b..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownLocationException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.registration.exception;
-
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.parsing.dto.ParsedHandlingEventData;
-
-/**
- * Thrown when trying to register a handling event with an unknown location.
- */
-public final class UnknownLocationException extends CannotRegisterHandlingEventException
-{
- public UnknownLocationException( ParsedHandlingEventData parsedHandlingEventData )
- {
- super( parsedHandlingEventData );
- }
-
- @Override
- public String getMessage()
- {
- return "Found no location with UN locode '" + unloc + "'.";
- }
-}
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/handling/registration/exception/UnknownVoyageException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownVoyageException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownVoyageException.java
deleted file mode 100644
index 1e5d6c1..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/interaction/handling/registration/exception/UnknownVoyageException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.registration.exception;
-
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.parsing.dto.ParsedHandlingEventData;
-
-/**
- * Thrown when trying to register an event with an unknown voyage number.
- */
-public final class UnknownVoyageException extends CannotRegisterHandlingEventException
-{
- public UnknownVoyageException( ParsedHandlingEventData parsedHandlingEventData )
- {
- super( parsedHandlingEventData );
- }
-
- @Override
- public String getMessage()
- {
- return "Found no voyage with voyage number '" + voy + "'.";
- }
-}
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/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
deleted file mode 100644
index c56addb..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/CargoRoleMap.java
+++ /dev/null
@@ -1,60 +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.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;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.InspectCargoDeliveryStatus;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.event.InspectArrivedCargo;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.event.InspectCargoInCustoms;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.event.InspectClaimedCargo;
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.inspection.event.InspectLoadedCargo;
-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.structure.cargo.Cargo;
-
-/**
- * Cargo Role Map
- *
- * Shows all the Roles that a CargoEntity can play.
- *
- * Note that the CargoEntity knows nothing about this map (and that Cargo (Data) knows nothing about CargoEntity).
- */
-public interface CargoRoleMap
- extends
-
- RegisterNewDestination.CargoInspectorRole,
- AssignCargoToRoute.CargoInspectorRole,
- DeriveUpdatedRouteSpecification.CargoInspectorRole,
-
- InspectCargoDeliveryStatus.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/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/CargosRoleMap.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/CargosRoleMap.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/CargosRoleMap.java
deleted file mode 100644
index cc484df..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/CargosRoleMap.java
+++ /dev/null
@@ -1,35 +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.rolemap;
-
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.booking.BookNewCargo;
-import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.CargoAggregateRoot;
-
-/**
- * Cargos Role Map
- *
- * Shows what Roles the CargoAggregateRoot can play.
- */
-public interface CargosRoleMap
- extends CargoAggregateRoot,
-
- BookNewCargo.BookingSystemRole
-{
-}
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/rolemap/HandlingEventsRoleMap.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/HandlingEventsRoleMap.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/HandlingEventsRoleMap.java
deleted file mode 100644
index 01ffec7..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/rolemap/HandlingEventsRoleMap.java
+++ /dev/null
@@ -1,35 +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.rolemap;
-
-import org.apache.zest.sample.dcicargo.sample_b.context.interaction.handling.registration.RegisterHandlingEvent;
-import org.apache.zest.sample.dcicargo.sample_b.data.aggregateroot.HandlingEventAggregateRoot;
-
-/**
- * Handling Events Role Map
- *
- * shows what Roles the HandlingEventAggregateRoot can play.
- */
-public interface HandlingEventsRoleMap
- extends HandlingEventAggregateRoot,
-
- RegisterHandlingEvent.EventRegistrarRole
-{
-}
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/service/routing/RoutingService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/service/routing/RoutingService.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/service/routing/RoutingService.java
deleted file mode 100644
index 037f00c..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/service/routing/RoutingService.java
+++ /dev/null
@@ -1,149 +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.service.routing;
-
-import java.rmi.RemoteException;
-import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.GraphTraversalService;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.TransitEdge;
-import org.apache.zest.sample.dcicargo.pathfinder_b.api.TransitPath;
-import org.apache.zest.sample.dcicargo.sample_b.context.service.routing.exception.FoundNoRoutesException;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.RouteSpecification;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
-import org.apache.zest.sample.dcicargo.sample_b.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.voyage.Voyage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Routing service.
- *
- * This is basically a data model translation layer between our domain model and the
- * API put forward by the path finder team, which operates in a different context from us.
- */
-@Mixins( RoutingService.Mixin.class )
-public interface RoutingService
- extends ServiceComposite
-{
- /**
- * @param routeSpecification route specification
- *
- * @return A list of itineraries that satisfy the specification. May be an empty list if no route is found.
- */
- List<Itinerary> fetchRoutesForSpecification( RouteSpecification routeSpecification )
- throws FoundNoRoutesException;
-
- abstract class Mixin
- implements RoutingService
- {
- private static final Logger logger = LoggerFactory.getLogger( RoutingService.class );
-
- @Structure
- ValueBuilderFactory vbf;
-
- @Structure
- UnitOfWorkFactory uowf;
-
- @Service
- GraphTraversalService graphTraversalService;
-
- public List<Itinerary> fetchRoutesForSpecification( RouteSpecification routeSpecification )
- throws FoundNoRoutesException
- {
- final LocalDate departureDate = routeSpecification.earliestDeparture().get();
- final Location origin = routeSpecification.origin().get();
- final Location destination = routeSpecification.destination().get();
-
- List<TransitPath> transitPaths;
- List<Itinerary> itineraries = new ArrayList<Itinerary>();
-
- try
- {
- transitPaths = graphTraversalService.findShortestPath( departureDate, origin.getCode(), destination.getCode() );
- }
- catch( RemoteException e )
- {
- logger.error( e.getMessage(), e );
- return Collections.emptyList();
- }
-
- // The returned result is then translated back into our domain model.
- for( TransitPath transitPath : transitPaths )
- {
- final Itinerary itinerary = toItinerary( transitPath );
-
- // Use the specification to safe-guard against invalid itineraries
- // We can use the side-effects free method of the RouteSpecification data object
- if( routeSpecification.isSatisfiedBy( itinerary ) )
- {
- itineraries.add( itinerary );
- }
- }
-
- if( itineraries.size() == 0 )
- {
- throw new FoundNoRoutesException( destination.name().get(),
- routeSpecification.arrivalDeadline().get());
- }
-
- return itineraries;
- }
-
- private Itinerary toItinerary( TransitPath transitPath )
- {
- ValueBuilder<Itinerary> itinerary = vbf.newValueBuilder( Itinerary.class );
- List<Leg> legs = new ArrayList<Leg>();
- for( TransitEdge edge : transitPath.getTransitEdges() )
- {
- legs.add( toLeg( edge ) );
- }
- itinerary.prototype().legs().set( legs );
-
- return itinerary.newInstance();
- }
-
- private Leg toLeg( TransitEdge edge )
- {
- UnitOfWork uow = uowf.currentUnitOfWork();
-
- // Build Leg value object
- ValueBuilder<Leg> leg = vbf.newValueBuilder( Leg.class );
- leg.prototype().voyage().set( uow.get( Voyage.class, edge.getVoyageNumber() ) );
- leg.prototype().loadLocation().set( uow.get( Location.class, edge.getFromUnLocode() ) );
- leg.prototype().unloadLocation().set( uow.get( Location.class, edge.getToUnLocode() ) );
- leg.prototype().loadDate().set( edge.getFromDate() );
- leg.prototype().unloadDate().set( edge.getToDate() );
-
- return leg.newInstance();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/service/routing/exception/FoundNoRoutesException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/service/routing/exception/FoundNoRoutesException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/service/routing/exception/FoundNoRoutesException.java
deleted file mode 100644
index 1293ffe..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/context/service/routing/exception/FoundNoRoutesException.java
+++ /dev/null
@@ -1,60 +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.service.routing.exception;
-
-import java.time.LocalDate;
-
-/**
- * Custom messages when the arrival deadline is too close and we can't find a route.
- */
-public class FoundNoRoutesException extends Exception
-{
- private final String city;
- private final LocalDate deadline;
-
- public FoundNoRoutesException( String city, LocalDate deadline )
- {
- this.city = city;
- this.deadline = deadline;
- }
-
- @Override
- public String getMessage()
- {
- if( deadline.isBefore( LocalDate.now().plusDays( 2 ) ) )
- {
- return "Impossible to get the cargo to " + city + " before " + deadline
- + "! Make a new booking with a deadline 2-3 weeks ahead in time.";
- }
- else if( deadline.isBefore( LocalDate.now().plusDays( 4 ) ) )
- {
- return "Couldn't find any routes arriving in " + city + " before " + deadline
- + ". Please try again or make a new booking with a deadline 2-3 weeks ahead in time.";
- }
- else if( deadline.isBefore( LocalDate.now().plusDays( 6 ) ) )
- {
- return "Sorry, our system couldn't immediately find a route arriving in " + city + " before " + deadline
- + ". Please try again, and we should hopefully be able to find a new route for you.";
- }
-
- return "Couldn't find any route to " + city + " arriving before " + deadline
- + ". There might be a shortage of voyages going there. Please try again.";
- }
-}
\ 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/data/aggregateroot/CargoAggregateRoot.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/aggregateroot/CargoAggregateRoot.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/aggregateroot/CargoAggregateRoot.java
deleted file mode 100644
index 3b3b8a0..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/aggregateroot/CargoAggregateRoot.java
+++ /dev/null
@@ -1,38 +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.aggregateroot;
-
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.sample.dcicargo.sample_b.data.factory.CargoFactory;
-
-/**
- * Cargo aggregate root
- *
- * An identified unique starting point to create Cargos.
- *
- * Cargos are only allowed to be created through this aggregate root. Can we enforce this?
- */
-public interface CargoAggregateRoot
- extends EntityComposite,
-
- CargoFactory
-{
- public static final String CARGOS_ID = "Cargos_id";
-}
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/data/aggregateroot/HandlingEventAggregateRoot.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/aggregateroot/HandlingEventAggregateRoot.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/aggregateroot/HandlingEventAggregateRoot.java
deleted file mode 100644
index bd6fd5d..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/aggregateroot/HandlingEventAggregateRoot.java
+++ /dev/null
@@ -1,38 +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.aggregateroot;
-
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.sample.dcicargo.sample_b.data.factory.HandlingEventFactory;
-
-/**
- * HandlingEvent aggregate root
- *
- * An identified unique starting point to create HandlingEvents.
- *
- * HandlingEvents are only allowed to be created through this aggregate root. Can we enforce this?
- */
-public interface HandlingEventAggregateRoot
- extends EntityComposite,
-
- HandlingEventFactory
-{
- public static final String HANDLING_EVENTS_ID = "Handling_events_id";
-}
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/data/factory/CargoFactory.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/CargoFactory.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/CargoFactory.java
deleted file mode 100644
index 3298df8..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/CargoFactory.java
+++ /dev/null
@@ -1,104 +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.factory;
-
-import java.util.UUID;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.constraint.ConstraintViolationException;
-import org.apache.zest.api.entity.EntityBuilder;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.unitofwork.NoSuchEntityException;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.sample.dcicargo.sample_b.data.factory.exception.CannotCreateCargoException;
-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.tracking.TrackingId;
-
-/**
- * Cargo factory
- *
- * If an empty tracking id string is received the factory will create an automated tracking id.
- *
- * Validations of RouteSpecification and Delivery are considered out of this scope.
- */
-@Mixins( CargoFactory.Mixin.class )
-public interface CargoFactory
-{
- Cargo createCargo( RouteSpecification routeSpecification, Delivery delivery, @Optional String id )
- throws CannotCreateCargoException;
-
- class Mixin
- implements CargoFactory
- {
- @Structure
- UnitOfWorkFactory uowf;
-
- @Structure
- ValueBuilderFactory vbf;
-
- public Cargo createCargo( RouteSpecification routeSpecification, Delivery delivery, String id )
- throws ConstraintViolationException, CannotCreateCargoException
- {
- TrackingId trackingId = buildTrackingId( id );
-
- UnitOfWork uow = uowf.currentUnitOfWork();
- EntityBuilder<Cargo> cargoBuilder = uow.newEntityBuilder( Cargo.class, trackingId.id().get() );
- cargoBuilder.instance().trackingId().set( trackingId );
- cargoBuilder.instance().origin().set( routeSpecification.origin().get() );
- cargoBuilder.instance().routeSpecification().set( routeSpecification );
- cargoBuilder.instance().delivery().set( delivery );
-
- return cargoBuilder.newInstance();
- }
-
- private TrackingId buildTrackingId( String id )
- throws CannotCreateCargoException
- {
- if( id == null || id.trim().equals( "" ) )
- {
- // Build random tracking id
- final String uuid = UUID.randomUUID().toString().toUpperCase();
- id = uuid.substring( 0, uuid.indexOf( "-" ) );
- }
- else
- {
- try
- {
- // Verify that tracking id doesn't exist in store
- uowf.currentUnitOfWork().get( Cargo.class, id );
- throw new CannotCreateCargoException( "Tracking id '" + id + "' is not unique." );
- }
- catch( NoSuchEntityException e )
- {
- // Ok: tracking id is unique
- }
- }
-
- ValueBuilder<TrackingId> trackingIdBuilder = vbf.newValueBuilder( TrackingId.class );
- trackingIdBuilder.prototype().id().set( id );
- return trackingIdBuilder.newInstance();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/HandlingEventFactory.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/HandlingEventFactory.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/HandlingEventFactory.java
deleted file mode 100644
index 9168d4f..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/HandlingEventFactory.java
+++ /dev/null
@@ -1,96 +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.factory;
-
-import java.time.LocalDate;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.entity.EntityBuilder;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.sample.dcicargo.sample_b.data.factory.exception.CannotCreateHandlingEventException;
-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;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.tracking.TrackingId;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage;
-
-/**
- * HandlingEventFactory
- *
- * Creates a valid handling event
- *
- * - Verifies if a voyage is mandatory or prohibited for the handling event type
- * - Verifies if a load/unload location is expected by the voyage
- *
- * Validations of TrackingId, Location and Voyage are considered out of this scope.
- */
-@Mixins( HandlingEventFactory.Mixin.class )
-public interface HandlingEventFactory
-{
- HandlingEvent createHandlingEvent( LocalDate registrationDate,
- LocalDate completionDate,
- TrackingId trackingId,
- HandlingEventType handlingEventType,
- Location location,
- @Optional Voyage voyage
- )
- throws CannotCreateHandlingEventException;
-
- public abstract class Mixin
- implements HandlingEventFactory
- {
- @Structure
- UnitOfWorkFactory uowf;
-
- public HandlingEvent createHandlingEvent( LocalDate registrationDate,
- LocalDate completionDate,
- TrackingId trackingId,
- HandlingEventType handlingEventType,
- Location location,
- Voyage voyage
- )
- throws CannotCreateHandlingEventException
- {
- if( voyage == null && handlingEventType.requiresVoyage() )
- {
- throw new CannotCreateHandlingEventException( "Voyage is required for handling event type " + handlingEventType );
- }
-
- else if( voyage != null && handlingEventType.prohibitsVoyage() )
- {
- throw new CannotCreateHandlingEventException( "Voyage is not allowed with handling event type " + handlingEventType );
- }
-
- UnitOfWork uow = uowf.currentUnitOfWork();
- EntityBuilder<HandlingEvent> handlingEventBuilder = uow.newEntityBuilder( HandlingEvent.class );
- handlingEventBuilder.instance().registrationDate().set( registrationDate );
- handlingEventBuilder.instance().completionDate().set( completionDate );
- handlingEventBuilder.instance().trackingId().set( trackingId );
- handlingEventBuilder.instance().handlingEventType().set( handlingEventType );
- handlingEventBuilder.instance().location().set( location );
- handlingEventBuilder.instance().voyage().set( voyage );
-
- // Save and return
- return handlingEventBuilder.newInstance();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/RouteSpecificationFactoryService.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/RouteSpecificationFactoryService.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/RouteSpecificationFactoryService.java
deleted file mode 100644
index 00511fe..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/RouteSpecificationFactoryService.java
+++ /dev/null
@@ -1,90 +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.factory;
-
-import java.time.LocalDate;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.service.ServiceComposite;
-import org.apache.zest.api.value.ValueBuilder;
-import org.apache.zest.api.value.ValueBuilderFactory;
-import org.apache.zest.sample.dcicargo.sample_b.data.factory.exception.CannotCreateRouteSpecificationException;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.RouteSpecification;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
-
-/**
- * Route Specification factory
- *
- * Enforces 3 invariants:
- * - no identical origin and destination
- * - deadline in the future
- * - earliest departure before deadline
- *
- * Validation of Locations is considered out of this scope.
- */
-@Mixins( RouteSpecificationFactoryService.Mixin.class )
-public interface RouteSpecificationFactoryService
- extends ServiceComposite
-{
- RouteSpecification build( Location origin, Location destination, LocalDate earliestDeparture, LocalDate deadline )
- throws CannotCreateRouteSpecificationException;
-
- abstract class Mixin
- implements RouteSpecificationFactoryService
- {
- @Structure
- ValueBuilderFactory vbf;
-
- public RouteSpecification build( Location origin,
- Location destination,
- LocalDate earliestDeparture,
- LocalDate deadline
- )
- throws CannotCreateRouteSpecificationException
- {
- if( origin == destination )
- {
- throw new CannotCreateRouteSpecificationException( "Origin location can't be same as destination location." );
- }
-
- if( !deadline.isAfter( LocalDate.now() ) )
- {
- throw new CannotCreateRouteSpecificationException(
- "Arrival deadline is in the past or Today." +
- "\nDeadline " + deadline +
- "\nToday (midnight) " + LocalDate.now().atStartOfDay().plusDays( 1 ) );
- }
-
- if( !deadline.isAfter( earliestDeparture ) )
- {
- throw new CannotCreateRouteSpecificationException( "Deadline can't be before departure:" +
- "\nDeparture " + earliestDeparture +
- "\nDeadline " + deadline );
- }
-
- ValueBuilder<RouteSpecification> routeSpec = vbf.newValueBuilder( RouteSpecification.class );
- routeSpec.prototype().origin().set( origin );
- routeSpec.prototype().destination().set( destination );
- routeSpec.prototype().earliestDeparture().set( earliestDeparture );
- routeSpec.prototype().arrivalDeadline().set( deadline );
- return routeSpec.newInstance();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/exception/CannotCreateCargoException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/exception/CannotCreateCargoException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/exception/CannotCreateCargoException.java
deleted file mode 100644
index 9365be8..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/exception/CannotCreateCargoException.java
+++ /dev/null
@@ -1,37 +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.factory.exception;
-
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.tracking.TrackingId;
-
-/**
- * If a Cargo can't be created.
- *
- * Usually because a supplied tracking id string
- * - doesn't match the pattern in {@link TrackingId}
- * - is not unique
- */
-public class CannotCreateCargoException extends Exception
-{
- public CannotCreateCargoException( 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/data/factory/exception/CannotCreateHandlingEventException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/exception/CannotCreateHandlingEventException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/exception/CannotCreateHandlingEventException.java
deleted file mode 100644
index 449f2f7..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/exception/CannotCreateHandlingEventException.java
+++ /dev/null
@@ -1,37 +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.factory.exception;
-
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEvent;
-
-/**
- * If a {@link HandlingEvent} can't be created from a given set of parameters.
- *
- * It is a checked exception because it's not a programming error, but rather a
- * special case that the application is built to handle. It can occur during normal
- * program execution.
- */
-public class CannotCreateHandlingEventException extends Exception
-{
- public CannotCreateHandlingEventException( 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/data/factory/exception/CannotCreateRouteSpecificationException.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/exception/CannotCreateRouteSpecificationException.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/exception/CannotCreateRouteSpecificationException.java
deleted file mode 100644
index 73cddc6..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/factory/exception/CannotCreateRouteSpecificationException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.data.factory.exception;
-
-/**
- * Thrown when trying to create an invalid Route Specification.
- */
-public class CannotCreateRouteSpecificationException extends Exception
-{
- private final String msg;
-
- public CannotCreateRouteSpecificationException( String msg )
- {
- this.msg = msg;
- }
-
- @Override
- public String getMessage()
- {
- return "Couldn't create a valid Route Specification: " + msg;
- }
-}
\ 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/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
deleted file mode 100644
index 86efe72..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/cargo/Cargo.java
+++ /dev/null
@@ -1,57 +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.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;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.tracking.TrackingId;
-
-/**
- * Cargo
- *
- * Data describing a cargo, it's planned route and current delivery status.
- *
- * {@link TrackingId} created automatically
- * {@link Location} origin Specified upon creation (mandatory)
- * {@link RouteSpecification} Specified upon creation (mandatory)
- * {@link Itinerary} Description of chosen route (optional)
- * {@link Delivery} Snapshot of the current delivery status (automatically created by the system)
- */
-public interface Cargo extends Identity
-{
- @Immutable
- Property<TrackingId> trackingId();
-
- @Immutable
- Association<Location> origin();
-
- Property<RouteSpecification> routeSpecification();
-
- @Optional
- Property<Itinerary> itinerary();
-
- Property<Delivery> delivery();
-}
\ 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/data/structure/cargo/RouteSpecification.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/cargo/RouteSpecification.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/cargo/RouteSpecification.java
deleted file mode 100644
index 38fdb2a..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/cargo/RouteSpecification.java
+++ /dev/null
@@ -1,96 +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.structure.cargo;
-
-import java.time.LocalDate;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
-
-/**
- * RouteSpecification
- *
- * Describes:
- * - where a cargo is going from (origin)
- * - the earliest departure date from origin (earliestDeparture)
- * - where a cargo is going to (destination)
- * - when a cargo is expected to arrive (arrivalDeadline)
- *
- * If the route specification needs to change because of unexpected
- * handling events, it's replaced with a new one in {@link Cargo}.
- *
- * An itinerary describes the route a cargo can take, and it satisfies the route
- * specification when the route
- * - starts in the origin location of the route specification origin
- * - starts after the earliest departure of the route specification
- * - ends in the destination location of the route specification
- * - ends before the arrival deadline of the route specification
- *
- * DCI Data is supposed to be dumb. Can we accept to have the specification
- * logic here?
- *
- * All properties are mandatory and immutable.
- */
-@Mixins( RouteSpecification.Mixin.class )
-public interface RouteSpecification
- extends ValueComposite
-{
- Association<Location> origin();
-
- Association<Location> destination();
-
- Property<LocalDate> earliestDeparture();
-
- Property<LocalDate> arrivalDeadline();
-
- // Side-effects free and UI agnostic convenience methods
- boolean isSatisfiedBy( Itinerary itinerary );
-
- String print();
-
- abstract class Mixin
- implements RouteSpecification
- {
- public boolean isSatisfiedBy( Itinerary itinerary )
- {
- return itinerary != null &&
- !itinerary.legs().get().isEmpty() &&
- origin().get().equals( itinerary.firstLeg().loadLocation().get() ) &&
- earliestDeparture().get().isBefore( itinerary.firstLeg().loadDate().get() ) &&
- destination().get().equals( itinerary.lastLeg().unloadLocation().get() ) &&
- arrivalDeadline().get().isAfter( itinerary.eta() );
- }
-
- public String print()
- {
- return "\nROUTE SPECIFICATION ------------" +
- "\n Origin " + origin().get() +
- "\n Destination " + destination().get() +
- "\n Earliest departure " +
- earliestDeparture().get() +
- "\n Arrival deadline " +
- arrivalDeadline().get() +
- "\n--------------------------------";
- }
- }
-}
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/data/structure/delivery/Delivery.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/Delivery.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/Delivery.java
deleted file mode 100644
index b32f62c..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/Delivery.java
+++ /dev/null
@@ -1,140 +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.structure.delivery;
-
-import java.time.Instant;
-import java.time.LocalDate;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.common.UseDefaults;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.cargo.RouteSpecification;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEvent;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.itinerary.Itinerary;
-
-/**
- * Delivery
- *
- * The Delivery describes the actual transportation of the cargo, as opposed to
- * the Cargo Owner requirement {@link RouteSpecification} and the plan {@link Itinerary}.
- *
- * Complex data of the shipping domain is captured here in a value object that is
- * re-created each time some delivery status changes.
- *
- * Booking
- * The life cycle of a cargo begins with the booking procedure. During a (short) period
- * of time, between booking and initial routing, the cargo has no itinerary and is therefore
- * not routed.
- *
- * Routing
- * The Cargo Owner or booking clerk requests a list of possible routes, matching the route
- * specification, and assigns the cargo to a preferred route. The route to which a cargo is
- * assigned is described by an itinerary. The cargo is now routed.
- *
- * Cargo handling
- * Receipt of the cargo in the origin location marks the beginning of a series of handling
- * events that will eventually deliver the cargo at the destination. Handling events are
- * supposed to be reported by local handling authorities through incident logging applications
- * that then notify us of those events.
- *
- * Processing of handling events
- * When we receive handling event data from an incident logging application we validate
- * and register the event to determine what action to take. A new Delivery snapshot value
- * object is saved with the Cargo.
- *
- * Change of destination
- * It may happen that the Cargo Owner changes the destination of a cargo in the middle of a
- * voyage. The cargo route specification then no longer matches the itinerary and we say
- * that the cargo is misrouted. This will cause the system to notify the proper personel
- * and request the Cargo Owner to re-route the cargo.
- *
- * Re-routing
- * A cargo can be re-routed during transport, on demand of the Cargo Owner, in which case
- * a new itinerary is requested. The old itinerary, being a value object, is discarded and
- * a new one is attached to the cargo.
- *
- * Customs
- * The cargo can be checked by custom authorities anytime during the delivery. This doesn't
- * affect the delivery status of the cargo.
- *
- * Claim
- * The life cycle of a cargo ends when the cargo is claimed by the Cargo Owner.
- *
- * ItineraryProgressIndex
- * We have added an index that tells us how far we have come on our route. An Itinerary
- * describes a route by a list of "legs" that each describes a load time/location, a voyage
- * and an unload time/location. The itineraryProgressIndex indicates what leg is the current
- * leg. In the DDD sample the location was used to determine the current leg, but if the
- * cargo was suddenly in an unexpected location (not in the itinerary) then we wouldn't be
- * able to find out what to expect next. With the itineraryProgressIndex we can and that
- * allow us to derive a more precise delivery snapshot taking the chronological perspective
- * into account too.
- *
- * LastKnowLocation and currentVoyage didn't add much value since we can extract those from
- * the lastHandlingEvent, so we removed those.
- */
-public interface Delivery
- extends ValueComposite
-{
- Property<Instant> timestamp();
-
- /* (types:)
- * RECEIVE
- * LOAD
- * UNLOAD
- * CUSTOMS
- * CLAIM
- */
- @Optional
- Association<HandlingEvent> lastHandlingEvent();
-
- /*
- * NOT_RECEIVED
- * IN_PORT
- * ONBOARD_CARRIER
- * CLAIMED
- * UNKNOWN
- */
- Property<TransportStatus> transportStatus();
-
- @UseDefaults
- Property<Boolean> isUnloadedAtDestination();
-
- /*
- * NOT_ROUTED
- * ROUTED
- * MISROUTED
- */
- Property<RoutingStatus> routingStatus();
-
- @UseDefaults
- Property<Boolean> isMisdirected();
-
- @Optional
- Property<LocalDate> eta();
-
- // Index of earliest uncompleted Itinerary Leg - bumped up after each unload (except at destination)
- @UseDefaults
- Property<Integer> itineraryProgressIndex();
-
- @Optional
- Property<NextHandlingEvent> nextHandlingEvent();
-}
\ 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/data/structure/delivery/NextHandlingEvent.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/NextHandlingEvent.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/NextHandlingEvent.java
deleted file mode 100644
index 703976f..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/NextHandlingEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.data.structure.delivery;
-
-import java.time.LocalDate;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.common.Optional;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.handling.HandlingEventType;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage;
-
-/**
- * NextHandlingEvent
- *
- * (former "HandlingActivity" / "ExpectedHandlingEvent")
- *
- * This represents our assumptions about the next handling event for a cargo.
- *
- * Since a cargo could have been loaded onto an unexpected carrier it seems better
- * not to call the next unload an _expected_ handling event. It's expected to
- * the carrier voyage schedule, but unexpected to the itinerary.
- *
- * A time for the expected event was added.
- */
-public interface NextHandlingEvent
- extends ValueComposite
-{
- Property<HandlingEventType> handlingEventType();
-
- Association<Location> location();
-
- @Optional
- Property<LocalDate> date();
-
- @Optional
- Association<Voyage> voyage();
-}
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/data/structure/delivery/RoutingStatus.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/RoutingStatus.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/RoutingStatus.java
deleted file mode 100644
index a436e6f..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/RoutingStatus.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.structure.delivery;
-
-/**
- * RoutingStatus
- *
- * A routing status indicates whether an itinerary is assigned to
- * a cargo and satisfying the route specification.
- */
-public enum RoutingStatus
-{
- NOT_ROUTED, // Itinerary has not been assigned to cargo yet
- ROUTED, // Itinerary is assigned to cargo
- MISROUTED; // RouteSpecification is not satisfied by Itinerary
-}
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/data/structure/delivery/TransportStatus.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/TransportStatus.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/TransportStatus.java
deleted file mode 100644
index 2258ea0..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/delivery/TransportStatus.java
+++ /dev/null
@@ -1,34 +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.structure.delivery;
-
-/**
- * TransportStatus
- *
- * A transport status represents what transportation state a cargo is in.
- */
-public enum TransportStatus
-{
- NOT_RECEIVED,
- IN_PORT,
- ONBOARD_CARRIER,
- CLAIMED,
- UNKNOWN
-}
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/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
deleted file mode 100644
index 35f84b8..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEvent.java
+++ /dev/null
@@ -1,96 +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.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;
-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.data.structure.voyage.Voyage;
-
-/**
- * HandlingEvent
- *
- * A HandlingEvent is used to register the event when, for instance,
- * a cargo is unloaded from a carrier at some location at a given time.
- *
- * The HandlingEvents are sent from different Incident Logging Applications
- * some time after the event occurred and contain information about the
- * {@link TrackingId}, {@link Location}, timestamp of the completion of the event,
- * and possibly, if applicable a {@link Voyage}.
- *
- * Note that we don't save the whole cargo graph here as in the DDD sample! With
- * the tracking id saved only, our HandlingEvent objects become much lighter and
- * faster to save as we register incoming handling event data in high volumes from
- * incident logging applications.
- *
- * HandlingEvents could contain information about a {@link Voyage} and if so,
- * the event type must be either {@link HandlingEventType#LOAD} or
- * {@link HandlingEventType#UNLOAD}.
- *
- * All other events must be of type {@link HandlingEventType#RECEIVE},
- * {@link HandlingEventType#CLAIM} or {@link HandlingEventType#CUSTOMS}.
- */
-@Immutable
-@Mixins( HandlingEvent.Mixin.class )
-public interface HandlingEvent extends Identity
-{
- Property<TrackingId> trackingId();
-
- Property<LocalDate> completionDate();
-
- Property<LocalDate> registrationDate();
-
- Property<HandlingEventType> handlingEventType();
-
- Association<Location> location();
-
- @Optional
- Association<Voyage> voyage();
-
- String print();
-
- abstract class Mixin
- implements HandlingEvent
- {
- public String print()
- {
- String voyage = "";
- if( voyage().get() != null )
- {
- voyage = voyage().get().voyageNumber().get().number().get();
- }
-
- return "\nHANDLING EVENT -----------------" +
- "\n Cargo " + trackingId().get().id().get() +
- "\n Type " + handlingEventType().get().name() +
- "\n Location " + location().get().getString() +
- "\n Completed " + completionDate().get() +
- "\n Registered " + registrationDate().get() +
- "\n Voyage " + voyage +
- "\n--------------------------------\n";
- }
- }
-}
\ 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/data/structure/handling/HandlingEventType.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEventType.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEventType.java
deleted file mode 100644
index ca19a06..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/handling/HandlingEventType.java
+++ /dev/null
@@ -1,62 +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.structure.handling;
-
-/**
- * HandlingEventType
- *
- * A handling event type either requires or prohibits a voyage association.
- */
-public enum HandlingEventType
-{
- RECEIVE( false ),
- LOAD( true ),
- UNLOAD( true ),
- CUSTOMS( false ),
- CLAIM( false );
-
- private final boolean voyageRequired;
-
- /**
- * Private enum constructor.
- *
- * @param voyageRequired whether or not a voyage is associated with this event type
- */
- private HandlingEventType( final boolean voyageRequired )
- {
- this.voyageRequired = voyageRequired;
- }
-
- /**
- * @return True if a voyage association is required for this event type.
- */
- public boolean requiresVoyage()
- {
- return voyageRequired;
- }
-
- /**
- * @return True if a voyage association is prohibited for this event type.
- */
- public boolean prohibitsVoyage()
- {
- return !requiresVoyage();
- }
-}
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/data/structure/itinerary/Itinerary.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Itinerary.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Itinerary.java
deleted file mode 100644
index b40fb60..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Itinerary.java
+++ /dev/null
@@ -1,115 +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.structure.itinerary;
-
-import java.time.Duration;
-import java.time.LocalDate;
-import java.util.List;
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.library.constraints.annotation.NotEmpty;
-
-/**
- * Itinerary
- *
- * Describes a planned route for a Cargo.
- *
- * The Itinerary has a list of Legs each describing expected loading onto/ unloading from
- * voyages at different locations. The list of legs is mandatory, immutable and can't be empty.
- */
-@Mixins( Itinerary.Mixin.class )
-public interface Itinerary
- extends ValueComposite
-{
- @NotEmpty
- Property<List<Leg>> legs();
-
- // Side-effects free and UI agnostic convenience methods
- Leg firstLeg();
-
- Leg leg( Integer current );
-
- Leg lastLeg();
-
- LocalDate eta();
-
- long days();
-
- String print();
-
- public abstract class Mixin
- implements Itinerary
- {
- public Leg firstLeg()
- {
- return legs().get().get( 0 );
- }
-
- public Leg leg( Integer index )
- {
- if( index < 0 || index + 1 > legs().get().size() )
- {
- return null;
- }
-
- return legs().get().get( index );
- }
-
- public Leg lastLeg()
- {
- return legs().get().get( legs().get().size() - 1 );
- }
-
- public LocalDate eta()
- {
- return lastLeg().unloadDate().get();
- }
-
- public long days()
- {
- LocalDate dep = firstLeg().loadDate().get();
- LocalDate arr = lastLeg().unloadDate().get();
- return Duration.between( dep, arr ).toDays();
- }
-
- public String print()
- {
- StringBuilder sb = new StringBuilder( "\nITINERARY -----------------------------------------------------" );
- for( int i = 0; i < legs().get().size(); i++ )
- {
- printLeg( i, sb, legs().get().get( i ) );
- }
- return sb.append( "\n---------------------------------------------------------------\n" ).toString();
- }
-
- private void printLeg( int i, StringBuilder sb, Leg leg )
- {
- sb.append( "\n Leg " ).append( i );
- sb.append( " Load " );
- sb.append( leg.loadDate().get() );
- sb.append( " " ).append( leg.loadLocation().get() );
- sb.append( " " ).append( leg.voyage().get() );
- sb.append( " Unload " );
- sb.append( leg.unloadDate().get() );
- sb.append( " " ).append( leg.unloadLocation().get() );
- }
- }
-}
\ No newline at end of file