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:47 UTC
[06/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/data/structure/itinerary/Leg.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Leg.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Leg.java
deleted file mode 100644
index 7aeb47c..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/itinerary/Leg.java
+++ /dev/null
@@ -1,48 +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.LocalDate;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage.Voyage;
-
-/**
- * A leg describes an expected segment of a route:
- * - loading onto a voyage at a load location
- * - unloading from the voyage at a unload location
- *
- * All properties are mandatory and immutable.
- */
-public interface Leg
- extends ValueComposite
-{
- Association<Location> loadLocation();
-
- Property<LocalDate> loadDate();
-
- Association<Voyage> voyage();
-
- Property<LocalDate> unloadDate();
-
- Association<Location> unloadLocation();
-}
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/location/Location.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/location/Location.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/location/Location.java
deleted file mode 100644
index 5cb9125..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/location/Location.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.location;
-
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Immutable;
-import org.apache.zest.api.property.Property;
-
-/**
- * Location
- *
- * A location is a stop on a journey, such as cargo origin or destination, or
- * carrier movement endpoints.
- *
- * It is uniquely identified by a {@link UnLocode}.
- *
- * All properties are mandatory and immutable.
- */
-@Immutable
-@Mixins( Location.Mixin.class )
-public interface Location
-{
- Property<UnLocode> unLocode();
-
- Property<String> name();
-
- // Side-effects free and UI agnostic convenience methods
- String getCode();
-
- String getString();
-
- abstract class Mixin
- implements Location
- {
- public String getCode()
- {
- return unLocode().get().code().get();
- }
-
- public String getString()
- {
- return name().get() + " (" + getCode() + ")";
- }
- }
-}
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/location/UnLocode.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/location/UnLocode.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/location/UnLocode.java
deleted file mode 100644
index ca42566..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/location/UnLocode.java
+++ /dev/null
@@ -1,43 +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.location;
-
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.library.constraints.annotation.Matches;
-
-/**
- * UnLocode
- *
- * A United Nations location code.
- *
- * http://www.unece.org/cefact/locode/
- * http://www.unece.org/cefact/locode/DocColumnDescription.htm#LOCODE
- *
- * UnLocode is mandatory and immutable.
- */
-public interface UnLocode
- extends ValueComposite
-{
- // Country code is exactly two letters.
- // Location code is usually three letters, but may contain the numbers 2-9 as well
- @Matches( "[a-zA-Z]{2}[a-zA-Z2-9]{3}" )
- Property<String> code();
-}
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/tracking/TrackingId.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/tracking/TrackingId.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/tracking/TrackingId.java
deleted file mode 100644
index 897137e..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/tracking/TrackingId.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.data.structure.tracking;
-
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.library.constraints.annotation.Matches;
-
-/**
- * TrackingId
- *
- * A TrackingId uniquely identifies a particular cargo.
- *
- * Suggested constraints:
- * - starts with a letter [a-zA-Z] or digit
- * - then allows underscore/dash
- * - is minimum 3 characters long
- * - is maximum 30 characters long.
- */
-public interface TrackingId
- extends ValueComposite
-{
- @Matches( "[a-zA-Z0-9]{1}[a-zA-Z0-9_-]{2,29}" )
- Property<String> 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/structure/voyage/CarrierMovement.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/CarrierMovement.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/CarrierMovement.java
deleted file mode 100644
index af399a9..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/CarrierMovement.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.data.structure.voyage;
-
-import java.time.LocalDate;
-import org.apache.zest.api.association.Association;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
-
-/**
- * CarrierMovement
- *
- * A carrier movement is a vessel voyage from one location to another.
- *
- * All properties are mandatory and immutable.
- */
-public interface CarrierMovement
- extends ValueComposite
-{
- Association<Location> departureLocation();
-
- Association<Location> arrivalLocation();
-
- Property<LocalDate> departureDate();
-
- Property<LocalDate> arrivalDate();
-}
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/voyage/Schedule.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Schedule.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Schedule.java
deleted file mode 100644
index 1ff42e5..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Schedule.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.structure.voyage;
-
-import java.util.List;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-
-/**
- * Schedule
- *
- * A schedule is a series of {@link CarrierMovement}s.
- *
- * List of carrier movements is mandatory and immutable.
- */
-public interface Schedule
- extends ValueComposite
-{
- Property<List<CarrierMovement>> carrierMovements();
-}
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/voyage/Voyage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Voyage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Voyage.java
deleted file mode 100644
index 8304001..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/Voyage.java
+++ /dev/null
@@ -1,89 +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.voyage;
-
-import org.apache.zest.api.mixin.Mixins;
-import org.apache.zest.api.property.Property;
-import org.apache.zest.sample.dcicargo.sample_b.data.structure.location.Location;
-
-/**
- * Voyage
- *
- * A voyage is a ship, train, flight etc carrying a cargo from one location
- * to another. A {@link Schedule} describes the route it takes.
- *
- * A cargo can be loaded onto part of, or the whole voyage.
- *
- * All properties are mandatory and immutable.
- */
-@Mixins( Voyage.Mixin.class )
-public interface Voyage
-{
- Property<VoyageNumber> voyageNumber();
-
- Property<Schedule> schedule();
-
- // Side-effects free and UI agnostic convenience methods
- CarrierMovement carrierMovementDepartingFrom( Location departure );
-
- String print();
-
- public abstract class Mixin
- implements Voyage
- {
- public CarrierMovement carrierMovementDepartingFrom( Location departure )
- {
- for( CarrierMovement carrierMovement : schedule().get().carrierMovements().get() )
- {
- if( carrierMovement.departureLocation().get().equals( departure ) )
- {
- return carrierMovement;
- }
- }
-
- return null;
- }
-
- public String print()
- {
- StringBuilder sb = new StringBuilder( "\nVOYAGE " )
- .append( voyageNumber().get().number().get() )
- .append( " -----------------------------------------------------" );
-
- for( int i = 0; i < schedule().get().carrierMovements().get().size(); i++ )
- {
- printLeg( i, sb, schedule().get().carrierMovements().get().get( i ) );
- }
-
- return sb.append( "\n---------------------------------------------------------------\n" ).toString();
- }
-
- private void printLeg( int i, StringBuilder sb, CarrierMovement carrierMovement )
- {
- sb.append( "\n (Leg " ).append( i ).append( ")" );
- sb.append( " Departure " );
- sb.append( carrierMovement.departureDate().get() );
- sb.append( " " ).append( carrierMovement.departureLocation().get() );
- sb.append( " Arrival " );
- sb.append( carrierMovement.arrivalDate().get() );
- sb.append( " " ).append( carrierMovement.arrivalLocation().get() );
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/VoyageNumber.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/VoyageNumber.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/VoyageNumber.java
deleted file mode 100644
index a9096bc..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/data/structure/voyage/VoyageNumber.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.data.structure.voyage;
-
-import org.apache.zest.api.property.Property;
-import org.apache.zest.api.value.ValueComposite;
-
-/**
- * VoyageNumber
- *
- * Identifies a {@link Voyage}.
- *
- * Voyage number is mandatory and immutable.
- */
-public interface VoyageNumber
- extends ValueComposite
-{
- Property<String> number();
-}
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/infrastructure/WicketZestApplication.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java
deleted file mode 100644
index c6c5281..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/WicketZestApplication.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure;
-
-import javax.servlet.http.HttpServletRequest;
-import org.apache.wicket.Page;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.zest.api.ZestAPI;
-import org.apache.zest.api.composite.TransientBuilderFactory;
-import org.apache.zest.api.injection.scope.Service;
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.query.QueryBuilderFactory;
-import org.apache.zest.api.structure.Application;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.unitofwork.UnitOfWork;
-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.api.value.ValueBuilderFactory;
-import org.apache.zest.bootstrap.ApplicationAssembler;
-import org.apache.zest.bootstrap.Energy4Java;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.dci.Context;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.Queries;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.model.ReadOnlyModel;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.page.BaseWebPage;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * WicketZestApplication
- *
- * Base Wicket Web Application containing the Zest application.
- */
-public class WicketZestApplication
- extends WebApplication
-{
- public Logger logger = LoggerFactory.getLogger( WicketZestApplication.class );
-
- protected Application zestApp;
- protected Module zestModule;
-
- @Structure
- protected UnitOfWorkFactory uowf;
-
- @Structure
- protected ValueBuilderFactory vbf;
-
- @Structure
- protected TransientBuilderFactory tbf;
-
- @Structure
- protected QueryBuilderFactory qbf;
-
- @Structure
- protected ZestAPI api;
-
- /**
- * Zest Assembler
- *
- * To let the custom application class (DCISampleApplication_x) focus on starting up the
- * Wicket environment, I made a convention of having Zest Assembler files in an 'assembly'
- * folder beside the custom application class.
- *
- * There's always only one application file, but we could split the assemblage into several
- * files ie. one for each layer. In that case, the Assembler file would be distributing to
- * the individual LayerXAssembler classes.
- *
- * If you like, you can also override this method in the custom application class and simply
- * return an instance of YourAssembler:
- * <pre><code>
- * @Override protected ApplicationAssembler getAssembler() {
- * return new YourAssemblerInAnyPath();
- * }
- * </code></pre>
- */
- protected ApplicationAssembler getAssembler()
- throws Exception
- {
- String appPath = getClass().getCanonicalName();
- String expectedPathFromApplication = ".assembly.Assembler";
- String assemblerPath = appPath.substring( 0, appPath.lastIndexOf( "." ) ) + expectedPathFromApplication;
- try
- {
- return (ApplicationAssembler) Class.forName( assemblerPath ).newInstance();
- }
- catch( ClassNotFoundException e )
- {
- throw new Exception( "Couldn't find Zest assembler in path '" + assemblerPath + "'" );
- }
- }
-
- protected String defaultLayerName()
- {
- return "BOOTSTRAP";
- }
-
- protected String defaultModuleName()
- {
- return "BOOTSTRAP-Bootstrap";
- }
-
- // Override this to bootstrap the wicket application
- protected void wicketInit()
- {
- }
-
- @Override
- protected void init()
- {
- startZest();
- handleUnitOfWork();
-
- Context.prepareContextBaseClass( uowf, vbf );
- BaseWebPage.prepareBaseWebPageClass( tbf );
- ReadOnlyModel.prepareModelBaseClass( zestModule, api);
- Queries.prepareQueriesBaseClass( uowf, qbf );
-
- wicketInit();
- }
-
- private void startZest()
- {
- try
- {
- logger.info( "Starting Zest application" );
- Energy4Java zest = new Energy4Java();
- zestApp = zest.newApplication( getAssembler() );
- zestApp.activate();
- zestModule = zestApp.findModule( defaultLayerName(), defaultModuleName() );
-
- // Zest injects @Structure and @Service elements into this application instance
- zestModule.injectTo( this );
-
- logger.info( "Started Zest application" );
- }
- catch( Exception e )
- {
- logger.error( "Could not start Zest application." );
- e.printStackTrace();
- System.exit( 100 );
- }
- }
-
- private void handleUnitOfWork()
- {
- getRequestCycleListeners().add( new AbstractRequestCycleListener()
- {
- @Override
- public void onBeginRequest( final RequestCycle requestCycle )
- {
- super.onBeginRequest( requestCycle );
-
- logger.debug( "================================" );
- logger.debug( "REQUEST start" );
- logger.debug( requestCycle.getRequest().toString() );
- logger.debug( requestCycle.getRequest().getRequestParameters().toString() );
-
- UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase( "REQUEST" ) );
- logger.debug( " ### NEW " + uow + " ### MODULE: " + zestModule );
- }
-
- @Override
- public void onEndRequest( final RequestCycle requestCycle )
- {
- UnitOfWork uow = uowf.currentUnitOfWork();
- if( uow != null )
- {
- try
- {
- if( "POST".equals( ( (HttpServletRequest) requestCycle.getRequest()
- .getContainerRequest() ).getMethod() ) )
- {
- // "Save"
- logger.debug( " ### COMPLETE " + uow + " ### MODULE: " + zestModule );
- uow.complete();
- }
- else
- {
- // GET requests
- logger.debug( " ### DISCARD " + uow + " ### MODULE: " + zestModule );
- uow.discard();
- }
- }
- catch( UnitOfWorkCompletionException e )
- {
- logger.error( " ### DISCARD " + uow + " ### MODULE: " + zestModule );
- uow.discard();
- e.printStackTrace();
- }
- }
- logger.debug( "REQUEST end" );
- logger.debug( "------------------------------------" );
- }
- } );
- }
-
- // Since Zest can only add concrete classes in the assembly, we need to implement a (dummy) getHomePage()
- // method here. Override in wicket application class with a real returned page class.
- @Override
- public Class<? extends Page> getHomePage()
- {
- return null;
- }
-
- @Override
- protected void onDestroy()
- {
- if( zestApp == null )
- {
- return;
- }
-
- try
- {
- logger.info( "Passivating Zest application" );
- zestApp.passivate();
- }
- catch( Exception e )
- {
- e.printStackTrace();
- }
- }
-
- public String appVersion()
- {
- return zestApp.version();
- }
-}
\ 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/infrastructure/conversion/DTO.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/DTO.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/DTO.java
deleted file mode 100644
index 511f346..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/conversion/DTO.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.infrastructure.conversion;
-
-import org.apache.zest.api.entity.Identity;
-import org.apache.zest.api.property.Immutable;
-import org.apache.zest.api.value.ValueComposite;
-
-/**
- * DTO
- *
- * Base class for DTOs
- *
- * Zest-comment:
- * ValueComposites that extend DTO are candidates to have association types converted and
- * assigned in the EntityToDTOService.
- */
-@Immutable
-public interface DTO extends ValueComposite, Identity
-{
-}
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/infrastructure/dci/Context.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/Context.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/Context.java
deleted file mode 100644
index c45ad7a..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/Context.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.dci;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-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.api.value.ValueComposite;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Context
- *
- * Base class for DCI Contexts
- *
- * Helps assigning Entity objects to Roles and to "inject" the Context object into Methodful Roles.
- */
-public abstract class Context
-{
- protected Logger logger = LoggerFactory.getLogger( getClass() );
-
- /**
- * We don't allow SubContexts to access the store directly
- *
- * All entities should be created through aggregate r
- */
- private static ValueBuilderFactory vbf;
- private static UnitOfWorkFactory uowf;
-
- protected Context()
- {
- }
-
- /*
- * Role assignment + Context "injection"
- *
- * Cast a Data object to a Role, set the Context object in the Role and return the RolePlayer.
- *
- * Requirements:
- * 1) SomeRole interface declares a 'void setContext(YourContext context);' method
- * 2) SomeRole.Mixin class extends RoleMixin<YourContext>
- *
- * The RolePlayer can then use the context pointer to lookup other Roles in the current Context.
- */
- protected <T> T rolePlayer( Class<T> roleClass, Object dataObject )
- {
- if( dataObject == null )
- {
- return null;
- }
-
- objectCanPlayRole( roleClass, dataObject );
- T rolePlayer = roleClass.cast( dataObject );
- setContext( rolePlayer, this );
- return rolePlayer;
- }
-
- private <T> void objectCanPlayRole( Class<T> roleClass, Object dataObject )
- {
- if( roleClass.isAssignableFrom( dataObject.getClass() ) )
- {
- return;
- }
-
- String className;
- if( dataObject instanceof Proxy )
- {
- className = Proxy.getInvocationHandler( dataObject ).getClass().getSimpleName();
- }
- else
- {
- className = dataObject.getClass().getSimpleName();
- }
-
- throw new IllegalArgumentException(
- "Object '" + className + "' can't play Role of '" + roleClass.getSimpleName() + "'" );
- }
-
- /*
- * Poor mans Context injection
- * */
- private <T> void setContext( T rolePlayer, Context context )
- {
- try
- {
- Method setContextMethod = rolePlayer.getClass().getDeclaredMethod( "setContext", context.getClass() );
-
- // Set Context in Role
- setContextMethod.invoke( rolePlayer, context );
- }
- catch( Exception e )
- {
- String c = context.getClass().getSimpleName();
- String r = rolePlayer.getClass().getSimpleName();
- String msg = "Couldn't invoke 'void setContext( " + c + " context);' on " + r + "." +
- "\nPlease check the following requirements: " +
- "\n1) 'void setContext( " + c + " context);' is declared in " + r + " interface." +
- "\n2) " + r + " extends RoleMixin<" + c + ">";
- logger.error( msg, e.getMessage() );
- e.printStackTrace();
- throw new RuntimeException( msg );
- }
- }
-
- // Entity object instantiation
-
- protected <T, U> T rolePlayer( Class<T> roleClass, Class<U> dataClass, String entityId )
- {
- U dataObject = uowf.currentUnitOfWork().get( dataClass, entityId );
- return rolePlayer( roleClass, dataObject );
- }
-
- protected static <T> T loadEntity( Class<T> entityRoleClass, String entityId )
- {
- return uowf.currentUnitOfWork().get( entityRoleClass, entityId );
- }
-
- protected static <T extends ValueComposite> ValueBuilder<T> valueBuilder( Class<T> valueClass )
- {
- return vbf.newValueBuilder( valueClass );
- }
-
- public static void prepareContextBaseClass( UnitOfWorkFactory uowf, ValueBuilderFactory vbf )
- {
- Context.uowf = uowf;
- Context.vbf = vbf;
- }
-}
\ 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/infrastructure/dci/RoleMixin.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/RoleMixin.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/RoleMixin.java
deleted file mode 100644
index 9e7a757..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/dci/RoleMixin.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.dci;
-
-import org.apache.zest.api.injection.scope.Structure;
-import org.apache.zest.api.query.QueryBuilderFactory;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueBuilderFactory;
-
-/**
- * RoleMixin
- *
- * Base class for Methodful Roles in Contexts
- *
- * Helps "inject" the Context object into the Role Player.
- *
- * The context field name is now "c" since we don't want the word "context" interfere
- * with domain semantics. We could for instance in one domain have some "material context"
- * where "context" is not a DCI Context but the context of some material. In that case a
- * DCI keyword "context" would confuse the semantics. We could also use "ctx", but why not
- * the shortest option? Less typing, and we know what it is. Furthermore a single letter is
- * easier to spot in the code masses than "ctx" (good to be able to quickly spot all uses
- * of the Context).
- */
-public abstract class RoleMixin<T extends Context>
-{
- // Context object reference
- public T c;
-
- // Other common role services/methods could be added here...
-
- @Structure
- public UnitOfWorkFactory uowf;
-
- @Structure
- public QueryBuilderFactory qbf;
-
- @Structure
- public ValueBuilderFactory vbf;
-
- /**
- * setContext is called with method invocation in {@link Context#setContext(Object, Context)}
- * (therefore "never used" according to IDE)
- */
- public void setContext( T context )
- {
- c = context;
- }
-}
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/infrastructure/model/EntityModel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java
deleted file mode 100644
index 4191630..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/EntityModel.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.model;
-
-import org.apache.wicket.model.IModel;
-import org.apache.zest.api.entity.EntityComposite;
-import org.apache.zest.api.entity.EntityReference;
-import org.apache.zest.api.entity.Identity;
-import org.apache.zest.api.unitofwork.NoSuchEntityException;
-import org.apache.zest.api.usecase.Usecase;
-import org.apache.zest.sample.dcicargo.sample_b.infrastructure.conversion.DTO;
-
-/**
- * EntityModel
- *
- * A Wicket Model that bridges to our Zest data store.
- *
- * In Wicket we need to be able to pass around serializable data that can be "detachable".
- * Zest entities are therefore lazy loaded with a class and identity through our UnitOfWork
- * and then converted to a DTO ValueComposite.
- */
-public class EntityModel<T extends Identity>
- extends ReadOnlyModel<T>
-{
- private Class<T> entityClass;
- private String identity;
- private Class<T> dtoClass;
-
- private transient T dtoComposite;
-
- public EntityModel( Class<T> entityClass, String identity, Class<T> dtoClass )
- {
- this.entityClass = entityClass;
- this.identity = identity;
- this.dtoClass = dtoClass;
- }
-
- public static <T extends Identity> IModel<T> of(
- Class<T> entityClass, String identity, Class<T> dtoClass
- )
- {
- return new EntityModel<T>( entityClass, identity, dtoClass );
- }
-
- public T getObject()
- {
- if( dtoComposite == null && identity != null )
- {
- dtoComposite = uowf.currentUnitOfWork().toValue( dtoClass, loadEntity() );
- }
- return dtoComposite;
- }
-
- public void detach()
- {
- dtoComposite = null;
- }
-
- private T loadEntity()
- {
- T entity = uowf.currentUnitOfWork().get( entityClass, identity );
- if( entity == null )
- {
- Usecase usecase = uowf.currentUnitOfWork().usecase();
- throw new NoSuchEntityException( EntityReference.parseEntityReference( identity ), entityClass, usecase );
- }
- return entity;
- }
-}
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/infrastructure/model/JSONModel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/JSONModel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/JSONModel.java
deleted file mode 100644
index 554d2e5..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/JSONModel.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.model;
-
-import org.apache.zest.api.value.ValueComposite;
-import org.apache.zest.api.value.ValueSerializer;
-
-/**
- * JSONModel
- *
- * Model that can serialize/de-serialize an object to/from a JSON string.
- */
-public class JSONModel<T, U extends ValueComposite>
- extends ReadOnlyModel<T>
-{
- private Class<U> valueCompositeClass;
- private String json;
- private transient T valueComposite;
-
- @SuppressWarnings( "unchecked" )
- public JSONModel( T valueComposite, Class<U> valueCompositeClass )
- {
- json = serviceFinder.findService( ValueSerializer.class ).get().serialize( (U) valueComposite );;
- this.valueCompositeClass = valueCompositeClass;
- }
-
- @SuppressWarnings( "unchecked" )
- public static <T, U extends ValueComposite> JSONModel<T, U> of( T value )
- {
- if( !( value instanceof ValueComposite ) )
- {
- throw new RuntimeException( value + " has to be an instance of a ValueComposite." );
- }
-
- // Get ValueComposite interface
- Class<U> valueCompositeClass = (Class<U>) api.valueDescriptorFor( value ).valueType().mainType();
-
- return new JSONModel<T, U>( value, valueCompositeClass );
- }
-
- @SuppressWarnings( "unchecked" )
- public T getObject()
- {
- if( valueComposite == null && json != null )
- {
- // De-serialize
- valueComposite = (T) vbf.newValueFromSerializedState( valueCompositeClass, json ); // Unchecked cast
- }
- return valueComposite;
- }
-
- public void detach()
- {
- valueComposite = null;
- }
-}
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/infrastructure/model/Queries.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/Queries.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/Queries.java
deleted file mode 100644
index d4e1ed6..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/Queries.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.model;
-
-import java.io.Serializable;
-import org.apache.zest.api.query.QueryBuilderFactory;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-
-/**
- * Queries
- *
- * Base class for Queries objects in our query package in the communication layer.
- */
-public class Queries
- implements Serializable // For Wicket (don't remove)
-{
- static protected UnitOfWorkFactory uowf;
- static protected QueryBuilderFactory qbf;
-
- public static void prepareQueriesBaseClass( UnitOfWorkFactory unitOfWorkFactory,
- QueryBuilderFactory queryBuilderFactory
- )
- {
- uowf = unitOfWorkFactory;
- qbf = queryBuilderFactory;
- }
-}
\ 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/infrastructure/model/QueryModel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/QueryModel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/QueryModel.java
deleted file mode 100644
index 96a132d..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/QueryModel.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.zest.api.entity.Identity;
-import org.apache.zest.api.query.Query;
-
-/**
- * QueryModel
- *
- * Callback Wicket model that holds a Zest Query object that can be called when needed to
- * retrieve fresh data.
- */
-public abstract class QueryModel<T extends Identity>
- extends ReadOnlyModel<List<T>>
-{
- private Class<T> dtoClass;
- private transient List<T> dtoList;
-
- public QueryModel( Class<T> dtoClass )
- {
- this.dtoClass = dtoClass;
- }
-
- public List<T> getObject()
- {
- if( dtoList != null )
- {
- return dtoList;
- }
-
- dtoList = new ArrayList<T>();
- for( T entity : getQuery() )
- {
- dtoList.add( getValue( entity ) );
- }
-
- return dtoList;
- }
-
- // Callback to retrieve the (unserializable) Zest Query object
- public abstract Query<T> getQuery();
-
- public T getValue( T entity )
- {
- Class<T> dtoClass = this.dtoClass;
- return uowf.currentUnitOfWork().toValue( dtoClass, entity );
- }
-
- public void detach()
- {
- dtoList = null;
- }
-}
\ 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/infrastructure/model/ReadOnlyModel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java
deleted file mode 100644
index bbb0d1f..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/model/ReadOnlyModel.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.model;
-
-import org.apache.wicket.model.IModel;
-import org.apache.zest.api.ZestAPI;
-import org.apache.zest.api.service.ServiceFinder;
-import org.apache.zest.api.structure.Module;
-import org.apache.zest.api.unitofwork.UnitOfWorkFactory;
-import org.apache.zest.api.value.ValueBuilderFactory;
-
-/**
- * ReadOnlyModel
- *
- * Abstract base model for Wicket model objects taking Zest objects.
- */
-public abstract class ReadOnlyModel<T>
- implements IModel<T>
-{
- private static final long serialVersionUID = 1L;
-
- static protected ZestAPI api;
- static protected ServiceFinder serviceFinder;
- static protected UnitOfWorkFactory uowf;
- static protected ValueBuilderFactory vbf;
-
- /**
- * This default implementation of setObject unconditionally throws an
- * UnsupportedOperationException. Since the method is final, any subclass is effectively a
- * read-only model.
- *
- * @param object The object to set into the model
- *
- * @throws UnsupportedOperationException
- */
- public final void setObject( final T object )
- {
- throw new UnsupportedOperationException( "Model " + getClass() +
- " does not support setObject(Object)" );
- }
-
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder( "Model:classname=[" );
- sb.append( getClass().getName() ).append( "]" );
- return sb.toString();
- }
-
- public static void prepareModelBaseClass( Module m,
- ZestAPI api
- )
- {
- uowf = m.unitOfWorkFactory();
- serviceFinder = m;
- vbf = m;
- ReadOnlyModel.api = api;
- }
-}
\ 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/infrastructure/wicket/color/CorrectColor.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/color/CorrectColor.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/color/CorrectColor.java
deleted file mode 100644
index f6908b4..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/color/CorrectColor.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.infrastructure.wicket.color;
-
-import org.apache.wicket.AttributeModifier;
-
-/**
- * CorrectColor
- *
- * Convenience method for adding an AttributeModifier based on a boolean value.
- */
-public class CorrectColor extends AttributeModifier
-{
- public CorrectColor( Boolean condition )
- {
- super( "class", condition ? "correctColor" : "VA_REMOVE" );
- }
-}
\ 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/infrastructure/wicket/color/ErrorColor.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/color/ErrorColor.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/color/ErrorColor.java
deleted file mode 100644
index fce93a5..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/color/ErrorColor.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.infrastructure.wicket.color;
-
-import org.apache.wicket.AttributeModifier;
-
-/**
- * ErrorColor
- *
- * Convenience method for adding an AttributeModifier based on a boolean value.
- */
-public class ErrorColor extends AttributeModifier
-{
- public ErrorColor( Boolean condition )
- {
- super( "class", condition ? "errorColor" : "VA_REMOVE" );
- }
-}
\ 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/infrastructure/wicket/form/AbstractForm.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/AbstractForm.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/AbstractForm.java
deleted file mode 100644
index d6e54a3..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/AbstractForm.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form;
-
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.markup.html.form.Button;
-import org.apache.wicket.markup.html.form.CheckBox;
-import org.apache.wicket.markup.html.form.FormComponent;
-import org.apache.wicket.markup.html.form.RadioChoice;
-import org.apache.wicket.markup.html.form.StatelessForm;
-import org.apache.wicket.util.visit.IVisit;
-import org.apache.wicket.util.visit.IVisitor;
-
-/**
- * AbstractForm
- *
- * Base class for forms.
- */
-public abstract class AbstractForm<T> extends StatelessForm<T>
-{
- public AbstractForm( String id )
- {
- super( id );
- }
-
- public AbstractForm()
- {
- super( "form" );
- }
-
- public void focusFirstError( final AjaxRequestTarget target )
- {
- visitFormComponents( new IVisitor<FormComponent<?>, Void>()
- {
- public void component( FormComponent<?> fc, IVisit<Void> visit )
- {
- if( isOtherComponent( fc ) || fc.isValid() )
- {
- return;
- }
-
- target.focusComponent( fc );
- visit.stop();
- }
- } );
- }
-
- private boolean isOtherComponent( FormComponent<?> fc )
- {
- return fc instanceof Button || fc instanceof CheckBox || fc instanceof RadioChoice;
- }
-}
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/infrastructure/wicket/form/DateTextFieldWithPicker.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/DateTextFieldWithPicker.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/DateTextFieldWithPicker.java
deleted file mode 100644
index 2983e03..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/DateTextFieldWithPicker.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form;
-
-import com.google.code.joliratools.StatelessAjaxEventBehavior;
-import java.time.LocalDate;
-import java.time.LocalTime;
-import java.time.ZoneOffset;
-import java.time.format.DateTimeFormatter;
-import java.util.Map;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.datetime.DateConverter;
-import org.apache.wicket.datetime.PatternDateConverter;
-import org.apache.wicket.datetime.markup.html.form.DateTextField;
-import org.apache.wicket.devutils.stateless.StatelessComponent;
-import org.apache.wicket.extensions.yui.calendar.DatePicker;
-import org.apache.wicket.markup.html.IHeaderResponse;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.validation.validator.DateValidator;
-
-import static java.util.Date.from;
-
-/**
- * DateTextFieldWithPicker
- *
- * Customized {@link DateTextField} with a {@link DatePicker}.
- */
-@StatelessComponent
-public class DateTextFieldWithPicker extends DateTextField
-{
- DatePicker datePicker;
-
- // Configurable widget options
- private LocalDate earliestDate;
- private LocalDate selectedDate;
-
- private final static DateTimeFormatter YUI_DATE_FORMAT = DateTimeFormatter.ofPattern( "MM/dd/yyyy" );
-
- public DateTextFieldWithPicker( String id, String label, Component model )
- {
-// this( id, new PropertyModel<Date>( model, id ), new StyleDateConverter( "S-", true ) );
- this( id, label, new PropertyModel<>( model, id ), new PatternDateConverter( "yyyy-MM-dd", true ) );
- }
-
- public DateTextFieldWithPicker( String id, String label, IModel<java.util.Date> model, DateConverter converter )
- {
- super( id, model, converter );
-
- // Make the text field reachable by Ajax requests
- setOutputMarkupId( true );
-
- // Set required as default
- setRequired( true );
-
- // Add Date Picker with callback configuration
- add( newDatePicker().setShowOnFieldClick( true ) );
-
- setNonEmptyLabel( label );
-
- // Show calendar if tabbing into the text field (weird it isn't default)
- add( new StatelessAjaxEventBehavior( "onfocus" )
- {
- @Override
- protected void onEvent( AjaxRequestTarget target )
- {
- String componentId = getComponent().getMarkupId();
- String widgetId = componentId + "DpJs";
- target.appendJavaScript(
- "Wicket.DateTime.showCalendar(" +
- "YAHOO.wicket['" + widgetId + "'], " +
- "document.getElementById('" + componentId + "').value, " +
- "'yyyy-MM-dd');"
- );
- }
-
- @Override
- protected PageParameters getPageParameters()
- {
- return null;
- }
- } );
-
-// add( new StatelessAjaxEventBehavior( "onBlur" )
-// {
-// @Override
-// protected void onEvent( AjaxRequestTarget target )
-// {
-// String componentId = getComponent().getMarkupId();
-// String widgetId = componentId + "DpJs";
-// target.appendJavaScript(
-// "Wicket.DateTime.showCalendar(" +
-// "YAHOO.wicket['" + widgetId + "'], " +
-// "document.getElementById('" + componentId + "').value, " +
-// "'yyyy-MM-dd');" +
-// "YAHOO.wicket['" + widgetId + "'].hide();" );
-// }
-//
-// @Override
-// protected PageParameters getPageParameters()
-// {
-// return null;
-// }
-// } );
- }
-
- private void setNonEmptyLabel( String label )
- {
- if( label == null )
- {
- return;
- }
-
- if( label.isEmpty() )
- {
- throw new IllegalArgumentException( "Can't set an empty label on the drop down selector." );
- }
-
- setLabel( Model.of( label ) );
- }
-
- /**
- * The DatePicker that gets added to the DateTextField component. Users may override this method
- * with a DatePicker of their choice.
- *
- * @return a new {@link DatePicker} instance
- */
- protected DatePicker newDatePicker()
- {
- return new DatePicker()
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void configure( final Map<String, Object> widgetProperties,
- final IHeaderResponse response, final Map<String, Object> initVariables
- )
- {
- super.configure( widgetProperties, response, initVariables );
-
- DateTextFieldWithPicker.this.configure( widgetProperties );
- }
- };
- }
-
- /**
- * Gives overriding classes the option of adding (or even changing/ removing) configuration
- * properties for the javascript widget. See <a
- * href="http://developer.yahoo.com/yui/calendar/">the widget's documentation</a> for the
- * available options. If you want to override/ remove properties, you should call
- * super.configure(properties) first. If you don't call that, be aware that you will have to
- * call {@literal #localize(Map)} manually if you like localized strings to be added.
- *
- * @param widgetProperties the current widget properties
- */
- protected void configure( Map<String, Object> widgetProperties )
- {
- // Set various YUI calendar options - add more if necessary
- widgetProperties.put( "mindate", getEarliestDateStr() );
- widgetProperties.put( "selected", getSelectedDateStr() );
- }
-
- public DateTextFieldWithPicker earliestDate( LocalDate newEarliestDate )
- {
- if( selectedDate != null && newEarliestDate.isAfter( selectedDate ) )
- {
- throw new IllegalArgumentException( "Earliest date can't be before selected day." );
- }
-
- earliestDate = newEarliestDate;
-
- // Input field validation - date should be _after_ minimumDate (not the same)
- LocalDate minimumDate = newEarliestDate.minusDays( 1 );
- add( DateValidator.minimum( from( minimumDate.atTime( LocalTime.now() ).toInstant( ZoneOffset.UTC ) ) ) );
-
- return this;
- }
-
- // Add latestDate(..) + other configuration options if needed..
-
- public DateTextFieldWithPicker selectedDate( LocalDate newSelectedDate )
- {
- if( earliestDate != null && newSelectedDate.isBefore( earliestDate ) )
- {
- throw new IllegalArgumentException( "Selected date can't be before earliest day." );
- }
-
- selectedDate = newSelectedDate;
-
- return this;
- }
-
- private String getSelectedDateStr()
- {
- if( selectedDate != null )
- {
- return YUI_DATE_FORMAT.format( selectedDate );
- }
-
- // Select today or earliest date (if later) as default
- return earliestDate == null ?
- YUI_DATE_FORMAT.format( LocalDate.now() ) :
- YUI_DATE_FORMAT.format( earliestDate );
- }
-
- private String getEarliestDateStr()
- {
- return earliestDate == null ? "" : YUI_DATE_FORMAT.format( earliestDate );
- }
-}
\ 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/infrastructure/wicket/form/SelectorInForm.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/SelectorInForm.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/SelectorInForm.java
deleted file mode 100644
index 27f6931..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/form/SelectorInForm.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.form;
-
-import java.util.List;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.util.ListModel;
-
-/**
- * SelectorInForm
- *
- * Convenience drop down list that resolves properties against a form.
- */
-public class SelectorInForm extends DropDownChoice<String>
-{
- PropertyModel<String> disablingPropertyModel;
- String disablingValue = "";
-
- public SelectorInForm( String property, String label, List<String> choices, Form form )
- {
- super( property + "Selector", new PropertyModel<String>( form, property ), new ListModel<String>( choices ) );
- setNonEmptyLabel( label );
- setOutputMarkupId( true );
- }
-
- public SelectorInForm( String property, String label, List<String> choices, Form form, String disablingProperty )
- {
- super( property + "Selector", new PropertyModel<String>( form, property ), new ListModel<String>( choices ) );
- disablingPropertyModel = new PropertyModel<String>( form, disablingProperty );
- setNonEmptyLabel( label );
- setOutputMarkupId( true );
- }
-
- private void setNonEmptyLabel( String label )
- {
- if( label == null )
- {
- return;
- }
-
- if( label.isEmpty() )
- {
- throw new IllegalArgumentException( "Can't set an empty label on the drop down selector." );
- }
-
- setLabel( Model.of( label ) );
- }
-
- @Override
- protected boolean isDisabled( final String currentValue, int index, String selected )
- {
- if( disablingPropertyModel != null )
- {
- disablingValue = disablingPropertyModel.getObject();
- }
-
- return currentValue.equals( disablingValue );
- }
-}
\ 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/infrastructure/wicket/link/LinkPanel.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/link/LinkPanel.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/link/LinkPanel.java
deleted file mode 100644
index 8188c1f..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/link/LinkPanel.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.link;
-
-import org.apache.wicket.Page;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-/**
- * LinkPanel
- *
- * Convenience panel for displaying a bookmarkable link
- */
-public class LinkPanel extends Panel
-{
- public <T extends Page> LinkPanel( String id, Class<T> pageClass, String rowId )
- {
- this( id, pageClass, rowId, rowId );
- }
-
- public <T extends Page> LinkPanel( String id, Class<T> pageClass, String rowId, String label )
- {
- super( id );
-
- PageParameters pageParameters = new PageParameters().set( 0, rowId );
- BookmarkablePageLink<Void> link = new BookmarkablePageLink<Void>( "link", pageClass, pageParameters );
- link.add( new Label( "label", label ) );
- add( link );
- }
-}
\ 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/infrastructure/wicket/page/BaseWebPage.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/page/BaseWebPage.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/page/BaseWebPage.java
deleted file mode 100644
index d094de7..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/page/BaseWebPage.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.page;
-
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.zest.api.composite.TransientBuilderFactory;
-import org.apache.zest.api.composite.TransientComposite;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * BaseWebPage
- *
- * Convenience base page to provide access to common resources
- */
-public class BaseWebPage extends WebPage
-{
- public Logger logger = LoggerFactory.getLogger( getClass() );
-
- static protected TransientBuilderFactory tbf;
-
- public BaseWebPage( PageParameters pageParameters )
- {
- super( pageParameters );
- }
-
- public BaseWebPage()
- {
- }
-
- public static <T extends TransientComposite> T query( Class<T> queryClass )
- {
- return tbf.newTransient( queryClass );
- }
-
- public static void prepareBaseWebPageClass( TransientBuilderFactory transientBuilderFactory )
- {
- tbf = transientBuilderFactory;
- }
-}
\ 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/infrastructure/wicket/prevnext/PrevNext.java
----------------------------------------------------------------------
diff --git a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/prevnext/PrevNext.java b/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/prevnext/PrevNext.java
deleted file mode 100644
index 485ab0a..0000000
--- a/samples/dci-cargo/dcisample_b/src/main/java/org/apache/zest/sample/dcicargo/sample_b/infrastructure/wicket/prevnext/PrevNext.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *
- */
-package org.apache.zest.sample.dcicargo.sample_b.infrastructure.wicket.prevnext;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.apache.wicket.AttributeModifier;
-import org.apache.wicket.MetaDataKey;
-import org.apache.wicket.Page;
-import org.apache.wicket.Session;
-import org.apache.wicket.devutils.stateless.StatelessComponent;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-
-/**
- * PrevNext
- *
- * Panel for displaying and administrating pre/next arrows to browse detail pages
- * of records from a list. Record ids are kept in the session. Also takes care of
- * showing disabled icons at beginning/end.
- */
-@StatelessComponent
-public class PrevNext extends Panel
-{
- private static final MetaDataKey<ArrayList<String>> PREV_NEXT_PANEL_KEY = new MetaDataKey<ArrayList<String>>()
- {
- private static final long serialVersionUID = 1L;
- };
-
- public static void registerIds( Session session, ArrayList<String> ids )
- {
- if( ids == null || ids.isEmpty() )
- {
- throw new RuntimeException( "Please register a list of ids." );
- }
-
- session.setMetaData( PREV_NEXT_PANEL_KEY, ids );
- session.bind();
- }
-
- public static void addId( Session session, String id )
- {
- if( id == null || id.isEmpty() )
- {
- throw new RuntimeException( "Can't register empty id." );
- }
-
- ArrayList<String> ids = session.getMetaData( PREV_NEXT_PANEL_KEY );
- if( ids == null || ids.isEmpty() )
- {
- ids = new ArrayList<String>();
- }
-
- ids.add( id );
- session.setMetaData( PREV_NEXT_PANEL_KEY, ids );
- session.bind();
- }
-
- public PrevNext( String id, Class<? extends Page> pageClass, String actualId )
- {
- super( id );
-
- List<String> ids = getSession().getMetaData( PREV_NEXT_PANEL_KEY );
-
- if( ids == null || ids.size() == 0 )
- {
- setEnabled( false );
- setVisible( false );
- return;
- }
-
- String prev = null;
- String current;
- for( Iterator<String> it = ids.iterator(); it.hasNext(); )
- {
- current = it.next();
- if( current.equals( actualId ) )
- {
- if( prev == null )
- {
- add( new WebMarkupContainer( "prev" ).add( new AttributeModifier( "class", "prevDisabled" ) ) );
- }
- else
- {
- add( new BookmarkablePageLink<Void>( "prev", pageClass, new PageParameters().set( 0, prev ) ) );
- }
-
- if( !it.hasNext() )
- {
- add( new WebMarkupContainer( "next" ).add( new AttributeModifier( "class", "nextDisabled" ) ) );
- }
- else
- {
- add( new BookmarkablePageLink<Void>( "next", pageClass, new PageParameters().set( 0, it.next() ) ) );
- }
-
- return;
- }
- prev = current;
- }
-
- throw new RuntimeException( "Passed tracking id was not found in the PrevNextSession." );
- }
-}
\ No newline at end of file