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.
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/21baf180 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/21baf180 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/21baf180 Branch: refs/heads/develop Commit: 21baf180e777eee255509e1125d72630e2bdb414 Parents: 1ead133 Author: Niclas Hedhman <[email protected]> Authored: Sun Jun 12 20:45:31 2016 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Sun Jun 12 20:45:35 2016 +0800 ---------------------------------------------------------------------- .../bonecp/BoneCPDataSourceServiceImporter.java | 4 +- .../sql/dbcp/DBCPDataSourceServiceImporter.java | 4 +- libraries/sql/build.gradle | 1 - ...bstractPooledDataSourceServiceAssembler.java | 2 - .../AbstractDataSourceServiceImporterMixin.java | 27 +- samples/dci-cargo/dcisample_a/build.gradle | 1 - .../sample_a/bootstrap/assembly/Assembler.java | 54 ++- .../bootstrap/sampledata/BaseDataService.java | 8 +- .../bootstrap/sampledata/SampleDataService.java | 10 +- .../communication/query/BookingQueries.java | 1 - .../communication/query/CommonQueries.java | 17 +- .../communication/query/HandlingQueries.java | 14 +- .../communication/query/TrackingQueries.java | 23 +- .../communication/query/dto/CargoDTO.java | 53 --- .../query/dto/HandlingEventDTO.java | 51 --- .../communication/query/dto/LocationDTO.java | 33 -- .../communication/query/dto/VoyageDTO.java | 33 -- .../web/booking/CargoDetailsPage.java | 8 +- .../web/booking/CargoListPage.java | 12 +- .../web/booking/ChangeDestinationPage.java | 4 +- .../web/handling/RegisterHandlingEventPage.java | 5 +- .../web/tracking/HandlingHistoryPanel.java | 16 +- .../web/tracking/NextHandlingEventPanel.java | 8 +- .../web/tracking/TrackCargoPage.java | 8 +- .../sample_a/context/rolemap/CargoRoleMap.java | 7 +- .../sample_a/context/rolemap/CargosRoleMap.java | 7 +- .../context/rolemap/HandlingEventRoleMap.java | 10 +- .../context/rolemap/HandlingEventsRoleMap.java | 8 +- .../context/shipping/booking/BookNewCargo.java | 9 +- .../handling/RegisterHandlingEvent.java | 6 +- .../sample_a/data/entity/CargoEntity.java | 33 -- .../sample_a/data/entity/CargosEntity.java | 32 -- .../data/entity/HandlingEventEntity.java | 33 -- .../data/entity/HandlingEventsEntity.java | 34 -- .../sample_a/data/entity/LocationEntity.java | 36 -- .../sample_a/data/entity/VoyageEntity.java | 36 -- .../sample_a/data/shipping/cargo/Cargo.java | 3 +- .../sample_a/data/shipping/cargo/Cargos.java | 2 + .../data/shipping/cargo/TrackingId.java | 3 +- .../data/shipping/delivery/Delivery.java | 1 - .../delivery/ExpectedHandlingEvent.java | 1 - .../data/shipping/handling/HandlingEvent.java | 3 +- .../data/shipping/handling/HandlingEvents.java | 2 + .../sample_a/data/shipping/itinerary/Leg.java | 1 - .../data/shipping/location/UnLocode.java | 1 - .../data/shipping/voyage/CarrierMovement.java | 1 - .../sample_a/data/shipping/voyage/Schedule.java | 1 - .../data/shipping/voyage/VoyageNumber.java | 1 - .../infrastructure/WicketZestApplication.java | 6 +- .../conversion/EntityToDTOService.java | 327 ------------------ .../infrastructure/model/EntityModel.java | 26 +- .../infrastructure/model/QueryModel.java | 18 +- .../infrastructure/model/ReadOnlyModel.java | 6 +- .../sample_a/bootstrap/test/TestAssembler.java | 17 +- .../shipping/booking/BookNewCargoTest.java | 17 +- .../booking/BuildDeliverySnapshotTest.java | 31 +- .../shipping/handling/InspectCargoTest.java | 11 +- .../handling/RegisterHandlingEventTest.java | 3 +- samples/dci-cargo/dcisample_b/build.gradle | 1 - .../sample_b/bootstrap/assembly/Assembler.java | 32 +- .../communication/query/CommonQueries.java | 17 +- .../communication/query/HandlingQueries.java | 14 +- .../communication/query/TrackingQueries.java | 19 +- .../communication/query/dto/CargoDTO.java | 56 ---- .../query/dto/HandlingEventDTO.java | 52 --- .../communication/query/dto/LocationDTO.java | 33 -- .../communication/query/dto/VoyageDTO.java | 33 -- .../web/booking/CargoDetailsPage.java | 8 +- .../web/booking/CargoListPage.java | 12 +- .../web/booking/ChangeDestinationPage.java | 4 +- .../web/tracking/HandlingHistoryPanel.java | 14 +- .../web/tracking/NextHandlingEventPanel.java | 6 +- .../web/tracking/TrackCargoPage.java | 8 +- .../DeriveUpdatedRouteSpecification.java | 10 +- .../inspection/event/InspectCargoInCustoms.java | 12 +- .../inspection/event/InspectClaimedCargo.java | 12 +- .../inspection/event/InspectUnhandledCargo.java | 13 +- .../parsing/dto/ParsedHandlingEventData.java | 2 +- .../registration/RegisterHandlingEvent.java | 21 +- .../sample_b/context/rolemap/CargoRoleMap.java | 27 +- .../sample_b/data/entity/CargoEntity.java | 33 -- .../data/entity/HandlingEventEntity.java | 33 -- .../sample_b/data/entity/LocationEntity.java | 36 -- .../sample_b/data/entity/VoyageEntity.java | 36 -- .../sample_b/data/structure/cargo/Cargo.java | 3 +- .../data/structure/handling/HandlingEvent.java | 7 +- .../infrastructure/WicketZestApplication.java | 6 +- .../sample_b/infrastructure/conversion/DTO.java | 3 +- .../conversion/EntityToDTOService.java | 335 ------------------- .../infrastructure/model/EntityModel.java | 19 +- .../infrastructure/model/QueryModel.java | 13 +- .../infrastructure/model/ReadOnlyModel.java | 6 +- .../sample_b/bootstrap/test/TestAssembler.java | 12 +- .../context/test/booking/BookNewCargoTest.java | 12 +- .../registration/RegisterHandlingEventTest.java | 3 +- 95 files changed, 338 insertions(+), 1755 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/libraries/sql-bonecp/src/main/java/org/apache/zest/library/sql/bonecp/BoneCPDataSourceServiceImporter.java ---------------------------------------------------------------------- diff --git a/libraries/sql-bonecp/src/main/java/org/apache/zest/library/sql/bonecp/BoneCPDataSourceServiceImporter.java b/libraries/sql-bonecp/src/main/java/org/apache/zest/library/sql/bonecp/BoneCPDataSourceServiceImporter.java index c9e9a36..e1d6e65 100644 --- a/libraries/sql-bonecp/src/main/java/org/apache/zest/library/sql/bonecp/BoneCPDataSourceServiceImporter.java +++ b/libraries/sql-bonecp/src/main/java/org/apache/zest/library/sql/bonecp/BoneCPDataSourceServiceImporter.java @@ -24,7 +24,7 @@ import java.util.Properties; import org.apache.zest.api.activation.Activators; import org.apache.zest.api.mixin.Mixins; import org.apache.zest.library.sql.datasource.AbstractDataSourceServiceImporterMixin; -import org.apache.zest.library.sql.datasource.DataSourceConfigurationValue; +import org.apache.zest.library.sql.datasource.DataSourceConfiguration; import org.apache.zest.library.sql.datasource.DataSourceServiceImporterActivation; /** @@ -43,7 +43,7 @@ public class BoneCPDataSourceServiceImporter { @Override - protected BoneCPDataSource setupDataSourcePool( DataSourceConfigurationValue config ) + protected BoneCPDataSource setupDataSourcePool( DataSourceConfiguration config ) throws Exception { BoneCPDataSource pool = new BoneCPDataSource(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/libraries/sql-dbcp/src/main/java/org/apache/zest/library/sql/dbcp/DBCPDataSourceServiceImporter.java ---------------------------------------------------------------------- diff --git a/libraries/sql-dbcp/src/main/java/org/apache/zest/library/sql/dbcp/DBCPDataSourceServiceImporter.java b/libraries/sql-dbcp/src/main/java/org/apache/zest/library/sql/dbcp/DBCPDataSourceServiceImporter.java index c54709c..92af487 100644 --- a/libraries/sql-dbcp/src/main/java/org/apache/zest/library/sql/dbcp/DBCPDataSourceServiceImporter.java +++ b/libraries/sql-dbcp/src/main/java/org/apache/zest/library/sql/dbcp/DBCPDataSourceServiceImporter.java @@ -26,7 +26,7 @@ import org.apache.zest.api.mixin.Mixins; import org.apache.zest.api.service.ServiceComposite; import org.apache.zest.api.service.ServiceImporter; import org.apache.zest.library.sql.datasource.AbstractDataSourceServiceImporterMixin; -import org.apache.zest.library.sql.datasource.DataSourceConfigurationValue; +import org.apache.zest.library.sql.datasource.DataSourceConfiguration; import org.apache.zest.library.sql.datasource.DataSourceServiceImporterActivation; @Mixins( DBCPDataSourceServiceImporter.Mixin.class ) @@ -40,7 +40,7 @@ public interface DBCPDataSourceServiceImporter { @Override - protected BasicDataSource setupDataSourcePool( DataSourceConfigurationValue config ) + protected BasicDataSource setupDataSourcePool( DataSourceConfiguration config ) throws Exception { BasicDataSource pool = new BasicDataSource(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/libraries/sql/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/sql/build.gradle b/libraries/sql/build.gradle index 6e84d69..c168628 100644 --- a/libraries/sql/build.gradle +++ b/libraries/sql/build.gradle @@ -25,7 +25,6 @@ jar { manifest { name = "Apache Zest⢠Library - SQL" }} dependencies { compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap")) compile(project(":org.apache.zest.libraries:org.apache.zest.library.circuitbreaker")) - compile(project(":org.apache.zest.libraries:org.apache.zest.library.conversion")) compile(project(":org.apache.zest.libraries:org.apache.zest.library.jmx")) compile libraries.slf4j_api http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/libraries/sql/src/main/java/org/apache/zest/library/sql/assembly/AbstractPooledDataSourceServiceAssembler.java ---------------------------------------------------------------------- diff --git a/libraries/sql/src/main/java/org/apache/zest/library/sql/assembly/AbstractPooledDataSourceServiceAssembler.java b/libraries/sql/src/main/java/org/apache/zest/library/sql/assembly/AbstractPooledDataSourceServiceAssembler.java index 0f67d14..a01ed9e 100644 --- a/libraries/sql/src/main/java/org/apache/zest/library/sql/assembly/AbstractPooledDataSourceServiceAssembler.java +++ b/libraries/sql/src/main/java/org/apache/zest/library/sql/assembly/AbstractPooledDataSourceServiceAssembler.java @@ -23,7 +23,6 @@ import org.apache.zest.api.common.Visibility; import org.apache.zest.bootstrap.Assemblers; import org.apache.zest.bootstrap.AssemblyException; import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.library.conversion.values.EntityToValueService; import org.apache.zest.library.sql.datasource.DataSourceConfiguration; import org.apache.zest.library.sql.datasource.DataSourceConfigurationValue; @@ -37,7 +36,6 @@ public abstract class AbstractPooledDataSourceServiceAssembler<AssemblerType> throws AssemblyException { module.values( DataSourceConfigurationValue.class ).visibleIn( Visibility.module ); - module.services( EntityToValueService.class ).visibleIn( Visibility.module ); if( hasConfig() ) { configModule().entities( DataSourceConfiguration.class ).visibleIn( configVisibility() ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/libraries/sql/src/main/java/org/apache/zest/library/sql/datasource/AbstractDataSourceServiceImporterMixin.java ---------------------------------------------------------------------- diff --git a/libraries/sql/src/main/java/org/apache/zest/library/sql/datasource/AbstractDataSourceServiceImporterMixin.java b/libraries/sql/src/main/java/org/apache/zest/library/sql/datasource/AbstractDataSourceServiceImporterMixin.java index 1e02699..cb18e3c 100644 --- a/libraries/sql/src/main/java/org/apache/zest/library/sql/datasource/AbstractDataSourceServiceImporterMixin.java +++ b/libraries/sql/src/main/java/org/apache/zest/library/sql/datasource/AbstractDataSourceServiceImporterMixin.java @@ -38,7 +38,6 @@ import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException; import org.apache.zest.api.unitofwork.UnitOfWorkFactory; import org.apache.zest.api.usecase.UsecaseBuilder; import org.apache.zest.library.circuitbreaker.CircuitBreaker; -import org.apache.zest.library.conversion.values.EntityToValue; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,7 +47,7 @@ public abstract class AbstractDataSourceServiceImporterMixin<PooledDataSourceTyp protected static final Logger LOGGER = LoggerFactory.getLogger( AbstractDataSourceServiceImporterMixin.class ); - private final Map<String, DataSourceConfigurationValue> configs = new HashMap<>(); + private final Map<String, DataSourceConfiguration> configs = new HashMap<>(); private final Map<String, PooledDataSourceType> pools = new HashMap<>(); @@ -57,9 +56,6 @@ public abstract class AbstractDataSourceServiceImporterMixin<PooledDataSourceTyp @Structure protected UnitOfWorkFactory uowf; - @Service - private EntityToValue entityToValue; - @Override public final void passivateDataSourceService() throws Exception @@ -81,7 +77,7 @@ public abstract class AbstractDataSourceServiceImporterMixin<PooledDataSourceTyp try { - DataSourceConfigurationValue config = getConfiguration( importedServiceDescriptor.identity() ); + DataSourceConfiguration config = getConfiguration( importedServiceDescriptor.identity() ); if ( !config.enabled().get() ) { // Not started throw new ServiceImporterException( "DataSource not enabled" ); @@ -126,16 +122,16 @@ public abstract class AbstractDataSourceServiceImporterMixin<PooledDataSourceTyp } } - private DataSourceConfigurationValue getConfiguration( String identity ) + private DataSourceConfiguration getConfiguration( String identity ) throws InstantiationException { - DataSourceConfigurationValue config = configs.get( identity ); + DataSourceConfiguration config = configs.get( identity ); if ( config == null ) { UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "Create DataSource pool configuration" ) ); try { DataSourceConfiguration configEntity = uow.get( DataSourceConfiguration.class, identity ); - config = entityToValue.convert( DataSourceConfigurationValue.class, configEntity ); + config = uow.toValue( DataSourceConfiguration.class, configEntity ); } catch ( NoSuchEntityException e ) { EntityBuilder<DataSourceConfiguration> configBuilder = uow.newEntityBuilder( DataSourceConfiguration.class, identity ); @@ -154,7 +150,7 @@ public abstract class AbstractDataSourceServiceImporterMixin<PooledDataSourceTyp } DataSourceConfiguration configEntity = configBuilder.newInstance(); - config = entityToValue.convert( DataSourceConfigurationValue.class, configEntity ); + config = uow.toValue( DataSourceConfiguration.class, configEntity ); // save try { @@ -176,19 +172,16 @@ public abstract class AbstractDataSourceServiceImporterMixin<PooledDataSourceTyp @Override public final boolean isAvailable( DataSource instance ) { - if ( pools.containsValue( instance ) ) { + if ( pools.containsValue( instance ) ) + { CircuitBreaker circuitBreaker = circuitBreakers.get( instance ); - if ( circuitBreaker != null ) { - return circuitBreaker.isOn(); - } else { - return true; - } + return circuitBreaker == null || circuitBreaker.isOn(); } else { return false; } } - protected abstract PooledDataSourceType setupDataSourcePool( DataSourceConfigurationValue configuration ) + protected abstract PooledDataSourceType setupDataSourcePool( DataSourceConfiguration configuration ) throws Exception; protected abstract void passivateDataSourcePool( PooledDataSourceType dataSourcePool ) http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/build.gradle ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/build.gradle b/samples/dci-cargo/dcisample_a/build.gradle index f2f5424..2af8595 100644 --- a/samples/dci-cargo/dcisample_a/build.gradle +++ b/samples/dci-cargo/dcisample_a/build.gradle @@ -26,7 +26,6 @@ dependencies { compile project( ':org.apache.zest.core:org.apache.zest.core.bootstrap' ) compile project( ':org.apache.zest.libraries:org.apache.zest.library.constraints' ) - compile project( ':org.apache.zest.libraries:org.apache.zest.library.conversion' ) compile project( ':org.apache.zest.extensions:org.apache.zest.extension.valueserialization-orgjson' ) compile project( ':org.apache.zest.extensions:org.apache.zest.extension.indexing-rdf' ) compile project( ':org.apache.zest.tools:org.apache.zest.tool.envisage' ) http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/assembly/Assembler.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/assembly/Assembler.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/assembly/Assembler.java index 267cd63..6572766 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/assembly/Assembler.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/assembly/Assembler.java @@ -41,10 +41,6 @@ import org.apache.zest.sample.dcicargo.sample_a.bootstrap.DCISampleApplication_a import org.apache.zest.sample.dcicargo.sample_a.bootstrap.sampledata.BaseDataService; import org.apache.zest.sample.dcicargo.sample_a.bootstrap.sampledata.SampleDataService; import org.apache.zest.sample.dcicargo.sample_a.communication.query.BookingQueries; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.CargoDTO; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.HandlingEventDTO; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.LocationDTO; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.VoyageDTO; import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.CargoRoleMap; import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.CargosRoleMap; import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.HandlingEventRoleMap; @@ -54,17 +50,18 @@ import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.RouteSpecificati import org.apache.zest.sample.dcicargo.sample_a.context.support.ApplicationEvents; import org.apache.zest.sample.dcicargo.sample_a.context.support.RegisterHandlingEventAttemptDTO; import org.apache.zest.sample.dcicargo.sample_a.context.support.RoutingService; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.LocationEntity; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.VoyageEntity; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.ExpectedHandlingEvent; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.itinerary.Leg; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.UnLocode; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.CarrierMovement; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Schedule; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.VoyageNumber; -import org.apache.zest.sample.dcicargo.sample_a.infrastructure.conversion.EntityToDTOService; import org.apache.zest.spi.uuid.UuidIdentityGeneratorService; import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService; @@ -173,18 +170,14 @@ public class Assembler BookingQueries.class ) .visibleIn( application ); - queryModule - .values( - CargoDTO.class, - LocationDTO.class, - HandlingEventDTO.class, - VoyageDTO.class ); + queryModule.services( UuidIdentityGeneratorService.class ); - queryModule - .addServices( - EntityToDTOService.class, - OrgJsonValueSerializationService.class ) - .visibleIn( application ); + queryModule.values( + Cargo.class, + Location.class, + HandlingEvent.class, + Voyage.class + ); } private void assembleContextLayer( LayerAssembly contextLayer ) @@ -192,20 +185,18 @@ public class Assembler { // Role-playing entities ModuleAssembly entityRoleModule = contextLayer.module( "CONTEXT-EntityRole" ); - entityRoleModule - .entities( - CargoRoleMap.class, - CargosRoleMap.class, - HandlingEventRoleMap.class, - HandlingEventsRoleMap.class ) + entityRoleModule.entities( CargoRoleMap.class, + CargosRoleMap.class, + HandlingEventRoleMap.class, + HandlingEventsRoleMap.class ) .visibleIn( application ); // Non-role-playing entities ModuleAssembly entityNonRoleModule = contextLayer.module( "CONTEXT-EntityNonRole" ); entityNonRoleModule .entities( - LocationEntity.class, - VoyageEntity.class ) + Location.class, + Voyage.class ) .visibleIn( application ); // Role-playing values @@ -254,15 +245,8 @@ public class Assembler serializationModule .services( OrgJsonValueSerializationService.class ) .taggedWith( ValueSerialization.Formats.JSON ) - .setMetaInfo( new Function<Application, Module>() - { - @Override - public Module apply( Application application ) - { - return application.findModule( "CONTEXT", "CONTEXT-ContextSupport" ); - } - } ) - .visibleIn( application ); + .setMetaInfo( (Function<Application, Module>) application1 -> application1.findModule( "CONTEXT", "CONTEXT-ContextSupport" ) ) + .visibleIn( application ); ModuleAssembly indexingModule = infrastructureLayer.module( "INFRASTRUCTURE-Indexing" ); indexingModule http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/sampledata/BaseDataService.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/sampledata/BaseDataService.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/sampledata/BaseDataService.java index c4d6ede..f1d5291 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/sampledata/BaseDataService.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/sampledata/BaseDataService.java @@ -29,8 +29,8 @@ import org.apache.zest.api.service.ServiceReference; import org.apache.zest.api.structure.Module; import org.apache.zest.api.unitofwork.UnitOfWork; import org.apache.zest.api.value.ValueBuilder; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargosEntity; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.HandlingEventsEntity; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvents; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.UnLocode; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Schedule; @@ -139,8 +139,8 @@ public interface BaseDataService ) ); // Cargo and HandlingEvent factories - CargosEntity CARGOS = uow.newEntity( CargosEntity.class, CargosEntity.CARGOS_ID ); - uow.newEntity( HandlingEventsEntity.class, HandlingEventsEntity.HANDLING_EVENTS_ID ); + Cargos CARGOS = uow.newEntity( Cargos.class, Cargos.CARGOS_ID ); + uow.newEntity( HandlingEvents.class, HandlingEvents.HANDLING_EVENTS_ID ); logger.debug( "BASIC DATA CREATED" ); uow.complete(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/sampledata/SampleDataService.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/sampledata/SampleDataService.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/sampledata/SampleDataService.java index da00cea..98fcdd8 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/sampledata/SampleDataService.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/sampledata/SampleDataService.java @@ -20,7 +20,6 @@ package org.apache.zest.sample.dcicargo.sample_a.bootstrap.sampledata; import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -41,8 +40,8 @@ import org.apache.zest.api.usecase.Usecase; import org.apache.zest.api.usecase.UsecaseBuilder; import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo; import org.apache.zest.sample.dcicargo.sample_a.context.shipping.handling.RegisterHandlingEvent; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargosEntity; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.ExpectedHandlingEvent; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary; @@ -65,8 +64,7 @@ public interface SampleDataService void insertSampleData() throws Exception; - class Activator - extends ActivatorAdapter<ServiceReference<SampleDataService>> + class Activator extends ActivatorAdapter<ServiceReference<SampleDataService>> { @Override @@ -268,14 +266,14 @@ public interface SampleDataService Usecase usecase = UsecaseBuilder.newUsecase( "### Populate Random Cargos ###" ); UnitOfWork uow = uowf.newUnitOfWork( usecase ); - CargosEntity cargos = uow.get( CargosEntity.class, CargosEntity.CARGOS_ID ); + Cargos cargos = uow.get( Cargos.class, Cargos.CARGOS_ID ); QueryBuilder<Location> qb = qbf.newQueryBuilder( Location.class ); Query<Location> allLocations = uow.newQuery( qb ); int locationSize = (int) allLocations.count(); // Make array for selection of location with random index - final List<Location> locationList = new ArrayList<Location>(); + final List<Location> locationList = new ArrayList<>(); for( Location location : allLocations ) { locationList.add( location ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/BookingQueries.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/BookingQueries.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/BookingQueries.java index c4fbf4e..6d3b660 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/BookingQueries.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/BookingQueries.java @@ -68,7 +68,6 @@ public interface BookingQueries { modelList.add( JSONModel.of( itinerary ) ); } - return modelList; } } http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/CommonQueries.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/CommonQueries.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/CommonQueries.java index 60fa98a..94ed7ce 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/CommonQueries.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/CommonQueries.java @@ -24,8 +24,7 @@ import java.util.List; import org.apache.wicket.model.IModel; import org.apache.zest.api.query.Query; import org.apache.zest.api.query.QueryBuilder; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.CargoDTO; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargoEntity; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location; import org.apache.zest.sample.dcicargo.sample_a.infrastructure.model.EntityModel; import org.apache.zest.sample.dcicargo.sample_a.infrastructure.model.Queries; @@ -43,20 +42,20 @@ import static org.apache.zest.api.query.QueryExpressions.templateFor; */ public class CommonQueries extends Queries { - public IModel<CargoDTO> cargo( String trackingId ) + public IModel<Cargo> cargo( String trackingId ) { - return EntityModel.of( CargoEntity.class, trackingId, CargoDTO.class ); + return EntityModel.of( Cargo.class, trackingId, Cargo.class ); } - public IModel<List<CargoDTO>> cargoList() + public IModel<List<Cargo>> cargoList() { - return new QueryModel<CargoDTO, CargoEntity>( CargoDTO.class ) + return new QueryModel<Cargo>( Cargo.class ) { - public Query<CargoEntity> getQuery() + public Query<Cargo> getQuery() { - QueryBuilder<CargoEntity> qb = qbf.newQueryBuilder( CargoEntity.class ); + QueryBuilder<Cargo> qb = qbf.newQueryBuilder( Cargo.class ); return uowf.currentUnitOfWork().newQuery( qb ) - .orderBy( orderBy( templateFor( CargoEntity.class ).trackingId().get().id() ) ); + .orderBy( orderBy( templateFor( Cargo.class ).trackingId().get().id() ) ); } }; } http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/HandlingQueries.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/HandlingQueries.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/HandlingQueries.java index f9486f0..9e61655 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/HandlingQueries.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/HandlingQueries.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.List; import org.apache.zest.api.query.Query; import org.apache.zest.api.query.QueryBuilder; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargoEntity; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage; import org.apache.zest.sample.dcicargo.sample_a.infrastructure.model.Queries; @@ -54,11 +54,11 @@ public class HandlingQueries extends Queries public List<String> cargoIds() { - QueryBuilder<CargoEntity> qb = qbf.newQueryBuilder( CargoEntity.class ); - Query<CargoEntity> cargos = uowf.currentUnitOfWork().newQuery( qb ) - .orderBy( orderBy( templateFor( CargoEntity.class ).trackingId().get().id() ) ); - List<String> cargoList = new ArrayList<String>(); - for( CargoEntity cargo : cargos ) + QueryBuilder<Cargo> qb = qbf.newQueryBuilder( Cargo.class ); + Query<Cargo> cargos = uowf.currentUnitOfWork().newQuery( qb ) + .orderBy( orderBy( templateFor( Cargo.class ).trackingId().get().id() ) ); + List<String> cargoList = new ArrayList<>(); + for( Cargo cargo : cargos ) { cargoList.add( cargo.trackingId().get().id().get() ); } @@ -67,7 +67,7 @@ public class HandlingQueries extends Queries public List<String> eventTypes() { - List<String> eventTypes = new ArrayList<String>(); + List<String> eventTypes = new ArrayList<>(); for( HandlingEventType eventType : HandlingEventType.values() ) { eventTypes.add( eventType.name() ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/TrackingQueries.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/TrackingQueries.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/TrackingQueries.java index 7685f77..f7d2e49 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/TrackingQueries.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/TrackingQueries.java @@ -25,9 +25,6 @@ import org.apache.wicket.model.IModel; import org.apache.zest.api.query.Query; import org.apache.zest.api.query.QueryBuilder; import org.apache.zest.api.query.QueryExpressions; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.HandlingEventDTO; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargoEntity; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.HandlingEventEntity; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent; import org.apache.zest.sample.dcicargo.sample_a.infrastructure.model.Queries; @@ -44,15 +41,15 @@ public class TrackingQueries extends Queries { public List<String> routedCargos() { - Cargo cargoEntity = templateFor( CargoEntity.class ); + Cargo cargoEntity = templateFor( Cargo.class ); - QueryBuilder<CargoEntity> qb = qbf.newQueryBuilder( CargoEntity.class ) + QueryBuilder<Cargo> qb = qbf.newQueryBuilder( Cargo.class ) .where( isNotNull( cargoEntity.itinerary() ) ); - Query<CargoEntity> cargos = uowf.currentUnitOfWork().newQuery( qb ) + Query<Cargo> cargos = uowf.currentUnitOfWork().newQuery( qb ) .orderBy( orderBy( cargoEntity.trackingId().get().id() ) ); List<String> cargoList = new ArrayList<String>(); - for( CargoEntity cargo : cargos ) + for( Cargo cargo : cargos ) { cargoList.add( cargo.trackingId().get().id().get() ); } @@ -60,17 +57,19 @@ public class TrackingQueries extends Queries return cargoList; } - public IModel<List<HandlingEventDTO>> events( final String trackingIdString ) + public IModel<List<HandlingEvent>> events( final String trackingIdString ) { - return new QueryModel<HandlingEventDTO, HandlingEventEntity>( HandlingEventDTO.class ) + return new QueryModel<HandlingEvent>( HandlingEvent.class ) { - public Query<HandlingEventEntity> getQuery() + public Query<HandlingEvent> getQuery() { HandlingEvent eventTemplate = templateFor( HandlingEvent.class ); - QueryBuilder<HandlingEventEntity> qb = qbf.newQueryBuilder( HandlingEventEntity.class ) + QueryBuilder<HandlingEvent> qb = qbf.newQueryBuilder( HandlingEvent.class ) .where( QueryExpressions.eq( eventTemplate.trackingId().get().id(), trackingIdString ) ); - return uowf.currentUnitOfWork().newQuery( qb ) + return uowf + .currentUnitOfWork() + .newQuery( qb ) .orderBy( orderBy( eventTemplate.completionDate() ) ); } }; http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/CargoDTO.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/CargoDTO.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/CargoDTO.java deleted file mode 100644 index 4113088..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/CargoDTO.java +++ /dev/null @@ -1,53 +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_a.communication.query.dto; - -import org.apache.zest.api.common.Optional; -import org.apache.zest.api.property.Property; -import org.apache.zest.library.conversion.values.Unqualified; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.RouteSpecification; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary; -import org.apache.zest.sample.dcicargo.sample_a.infrastructure.conversion.DTO; - -/** - * Cargo DTO - * - * We need the @Unqualified annotation since the CargoDTO interface has other properties than {@link Cargo} - * so that properties can not be directly mapped when we convert from entity to immutable value DTO. - * With the annotation, property access methods are compared by name instead. - */ -@Unqualified -public interface CargoDTO extends DTO -{ - Property<TrackingId> trackingId(); - - // Associated Location entity in Cargo is converted to an immutable LocationDTO value object - Property<LocationDTO> origin(); - - Property<RouteSpecification> routeSpecification(); - - Property<Delivery> delivery(); - - @Optional - Property<Itinerary> itinerary(); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/HandlingEventDTO.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/HandlingEventDTO.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/HandlingEventDTO.java deleted file mode 100644 index 4b4c1ae..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/HandlingEventDTO.java +++ /dev/null @@ -1,51 +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_a.communication.query.dto; - -import java.time.LocalDate; -import org.apache.zest.api.common.Optional; -import org.apache.zest.api.property.Property; -import org.apache.zest.library.conversion.values.Unqualified; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType; -import org.apache.zest.sample.dcicargo.sample_a.infrastructure.conversion.DTO; - -/** - * HandlingEvent DTO - * - * We need the @Unqualified annotation since the HandlingEventDTO interface has other properties than - * {@link HandlingEvent} so that properties can not be directly mapped when we convert from entity to - * immutable value DTO. With the annotation, property access methods are compared by name instead. - */ -@Unqualified -public interface HandlingEventDTO extends DTO -{ - Property<LocalDate> completionDate(); - - Property<TrackingId> trackingId(); - - Property<HandlingEventType> handlingEventType(); - - Property<LocationDTO> location(); - - @Optional - Property<VoyageDTO> voyage(); -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/LocationDTO.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/LocationDTO.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/LocationDTO.java deleted file mode 100644 index 08a3036..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/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_a.communication.query.dto; - -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location; -import org.apache.zest.sample.dcicargo.sample_a.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_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/VoyageDTO.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/VoyageDTO.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/query/dto/VoyageDTO.java deleted file mode 100644 index 6ad0b3b..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/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_a.communication.query.dto; - -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage; -import org.apache.zest.sample.dcicargo.sample_a.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_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/CargoDetailsPage.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/CargoDetailsPage.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/CargoDetailsPage.java index 0e07841..d1a36f1 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/CargoDetailsPage.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/CargoDetailsPage.java @@ -32,9 +32,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_a.communication.query.CommonQueries; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.CargoDTO; import org.apache.zest.sample.dcicargo.sample_a.communication.web.tracking.HandlingHistoryPanel; import org.apache.zest.sample.dcicargo.sample_a.communication.web.tracking.NextHandlingEventPanel; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.RouteSpecification; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.RoutingStatus; @@ -62,8 +62,8 @@ public class CargoDetailsPage extends BookingBasePage { super( new PageParameters().set( 0, trackingId ) ); - IModel<CargoDTO> cargoModel = new CommonQueries().cargo( trackingId ); - CargoDTO cargo = cargoModel.getObject(); + IModel<Cargo> cargoModel = new CommonQueries().cargo( trackingId ); + Cargo cargo = cargoModel.getObject(); Delivery delivery = cargo.delivery().get(); RouteSpecification routeSpecification = cargo.routeSpecification().get(); final RoutingStatus routingStatus = delivery.routingStatus().get(); @@ -123,7 +123,7 @@ public class CargoDetailsPage extends BookingBasePage private class ItineraryFragment extends Fragment { - public ItineraryFragment( final IModel<CargoDTO> cargoModel, final RoutingStatus routingStatus ) + public ItineraryFragment( final IModel<Cargo> 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_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/CargoListPage.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/CargoListPage.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/CargoListPage.java index 35e260f..25bc21e 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/CargoListPage.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/CargoListPage.java @@ -31,7 +31,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_a.communication.query.CommonQueries; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.CargoDTO; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.RouteSpecification; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.RoutingStatus; @@ -50,22 +50,22 @@ public class CargoListPage extends BookingBasePage { public CargoListPage() { - IModel<List<CargoDTO>> cargoList = new CommonQueries().cargoList(); + IModel<List<Cargo>> cargoList = new CommonQueries().cargoList(); // Save current trackingIds in session (for prev/next buttons on details page) ArrayList<String> 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<CargoDTO>( "list", cargoList ) + add( new ListView<Cargo>( "list", cargoList ) { @Override - protected void populateItem( ListItem<CargoDTO> item ) + protected void populateItem( ListItem<Cargo> item ) { - CargoDTO cargo = item.getModelObject(); + Cargo cargo = item.getModelObject(); String trackingId = cargo.trackingId().get().id().get(); Delivery delivery = cargo.delivery().get(); RoutingStatus routingStatus = cargo.delivery().get().routingStatus().get(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/ChangeDestinationPage.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/ChangeDestinationPage.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/ChangeDestinationPage.java index c6a03bf..e435cdb 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/ChangeDestinationPage.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/booking/ChangeDestinationPage.java @@ -28,8 +28,8 @@ 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_a.communication.query.CommonQueries; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.CargoDTO; import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.infrastructure.wicket.form.AbstractForm; import org.apache.zest.sample.dcicargo.sample_a.infrastructure.wicket.form.SelectorInForm; @@ -53,7 +53,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<String> locations = fetch.unLocodes(); origin = cargo.origin().get().getCode(); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/handling/RegisterHandlingEventPage.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/handling/RegisterHandlingEventPage.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/handling/RegisterHandlingEventPage.java index 93cbab2..e522a93 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/handling/RegisterHandlingEventPage.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/handling/RegisterHandlingEventPage.java @@ -20,7 +20,6 @@ package org.apache.zest.sample.dcicargo.sample_a.communication.web.handling; import java.time.LocalDate; -import java.time.LocalDateTime; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton; import org.apache.wicket.markup.html.form.Form; @@ -106,8 +105,8 @@ public class RegisterHandlingEventPage extends BasePage { map.put( "voyage", voyageNumber ); } - String msg = new StringResourceModel( "handlingEvent.${type}", this, new Model<ValueMap>( map ) ) - .getObject(); + String msg = new StringResourceModel( + "handlingEvent.${type}", this, new Model<>( map ) ).getObject(); feedback.info( "Registered handling event for cargo '" + trackingId + "': " + msg ); target.add( feedback ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/HandlingHistoryPanel.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/HandlingHistoryPanel.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/HandlingHistoryPanel.java index d96bb39..5aa441f 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/HandlingHistoryPanel.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/HandlingHistoryPanel.java @@ -32,8 +32,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_a.communication.query.TrackingQueries; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.CargoDTO; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.HandlingEventDTO; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent; import org.apache.zest.sample.dcicargo.sample_a.infrastructure.wicket.color.ErrorColor; /** @@ -44,18 +44,18 @@ import org.apache.zest.sample.dcicargo.sample_a.infrastructure.wicket.color.Erro @StatelessComponent public class HandlingHistoryPanel extends Panel { - public HandlingHistoryPanel( String id, final IModel<CargoDTO> cargoModel, String trackingId ) + public HandlingHistoryPanel( String id, final IModel<Cargo> cargoModel, String trackingId ) { super( id ); - IModel<List<HandlingEventDTO>> handlingEventsModel = new TrackingQueries().events( trackingId ); + IModel<List<HandlingEvent>> handlingEventsModel = new TrackingQueries().events( trackingId ); - add( new ListView<HandlingEventDTO>( "handlingEvents", handlingEventsModel ) + add( new ListView<HandlingEvent>( "handlingEvents", handlingEventsModel ) { @Override - protected void populateItem( ListItem<HandlingEventDTO> item ) + protected void populateItem( ListItem<HandlingEvent> item ) { - HandlingEventDTO event = item.getModelObject(); + HandlingEvent event = item.getModelObject(); Boolean isLast = item.getIndex() == getList().size() - 1; Boolean isMisdirected = cargoModel.getObject().delivery().get().isMisdirected().get(); @@ -74,7 +74,7 @@ public class HandlingHistoryPanel extends Panel { map.put( "voyage", event.voyage().get().voyageNumber().get().number().get() ); } - IModel text = new StringResourceModel( "handlingEvent.${type}", this, new Model<ValueMap>( map ) ); + IModel text = new StringResourceModel( "handlingEvent.${type}", this, new Model<>( map ) ); item.add( new Label( "event", text ) .add( new ErrorColor( isLast && isMisdirected ) ) .setEscapeModelStrings( false ) ); http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/NextHandlingEventPanel.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/NextHandlingEventPanel.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/NextHandlingEventPanel.java index 80f405c..77091e4 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/NextHandlingEventPanel.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/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_a.communication.query.dto.CargoDTO; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.ExpectedHandlingEvent; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType; @@ -41,16 +41,16 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location; @StatelessComponent public class NextHandlingEventPanel extends Panel { - public NextHandlingEventPanel( String id, IModel<CargoDTO> cargoModel ) + public NextHandlingEventPanel( String id, IModel<Cargo> cargoModel ) { super( id ); ValueMap map = new ValueMap(); Label label = new Label( "text", new StringResourceModel( - "expectedEvent.${expectedEvent}", this, new Model<ValueMap>( map ) ) ); + "expectedEvent.${expectedEvent}", 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_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/TrackCargoPage.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/TrackCargoPage.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/TrackCargoPage.java index 2f7f999..e891be1 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/communication/web/tracking/TrackCargoPage.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/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_a.communication.query.CommonQueries; import org.apache.zest.sample.dcicargo.sample_a.communication.query.TrackingQueries; -import org.apache.zest.sample.dcicargo.sample_a.communication.query.dto.CargoDTO; import org.apache.zest.sample.dcicargo.sample_a.communication.web.BasePage; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType; import org.apache.zest.sample.dcicargo.sample_a.infrastructure.wicket.form.AbstractForm; @@ -115,7 +115,7 @@ public class TrackCargoPage extends BasePage { try { - IModel<CargoDTO> cargoModel = new CommonQueries().cargo( trackingId ); + IModel<Cargo> 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 { - StatusFragment( IModel<CargoDTO> cargoModel, Boolean visible ) + StatusFragment( IModel<Cargo> 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_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/CargoRoleMap.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/CargoRoleMap.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/CargoRoleMap.java index 01db3a0..8f713f7 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/CargoRoleMap.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/CargoRoleMap.java @@ -19,14 +19,13 @@ */ package org.apache.zest.sample.dcicargo.sample_a.context.rolemap; +import org.apache.zest.api.entity.EntityComposite; import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargoEntity; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; /** * Cargo Role Map */ -public interface CargoRoleMap - extends CargoEntity, - BookNewCargo.RoutingFacadeRole +public interface CargoRoleMap extends BookNewCargo.RoutingFacadeRole, EntityComposite, Cargo { } http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/CargosRoleMap.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/CargosRoleMap.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/CargosRoleMap.java index 73b0097..51cdcd4 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/CargosRoleMap.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/CargosRoleMap.java @@ -19,14 +19,13 @@ */ package org.apache.zest.sample.dcicargo.sample_a.context.rolemap; +import org.apache.zest.api.entity.EntityComposite; import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BookNewCargo; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargosEntity; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos; /** * Cargos Role Map */ -public interface CargosRoleMap - extends CargosEntity, - BookNewCargo.CargoFactoryRole +public interface CargosRoleMap extends BookNewCargo.CargoFactoryRole, EntityComposite, Cargos { } http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/HandlingEventRoleMap.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/HandlingEventRoleMap.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/HandlingEventRoleMap.java index fcc1c2f..e88f204 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/HandlingEventRoleMap.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/HandlingEventRoleMap.java @@ -19,16 +19,16 @@ */ package org.apache.zest.sample.dcicargo.sample_a.context.rolemap; +import org.apache.zest.api.entity.EntityComposite; import org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking.BuildDeliverySnapshot; import org.apache.zest.sample.dcicargo.sample_a.context.shipping.handling.InspectCargo; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.HandlingEventEntity; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent; /** * Handling Event Role Map */ -public interface HandlingEventRoleMap - extends HandlingEventEntity, - BuildDeliverySnapshot.HandlingEventRole, - InspectCargo.CargoInspectorRole +public interface HandlingEventRoleMap extends BuildDeliverySnapshot.HandlingEventRole, + InspectCargo.CargoInspectorRole, + EntityComposite, HandlingEvent { } http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/HandlingEventsRoleMap.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/HandlingEventsRoleMap.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/HandlingEventsRoleMap.java index c1eb858..637c871 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/HandlingEventsRoleMap.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/rolemap/HandlingEventsRoleMap.java @@ -19,14 +19,14 @@ */ package org.apache.zest.sample.dcicargo.sample_a.context.rolemap; +import org.apache.zest.api.entity.EntityComposite; import org.apache.zest.sample.dcicargo.sample_a.context.shipping.handling.RegisterHandlingEvent; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.HandlingEventsEntity; +import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvents; /** * Handling Events Role Map */ -public interface HandlingEventsRoleMap - extends HandlingEventsEntity, - RegisterHandlingEvent.HandlingEventFactoryRole +public interface HandlingEventsRoleMap extends RegisterHandlingEvent.HandlingEventFactoryRole, + EntityComposite, HandlingEvents { } http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargo.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargo.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargo.java index 7a7ff72..d57593d 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargo.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargo.java @@ -29,9 +29,6 @@ import org.apache.zest.api.value.ValueBuilder; import org.apache.zest.api.value.ValueBuilderFactory; import org.apache.zest.sample.dcicargo.sample_a.context.support.FoundNoRoutesException; import org.apache.zest.sample.dcicargo.sample_a.context.support.RoutingService; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargoEntity; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.CargosEntity; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.LocationEntity; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.RouteSpecification; @@ -90,7 +87,7 @@ public class BookNewCargo extends Context public BookNewCargo( String originId, String destinationId, LocalDate deadline ) throws Exception { - this( loadEntity( CargosEntity.class, CargosEntity.CARGOS_ID ), + this( loadEntity( Cargos.class, Cargos.CARGOS_ID ), loadEntity( Location.class, originId ), loadEntity( Location.class, destinationId ), deadline ); @@ -98,7 +95,7 @@ public class BookNewCargo extends Context public BookNewCargo( String trackingIdString ) { - this( loadEntity( CargoEntity.class, trackingIdString ) ); + this( loadEntity( Cargo.class, trackingIdString ) ); } public BookNewCargo( String trackingIdString, Itinerary itinerary ) @@ -120,7 +117,7 @@ public class BookNewCargo extends Context public void changeDestination( String destination ) { - routingFacade.changeDestination( loadEntity( LocationEntity.class, destination ) ); + routingFacade.changeDestination( loadEntity( Location.class, destination ) ); } public List<Itinerary> routeCandidates() http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEvent.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEvent.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEvent.java index 4388edf..aa73033 100644 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEvent.java +++ b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/handling/RegisterHandlingEvent.java @@ -20,7 +20,6 @@ package org.apache.zest.sample.dcicargo.sample_a.context.shipping.handling; import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.Arrays; import org.apache.zest.api.injection.scope.Service; import org.apache.zest.api.injection.scope.This; @@ -30,7 +29,6 @@ import org.apache.zest.api.unitofwork.UnitOfWork; import org.apache.zest.api.value.ValueBuilder; import org.apache.zest.sample.dcicargo.sample_a.context.support.ApplicationEvents; import org.apache.zest.sample.dcicargo.sample_a.context.support.RegisterHandlingEventAttemptDTO; -import org.apache.zest.sample.dcicargo.sample_a.data.entity.HandlingEventsEntity; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId; import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent; @@ -41,7 +39,7 @@ import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage; import org.apache.zest.sample.dcicargo.sample_a.infrastructure.dci.Context; import org.apache.zest.sample.dcicargo.sample_a.infrastructure.dci.RoleMixin; -import static org.apache.zest.sample.dcicargo.sample_a.data.entity.HandlingEventsEntity.HANDLING_EVENTS_ID; +import static org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvents.HANDLING_EVENTS_ID; /** * Register new handling event use case. @@ -71,7 +69,7 @@ public class RegisterHandlingEvent extends Context String voyageNumberString ) { - handlingEventFactory = rolePlayer( HandlingEventFactoryRole.class, HandlingEventsEntity.class, HANDLING_EVENTS_ID ); + handlingEventFactory = rolePlayer( HandlingEventFactoryRole.class, HandlingEvents.class, HANDLING_EVENTS_ID ); this.registrationDate = registrationDate; this.completionDate = completionDate; http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/CargoEntity.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/CargoEntity.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/CargoEntity.java deleted file mode 100644 index f44b8e9..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/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_a.data.entity; - -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.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_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/CargosEntity.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/CargosEntity.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/CargosEntity.java deleted file mode 100644 index c04340f..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/CargosEntity.java +++ /dev/null @@ -1,32 +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_a.data.entity; - -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos; - -/** - * Cargo aggregate root? - */ -public interface CargosEntity - extends EntityComposite, Cargos -{ - public static final String CARGOS_ID = "Cargos_id"; -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/HandlingEventEntity.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/HandlingEventEntity.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/HandlingEventEntity.java deleted file mode 100644 index fd718c3..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/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_a.data.entity; - -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.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_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/HandlingEventsEntity.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/HandlingEventsEntity.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/HandlingEventsEntity.java deleted file mode 100644 index c941602..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/HandlingEventsEntity.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_a.data.entity; - -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvents; - -/** - * HandlingEvent aggregate root? - */ -public interface HandlingEventsEntity - extends EntityComposite, - - HandlingEvents -{ - public static final String HANDLING_EVENTS_ID = "Handling_events_id"; -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/21baf180/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/LocationEntity.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/LocationEntity.java b/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/data/entity/LocationEntity.java deleted file mode 100644 index f936893..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/java/org/apache/zest/sample/dcicargo/sample_a/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_a.data.entity; - -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.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 -{ -}
