Quellcode durchsuchen

[maven-release-plugin] copy for tag register-app-1.1.0

peter_backlund vor 17 Jahren
Ursprung
Commit
ef770695f8
100 geänderte Dateien mit 0 neuen und 5659 gelöschten Zeilen
  1. 0
    0
      assembly.xml
  2. 0
    19
      dddsample/license.txt
  3. 0
    304
      dddsample/pom.xml
  4. 0
    221
      dddsample/src/main/config/checkstyle.xml
  5. 0
    264
      dddsample/src/main/config/dddsample-format-eclipse.pref
  6. 0
    181
      dddsample/src/main/java/com/aggregator/HandlingReport.java
  7. 0
    32
      dddsample/src/main/java/com/aggregator/HandlingReportErrors.java
  8. 0
    54
      dddsample/src/main/java/com/aggregator/HandlingReportErrors_Exception.java
  9. 0
    39
      dddsample/src/main/java/com/aggregator/HandlingReportService.java
  10. 0
    72
      dddsample/src/main/java/com/aggregator/HandlingReportService.wsdl
  11. 0
    66
      dddsample/src/main/java/com/aggregator/HandlingReportServiceService.java
  12. 0
    97
      dddsample/src/main/java/com/aggregator/ObjectFactory.java
  13. 0
    60
      dddsample/src/main/java/com/aggregator/SubmitReport.java
  14. 0
    32
      dddsample/src/main/java/com/aggregator/SubmitReportResponse.java
  15. 0
    2
      dddsample/src/main/java/com/aggregator/package-info.java
  16. 0
    7
      dddsample/src/main/java/com/aggregator/package.html
  17. 0
    26
      dddsample/src/main/java/com/pathfinder/api/GraphTraversalService.java
  18. 0
    59
      dddsample/src/main/java/com/pathfinder/api/TransitEdge.java
  19. 0
    29
      dddsample/src/main/java/com/pathfinder/api/TransitPath.java
  20. 0
    7
      dddsample/src/main/java/com/pathfinder/api/package.html
  21. 0
    27
      dddsample/src/main/java/com/pathfinder/internal/GraphDAO.java
  22. 0
    83
      dddsample/src/main/java/com/pathfinder/internal/GraphTraversalServiceImpl.java
  23. 0
    7
      dddsample/src/main/java/com/pathfinder/internal/package.html
  24. 0
    14
      dddsample/src/main/java/com/pathfinder/package.html
  25. 0
    44
      dddsample/src/main/java/se/citerus/dddsample/application/ApplicationEvents.java
  26. 0
    47
      dddsample/src/main/java/se/citerus/dddsample/application/BookingService.java
  27. 0
    19
      dddsample/src/main/java/se/citerus/dddsample/application/CargoInspectionService.java
  28. 0
    35
      dddsample/src/main/java/se/citerus/dddsample/application/HandlingEventService.java
  29. 0
    92
      dddsample/src/main/java/se/citerus/dddsample/application/impl/BookingServiceImpl.java
  30. 0
    56
      dddsample/src/main/java/se/citerus/dddsample/application/impl/CargoInspectionServiceImpl.java
  31. 0
    60
      dddsample/src/main/java/se/citerus/dddsample/application/impl/HandlingEventServiceImpl.java
  32. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/application/impl/package.html
  33. 0
    16
      dddsample/src/main/java/se/citerus/dddsample/application/package.html
  34. 0
    39
      dddsample/src/main/java/se/citerus/dddsample/application/util/DateTestUtil.java
  35. 0
    333
      dddsample/src/main/java/se/citerus/dddsample/application/util/SampleDataGenerator.java
  36. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/application/util/package.html
  37. 0
    194
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Cargo.java
  38. 0
    34
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/CargoRepository.java
  39. 0
    333
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Delivery.java
  40. 0
    88
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/HandlingActivity.java
  41. 0
    165
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Itinerary.java
  42. 0
    92
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Leg.java
  43. 0
    100
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/RouteSpecification.java
  44. 0
    16
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/RoutingStatus.java
  45. 0
    59
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/TrackingId.java
  46. 0
    15
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/TransportStatus.java
  47. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/package.html
  48. 0
    19
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/CannotCreateHandlingEventException.java
  49. 0
    226
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingEvent.java
  50. 0
    89
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingEventFactory.java
  51. 0
    24
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingEventRepository.java
  52. 0
    74
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingHistory.java
  53. 0
    26
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/UnknownCargoException.java
  54. 0
    17
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/UnknownLocationException.java
  55. 0
    20
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/UnknownVoyageException.java
  56. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/package.html
  57. 0
    97
      dddsample/src/main/java/se/citerus/dddsample/domain/model/location/Location.java
  58. 0
    22
      dddsample/src/main/java/se/citerus/dddsample/domain/model/location/LocationRepository.java
  59. 0
    52
      dddsample/src/main/java/se/citerus/dddsample/domain/model/location/SampleLocations.java
  60. 0
    71
      dddsample/src/main/java/se/citerus/dddsample/domain/model/location/UnLocode.java
  61. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/domain/model/location/package.html
  62. 0
    9
      dddsample/src/main/java/se/citerus/dddsample/domain/model/package.html
  63. 0
    113
      dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/CarrierMovement.java
  64. 0
    134
      dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/SampleVoyages.java
  65. 0
    59
      dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/Schedule.java
  66. 0
    110
      dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/Voyage.java
  67. 0
    54
      dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/VoyageNumber.java
  68. 0
    13
      dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/VoyageRepository.java
  69. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/package.html
  70. 0
    14
      dddsample/src/main/java/se/citerus/dddsample/domain/package.html
  71. 0
    20
      dddsample/src/main/java/se/citerus/dddsample/domain/service/RoutingService.java
  72. 0
    9
      dddsample/src/main/java/se/citerus/dddsample/domain/service/package.html
  73. 0
    35
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/AbstractSpecification.java
  74. 0
    28
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/AndSpecification.java
  75. 0
    17
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/DomainEvent.java
  76. 0
    30
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/DomainObjectUtils.java
  77. 0
    17
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/Entity.java
  78. 0
    25
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/NotSpecification.java
  79. 0
    28
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/OrSpecification.java
  80. 0
    39
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/Specification.java
  81. 0
    19
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/ValueObject.java
  82. 0
    17
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/DomainEvent.java
  83. 0
    24
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/Entity.java
  84. 0
    71
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/EntitySupport.java
  85. 0
    15
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/Identity.java
  86. 0
    24
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/ValueObject.java
  87. 0
    60
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/ValueObjectSupport.java
  88. 0
    8
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/package.html
  89. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/domain/shared/package.html
  90. 0
    39
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/messaging/jms/CargoHandledConsumer.java
  91. 0
    43
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/messaging/jms/HandlingEventRegistrationAttemptConsumer.java
  92. 0
    95
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/messaging/jms/JmsApplicationEventsImpl.java
  93. 0
    18
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/messaging/jms/SimpleLoggingConsumer.java
  94. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/messaging/jms/package.html
  95. 0
    42
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/CargoRepositoryHibernate.java
  96. 0
    30
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/HandlingEventRepositoryHibernate.java
  97. 0
    23
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/HibernateRepository.java
  98. 0
    24
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/LocationRepositoryHibernate.java
  99. 0
    21
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/VoyageRepositoryHibernate.java
  100. 0
    0
      dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/package.html

register-app/assembly.xml → assembly.xml Datei anzeigen


+ 0
- 19
dddsample/license.txt Datei anzeigen

@@ -1,19 +0,0 @@
1
-Copyright (c) 2008-2009 Citerus AB and Domain Language, Inc.
2
-
3
-Permission is hereby granted, free of charge, to any person obtaining a copy
4
-of this software and associated documentation files (the "Software"), to deal
5
-in the Software without restriction, including without limitation the rights
6
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
-copies of the Software, and to permit persons to whom the Software is
8
-furnished to do so, subject to the following conditions:
9
-
10
-The above copyright notice and this permission notice shall be included in
11
-all copies or substantial portions of the Software.
12
-
13
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
-THE SOFTWARE.

+ 0
- 304
dddsample/pom.xml Datei anzeigen

@@ -1,304 +0,0 @@
1
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
-  <modelVersion>4.0.0</modelVersion>
4
-  <groupId>se.citerus</groupId>
5
-  <artifactId>dddsample</artifactId>
6
-  <packaging>war</packaging>
7
-  <name>DDDSample</name>
8
-  <version>1.2-SNAPSHOT</version>
9
-  <description>This application shows a few key concepts of
10
-    Domain Driven Design implemented in Enterprise Java.
11
-  </description>
12
-  <url>http://dddsample.sourceforge.net</url>
13
-  <distributionManagement>
14
-    <site>
15
-      <id>sf</id>
16
-      <url>scp://shell.sf.net/home/groups/d/dd/dddsample/htdocs/preview</url>
17
-    </site>
18
-  </distributionManagement>
19
-  <ciManagement/>
20
-  <developers>
21
-    <developer>
22
-      <id>eric_evans</id>
23
-      <name>Eric Evans</name>
24
-      <organization>Domain Language, Inc.</organization>
25
-      <organizationUrl>http://www.domainlanguage.com</organizationUrl>
26
-      <timezone>-8</timezone>
27
-    </developer>
28
-    <developer>
29
-      <id>peba</id>
30
-      <name>Peter Backlund</name>
31
-      <organization>Citerus</organization>
32
-      <organizationUrl>http://www.citerus.se</organizationUrl>
33
-      <timezone>+1</timezone>
34
-    </developer>
35
-    <developer>
36
-      <id>patrikfr</id>
37
-      <name>Patrik Fredriksson</name>
38
-      <organization>Citerus</organization>
39
-      <organizationUrl>http://www.citerus.se</organizationUrl>
40
-      <timezone>+1</timezone>
41
-    </developer>
42
-    <developer>
43
-      <id>jeham</id>
44
-      <name>Jesper Hammarback</name>
45
-      <organization>Citerus</organization>
46
-      <organizationUrl>http://www.citerus.se</organizationUrl>
47
-      <timezone>+1</timezone>
48
-    </developer>
49
-    <developer>
50
-      <id>jorgen_falk</id>
51
-      <name>Jorgen Falk</name>
52
-      <organization>Citerus</organization>
53
-      <organizationUrl>http://www.citerus.se</organizationUrl>
54
-      <timezone>+1</timezone>
55
-    </developer>
56
-  </developers>
57
-  <licenses>
58
-    <license>
59
-      <name>MIT</name>
60
-      <url>http://www.opensource.org/licenses/mit-license.php</url>
61
-      <distribution>repo</distribution>
62
-    </license>
63
-  </licenses>
64
-  <scm>
65
-    <developerConnection>scm:svn:https://dddsample.svn.sourceforge.net/svnroot/dddsample</developerConnection>
66
-    <url>http://ddd.sventon.org</url>
67
-  </scm>
68
-  <properties>
69
-    <spring.version>2.5.6</spring.version>
70
-    <cxf.version>2.1.3</cxf.version>
71
-  </properties>
72
-  <build>
73
-    <plugins>
74
-      <!-- Compiler -->
75
-      <plugin>
76
-        <artifactId>maven-compiler-plugin</artifactId>
77
-        <configuration>
78
-          <source>1.6</source>
79
-          <target>1.6</target>
80
-          <encoding>UTF-8</encoding>
81
-        </configuration>
82
-      </plugin>
83
-
84
-      <!-- Jetty plugin -->
85
-      <plugin>
86
-        <groupId>org.mortbay.jetty</groupId>
87
-        <artifactId>maven-jetty-plugin</artifactId>
88
-      </plugin>
89
-
90
-      <plugin>
91
-        <artifactId>maven-jar-plugin</artifactId>
92
-        <executions>
93
-
94
-          <!-- Package booking service facade classes in separate jar -->
95
-          <execution>
96
-            <id>package-booking-facade</id>
97
-            <phase>package</phase>
98
-            <goals>
99
-              <goal>jar</goal>
100
-            </goals>
101
-            <configuration>
102
-              <classifier>booking-facade</classifier>
103
-              <includes>
104
-                <include>**/se/citerus/dddsample/interfaces/booking/facade/*.class</include>
105
-                <include>**/se/citerus/dddsample/interfaces/booking/facade/dto/*.class</include>
106
-              </includes>
107
-              <archive>
108
-                <addMavenDescriptor>false</addMavenDescriptor>
109
-              </archive>
110
-            </configuration>
111
-          </execution>
112
-        </executions>
113
-      </plugin>
114
-
115
-      <!-- Assembly -->
116
-      <plugin>
117
-        <artifactId>maven-assembly-plugin</artifactId>
118
-        <configuration>
119
-          <descriptorRefs>
120
-            <descriptorRef>src</descriptorRef>
121
-          </descriptorRefs>
122
-        </configuration>
123
-      </plugin>
124
-      
125
-    </plugins>
126
-  </build>
127
-  <dependencies>
128
-    <dependency>
129
-      <groupId>junit</groupId>
130
-      <artifactId>junit</artifactId>
131
-      <version>4.4</version>
132
-      <scope>test</scope>
133
-    </dependency>
134
-    <dependency>
135
-      <groupId>org.springframework</groupId>
136
-      <artifactId>spring-webmvc</artifactId>
137
-      <version>${spring.version}</version>
138
-    </dependency>
139
-    <dependency>
140
-      <groupId>org.springframework</groupId>
141
-      <artifactId>spring-web</artifactId>
142
-      <version>${spring.version}</version>
143
-    </dependency>
144
-    <dependency>
145
-      <groupId>org.springframework</groupId>
146
-      <artifactId>spring</artifactId>
147
-      <version>${spring.version}</version>
148
-      <exclusions>
149
-        <exclusion>
150
-          <groupId>commons-logging</groupId>
151
-          <artifactId>commons-logging</artifactId>
152
-        </exclusion>
153
-      </exclusions>
154
-    </dependency>
155
-    <dependency>
156
-      <groupId>org.springframework</groupId>
157
-      <artifactId>spring-test</artifactId>
158
-      <version>${spring.version}</version>
159
-      <scope>test</scope>
160
-    </dependency>
161
-    <dependency>
162
-      <groupId>org.hibernate</groupId>
163
-      <artifactId>hibernate-core</artifactId>
164
-      <version>3.3.1.GA</version>
165
-      <!-- God, what is it with Java and logging frameworks... http://forum.hibernate.org/viewtopic.php?p=2401380 -->
166
-      <exclusions>
167
-        <exclusion>
168
-          <groupId>org.slf4j</groupId>
169
-          <artifactId>slf4j-api</artifactId>
170
-        </exclusion>
171
-      </exclusions>
172
-    </dependency>
173
-    <dependency>
174
-      <groupId>org.slf4j</groupId>
175
-      <artifactId>slf4j-log4j12</artifactId>
176
-      <version>1.5.6</version>
177
-    </dependency>
178
-    <dependency>
179
-      <groupId>org.slf4j</groupId>
180
-      <artifactId>jcl-over-slf4j</artifactId>
181
-      <version>1.5.6</version>
182
-    </dependency>
183
-    <dependency>
184
-      <groupId>org.slf4j</groupId>
185
-      <artifactId>slf4j-api</artifactId>
186
-      <version>1.5.6</version>
187
-    </dependency>
188
-    <dependency>
189
-      <groupId>javassist</groupId>
190
-      <artifactId>javassist</artifactId>
191
-      <version>3.8.0.GA</version>
192
-    </dependency>
193
-    <dependency>
194
-      <groupId>org.hibernate</groupId>
195
-      <artifactId>hibernate-annotations</artifactId>
196
-      <version>3.4.0.GA</version>
197
-    </dependency>
198
-    <dependency>
199
-      <groupId>commons-lang</groupId>
200
-      <artifactId>commons-lang</artifactId>
201
-      <version>2.3</version>
202
-    </dependency>
203
-    <dependency>
204
-      <groupId>commons-io</groupId>
205
-      <artifactId>commons-io</artifactId>
206
-      <version>1.3.1</version>
207
-    </dependency>
208
-    <dependency>
209
-      <groupId>commons-dbcp</groupId>
210
-      <artifactId>commons-dbcp</artifactId>
211
-      <version>1.2.2</version>
212
-    </dependency>
213
-    <dependency>
214
-      <groupId>hsqldb</groupId>
215
-      <artifactId>hsqldb</artifactId>
216
-      <version>1.8.0.7</version>
217
-    </dependency>
218
-    <dependency>
219
-      <groupId>javax.servlet</groupId>
220
-      <artifactId>servlet-api</artifactId>
221
-      <version>2.5</version>
222
-      <scope>provided</scope>
223
-    </dependency>
224
-    <dependency>
225
-      <groupId>taglibs</groupId>
226
-      <artifactId>standard</artifactId>
227
-      <version>1.1.2</version>
228
-    </dependency>
229
-    <dependency>
230
-      <groupId>javax.servlet</groupId>
231
-      <artifactId>jstl</artifactId>
232
-      <version>1.1.2</version>
233
-    </dependency>
234
-    <dependency>
235
-      <groupId>opensymphony</groupId>
236
-      <artifactId>sitemesh</artifactId>
237
-      <version>2.3</version>
238
-      <scope>runtime</scope>
239
-    </dependency>
240
-    <dependency>
241
-      <groupId>org.apache.activemq</groupId>
242
-      <artifactId>activemq-core</artifactId>
243
-      <version>5.2.0</version>
244
-      <exclusions>
245
-        <exclusion>
246
-          <groupId>commons-logging</groupId>
247
-          <artifactId>commons-logging-api</artifactId>
248
-        </exclusion>
249
-      </exclusions>
250
-    </dependency>
251
-    <dependency>
252
-      <groupId>org.apache.xbean</groupId>
253
-      <artifactId>xbean-spring</artifactId>
254
-      <version>3.4.3</version>
255
-    </dependency>
256
-    <dependency>
257
-      <groupId>org.easymock</groupId>
258
-      <artifactId>easymock</artifactId>
259
-      <version>2.3</version>
260
-      <scope>test</scope>
261
-    </dependency>
262
-    <dependency>
263
-      <groupId>org.apache.cxf</groupId>
264
-      <artifactId>cxf-rt-frontend-jaxws</artifactId>
265
-      <version>${cxf.version}</version>
266
-    </dependency>
267
-    <dependency>
268
-      <groupId>org.apache.cxf</groupId>
269
-      <artifactId>cxf-rt-transports-http</artifactId>
270
-      <version>${cxf.version}</version>
271
-    </dependency>
272
-  </dependencies>
273
-
274
-  <reporting>
275
-    <plugins>
276
-      <!-- Javadoc -->
277
-      <plugin>
278
-        <artifactId>maven-javadoc-plugin</artifactId>
279
-      </plugin>
280
-      <!-- Source code cross reference -->
281
-      <plugin>
282
-        <artifactId>maven-jxr-plugin</artifactId>
283
-      </plugin>
284
-      <!-- Test report -->
285
-      <plugin>
286
-        <artifactId>maven-surefire-report-plugin</artifactId>
287
-      </plugin>
288
-      <!-- Test coverage -->
289
-      <plugin>
290
-        <groupId>org.codehaus.mojo</groupId>
291
-        <artifactId>cobertura-maven-plugin</artifactId>
292
-      </plugin>
293
-      <!-- CheckStyle report -->
294
-      <plugin>
295
-        <artifactId>maven-checkstyle-plugin</artifactId>
296
-        <configuration>
297
-          <configLocation>src/main/config/checkstyle.xml</configLocation>
298
-          <!-- Java source code generated from WSDL -->
299
-          <excludes>**/com/aggregator/**/*</excludes>
300
-        </configuration>
301
-      </plugin>
302
-    </plugins>
303
-  </reporting>
304
-</project>

+ 0
- 221
dddsample/src/main/config/checkstyle.xml Datei anzeigen

@@ -1,221 +0,0 @@
1
-<?xml version="1.0"?>
2
-<!-- 
3
-/*
4
- * Copyright 2001-2004 The Apache Software Foundation.
5
- * 
6
- * Licensed under the Apache License, Version 2.0 (the "License");
7
- * you may not use this file except in compliance with the License.
8
- * You may obtain a copy of the License at
9
- * 
10
- *      http://www.apache.org/licenses/LICENSE-2.0
11
- * 
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- */
18
- -->
19
-
20
-<!DOCTYPE module PUBLIC
21
-    "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
22
-    "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
23
-
24
-<!--
25
-
26
-  Checkstyle configuration that checks the sun coding conventions from:
27
-
28
-    - the Java Language Specification at
29
-      http://java.sun.com/docs/books/jls/second_edition/html/index.html
30
-
31
-    - the Sun Code Conventions at http://java.sun.com/docs/codeconv/
32
-
33
-    - the Javadoc guidelines at
34
-      http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
35
-
36
-    - the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
37
-
38
-    - some best practices
39
-
40
-  Checkstyle is very configurable. Be sure to read the documentation at
41
-  http://checkstyle.sf.net (or in your downloaded distribution).
42
-
43
-  Most Checks are configurable, be sure to consult the documentation.
44
-
45
-  To completely disable a check, just comment it out or delete it from the file.
46
-
47
-  Finally, it is worth reading the documentation.
48
-
49
--->
50
-
51
-<module name="Checker">
52
-
53
-    <!-- Checks that a package.html file exists for each package.     -->
54
-    <!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
55
-    <module name="PackageHtml"/>
56
-
57
-    <!-- Checks whether files end with a new line.                        -->
58
-    <!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
59
-    <module name="NewlineAtEndOfFile"/>
60
-
61
-    <!-- Checks that property files contain the same keys.         -->
62
-    <!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
63
-    <module name="Translation"/>
64
-
65
-
66
-    <module name="TreeWalker">
67
-
68
-        <property name="cacheFile" value="${checkstyle.cache.file}"/>
69
-
70
-        <!-- Checks for Javadoc comments.                     -->
71
-        <!-- See http://checkstyle.sf.net/config_javadoc.html -->
72
-        <module name="JavadocMethod"/>
73
-        <module name="JavadocType">
74
-          <property name="scope" value="public"/>
75
-        </module>
76
-        <module name="JavadocVariable">
77
-          <property name="scope" value="public"/>
78
-        </module>
79
-        <module name="JavadocStyle"/>
80
-
81
-        <!-- Checks for Naming Conventions.                  -->
82
-        <!-- See http://checkstyle.sf.net/config_naming.html -->
83
-        <module name="ConstantName"/>
84
-        <module name="LocalFinalVariableName"/>
85
-        <module name="LocalVariableName"/>
86
-        <module name="MemberName"/>
87
-        <module name="MethodName"/>
88
-        <module name="PackageName"/>
89
-        <module name="ParameterName"/>
90
-        <module name="StaticVariableName"/>
91
-        <module name="TypeName"/>
92
-
93
-
94
-        <!-- Checks for Headers                                -->
95
-        <!-- See http://checkstyle.sf.net/config_header.html   -->
96
-        <!-- <module name="Header">                            -->
97
-            <!-- The follow property value demonstrates the ability     -->
98
-            <!-- to have access to ANT properties. In this case it uses -->
99
-            <!-- the ${basedir} property to allow Checkstyle to be run  -->
100
-            <!-- from any directory within a project. See property      -->
101
-            <!-- expansion,                                             -->
102
-            <!-- http://checkstyle.sf.net/config.html#properties        -->
103
-            <!-- <property                                              -->
104
-            <!--     name="headerFile"                                  -->
105
-            <!--     value="${basedir}/java.header"/>                   -->
106
-        <!-- </module> -->
107
-
108
-        <!-- Following interprets the header file as regular expressions. -->
109
-        <!-- <module name="RegexpHeader"/>                                -->
110
-
111
-
112
-        <!-- Checks for imports                              -->
113
-        <!-- See http://checkstyle.sf.net/config_import.html -->
114
-        <module name="AvoidStarImport"/>
115
-        <module name="IllegalImport"/> <!-- defaults to sun.* packages -->
116
-        <module name="RedundantImport"/>
117
-        <module name="UnusedImports"/>
118
-
119
-
120
-        <!-- Checks for Size Violations.                    -->
121
-        <!-- See http://checkstyle.sf.net/config_sizes.html -->
122
-        <module name="FileLength"/>
123
-
124
-        <module name="LineLength">
125
-         <property name="max" value="120"/>
126
-        </module>
127
-
128
-        <module name="MethodLength"/>
129
-        <module name="ParameterNumber"/>
130
-
131
-
132
-        <!-- Checks for whitespace                               -->
133
-        <!-- See http://checkstyle.sf.net/config_whitespace.html -->
134
-        <module name="EmptyForIteratorPad"/>
135
-        <module name="MethodParamPad"/>
136
-
137
-        <module name="NoWhitespaceAfter">
138
-          <!-- Default tokens and additional GENERIC_START -->
139
-          <property name="tokens" value="ARRAY_INIT, BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS, GENERIC_START"/>
140
-        </module>
141
-        
142
-        <module name="NoWhitespaceBefore">
143
-          <!-- Default tokens and additional GENERIC_START and GENERIC_END -->
144
-          <property name="tokens" value="SEMI, POST_DEC, POST_INC, GENERIC_START, GENERIC_END"/>
145
-        </module>
146
-        
147
-        <module name="WhitespaceAfter">
148
-          <!-- Default tokens and additional GENERIC_END -->
149
-          <property name="tokens" value="COMMA, SEMI, TYPECAST, GENERIC_END"/>
150
-        </module>
151
-        
152
-        <module name="WhitespaceAround">
153
-          <!-- Default tokens without GENERIC_START and GENERIC_END -->
154
-          <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN,
155
-        BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON,
156
-        DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, 
157
-        LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, 
158
-        LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN,
159
-        LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS,
160
-        MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN,
161
-        QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,
162
-        TYPE_EXTENSION_AND, WILDCARD_TYPE"/>
163
-        </module>
164
-        
165
-        <module name="OperatorWrap"/>
166
-        <module name="ParenPad"/>
167
-        <module name="TypecastParenPad"/>
168
-        <module name="TabCharacter"/>
169
-
170
-
171
-        <!-- Modifier Checks                                    -->
172
-        <!-- See http://checkstyle.sf.net/config_modifiers.html -->
173
-        <module name="ModifierOrder"/>
174
-        <module name="RedundantModifier"/>
175
-
176
-
177
-        <!-- Checks for blocks. You know, those {}'s         -->
178
-        <!-- See http://checkstyle.sf.net/config_blocks.html -->
179
-        <module name="AvoidNestedBlocks"/>
180
-        <module name="EmptyBlock"/>
181
-        <module name="LeftCurly"/>
182
-        <module name="NeedBraces"/>
183
-        <module name="RightCurly"/>
184
-
185
-
186
-        <!-- Checks for common coding problems               -->
187
-        <!-- See http://checkstyle.sf.net/config_coding.html -->
188
-        <module name="DoubleCheckedLocking"/>    <!-- MY FAVOURITE -->
189
-        <module name="EmptyStatement"/>
190
-        <module name="EqualsHashCode"/>
191
-        <module name="IllegalInstantiation"/>
192
-        <module name="InnerAssignment"/>
193
-        <module name="MagicNumber"/>
194
-        <module name="MissingSwitchDefault"/>
195
-        <module name="RedundantThrows"/>
196
-        <module name="SimplifyBooleanExpression"/>
197
-        <module name="SimplifyBooleanReturn"/>
198
-
199
-        <!-- Checks for class design                         -->
200
-        <!-- See http://checkstyle.sf.net/config_design.html -->
201
-        <module name="DesignForExtension"/>
202
-        <module name="FinalClass"/>
203
-        <module name="HideUtilityClassConstructor"/>
204
-        <module name="InterfaceIsType"/>
205
-        <module name="VisibilityModifier"/>
206
-
207
-
208
-        <!-- Miscellaneous other checks.                   -->
209
-        <!-- See http://checkstyle.sf.net/config_misc.html -->
210
-        <module name="ArrayTypeStyle"/>
211
-        <module name="FinalParameters"/>
212
-        <module name="GenericIllegalRegexp">
213
-            <property name="format" value="\s+$"/>
214
-            <property name="message" value="Line has trailing spaces."/>
215
-        </module>
216
-        <module name="TodoComment"/>
217
-        <module name="UpperEll"/>
218
-
219
-    </module>
220
-
221
-</module>

+ 0
- 264
dddsample/src/main/config/dddsample-format-eclipse.pref Datei anzeigen

@@ -1,264 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<profiles version="11">
3
-<profile kind="CodeFormatterProfile" name="DDDSample App code convention" version="11">
4
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
5
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
6
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
7
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
8
-<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
9
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
10
-<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
11
-<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
12
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
13
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
14
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
15
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
16
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value="insert"/>
17
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
18
-<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
19
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
20
-<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
21
-<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
22
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
23
-<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="2"/>
24
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
25
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
26
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
27
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
28
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
29
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
30
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value="insert"/>
31
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
32
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
33
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
34
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
35
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
36
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
37
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
38
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
39
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
40
-<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
41
-<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
42
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
43
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
44
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
45
-<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
46
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
47
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
48
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
49
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
50
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
51
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
52
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
53
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value="insert"/>
54
-<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
55
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
56
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
57
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
58
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
59
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
60
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
61
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
62
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
63
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
64
-<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
65
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
66
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
67
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
68
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
69
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
70
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
71
-<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
72
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
73
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value="insert"/>
74
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
75
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
76
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
77
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
78
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
79
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
80
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value="insert"/>
81
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
82
-<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
83
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
84
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
85
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
86
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
87
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
88
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
89
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
90
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
91
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
92
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value="insert"/>
93
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
94
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
95
-<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
96
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value="insert"/>
97
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
98
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
99
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
100
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
101
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
102
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
103
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
104
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
105
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
106
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
107
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
108
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
109
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
110
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
111
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
112
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
113
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
114
-<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
115
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
116
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
117
-<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
118
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
119
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value="insert"/>
120
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value="16"/>
121
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
122
-<setting id="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value="true"/>
123
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
124
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
125
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
126
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
127
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
128
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
129
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
130
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
131
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
132
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
133
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
134
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
135
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
136
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
137
-<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
138
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
139
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
140
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
141
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
142
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
143
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
144
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
145
-<setting id="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value="error"/>
146
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
147
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
148
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
149
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
150
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
151
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
152
-<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
153
-<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
154
-<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/>
155
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
156
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
157
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
158
-<setting id="org.eclipse.jdt.core.compiler.source" value="1.5"/>
159
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
160
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
161
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
162
-<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
163
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
164
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
165
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
166
-<setting id="org.eclipse.jdt.core.compiler.compliance" value="1.5"/>
167
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
168
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
169
-<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
170
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
171
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
172
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
173
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
174
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
175
-<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
176
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
177
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
178
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
179
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
180
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
181
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
182
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
183
-<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
184
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
185
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
186
-<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
187
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
188
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
189
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
190
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
191
-<setting id="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value="error"/>
192
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
193
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
194
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
195
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
196
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
197
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
198
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
199
-<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
200
-<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value="1.5"/>
201
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
202
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
203
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
204
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
205
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
206
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
207
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
208
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
209
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
210
-<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
211
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
212
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
213
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
214
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
215
-<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
216
-<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
217
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
218
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
219
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
220
-<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
221
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
222
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
223
-<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
224
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
225
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
226
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
227
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
228
-<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
229
-<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
230
-<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
231
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/>
232
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
233
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
234
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
235
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
236
-<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
237
-<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
238
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
239
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
240
-<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
241
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
242
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
243
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
244
-<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
245
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
246
-<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
247
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
248
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
249
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
250
-<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation" value="insert"/>
251
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
252
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
253
-<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
254
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
255
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
256
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
257
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
258
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
259
-<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
260
-<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
261
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
262
-<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
263
-</profile>
264
-</profiles>

+ 0
- 181
dddsample/src/main/java/com/aggregator/HandlingReport.java Datei anzeigen

@@ -1,181 +0,0 @@
1
-
2
-package com.aggregator;
3
-
4
-import javax.xml.bind.annotation.XmlAccessType;
5
-import javax.xml.bind.annotation.XmlAccessorType;
6
-import javax.xml.bind.annotation.XmlElement;
7
-import javax.xml.bind.annotation.XmlType;
8
-import javax.xml.datatype.XMLGregorianCalendar;
9
-import java.util.ArrayList;
10
-import java.util.List;
11
-
12
-
13
-/**
14
- * <p>Java class for handlingReport complex type.
15
- * 
16
- * <p>The following schema fragment specifies the expected content contained within this class.
17
- * 
18
- * <pre>
19
- * &lt;complexType name="handlingReport">
20
- *   &lt;complexContent>
21
- *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
22
- *       &lt;sequence>
23
- *         &lt;element name="completionTime" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
24
- *         &lt;element name="trackingIds" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
25
- *         &lt;element name="type" type="{http://www.w3.org/2001/XMLSchema}string"/>
26
- *         &lt;element name="unLocode" type="{http://www.w3.org/2001/XMLSchema}string"/>
27
- *         &lt;element name="voyageNumber" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
28
- *       &lt;/sequence>
29
- *     &lt;/restriction>
30
- *   &lt;/complexContent>
31
- * &lt;/complexType>
32
- * </pre>
33
- * 
34
- * 
35
- */
36
-@XmlAccessorType(XmlAccessType.FIELD)
37
-@XmlType(name = "handlingReport", propOrder = {
38
-    "completionTime",
39
-    "trackingIds",
40
-    "type",
41
-    "unLocode",
42
-    "voyageNumber"
43
-})
44
-public class HandlingReport {
45
-
46
-    @XmlElement(required = true)
47
-    protected XMLGregorianCalendar completionTime;
48
-    @XmlElement(required = true)
49
-    protected List<String> trackingIds;
50
-    @XmlElement(required = true)
51
-    protected String type;
52
-    @XmlElement(required = true)
53
-    protected String unLocode;
54
-    protected String voyageNumber;
55
-
56
-    /**
57
-     * Gets the value of the completionTime property.
58
-     * 
59
-     * @return
60
-     *     possible object is
61
-     *     {@link XMLGregorianCalendar }
62
-     *     
63
-     */
64
-    public XMLGregorianCalendar getCompletionTime() {
65
-        return completionTime;
66
-    }
67
-
68
-    /**
69
-     * Sets the value of the completionTime property.
70
-     * 
71
-     * @param value
72
-     *     allowed object is
73
-     *     {@link XMLGregorianCalendar }
74
-     *     
75
-     */
76
-    public void setCompletionTime(XMLGregorianCalendar value) {
77
-        this.completionTime = value;
78
-    }
79
-
80
-    /**
81
-     * Gets the value of the trackingIds property.
82
-     * 
83
-     * <p>
84
-     * This accessor method returns a reference to the live list,
85
-     * not a snapshot. Therefore any modification you make to the
86
-     * returned list will be present inside the JAXB object.
87
-     * This is why there is not a <CODE>set</CODE> method for the trackingIds property.
88
-     * 
89
-     * <p>
90
-     * For example, to add a new item, do as follows:
91
-     * <pre>
92
-     *    getTrackingIds().add(newItem);
93
-     * </pre>
94
-     * 
95
-     * 
96
-     * <p>
97
-     * Objects of the following type(s) are allowed in the list
98
-     * {@link String }
99
-     * 
100
-     * 
101
-     */
102
-    public List<String> getTrackingIds() {
103
-        if (trackingIds == null) {
104
-            trackingIds = new ArrayList<String>();
105
-        }
106
-        return this.trackingIds;
107
-    }
108
-
109
-    /**
110
-     * Gets the value of the type property.
111
-     * 
112
-     * @return
113
-     *     possible object is
114
-     *     {@link String }
115
-     *     
116
-     */
117
-    public String getType() {
118
-        return type;
119
-    }
120
-
121
-    /**
122
-     * Sets the value of the type property.
123
-     * 
124
-     * @param value
125
-     *     allowed object is
126
-     *     {@link String }
127
-     *     
128
-     */
129
-    public void setType(String value) {
130
-        this.type = value;
131
-    }
132
-
133
-    /**
134
-     * Gets the value of the unLocode property.
135
-     * 
136
-     * @return
137
-     *     possible object is
138
-     *     {@link String }
139
-     *     
140
-     */
141
-    public String getUnLocode() {
142
-        return unLocode;
143
-    }
144
-
145
-    /**
146
-     * Sets the value of the unLocode property.
147
-     * 
148
-     * @param value
149
-     *     allowed object is
150
-     *     {@link String }
151
-     *     
152
-     */
153
-    public void setUnLocode(String value) {
154
-        this.unLocode = value;
155
-    }
156
-
157
-    /**
158
-     * Gets the value of the voyageNumber property.
159
-     * 
160
-     * @return
161
-     *     possible object is
162
-     *     {@link String }
163
-     *     
164
-     */
165
-    public String getVoyageNumber() {
166
-        return voyageNumber;
167
-    }
168
-
169
-    /**
170
-     * Sets the value of the voyageNumber property.
171
-     * 
172
-     * @param value
173
-     *     allowed object is
174
-     *     {@link String }
175
-     *     
176
-     */
177
-    public void setVoyageNumber(String value) {
178
-        this.voyageNumber = value;
179
-    }
180
-
181
-}

+ 0
- 32
dddsample/src/main/java/com/aggregator/HandlingReportErrors.java Datei anzeigen

@@ -1,32 +0,0 @@
1
-
2
-package com.aggregator;
3
-
4
-import javax.xml.bind.annotation.XmlAccessType;
5
-import javax.xml.bind.annotation.XmlAccessorType;
6
-import javax.xml.bind.annotation.XmlType;
7
-
8
-
9
-/**
10
- * <p>Java class for HandlingReportErrors complex type.
11
- * 
12
- * <p>The following schema fragment specifies the expected content contained within this class.
13
- * 
14
- * <pre>
15
- * &lt;complexType name="HandlingReportErrors">
16
- *   &lt;complexContent>
17
- *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
18
- *       &lt;sequence>
19
- *       &lt;/sequence>
20
- *     &lt;/restriction>
21
- *   &lt;/complexContent>
22
- * &lt;/complexType>
23
- * </pre>
24
- * 
25
- * 
26
- */
27
-@XmlAccessorType(XmlAccessType.FIELD)
28
-@XmlType(name = "HandlingReportErrors")
29
-public class HandlingReportErrors {
30
-
31
-
32
-}

+ 0
- 54
dddsample/src/main/java/com/aggregator/HandlingReportErrors_Exception.java Datei anzeigen

@@ -1,54 +0,0 @@
1
-
2
-package com.aggregator;
3
-
4
-import javax.xml.ws.WebFault;
5
-
6
-
7
-/**
8
- * This class was generated by the JAX-WS RI.
9
- * JAX-WS RI 2.1.1 in JDK 6
10
- * Generated source version: 2.1
11
- * 
12
- */
13
-@WebFault(name = "HandlingReportErrors", targetNamespace = "http://ws.handling.interfaces.dddsample.citerus.se/")
14
-public class HandlingReportErrors_Exception
15
-    extends Exception
16
-{
17
-
18
-    /**
19
-     * Java type that goes as soapenv:Fault detail element.
20
-     * 
21
-     */
22
-    private HandlingReportErrors faultInfo;
23
-
24
-    /**
25
-     * 
26
-     * @param message
27
-     * @param faultInfo
28
-     */
29
-    public HandlingReportErrors_Exception(String message, HandlingReportErrors faultInfo) {
30
-        super(message);
31
-        this.faultInfo = faultInfo;
32
-    }
33
-
34
-    /**
35
-     * 
36
-     * @param message
37
-     * @param faultInfo
38
-     * @param cause
39
-     */
40
-    public HandlingReportErrors_Exception(String message, HandlingReportErrors faultInfo, Throwable cause) {
41
-        super(message, cause);
42
-        this.faultInfo = faultInfo;
43
-    }
44
-
45
-    /**
46
-     * 
47
-     * @return
48
-     *     returns fault bean: com.aggregator.HandlingReportErrors
49
-     */
50
-    public HandlingReportErrors getFaultInfo() {
51
-        return faultInfo;
52
-    }
53
-
54
-}

+ 0
- 39
dddsample/src/main/java/com/aggregator/HandlingReportService.java Datei anzeigen

@@ -1,39 +0,0 @@
1
-
2
-package com.aggregator;
3
-
4
-import javax.jws.WebMethod;
5
-import javax.jws.WebParam;
6
-import javax.jws.WebService;
7
-import javax.xml.bind.annotation.XmlSeeAlso;
8
-import javax.xml.ws.RequestWrapper;
9
-import javax.xml.ws.ResponseWrapper;
10
-
11
-
12
-/**
13
- * This class was generated by the JAX-WS RI.
14
- * JAX-WS RI 2.1.1 in JDK 6
15
- * Generated source version: 2.1
16
- * 
17
- */
18
-@WebService(name = "HandlingReportService", targetNamespace = "http://ws.handling.interfaces.dddsample.citerus.se/")
19
-@XmlSeeAlso({
20
-    ObjectFactory.class
21
-})
22
-public interface HandlingReportService {
23
-
24
-
25
-    /**
26
-     * 
27
-     * @param arg0
28
-     * @throws HandlingReportErrors_Exception
29
-     */
30
-    @WebMethod
31
-    @RequestWrapper(localName = "submitReport", targetNamespace = "http://ws.handling.interfaces.dddsample.citerus.se/", className = "com.aggregator.SubmitReport")
32
-    @ResponseWrapper(localName = "submitReportResponse", targetNamespace = "http://ws.handling.interfaces.dddsample.citerus.se/", className = "com.aggregator.SubmitReportResponse")
33
-    public void submitReport(
34
-        @WebParam(name = "arg0", targetNamespace = "")
35
-        HandlingReport arg0)
36
-        throws HandlingReportErrors_Exception
37
-    ;
38
-
39
-}

+ 0
- 72
dddsample/src/main/java/com/aggregator/HandlingReportService.wsdl Datei anzeigen

@@ -1,72 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<wsdl:definitions name="HandlingReportServiceService" targetNamespace="http://ws.handling.interfaces.dddsample.citerus.se/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ws.handling.interfaces.dddsample.citerus.se/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
3
-  <wsdl:types>
4
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://ws.handling.interfaces.dddsample.citerus.se/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://ws.handling.interfaces.dddsample.citerus.se/">
5
-    <xs:element name="submitReport" type="tns:submitReport"/>
6
-    <xs:element name="submitReportResponse" type="tns:submitReportResponse"/>
7
-    <xs:complexType name="submitReport">
8
-        <xs:sequence>
9
-            <xs:element minOccurs="0" name="arg0" type="tns:handlingReport"/>
10
-        </xs:sequence>
11
-    </xs:complexType>
12
-    <xs:complexType name="handlingReport">
13
-        <xs:sequence>
14
-            <xs:element name="completionTime" type="xs:dateTime"/>
15
-            <xs:element maxOccurs="unbounded" name="trackingIds" type="xs:string"/>
16
-            <xs:element name="type" type="xs:string"/>
17
-            <xs:element name="unLocode" type="xs:string"/>
18
-            <xs:element minOccurs="0" name="voyageNumber" type="xs:string"/>
19
-        </xs:sequence>
20
-    </xs:complexType>
21
-    <xs:complexType name="submitReportResponse">
22
-        <xs:sequence/>
23
-    </xs:complexType>
24
-    <xs:element name="HandlingReportErrors" type="tns:HandlingReportErrors"/>
25
-    <xs:complexType name="HandlingReportErrors">
26
-        <xs:sequence/>
27
-    </xs:complexType>
28
-</xs:schema>
29
-  </wsdl:types>
30
-  <wsdl:message name="HandlingReportErrors">
31
-    <wsdl:part name="HandlingReportErrors" element="tns:HandlingReportErrors">
32
-    </wsdl:part>
33
-  </wsdl:message>
34
-  <wsdl:message name="submitReport">
35
-    <wsdl:part name="parameters" element="tns:submitReport">
36
-    </wsdl:part>
37
-  </wsdl:message>
38
-  <wsdl:message name="submitReportResponse">
39
-    <wsdl:part name="parameters" element="tns:submitReportResponse">
40
-    </wsdl:part>
41
-  </wsdl:message>
42
-  <wsdl:portType name="HandlingReportService">
43
-    <wsdl:operation name="submitReport">
44
-      <wsdl:input name="submitReport" message="tns:submitReport">
45
-    </wsdl:input>
46
-      <wsdl:output name="submitReportResponse" message="tns:submitReportResponse">
47
-    </wsdl:output>
48
-      <wsdl:fault name="HandlingReportErrors" message="tns:HandlingReportErrors">
49
-    </wsdl:fault>
50
-    </wsdl:operation>
51
-  </wsdl:portType>
52
-  <wsdl:binding name="HandlingReportServiceServiceSoapBinding" type="tns:HandlingReportService">
53
-    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
54
-    <wsdl:operation name="submitReport">
55
-      <soap:operation soapAction="" style="document"/>
56
-      <wsdl:input name="submitReport">
57
-        <soap:body use="literal"/>
58
-      </wsdl:input>
59
-      <wsdl:output name="submitReportResponse">
60
-        <soap:body use="literal"/>
61
-      </wsdl:output>
62
-      <wsdl:fault name="HandlingReportErrors">
63
-        <soap:fault name="HandlingReportErrors" use="literal"/>
64
-      </wsdl:fault>
65
-    </wsdl:operation>
66
-  </wsdl:binding>
67
-  <wsdl:service name="HandlingReportServiceService">
68
-    <wsdl:port name="HandlingReportServicePort" binding="tns:HandlingReportServiceServiceSoapBinding">
69
-      <soap:address location="http://localhost:9090/HandlingReportServicePort"/>
70
-    </wsdl:port>
71
-  </wsdl:service>
72
-</wsdl:definitions>

+ 0
- 66
dddsample/src/main/java/com/aggregator/HandlingReportServiceService.java Datei anzeigen

@@ -1,66 +0,0 @@
1
-
2
-package com.aggregator;
3
-
4
-import javax.xml.namespace.QName;
5
-import javax.xml.ws.Service;
6
-import javax.xml.ws.WebEndpoint;
7
-import javax.xml.ws.WebServiceClient;
8
-import javax.xml.ws.WebServiceFeature;
9
-import java.net.MalformedURLException;
10
-import java.net.URL;
11
-
12
-
13
-/**
14
- * This class was generated by the JAX-WS RI.
15
- * JAX-WS RI 2.1.1 in JDK 6
16
- * Generated source version: 2.1
17
- * 
18
- */
19
-@WebServiceClient(name = "HandlingReportServiceService", targetNamespace = "http://ws.handling.interfaces.dddsample.citerus.se/", wsdlLocation = "file:///Users/peter/src/dddsample/src/main/resources/HandlingReportService.wsdl")
20
-public class HandlingReportServiceService
21
-    extends Service
22
-{
23
-
24
-    private final static URL HANDLINGREPORTSERVICESERVICE_WSDL_LOCATION;
25
-
26
-    static {
27
-        URL url = null;
28
-        try {
29
-            url = new URL("file:/Users/peter/src/dddsample/src/main/resources/HandlingReportService.wsdl");
30
-        } catch (MalformedURLException e) {
31
-            e.printStackTrace();
32
-        }
33
-        HANDLINGREPORTSERVICESERVICE_WSDL_LOCATION = url;
34
-    }
35
-
36
-    public HandlingReportServiceService(URL wsdlLocation, QName serviceName) {
37
-        super(wsdlLocation, serviceName);
38
-    }
39
-
40
-    public HandlingReportServiceService() {
41
-        super(HANDLINGREPORTSERVICESERVICE_WSDL_LOCATION, new QName("http://ws.handling.interfaces.dddsample.citerus.se/", "HandlingReportServiceService"));
42
-    }
43
-
44
-    /**
45
-     * 
46
-     * @return
47
-     *     returns HandlingReportService
48
-     */
49
-    @WebEndpoint(name = "HandlingReportServicePort")
50
-    public HandlingReportService getHandlingReportServicePort() {
51
-        return (HandlingReportService)super.getPort(new QName("http://ws.handling.interfaces.dddsample.citerus.se/", "HandlingReportServicePort"), HandlingReportService.class);
52
-    }
53
-
54
-    /**
55
-     * 
56
-     * @param features
57
-     *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
58
-     * @return
59
-     *     returns HandlingReportService
60
-     */
61
-    @WebEndpoint(name = "HandlingReportServicePort")
62
-    public HandlingReportService getHandlingReportServicePort(WebServiceFeature... features) {
63
-        return (HandlingReportService)super.getPort(new QName("http://ws.handling.interfaces.dddsample.citerus.se/", "HandlingReportServicePort"), HandlingReportService.class, features);
64
-    }
65
-
66
-}

+ 0
- 97
dddsample/src/main/java/com/aggregator/ObjectFactory.java Datei anzeigen

@@ -1,97 +0,0 @@
1
-
2
-package com.aggregator;
3
-
4
-import javax.xml.bind.JAXBElement;
5
-import javax.xml.bind.annotation.XmlElementDecl;
6
-import javax.xml.bind.annotation.XmlRegistry;
7
-import javax.xml.namespace.QName;
8
-
9
-
10
-/**
11
- * This object contains factory methods for each 
12
- * Java content interface and Java element interface 
13
- * generated in the com.aggregator package. 
14
- * <p>An ObjectFactory allows you to programatically 
15
- * construct new instances of the Java representation 
16
- * for XML content. The Java representation of XML 
17
- * content can consist of schema derived interfaces 
18
- * and classes representing the binding of schema 
19
- * type definitions, element declarations and model 
20
- * groups.  Factory methods for each of these are 
21
- * provided in this class.
22
- * 
23
- */
24
-@XmlRegistry
25
-public class ObjectFactory {
26
-
27
-    private final static QName _SubmitReport_QNAME = new QName("http://ws.handling.interfaces.dddsample.citerus.se/", "submitReport");
28
-    private final static QName _HandlingReportErrors_QNAME = new QName("http://ws.handling.interfaces.dddsample.citerus.se/", "HandlingReportErrors");
29
-    private final static QName _SubmitReportResponse_QNAME = new QName("http://ws.handling.interfaces.dddsample.citerus.se/", "submitReportResponse");
30
-
31
-    /**
32
-     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.aggregator
33
-     * 
34
-     */
35
-    public ObjectFactory() {
36
-    }
37
-
38
-    /**
39
-     * Create an instance of {@link HandlingReportErrors }
40
-     * 
41
-     */
42
-    public HandlingReportErrors createHandlingReportErrors() {
43
-        return new HandlingReportErrors();
44
-    }
45
-
46
-    /**
47
-     * Create an instance of {@link SubmitReportResponse }
48
-     * 
49
-     */
50
-    public SubmitReportResponse createSubmitReportResponse() {
51
-        return new SubmitReportResponse();
52
-    }
53
-
54
-    /**
55
-     * Create an instance of {@link HandlingReport }
56
-     * 
57
-     */
58
-    public HandlingReport createHandlingReport() {
59
-        return new HandlingReport();
60
-    }
61
-
62
-    /**
63
-     * Create an instance of {@link SubmitReport }
64
-     * 
65
-     */
66
-    public SubmitReport createSubmitReport() {
67
-        return new SubmitReport();
68
-    }
69
-
70
-    /**
71
-     * Create an instance of {@link JAXBElement }{@code <}{@link SubmitReport }{@code >}}
72
-     * 
73
-     */
74
-    @XmlElementDecl(namespace = "http://ws.handling.interfaces.dddsample.citerus.se/", name = "submitReport")
75
-    public JAXBElement<SubmitReport> createSubmitReport(SubmitReport value) {
76
-        return new JAXBElement<SubmitReport>(_SubmitReport_QNAME, SubmitReport.class, null, value);
77
-    }
78
-
79
-    /**
80
-     * Create an instance of {@link JAXBElement }{@code <}{@link HandlingReportErrors }{@code >}}
81
-     * 
82
-     */
83
-    @XmlElementDecl(namespace = "http://ws.handling.interfaces.dddsample.citerus.se/", name = "HandlingReportErrors")
84
-    public JAXBElement<HandlingReportErrors> createHandlingReportErrors(HandlingReportErrors value) {
85
-        return new JAXBElement<HandlingReportErrors>(_HandlingReportErrors_QNAME, HandlingReportErrors.class, null, value);
86
-    }
87
-
88
-    /**
89
-     * Create an instance of {@link JAXBElement }{@code <}{@link SubmitReportResponse }{@code >}}
90
-     * 
91
-     */
92
-    @XmlElementDecl(namespace = "http://ws.handling.interfaces.dddsample.citerus.se/", name = "submitReportResponse")
93
-    public JAXBElement<SubmitReportResponse> createSubmitReportResponse(SubmitReportResponse value) {
94
-        return new JAXBElement<SubmitReportResponse>(_SubmitReportResponse_QNAME, SubmitReportResponse.class, null, value);
95
-    }
96
-
97
-}

+ 0
- 60
dddsample/src/main/java/com/aggregator/SubmitReport.java Datei anzeigen

@@ -1,60 +0,0 @@
1
-
2
-package com.aggregator;
3
-
4
-import javax.xml.bind.annotation.XmlAccessType;
5
-import javax.xml.bind.annotation.XmlAccessorType;
6
-import javax.xml.bind.annotation.XmlType;
7
-
8
-
9
-/**
10
- * <p>Java class for submitReport complex type.
11
- * 
12
- * <p>The following schema fragment specifies the expected content contained within this class.
13
- * 
14
- * <pre>
15
- * &lt;complexType name="submitReport">
16
- *   &lt;complexContent>
17
- *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
18
- *       &lt;sequence>
19
- *         &lt;element name="arg0" type="{http://ws.handling.interfaces.dddsample.citerus.se/}handlingReport" minOccurs="0"/>
20
- *       &lt;/sequence>
21
- *     &lt;/restriction>
22
- *   &lt;/complexContent>
23
- * &lt;/complexType>
24
- * </pre>
25
- * 
26
- * 
27
- */
28
-@XmlAccessorType(XmlAccessType.FIELD)
29
-@XmlType(name = "submitReport", propOrder = {
30
-    "arg0"
31
-})
32
-public class SubmitReport {
33
-
34
-    protected HandlingReport arg0;
35
-
36
-    /**
37
-     * Gets the value of the arg0 property.
38
-     * 
39
-     * @return
40
-     *     possible object is
41
-     *     {@link HandlingReport }
42
-     *     
43
-     */
44
-    public HandlingReport getArg0() {
45
-        return arg0;
46
-    }
47
-
48
-    /**
49
-     * Sets the value of the arg0 property.
50
-     * 
51
-     * @param value
52
-     *     allowed object is
53
-     *     {@link HandlingReport }
54
-     *     
55
-     */
56
-    public void setArg0(HandlingReport value) {
57
-        this.arg0 = value;
58
-    }
59
-
60
-}

+ 0
- 32
dddsample/src/main/java/com/aggregator/SubmitReportResponse.java Datei anzeigen

@@ -1,32 +0,0 @@
1
-
2
-package com.aggregator;
3
-
4
-import javax.xml.bind.annotation.XmlAccessType;
5
-import javax.xml.bind.annotation.XmlAccessorType;
6
-import javax.xml.bind.annotation.XmlType;
7
-
8
-
9
-/**
10
- * <p>Java class for submitReportResponse complex type.
11
- * 
12
- * <p>The following schema fragment specifies the expected content contained within this class.
13
- * 
14
- * <pre>
15
- * &lt;complexType name="submitReportResponse">
16
- *   &lt;complexContent>
17
- *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
18
- *       &lt;sequence>
19
- *       &lt;/sequence>
20
- *     &lt;/restriction>
21
- *   &lt;/complexContent>
22
- * &lt;/complexType>
23
- * </pre>
24
- * 
25
- * 
26
- */
27
-@XmlAccessorType(XmlAccessType.FIELD)
28
-@XmlType(name = "submitReportResponse")
29
-public class SubmitReportResponse {
30
-
31
-
32
-}

+ 0
- 2
dddsample/src/main/java/com/aggregator/package-info.java Datei anzeigen

@@ -1,2 +0,0 @@
1
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://ws.handling.interfaces.dddsample.citerus.se/")
2
-package com.aggregator;

+ 0
- 7
dddsample/src/main/java/com/aggregator/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-	Generated from the upstream Aggregation Service WSDL
5
-</p>
6
-</body>
7
-</html>

+ 0
- 26
dddsample/src/main/java/com/pathfinder/api/GraphTraversalService.java Datei anzeigen

@@ -1,26 +0,0 @@
1
-package com.pathfinder.api;
2
-
3
-import java.rmi.Remote;
4
-import java.rmi.RemoteException;
5
-import java.util.List;
6
-import java.util.Properties;
7
-
8
-/**
9
- * Part of the external graph traversal API exposed by the routing team
10
- * and used by us (booking and tracking team).
11
- *
12
- */
13
-public interface GraphTraversalService extends Remote {
14
-
15
-  /**
16
-   * @param originUnLocode origin UN Locode
17
-   * @param destinationUnLocode destination UN Locode
18
-   * @param limitations restrictions on the path selection, as key-value according to some API specification
19
-   * @return A list of transit paths
20
-   * @throws RemoteException RMI problem
21
-   */
22
-  List<TransitPath> findShortestPath(String originUnLocode,
23
-                                     String destinationUnLocode,
24
-                                     Properties limitations) throws RemoteException;
25
-
26
-}

+ 0
- 59
dddsample/src/main/java/com/pathfinder/api/TransitEdge.java Datei anzeigen

@@ -1,59 +0,0 @@
1
-package com.pathfinder.api;
2
-
3
-import java.io.Serializable;
4
-import java.util.Date;
5
-
6
-/**
7
- * Represents an edge in a path through a graph,
8
- * describing the route of a cargo.
9
- *  
10
- */
11
-public final class TransitEdge implements Serializable {
12
-
13
-  private final String voyageNumber;
14
-  private final String fromUnLocode;
15
-  private final String toUnLocode;
16
-  private final Date fromDate;
17
-  private final Date toDate;
18
-
19
-  /**
20
-   * Constructor.
21
-   *
22
-   * @param voyageNumber
23
-   * @param fromUnLocode
24
-   * @param toUnLocode
25
-   * @param fromDate
26
-   * @param toDate
27
-   */
28
-  public TransitEdge(final String voyageNumber,
29
-                     final String fromUnLocode,
30
-                     final String toUnLocode,
31
-                     final Date fromDate,
32
-                     final Date toDate) {
33
-    this.voyageNumber = voyageNumber;
34
-    this.fromUnLocode = fromUnLocode;
35
-    this.toUnLocode = toUnLocode;
36
-    this.fromDate = fromDate;
37
-    this.toDate = toDate;
38
-  }
39
-
40
-  public String getVoyageNumber() {
41
-    return voyageNumber;
42
-  }
43
-
44
-  public String getFromUnLocode() {
45
-    return fromUnLocode;
46
-  }
47
-
48
-  public String getToUnLocode() {
49
-    return toUnLocode;
50
-  }
51
-
52
-  public Date getFromDate() {
53
-    return fromDate;
54
-  }
55
-
56
-  public Date getToDate() {
57
-    return toDate;
58
-  }
59
-}

+ 0
- 29
dddsample/src/main/java/com/pathfinder/api/TransitPath.java Datei anzeigen

@@ -1,29 +0,0 @@
1
-package com.pathfinder.api;
2
-
3
-import java.io.Serializable;
4
-import java.util.Collections;
5
-import java.util.List;
6
-
7
-/**
8
- *
9
- */
10
-public final class TransitPath implements Serializable {
11
-
12
-  private final List<TransitEdge> transitEdges;
13
-
14
-  /**
15
-   * Constructor.
16
-   *
17
-   * @param transitEdges The legs for this itinerary.
18
-   */
19
-  public TransitPath(final List<TransitEdge> transitEdges) {
20
-    this.transitEdges = transitEdges;
21
-  }
22
-
23
-  /**
24
-   * @return An unmodifiable list DTOs.
25
-   */
26
-  public List<TransitEdge> getTransitEdges() {
27
-    return Collections.unmodifiableList(transitEdges);
28
-  }
29
-}

+ 0
- 7
dddsample/src/main/java/com/pathfinder/api/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  Public API for the pathfinder application.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 27
dddsample/src/main/java/com/pathfinder/internal/GraphDAO.java Datei anzeigen

@@ -1,27 +0,0 @@
1
-package com.pathfinder.internal;
2
-
3
-import java.util.ArrayList;
4
-import java.util.Arrays;
5
-import java.util.List;
6
-import java.util.Random;
7
-
8
-public class GraphDAO {
9
-
10
-  private static final Random random = new Random();
11
-
12
-  public List<String> listLocations() {
13
-    return new ArrayList<String>(Arrays.asList(
14
-      "CNHKG", "AUMEL", "SESTO", "FIHEL", "USCHI", "JNTKO", "DEHAM", "CNSHA", "NLRTM", "SEGOT", "CNHGH", "USNYC", "USDAL"
15
-    ));
16
-  }
17
-
18
-  public String getVoyageNumber(String from, String to) {
19
-    final int i = random.nextInt(5);
20
-    if (i == 0) return "0100S";
21
-    if (i == 1) return "0200T";
22
-    if (i == 2) return "0300A";
23
-    if (i == 3) return "0301S";
24
-    return "0400S";
25
-  }
26
-  
27
-}

+ 0
- 83
dddsample/src/main/java/com/pathfinder/internal/GraphTraversalServiceImpl.java Datei anzeigen

@@ -1,83 +0,0 @@
1
-package com.pathfinder.internal;
2
-
3
-import com.pathfinder.api.GraphTraversalService;
4
-import com.pathfinder.api.TransitEdge;
5
-import com.pathfinder.api.TransitPath;
6
-
7
-import java.util.*;
8
-
9
-public class GraphTraversalServiceImpl implements GraphTraversalService {
10
-
11
-  private GraphDAO dao;
12
-  private Random random;
13
-  private static final long ONE_MIN_MS = 1000 * 60;
14
-  private static final long ONE_DAY_MS = ONE_MIN_MS * 60 * 24;
15
-
16
-  public GraphTraversalServiceImpl(GraphDAO dao) {
17
-    this.dao = dao;
18
-    this.random = new Random();
19
-  }
20
-
21
-  public List<TransitPath> findShortestPath(final String originUnLocode,
22
-                                            final String destinationUnLocode,
23
-                                            final Properties limitations) {
24
-    Date date = nextDate(new Date());
25
-
26
-    List<String> allVertices = dao.listLocations();
27
-    allVertices.remove(originUnLocode);
28
-    allVertices.remove(destinationUnLocode);
29
-
30
-    final int candidateCount = getRandomNumberOfCandidates();
31
-    final List<TransitPath> candidates = new ArrayList<TransitPath>(candidateCount);
32
-
33
-    for (int i = 0; i < candidateCount; i++) {
34
-      allVertices = getRandomChunkOfLocations(allVertices);
35
-      final List<TransitEdge> transitEdges = new ArrayList<TransitEdge>(allVertices.size() - 1);
36
-      final String firstLegTo = allVertices.get(0);
37
-
38
-      Date fromDate = nextDate(date);
39
-      Date toDate = nextDate(fromDate);
40
-      date = nextDate(toDate);
41
-
42
-      transitEdges.add(new TransitEdge(
43
-        dao.getVoyageNumber(originUnLocode, firstLegTo),
44
-        originUnLocode, firstLegTo, fromDate, toDate));
45
-
46
-      for (int j = 0; j < allVertices.size() - 1; j++) {
47
-        final String curr = allVertices.get(j);
48
-        final String next = allVertices.get(j + 1);
49
-        fromDate = nextDate(date);
50
-        toDate = nextDate(fromDate);
51
-        date = nextDate(toDate);
52
-        transitEdges.add(new TransitEdge(dao.getVoyageNumber(curr, next), curr, next, fromDate, toDate));
53
-      }
54
-
55
-      final String lastLegFrom = allVertices.get(allVertices.size() - 1);
56
-      fromDate = nextDate(date);
57
-      toDate = nextDate(fromDate);
58
-      transitEdges.add(new TransitEdge(
59
-        dao.getVoyageNumber(lastLegFrom, destinationUnLocode),
60
-        lastLegFrom, destinationUnLocode, fromDate, toDate));
61
-
62
-      candidates.add(new TransitPath(transitEdges));
63
-    }
64
-
65
-    return candidates;
66
-  }
67
-
68
-  private Date nextDate(Date date) {
69
-    return new Date(date.getTime() + ONE_DAY_MS + (random.nextInt(1000) - 500) * ONE_MIN_MS);
70
-  }
71
-
72
-  private int getRandomNumberOfCandidates() {
73
-    return 3 + random.nextInt(3);
74
-  }
75
-
76
-  private List<String> getRandomChunkOfLocations(List<String> allLocations) {
77
-    Collections.shuffle(allLocations);
78
-    final int total = allLocations.size();
79
-    final int chunk = total > 4 ? 1 + new Random().nextInt(5) : total;
80
-    return allLocations.subList(0, chunk);
81
-  }
82
-
83
-}

+ 0
- 7
dddsample/src/main/java/com/pathfinder/internal/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  Internal parts of the pathfinder application.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 14
dddsample/src/main/java/com/pathfinder/package.html Datei anzeigen

@@ -1,14 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  This is the pathfinder application context, which is separate from "our" application and context.
5
-  Our domain model with cargo, itinerary, handling event etc does not exist here.
6
-  The routing domain service implementation works against the API exposed by
7
-  this context.
8
-</p>
9
-<p>
10
-  It is not related to the core application at all, and is only part of this source tree for
11
-  developer convenience.
12
-</p>
13
-</body>
14
-</html>

+ 0
- 44
dddsample/src/main/java/se/citerus/dddsample/application/ApplicationEvents.java Datei anzeigen

@@ -1,44 +0,0 @@
1
-package se.citerus.dddsample.application;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.Cargo;
4
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
5
-import se.citerus.dddsample.interfaces.handling.HandlingEventRegistrationAttempt;
6
-
7
-/**
8
- * This interface provides a way to let other parts
9
- * of the system know about events that have occurred.
10
- * <p/>
11
- * It may be implemented synchronously or asynchronously, using
12
- * for example JMS.
13
- */
14
-public interface ApplicationEvents {
15
-
16
-  /**
17
-   * A cargo has been handled.
18
-   *
19
-   * @param event handling event
20
-   */
21
-  void cargoWasHandled(HandlingEvent event);
22
-
23
-  /**
24
-   * A cargo has been misdirected.
25
-   *
26
-   * @param cargo cargo
27
-   */
28
-  void cargoWasMisdirected(Cargo cargo);
29
-
30
-  /**
31
-   * A cargo has arrived at its final destination.
32
-   *
33
-   * @param cargo cargo
34
-   */
35
-  void cargoHasArrived(Cargo cargo);
36
-
37
-  /**
38
-   * A handling event regitration attempt is received.
39
-   *
40
-   * @param attempt handling event registration attempt
41
-   */
42
-  void receivedHandlingEventRegistrationAttempt(HandlingEventRegistrationAttempt attempt);
43
-
44
-}

+ 0
- 47
dddsample/src/main/java/se/citerus/dddsample/application/BookingService.java Datei anzeigen

@@ -1,47 +0,0 @@
1
-package se.citerus.dddsample.application;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.Itinerary;
4
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
5
-import se.citerus.dddsample.domain.model.location.UnLocode;
6
-
7
-import java.util.Date;
8
-import java.util.List;
9
-
10
-/**
11
- * Cargo booking service.
12
- */
13
-public interface BookingService {
14
-
15
-  /**
16
-   * Registers a new cargo in the tracking system, not yet routed.
17
-   *
18
-   * @param origin      cargo origin
19
-   * @param destination cargo destination
20
-   * @param arrivalDeadline arrival deadline
21
-   * @return Cargo tracking id
22
-   */
23
-  TrackingId bookNewCargo(UnLocode origin, UnLocode destination, Date arrivalDeadline);
24
-
25
-  /**
26
-   * Requests a list of itineraries describing possible routes for this cargo.
27
-   *
28
-   * @param trackingId cargo tracking id
29
-   * @return A list of possible itineraries for this cargo
30
-   */
31
-  List<Itinerary> requestPossibleRoutesForCargo(TrackingId trackingId);
32
-
33
-  /**
34
-   * @param itinerary itinerary describing the selected route
35
-   * @param trackingId cargo tracking id
36
-   */
37
-  void assignCargoToRoute(Itinerary itinerary, TrackingId trackingId);
38
-
39
-  /**
40
-   * Changes the destination of a cargo.
41
-   *
42
-   * @param trackingId cargo tracking id
43
-   * @param unLocode UN locode of new destination
44
-   */
45
-  void changeDestination(TrackingId trackingId, UnLocode unLocode);
46
-
47
-}

+ 0
- 19
dddsample/src/main/java/se/citerus/dddsample/application/CargoInspectionService.java Datei anzeigen

@@ -1,19 +0,0 @@
1
-package se.citerus.dddsample.application;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
4
-
5
-/**
6
- * Cargo inspection service.
7
- */
8
-public interface CargoInspectionService {
9
-
10
-  /**
11
-   * Inspect cargo and send relevant notifications to interested parties,
12
-   * for example if a cargo has been misdirected, or unloaded
13
-   * at the final destination.
14
-   *
15
-   * @param trackingId cargo tracking id
16
-   */
17
-  void inspectCargo(TrackingId trackingId);
18
-
19
-}

+ 0
- 35
dddsample/src/main/java/se/citerus/dddsample/application/HandlingEventService.java Datei anzeigen

@@ -1,35 +0,0 @@
1
-package se.citerus.dddsample.application;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
4
-import se.citerus.dddsample.domain.model.handling.CannotCreateHandlingEventException;
5
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
6
-import se.citerus.dddsample.domain.model.location.UnLocode;
7
-import se.citerus.dddsample.domain.model.voyage.VoyageNumber;
8
-
9
-import java.util.Date;
10
-
11
-/**
12
- * Handling event service.
13
- */
14
-public interface HandlingEventService {
15
-
16
-  /**
17
-   * Registers a handling event in the system, and notifies interested
18
-   * parties that a cargo has been handled.
19
-   *
20
-   * @param completionTime when the event was completed
21
-   * @param trackingId cargo tracking id
22
-   * @param voyageNumber voyage number
23
-   * @param unLocode UN locode for the location where the event occurred
24
-   * @param type type of event
25
-   * @throws se.citerus.dddsample.domain.model.handling.CannotCreateHandlingEventException
26
-   *  if a handling event that represents an actual event that's relevant to a cargo we're tracking
27
-   *  can't be created from the parameters 
28
-   */
29
-  void registerHandlingEvent(Date completionTime,
30
-                             TrackingId trackingId,
31
-                             VoyageNumber voyageNumber,
32
-                             UnLocode unLocode,
33
-                             HandlingEvent.Type type) throws CannotCreateHandlingEventException;
34
-
35
-}

+ 0
- 92
dddsample/src/main/java/se/citerus/dddsample/application/impl/BookingServiceImpl.java Datei anzeigen

@@ -1,92 +0,0 @@
1
-package se.citerus.dddsample.application.impl;
2
-
3
-import org.apache.commons.logging.Log;
4
-import org.apache.commons.logging.LogFactory;
5
-import org.springframework.transaction.annotation.Transactional;
6
-import se.citerus.dddsample.application.BookingService;
7
-import se.citerus.dddsample.domain.model.cargo.*;
8
-import se.citerus.dddsample.domain.model.location.Location;
9
-import se.citerus.dddsample.domain.model.location.LocationRepository;
10
-import se.citerus.dddsample.domain.model.location.UnLocode;
11
-import se.citerus.dddsample.domain.service.RoutingService;
12
-
13
-import java.util.Collections;
14
-import java.util.Date;
15
-import java.util.List;
16
-
17
-public final class BookingServiceImpl implements BookingService {
18
-
19
-  private final CargoRepository cargoRepository;
20
-  private final LocationRepository locationRepository;
21
-  private final RoutingService routingService;
22
-  private final Log logger = LogFactory.getLog(getClass());
23
-
24
-  public BookingServiceImpl(final CargoRepository cargoRepository,
25
-                            final LocationRepository locationRepository,
26
-                            final RoutingService routingService) {
27
-    this.cargoRepository = cargoRepository;
28
-    this.locationRepository = locationRepository;
29
-    this.routingService = routingService;
30
-  }
31
-
32
-  @Override
33
-  @Transactional
34
-  public TrackingId bookNewCargo(final UnLocode originUnLocode,
35
-                                 final UnLocode destinationUnLocode,
36
-                                 final Date arrivalDeadline) {
37
-    // TODO modeling this as a cargo factory might be suitable
38
-    final TrackingId trackingId = cargoRepository.nextTrackingId();
39
-    final Location origin = locationRepository.find(originUnLocode);
40
-    final Location destination = locationRepository.find(destinationUnLocode);
41
-    final RouteSpecification routeSpecification = new RouteSpecification(origin, destination, arrivalDeadline);
42
-
43
-    final Cargo cargo = new Cargo(trackingId, routeSpecification);
44
-
45
-    cargoRepository.store(cargo);
46
-    logger.info("Booked new cargo with tracking id " + cargo.trackingId().idString());
47
-
48
-    return cargo.trackingId();
49
-  }
50
-
51
-  @Override
52
-  @Transactional
53
-  public List<Itinerary> requestPossibleRoutesForCargo(final TrackingId trackingId) {
54
-    final Cargo cargo = cargoRepository.find(trackingId);
55
-
56
-    if (cargo == null) {
57
-      return Collections.emptyList();
58
-    }
59
-
60
-    return routingService.fetchRoutesForSpecification(cargo.routeSpecification());
61
-  }
62
-
63
-  @Override
64
-  @Transactional
65
-  public void assignCargoToRoute(final Itinerary itinerary, final TrackingId trackingId) {
66
-    final Cargo cargo = cargoRepository.find(trackingId);
67
-    if (cargo == null) {
68
-      throw new IllegalArgumentException("Can't assign itinerary to non-existing cargo " + trackingId);
69
-    }
70
-
71
-    cargo.assignToRoute(itinerary);
72
-    cargoRepository.store(cargo);
73
-
74
-    logger.info("Assigned cargo " + trackingId + " to new route");
75
-  }
76
-
77
-  @Override
78
-  @Transactional
79
-  public void changeDestination(final TrackingId trackingId, final UnLocode unLocode) {
80
-    final Cargo cargo = cargoRepository.find(trackingId);
81
-    final Location newDestination = locationRepository.find(unLocode);
82
-
83
-    final RouteSpecification routeSpecification = new RouteSpecification(
84
-      cargo.origin(), newDestination, cargo.routeSpecification().arrivalDeadline()
85
-    );
86
-    cargo.specifyNewRoute(routeSpecification);
87
-
88
-    cargoRepository.store(cargo);
89
-    logger.info("Changed destination for cargo " + trackingId + " to " + routeSpecification.destination());
90
-  }
91
-
92
-}

+ 0
- 56
dddsample/src/main/java/se/citerus/dddsample/application/impl/CargoInspectionServiceImpl.java Datei anzeigen

@@ -1,56 +0,0 @@
1
-package se.citerus.dddsample.application.impl;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import org.apache.commons.logging.Log;
5
-import org.apache.commons.logging.LogFactory;
6
-import org.springframework.transaction.annotation.Transactional;
7
-import se.citerus.dddsample.application.ApplicationEvents;
8
-import se.citerus.dddsample.application.CargoInspectionService;
9
-import se.citerus.dddsample.domain.model.cargo.Cargo;
10
-import se.citerus.dddsample.domain.model.cargo.CargoRepository;
11
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
12
-import se.citerus.dddsample.domain.model.handling.HandlingEventRepository;
13
-import se.citerus.dddsample.domain.model.handling.HandlingHistory;
14
-
15
-public class CargoInspectionServiceImpl implements CargoInspectionService {
16
-
17
-  private final ApplicationEvents applicationEvents;
18
-  private final CargoRepository cargoRepository;
19
-  private final HandlingEventRepository handlingEventRepository;
20
-  private final Log logger = LogFactory.getLog(getClass());
21
-
22
-  public CargoInspectionServiceImpl(final ApplicationEvents applicationEvents,
23
-                                    final CargoRepository cargoRepository,
24
-                                    final HandlingEventRepository handlingEventRepository) {
25
-    this.applicationEvents = applicationEvents;
26
-    this.cargoRepository = cargoRepository;
27
-    this.handlingEventRepository = handlingEventRepository;
28
-  }
29
-
30
-  @Override
31
-  @Transactional
32
-  public void inspectCargo(final TrackingId trackingId) {
33
-    Validate.notNull(trackingId, "Tracking ID is required");
34
-
35
-    final Cargo cargo = cargoRepository.find(trackingId);
36
-    if (cargo == null) {
37
-      logger.warn("Can't inspect non-existing cargo " + trackingId);
38
-      return;
39
-    }
40
-
41
-    final HandlingHistory handlingHistory = handlingEventRepository.lookupHandlingHistoryOfCargo(trackingId);
42
-
43
-    cargo.deriveDeliveryProgress(handlingHistory);
44
-
45
-    if (cargo.delivery().isMisdirected()) {
46
-      applicationEvents.cargoWasMisdirected(cargo);
47
-    }
48
-
49
-    if (cargo.delivery().isUnloadedAtDestination()) {
50
-      applicationEvents.cargoHasArrived(cargo);
51
-    }
52
-
53
-    cargoRepository.store(cargo);
54
-  }
55
-
56
-}

+ 0
- 60
dddsample/src/main/java/se/citerus/dddsample/application/impl/HandlingEventServiceImpl.java Datei anzeigen

@@ -1,60 +0,0 @@
1
-package se.citerus.dddsample.application.impl;
2
-
3
-import org.apache.commons.logging.Log;
4
-import org.apache.commons.logging.LogFactory;
5
-import org.springframework.transaction.annotation.Transactional;
6
-import se.citerus.dddsample.application.ApplicationEvents;
7
-import se.citerus.dddsample.application.HandlingEventService;
8
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
9
-import se.citerus.dddsample.domain.model.handling.CannotCreateHandlingEventException;
10
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
11
-import se.citerus.dddsample.domain.model.handling.HandlingEventFactory;
12
-import se.citerus.dddsample.domain.model.handling.HandlingEventRepository;
13
-import se.citerus.dddsample.domain.model.location.UnLocode;
14
-import se.citerus.dddsample.domain.model.voyage.VoyageNumber;
15
-
16
-import java.util.Date;
17
-
18
-public final class HandlingEventServiceImpl implements HandlingEventService {
19
-
20
-  private final ApplicationEvents applicationEvents;
21
-  private final HandlingEventRepository handlingEventRepository;
22
-  private final HandlingEventFactory handlingEventFactory;
23
-  private final Log logger = LogFactory.getLog(HandlingEventServiceImpl.class);
24
-
25
-  public HandlingEventServiceImpl(final HandlingEventRepository handlingEventRepository,
26
-                                  final ApplicationEvents applicationEvents,
27
-                                  final HandlingEventFactory handlingEventFactory) {
28
-    this.handlingEventRepository = handlingEventRepository;
29
-    this.applicationEvents = applicationEvents;
30
-    this.handlingEventFactory = handlingEventFactory;
31
-  }
32
-
33
-  @Override
34
-  @Transactional(rollbackFor = CannotCreateHandlingEventException.class)
35
-  public void registerHandlingEvent(final Date completionTime,
36
-                                    final TrackingId trackingId,
37
-                                    final VoyageNumber voyageNumber,
38
-                                    final UnLocode unLocode,
39
-                                    final HandlingEvent.Type type) throws CannotCreateHandlingEventException {
40
-    final Date registrationTime = new Date();
41
-    /* Using a factory to create a HandlingEvent (aggregate). This is where
42
-       it is determined wether the incoming data, the attempt, actually is capable
43
-       of representing a real handling event. */
44
-    final HandlingEvent event = handlingEventFactory.createHandlingEvent(
45
-      registrationTime, completionTime, trackingId, voyageNumber, unLocode, type
46
-    );
47
-
48
-    /* Store the new handling event, which updates the persistent
49
-       state of the handling event aggregate (but not the cargo aggregate -
50
-       that happens asynchronously!)
51
-     */
52
-    handlingEventRepository.store(event);
53
-
54
-    /* Publish an event stating that a cargo has been handled. */
55
-    applicationEvents.cargoWasHandled(event);
56
-
57
-    logger.info("Registered handling event");
58
-  }
59
-
60
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/application/impl/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-	Implementation of the application layer.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 16
dddsample/src/main/java/se/citerus/dddsample/application/package.html Datei anzeigen

@@ -1,16 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-	This is the application layer: code that's needed for the application to
5
-	performs its tasks. It defines, or is defined by, use cases.
6
-</p>
7
-<p>
8
-	It is thin in terms of knowledge of domain business logic,
9
-	although it may be large in terms of lines of code.
10
-	It coordinates the domain layer objects to perform the actual tasks. 
11
-</p>
12
-<p>
13
-	This layer is suitable for spanning transactions, security checks and high-level logging.
14
-</p>
15
-</body>
16
-</html>

+ 0
- 39
dddsample/src/main/java/se/citerus/dddsample/application/util/DateTestUtil.java Datei anzeigen

@@ -1,39 +0,0 @@
1
-package se.citerus.dddsample.application.util;
2
-
3
-import java.text.ParseException;
4
-import java.text.SimpleDateFormat;
5
-import java.util.Date;
6
-
7
-/**
8
- * A few utils for working with Date in tests.
9
- *
10
- */
11
-public final class DateTestUtil {
12
-
13
-  /**
14
-   * @param date date string as yyyy-MM-dd
15
-   * @return Date representation
16
-   */
17
-  public static Date toDate(final String date) {
18
-    return toDate(date, "00:00.00.000");
19
-  }
20
-
21
-  /**
22
-   * @param date date string as yyyy-MM-dd
23
-   * @param time time string as HH:mm
24
-   * @return Date representation
25
-   */
26
-  public static Date toDate(final String date, final String time) {
27
-    try {
28
-      return new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(date + " " + time);
29
-    } catch (ParseException e) {
30
-      throw new RuntimeException(e);
31
-    }
32
-  }
33
-
34
-  /**
35
-   * Prevent instantiation.
36
-   */
37
-  private DateTestUtil() {
38
-  }
39
-}

+ 0
- 333
dddsample/src/main/java/se/citerus/dddsample/application/util/SampleDataGenerator.java Datei anzeigen

@@ -1,333 +0,0 @@
1
-package se.citerus.dddsample.application.util;
2
-
3
-import org.hibernate.SessionFactory;
4
-import org.hibernate.classic.Session;
5
-import org.springframework.beans.factory.BeanFactoryUtils;
6
-import org.springframework.jdbc.core.JdbcTemplate;
7
-import org.springframework.transaction.PlatformTransactionManager;
8
-import org.springframework.transaction.TransactionStatus;
9
-import org.springframework.transaction.support.TransactionCallbackWithoutResult;
10
-import org.springframework.transaction.support.TransactionTemplate;
11
-import org.springframework.web.context.WebApplicationContext;
12
-import org.springframework.web.context.support.WebApplicationContextUtils;
13
-import static se.citerus.dddsample.application.util.DateTestUtil.toDate;
14
-import se.citerus.dddsample.domain.model.cargo.*;
15
-import se.citerus.dddsample.domain.model.handling.*;
16
-import se.citerus.dddsample.domain.model.location.Location;
17
-import se.citerus.dddsample.domain.model.location.LocationRepository;
18
-import se.citerus.dddsample.domain.model.location.SampleLocations;
19
-import static se.citerus.dddsample.domain.model.location.SampleLocations.*;
20
-import static se.citerus.dddsample.domain.model.voyage.SampleVoyages.*;
21
-import se.citerus.dddsample.domain.model.voyage.VoyageRepository;
22
-
23
-import javax.servlet.ServletContextEvent;
24
-import javax.servlet.ServletContextListener;
25
-import javax.sql.DataSource;
26
-import java.sql.Timestamp;
27
-import java.text.ParseException;
28
-import java.text.SimpleDateFormat;
29
-import static java.util.Arrays.asList;
30
-import java.util.Date;
31
-
32
-/**
33
- * Provides sample data.
34
- */
35
-public class SampleDataGenerator implements ServletContextListener {
36
-
37
-  private static final Timestamp base; 
38
-  static {
39
-    try {
40
-      Date date = new SimpleDateFormat("yyyy-MM-dd").parse("2008-01-01");
41
-      base = new Timestamp(date.getTime() - 1000L * 60 * 60 * 24 * 100);
42
-    } catch (ParseException e) {
43
-      throw new RuntimeException(e);
44
-    }
45
-  }
46
-
47
-  private static void loadHandlingEventData(JdbcTemplate jdbcTemplate) {
48
-    String handlingEventSql =
49
-      "insert into HandlingEvent (completionTime, registrationTime, type, location_id, voyage_id, cargo_id) " +
50
-      "values (?, ?, ?, ?, ?, ?)";
51
-
52
-    Object[][] handlingEventArgs = {
53
-        //XYZ (SESTO-FIHEL-DEHAM-CNHKG-JPTOK-AUMEL)
54
-        {ts(0),     ts((0)),    "RECEIVE",  1,  null,  1},
55
-        {ts((4)),   ts((5)),    "LOAD",     1,  1,     1},
56
-        {ts((14)),  ts((14)),   "UNLOAD",   5,  1,     1},
57
-        {ts((15)),  ts((15)),   "LOAD",     5,  1,     1},
58
-        {ts((30)),  ts((30)),   "UNLOAD",   6,  1,     1},
59
-        {ts((33)),  ts((33)),   "LOAD",     6,  1,     1},
60
-        {ts((34)),  ts((34)),   "UNLOAD",   3,  1,     1},
61
-        {ts((60)),  ts((60)),   "LOAD",     3,  1,     1},
62
-        {ts((70)),  ts((71)),   "UNLOAD",   4,  1,     1},
63
-        {ts((75)),  ts((75)),   "LOAD",     4,  1,     1},
64
-        {ts((88)),  ts((88)),   "UNLOAD",   2,  1,     1},
65
-        {ts((100)), ts((102)),  "CLAIM",    2,  null,  1},
66
-
67
-        //ZYX (AUMEL - USCHI - DEHAM -)
68
-        {ts((200)),   ts((201)),  "RECEIVE",  2,  null,  3},
69
-        {ts((202)),   ts((202)),  "LOAD",     2,  2,     3},
70
-        {ts((208)),   ts((208)),  "UNLOAD",   7,  2,     3},
71
-        {ts((212)),   ts((212)),  "LOAD",     7,  2,     3},
72
-        {ts((230)),   ts((230)),  "UNLOAD",   6,  2,     3},
73
-        {ts((235)),   ts((235)),  "LOAD",     6,  2,     3},
74
-
75
-        //ABC
76
-        {ts((20)),  ts((21)),   "CLAIM",    2,  null,  2},
77
-
78
-        //CBA
79
-        {ts((0)),   ts((1)),    "RECEIVE",  2,  null,  4},
80
-        {ts((10)),  ts((11)),   "LOAD",     2,  2,     4},
81
-        {ts((20)),  ts((21)),   "UNLOAD",   7,  2,     4},
82
-
83
-        //FGH
84
-        {ts(100),   ts(160),    "RECEIVE",  3,  null,   5},
85
-        {ts(150),   ts(110),    "LOAD",     3,  3,     5},
86
-
87
-        // JKL
88
-        {ts(200),   ts(220),    "RECEIVE",  6,  null,   6},
89
-        {ts(300),   ts(330),    "LOAD",     6,  3,     6},
90
-        {ts(400),   ts(440),    "UNLOAD",   5,  3,     6}  // Unexpected event
91
-    };
92
-    executeUpdate(jdbcTemplate, handlingEventSql, handlingEventArgs);
93
-  }
94
-
95
-  private static void loadCarrierMovementData(JdbcTemplate jdbcTemplate) {
96
-    String voyageSql =
97
-      "insert into Voyage (id, voyage_number) values (?, ?)";
98
-    Object[][] voyageArgs = {
99
-      {1,"0101"},
100
-      {2,"0202"},
101
-      {3,"0303"}
102
-    };
103
-    executeUpdate(jdbcTemplate, voyageSql, voyageArgs);
104
-
105
-    String carrierMovementSql =
106
-      "insert into CarrierMovement (id, voyage_id, departure_location_id, arrival_location_id, departure_time, arrival_time, cm_index) " +
107
-      "values (?,?,?,?,?,?,?)";
108
-
109
-    Object[][] carrierMovementArgs = {
110
-      // SESTO - FIHEL - DEHAM - CNHKG - JPTOK - AUMEL (voyage 0101)
111
-      {1,1,1,5,ts(1),ts(2),0},
112
-      {2,1,5,6,ts(1),ts(2),1},
113
-      {3,1,6,3,ts(1),ts(2),2},
114
-      {4,1,3,4,ts(1),ts(2),3},
115
-      {5,1,4,2,ts(1),ts(2),4},
116
-
117
-      // AUMEL - USCHI - DEHAM - SESTO - FIHEL (voyage 0202)
118
-      {7,2,2,7,ts(1),ts(2),0},
119
-      {8,2,7,6,ts(1),ts(2),1},
120
-      {9,2,6,1,ts(1),ts(2),2},
121
-      {6,2,1,5,ts(1),ts(2),3},
122
-
123
-      // CNHKG - AUMEL - FIHEL - DEHAM - SESTO - USCHI - JPTKO (voyage 0303)
124
-      {10,3,3,2,ts(1),ts(2),0},
125
-      {11,3,2,5,ts(1),ts(2),1},
126
-      {12,3,6,1,ts(1),ts(2),2},
127
-      {13,3,1,7,ts(1),ts(2),3},
128
-      {14,3,7,4,ts(1),ts(2),4}
129
-    };
130
-    executeUpdate(jdbcTemplate, carrierMovementSql, carrierMovementArgs);
131
-  }
132
-
133
-  private static void loadCargoData(JdbcTemplate jdbcTemplate) {
134
-    String cargoSql =
135
-      "insert into Cargo (id, tracking_id, origin_id, spec_origin_id, spec_destination_id, spec_arrival_deadline, transport_status, current_voyage_id, last_known_location_id, is_misdirected, routing_status, calculated_at, unloaded_at_dest) " +
136
-      "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
137
-
138
-    Object[][] cargoArgs = {
139
-      {1, "XYZ", 1, 1, 2, ts(10), "IN_PORT", null, 1, false, "ROUTED", ts(100), false},
140
-      {2, "ABC", 1, 1, 5, ts(20), "IN_PORT", null, 1, false, "ROUTED", ts(100), false},
141
-      {3, "ZYX", 2, 2, 1, ts(30), "IN_PORT", null, 1, false, "NOT_ROUTED", ts(100), false},
142
-      {4, "CBA", 5, 5, 1, ts(40), "IN_PORT", null, 1, false, "MISROUTED", ts(100), false},
143
-      {5, "FGH", 1, 3, 5, ts(50), "IN_PORT", null, 1, false, "ROUTED", ts(100), false},  // Cargo origin differs from spec origin
144
-      {6, "JKL", 6, 6, 4, ts(60), "IN_PORT", null, 1, true, "ROUTED", ts(100), false}
145
-    };
146
-    executeUpdate(jdbcTemplate, cargoSql, cargoArgs);
147
-  }
148
-
149
-  private static void loadLocationData(JdbcTemplate jdbcTemplate) {
150
-    String locationSql =
151
-      "insert into Location (id, unlocode, name) " +
152
-      "values (?, ?, ?)";
153
-
154
-    Object[][] locationArgs = {
155
-      {1, "SESTO", "Stockholm"},
156
-      {2, "AUMEL", "Melbourne"},
157
-      {3, "CNHKG", "Hongkong"},
158
-      {4, "JPTOK", "Tokyo"},
159
-      {5, "FIHEL", "Helsinki"},
160
-      {6, "DEHAM", "Hamburg"},
161
-      {7, "USCHI", "Chicago"}
162
-    };
163
-    executeUpdate(jdbcTemplate, locationSql, locationArgs);
164
-  }
165
-
166
-  private static void loadItineraryData(JdbcTemplate jdbcTemplate) {
167
-    String legSql =
168
-      "insert into Leg (id, cargo_id, voyage_id, load_location_id, unload_location_id, load_time, unload_time, leg_index) " +
169
-      "values (?,?,?,?,?,?,?,?)";
170
-
171
-    Object [][] legArgs = {
172
-      // Cargo 5: Hongkong - Melbourne - Stockholm - Helsinki
173
-      {1,5,1,3,2,ts(1),ts(2),0},
174
-      {2,5,1,2,1,ts(3),ts(4),1},
175
-      {3,5,1,1,5,ts(4),ts(5),2},
176
-      // Cargo 6: Hamburg - Stockholm - Chicago - Tokyo
177
-      {4,6,2,6,1,ts(1),ts(2),0},
178
-      {5,6,2,1,7,ts(3),ts(4),1},
179
-      {6,6,2,7,4,ts(5),ts(6),2}
180
-    };
181
-    executeUpdate(jdbcTemplate, legSql, legArgs);
182
-  }
183
-
184
-  public void contextInitialized(ServletContextEvent event) {
185
-    WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(event.getServletContext());
186
-    DataSource dataSource = (DataSource) BeanFactoryUtils.beanOfType(context, DataSource.class);
187
-    PlatformTransactionManager transactionManager = (PlatformTransactionManager) BeanFactoryUtils.beanOfType(context, PlatformTransactionManager.class);
188
-    TransactionTemplate tt = new TransactionTemplate(transactionManager);
189
-    //loadSampleData(new JdbcTemplate(dataSource), tt);
190
-
191
-
192
-    SessionFactory sf = (SessionFactory) BeanFactoryUtils.beanOfType(context, SessionFactory.class);
193
-    HandlingEventFactory handlingEventFactory = new HandlingEventFactory(
194
-      getBean(context, CargoRepository.class),
195
-      getBean(context, VoyageRepository.class),
196
-      getBean(context, LocationRepository.class));
197
-    loadHibernateData(tt, sf, handlingEventFactory, getBean(context, HandlingEventRepository.class));
198
-  }
199
-
200
-  private <T> T getBean(WebApplicationContext context, Class<T> cls) {
201
-    return (T) BeanFactoryUtils.beanOfType(context, cls);
202
-  }
203
-
204
-  public static void loadHibernateData(TransactionTemplate tt, final SessionFactory sf, final HandlingEventFactory handlingEventFactory, final HandlingEventRepository handlingEventRepository) {
205
-    System.out.println("*** Loading Hibernate data ***");
206
-    tt.execute(new TransactionCallbackWithoutResult() {
207
-      @Override
208
-      protected void doInTransactionWithoutResult(TransactionStatus status) {
209
-        Session session = sf.getCurrentSession();
210
-
211
-        for (Location location : SampleLocations.getAll()) {
212
-          session.save(location);
213
-        }
214
-
215
-        session.save(HONGKONG_TO_NEW_YORK);
216
-        session.save(NEW_YORK_TO_DALLAS);
217
-        session.save(DALLAS_TO_HELSINKI);
218
-        session.save(HELSINKI_TO_HONGKONG);
219
-        session.save(DALLAS_TO_HELSINKI_ALT);
220
-
221
-        RouteSpecification routeSpecification = new RouteSpecification(HONGKONG, HELSINKI, toDate("2009-03-15"));
222
-        TrackingId trackingId = new TrackingId("ABC123");
223
-        Cargo abc123 = new Cargo(trackingId, routeSpecification);
224
-
225
-        Itinerary itinerary = new Itinerary(asList(
226
-          new Leg(HONGKONG_TO_NEW_YORK, HONGKONG, NEWYORK, toDate("2009-03-02"), toDate("2009-03-05")),
227
-          new Leg(NEW_YORK_TO_DALLAS, NEWYORK, DALLAS, toDate("2009-03-06"), toDate("2009-03-08")),
228
-          new Leg(DALLAS_TO_HELSINKI, DALLAS, HELSINKI, toDate("2009-03-09"), toDate("2009-03-12"))
229
-        ));
230
-        abc123.assignToRoute(itinerary);
231
-
232
-        session.save(abc123);
233
-        
234
-        try {
235
-          HandlingEvent event1 = handlingEventFactory.createHandlingEvent(
236
-            new Date(), toDate("2009-03-01"), trackingId, null, HONGKONG.unLocode(), HandlingEvent.Type.RECEIVE
237
-          );
238
-          session.save(event1);
239
-
240
-          HandlingEvent event2 = handlingEventFactory.createHandlingEvent(
241
-            new Date(), toDate("2009-03-02"), trackingId, HONGKONG_TO_NEW_YORK.voyageNumber(), HONGKONG.unLocode(), HandlingEvent.Type.LOAD
242
-          );
243
-          session.save(event2);
244
-
245
-          HandlingEvent event3 = handlingEventFactory.createHandlingEvent(
246
-            new Date(), toDate("2009-03-05"), trackingId, HONGKONG_TO_NEW_YORK.voyageNumber(), NEWYORK.unLocode(), HandlingEvent.Type.UNLOAD
247
-          );
248
-          session.save(event3);
249
-        } catch (CannotCreateHandlingEventException e) {
250
-          throw new RuntimeException(e);
251
-        }
252
-
253
-        HandlingHistory handlingHistory = handlingEventRepository.lookupHandlingHistoryOfCargo(trackingId);
254
-        abc123.deriveDeliveryProgress(handlingHistory);
255
-
256
-        session.update(abc123);
257
-
258
-        // Cargo JKL567
259
-
260
-        RouteSpecification routeSpecification1 = new RouteSpecification(HANGZOU, STOCKHOLM, toDate("2009-03-18"));
261
-        TrackingId trackingId1 = new TrackingId("JKL567");
262
-        Cargo jkl567 = new Cargo(trackingId1, routeSpecification1);
263
-
264
-        Itinerary itinerary1 = new Itinerary(asList(
265
-          new Leg(HONGKONG_TO_NEW_YORK, HANGZOU, NEWYORK, toDate("2009-03-03"), toDate("2009-03-05")),
266
-          new Leg(NEW_YORK_TO_DALLAS, NEWYORK, DALLAS, toDate("2009-03-06"), toDate("2009-03-08")),
267
-          new Leg(DALLAS_TO_HELSINKI, DALLAS, STOCKHOLM, toDate("2009-03-09"), toDate("2009-03-11"))
268
-        ));
269
-        jkl567.assignToRoute(itinerary1);
270
-
271
-        session.save(jkl567);
272
-
273
-        try {
274
-          HandlingEvent event1 = handlingEventFactory.createHandlingEvent(
275
-            new Date(), toDate("2009-03-01"), trackingId1, null, HANGZOU.unLocode(), HandlingEvent.Type.RECEIVE
276
-          );
277
-          session.save(event1);
278
-
279
-          HandlingEvent event2 = handlingEventFactory.createHandlingEvent(
280
-            new Date(), toDate("2009-03-03"), trackingId1, HONGKONG_TO_NEW_YORK.voyageNumber(), HANGZOU.unLocode(), HandlingEvent.Type.LOAD
281
-          );
282
-          session.save(event2);
283
-
284
-          HandlingEvent event3 = handlingEventFactory.createHandlingEvent(
285
-            new Date(), toDate("2009-03-05"), trackingId1, HONGKONG_TO_NEW_YORK.voyageNumber(), NEWYORK.unLocode(), HandlingEvent.Type.UNLOAD
286
-          );
287
-          session.save(event3);
288
-
289
-          HandlingEvent event4 = handlingEventFactory.createHandlingEvent(
290
-            new Date(), toDate("2009-03-06"), trackingId1, HONGKONG_TO_NEW_YORK.voyageNumber(), NEWYORK.unLocode(), HandlingEvent.Type.LOAD
291
-          );
292
-          session.save(event4);
293
-
294
-        } catch (CannotCreateHandlingEventException e) {
295
-          throw new RuntimeException(e);
296
-        }
297
-
298
-        HandlingHistory handlingHistory1 = handlingEventRepository.lookupHandlingHistoryOfCargo(trackingId1);
299
-        jkl567.deriveDeliveryProgress(handlingHistory1);
300
-
301
-        session.update(jkl567);
302
-      }
303
-    });
304
-  }
305
-
306
-  public void contextDestroyed(ServletContextEvent event) {}
307
-
308
-  public static void loadSampleData(final JdbcTemplate jdbcTemplate, TransactionTemplate transactionTemplate) {
309
-    transactionTemplate.execute(new TransactionCallbackWithoutResult() {
310
-      protected void doInTransactionWithoutResult(TransactionStatus status) {
311
-        loadLocationData(jdbcTemplate);
312
-        loadCarrierMovementData(jdbcTemplate);
313
-        loadCargoData(jdbcTemplate);
314
-        loadItineraryData(jdbcTemplate);
315
-        loadHandlingEventData(jdbcTemplate);
316
-      }
317
-    });
318
-  }
319
-
320
-  private static void executeUpdate(JdbcTemplate jdbcTemplate, String sql, Object[][] args) {
321
-    for (Object[] arg : args) {
322
-      jdbcTemplate.update(sql, arg);
323
-    }
324
-  }
325
-
326
-  private static Timestamp ts(int hours) {
327
-    return new Timestamp(base.getTime() + 1000L * 60 * 60 * hours);
328
-  }
329
-
330
-  public static Date offset(int hours) {
331
-    return new Date(ts(hours).getTime());
332
-  }
333
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/application/util/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  Various utilities.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 194
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Cargo.java Datei anzeigen

@@ -1,194 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
5
-import se.citerus.dddsample.domain.model.handling.HandlingHistory;
6
-import se.citerus.dddsample.domain.model.location.Location;
7
-import se.citerus.dddsample.domain.shared.DomainObjectUtils;
8
-import se.citerus.dddsample.domain.shared.Entity;
9
-
10
-/**
11
- * A Cargo. This is the central class in the domain model,
12
- * and it is the root of the Cargo-Itinerary-Leg-Delivery-RouteSpecification aggregate.
13
- *
14
- * A cargo is identified by a unique tracking id, and it always has an origin
15
- * and a route specification. The life cycle of a cargo begins with the booking procedure,
16
- * when the tracking id is assigned. During a (short) period of time, between booking
17
- * and initial routing, the cargo has no itinerary.
18
- *
19
- * The booking clerk requests a list of possible routes, matching the route specification,
20
- * and assigns the cargo to one route. The route to which a cargo is assigned is described
21
- * by an itinerary.
22
- *
23
- * A cargo can be re-routed during transport, on demand of the customer, in which case
24
- * a new route is specified for the cargo and a new route is requested. The old itinerary,
25
- * being a value object, is discarded and a new one is attached.
26
- *
27
- * It may also happen that a cargo is accidentally misrouted, which should notify the proper
28
- * personnel and also trigger a re-routing procedure.
29
- *
30
- * When a cargo is handled, the status of the delivery changes. Everything about the delivery
31
- * of the cargo is contained in the Delivery value object, which is replaced whenever a cargo
32
- * is handled by an asynchronous event triggered by the registration of the handling event.
33
- *
34
- * The delivery can also be affected by routing changes, i.e. when a the route specification
35
- * changes, or the cargo is assigned to a new route. In that case, the delivery update is performed
36
- * synchronously within the cargo aggregate.
37
- *
38
- * The life cycle of a cargo ends when the cargo is claimed by the customer.
39
- *
40
- * The cargo aggregate, and the entre domain model, is built to solve the problem
41
- * of booking and tracking cargo. All important business rules for determining whether
42
- * or not a cargo is misdirected, what the current status of the cargo is (on board carrier,
43
- * in port etc), are captured in this aggregate.
44
- *
45
- */
46
-public class Cargo implements Entity<Cargo> {
47
-
48
-  private TrackingId trackingId;
49
-  private Location origin;
50
-  private RouteSpecification routeSpecification;
51
-  private Itinerary itinerary;
52
-  private Delivery delivery;
53
-
54
-  public Cargo(final TrackingId trackingId, final RouteSpecification routeSpecification) {
55
-    Validate.notNull(trackingId, "Tracking ID is required");
56
-    Validate.notNull(routeSpecification, "Route specification is required");
57
-
58
-    this.trackingId = trackingId;
59
-    // Cargo origin never changes, even if the route specification changes.
60
-    // However, at creation, cargo orgin can be derived from the initial route specification.
61
-    this.origin = routeSpecification.origin();
62
-    this.routeSpecification = routeSpecification;
63
-
64
-    this.delivery = Delivery.derivedFrom(
65
-      this.routeSpecification, this.itinerary, HandlingHistory.EMPTY
66
-    );
67
-  }
68
-
69
-  /**
70
-   * The tracking id is the identity of this entity, and is unique.
71
-   * 
72
-   * @return Tracking id.
73
-   */
74
-  public TrackingId trackingId() {
75
-    return trackingId;
76
-  }
77
-
78
-  /**
79
-   * @return Origin location.
80
-   */
81
-  public Location origin() {
82
-    return origin;
83
-  }
84
-
85
-  /**
86
-   * @return The delivery. Never null.
87
-   */
88
-  public Delivery delivery() {
89
-    return delivery;
90
-  }
91
-
92
-  /**
93
-   * @return The itinerary. Never null.
94
-   */
95
-  public Itinerary itinerary() {
96
-    return DomainObjectUtils.nullSafe(this.itinerary, Itinerary.EMPTY_ITINERARY);
97
-  }
98
-
99
-  /**
100
-   * @return The route specification.
101
-   */
102
-  public RouteSpecification routeSpecification() {
103
-    return routeSpecification;
104
-  }
105
-  
106
-  /**
107
-   * Specifies a new route for this cargo.
108
-   *
109
-   * @param routeSpecification route specification.
110
-   */
111
-  public void specifyNewRoute(final RouteSpecification routeSpecification) {
112
-    Validate.notNull(routeSpecification, "Route specification is required");
113
-
114
-    this.routeSpecification = routeSpecification;
115
-    // Handling consistency within the Cargo aggregate synchronously
116
-    this.delivery = delivery.updateOnRouting(this.routeSpecification, this.itinerary);
117
-  }
118
-
119
-  /**
120
-   * Attach a new itinerary to this cargo.
121
-   *
122
-   * @param itinerary an itinerary. May not be null.
123
-   */
124
-  public void assignToRoute(final Itinerary itinerary) {
125
-    Validate.notNull(itinerary, "Itinerary is required for assignment");
126
-
127
-    this.itinerary = itinerary;
128
-    // Handling consistency within the Cargo aggregate synchronously
129
-    this.delivery = delivery.updateOnRouting(this.routeSpecification, this.itinerary);
130
-  }
131
-
132
-  /**
133
-   * Updates all aspects of the cargo aggregate status
134
-   * based on the current route specification, itinerary and handling of the cargo.
135
-   * <p/>
136
-   * When either of those three changes, i.e. when a new route is specified for the cargo,
137
-   * the cargo is assigned to a route or when the cargo is handled, the status must be
138
-   * re-calculated.
139
-   * <p/>
140
-   * {@link RouteSpecification} and {@link Itinerary} are both inside the Cargo
141
-   * aggregate, so changes to them cause the status to be updated <b>synchronously</b>,
142
-   * but changes to the delivery history (when a cargo is handled) cause the status update
143
-   * to happen <b>asynchronously</b> since {@link HandlingEvent} is in a different aggregate.
144
-   *
145
-   * @param handlingHistory handling history
146
-   */
147
-  public void deriveDeliveryProgress(final HandlingHistory handlingHistory) {
148
-    // TODO filter events on cargo (must be same as this cargo)
149
-
150
-    // Delivery is a value object, so we can simply discard the old one
151
-    // and replace it with a new
152
-    this.delivery = Delivery.derivedFrom(routeSpecification(), itinerary(), handlingHistory);
153
-  }
154
-
155
-  @Override
156
-  public boolean sameIdentityAs(final Cargo other) {
157
-    return other != null && trackingId.sameValueAs(other.trackingId);
158
-  }
159
-
160
-  /**
161
-   * @param object to compare
162
-   * @return True if they have the same identity
163
-   * @see #sameIdentityAs(Cargo)
164
-   */
165
-  @Override
166
-  public boolean equals(final Object object) {
167
-    if (this == object) return true;
168
-    if (object == null || getClass() != object.getClass()) return false;
169
-
170
-    final Cargo other = (Cargo) object;
171
-    return sameIdentityAs(other);
172
-  }
173
-
174
-  /**
175
-   * @return Hash code of tracking id.
176
-   */
177
-  @Override
178
-  public int hashCode() {
179
-    return trackingId.hashCode();
180
-  }
181
-
182
-  @Override
183
-  public String toString() {
184
-    return trackingId.toString();
185
-  }
186
-
187
-  Cargo() {
188
-    // Needed by Hibernate
189
-  }
190
-
191
-  // Auto-generated surrogate key
192
-  private Long id;
193
-
194
-}

+ 0
- 34
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/CargoRepository.java Datei anzeigen

@@ -1,34 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import java.util.List;
4
-
5
-public interface CargoRepository {
6
-
7
-  /**
8
-   * Finds a cargo using given id.
9
-   *
10
-   * @param trackingId Id
11
-   * @return Cargo if found, else {@code null}
12
-   */
13
-  Cargo find(TrackingId trackingId);
14
-
15
-  /**
16
-   * Finds all cargo.
17
-   *
18
-   * @return All cargo.
19
-   */
20
-  List<Cargo> findAll();
21
-
22
-  /**
23
-   * Saves given cargo.
24
-   *
25
-   * @param cargo cargo to save
26
-   */
27
-  void store(Cargo cargo);
28
-
29
-  /**
30
-   * @return A unique, generated tracking Id.
31
-   */
32
-  TrackingId nextTrackingId();
33
-
34
-}

+ 0
- 333
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Delivery.java Datei anzeigen

@@ -1,333 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import org.apache.commons.lang.builder.EqualsBuilder;
5
-import org.apache.commons.lang.builder.HashCodeBuilder;
6
-import static se.citerus.dddsample.domain.model.cargo.RoutingStatus.*;
7
-import static se.citerus.dddsample.domain.model.cargo.TransportStatus.*;
8
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
9
-import se.citerus.dddsample.domain.model.handling.HandlingHistory;
10
-import se.citerus.dddsample.domain.model.location.Location;
11
-import se.citerus.dddsample.domain.model.voyage.Voyage;
12
-import se.citerus.dddsample.domain.shared.DomainObjectUtils;
13
-import se.citerus.dddsample.domain.shared.ValueObject;
14
-
15
-import java.util.Date;
16
-import java.util.Iterator;
17
-
18
-/**
19
- * The actual transportation of the cargo, as opposed to
20
- * the customer requirement (RouteSpecification) and the plan (Itinerary). 
21
- *
22
- */
23
-public class Delivery implements ValueObject<Delivery> {
24
-
25
-  private TransportStatus transportStatus;
26
-  private Location lastKnownLocation;
27
-  private Voyage currentVoyage;
28
-  private boolean misdirected;
29
-  private Date eta;
30
-  private HandlingActivity nextExpectedActivity;
31
-  private boolean isUnloadedAtDestination;
32
-  private RoutingStatus routingStatus;
33
-  private Date calculatedAt;
34
-  private HandlingEvent lastEvent;
35
-
36
-  private static final Date ETA_UNKOWN = null;
37
-  private static final HandlingActivity NO_ACTIVITY = null;
38
-
39
-  /**
40
-   * Creates a new delivery snapshot to reflect changes in routing, i.e.
41
-   * when the route specification or the itinerary has changed
42
-   * but no additional handling of the cargo has been performed.
43
-   *
44
-   * @param routeSpecification route specification
45
-   * @param itinerary itinerary
46
-   * @return An up to date delivery
47
-   */
48
-  Delivery updateOnRouting(RouteSpecification routeSpecification, Itinerary itinerary) {
49
-    Validate.notNull(routeSpecification, "Route specification is required");
50
-
51
-    return new Delivery(this.lastEvent, itinerary, routeSpecification);
52
-  }
53
-
54
-  /**
55
-   * Creates a new delivery snapshot based on the complete handling history of a cargo,
56
-   * as well as its route specification and itinerary.
57
-   *
58
-   * @param routeSpecification route specification
59
-   * @param itinerary itinerary
60
-   * @param handlingHistory delivery history
61
-   * @return An up to date delivery.
62
-   */
63
-  static Delivery derivedFrom(RouteSpecification routeSpecification, Itinerary itinerary, HandlingHistory handlingHistory) {
64
-    Validate.notNull(routeSpecification, "Route specification is required");
65
-    Validate.notNull(handlingHistory, "Delivery history is required");
66
-
67
-    final HandlingEvent lastEvent = handlingHistory.mostRecentlyCompletedEvent();
68
-
69
-    return new Delivery(lastEvent, itinerary, routeSpecification);
70
-  }
71
-
72
-  /**
73
-   * Internal constructor.
74
-   *
75
-   * @param lastEvent last event
76
-   * @param itinerary itinerary
77
-   * @param routeSpecification route specification
78
-   */
79
-  private Delivery(HandlingEvent lastEvent, Itinerary itinerary, RouteSpecification routeSpecification) {
80
-    this.calculatedAt = new Date();
81
-    this.lastEvent = lastEvent;
82
-
83
-    this.misdirected = calculateMisdirectionStatus(itinerary);
84
-    this.routingStatus = calculateRoutingStatus(itinerary, routeSpecification);
85
-    this.transportStatus = calculateTransportStatus();
86
-    this.lastKnownLocation = calculateLastKnownLocation();
87
-    this.currentVoyage = calculateCurrentVoyage();
88
-    this.eta = calculateEta(itinerary);
89
-    this.nextExpectedActivity = calculateNextExpectedActivity(routeSpecification, itinerary);
90
-    this.isUnloadedAtDestination = calculateUnloadedAtDestination(routeSpecification);
91
-  }
92
-
93
-  /**
94
-   * @return Transport status
95
-   */
96
-  public TransportStatus transportStatus() {
97
-    return transportStatus;
98
-  }
99
-
100
-  /**
101
-   * @return Last known location of the cargo, or Location.UNKNOWN if the delivery history is empty.
102
-   */
103
-  public Location lastKnownLocation() {
104
-    return DomainObjectUtils.nullSafe(lastKnownLocation, Location.UNKNOWN);
105
-  }
106
-
107
-  /**
108
-   * @return Current voyage.
109
-   */
110
-  public Voyage currentVoyage() {
111
-    return DomainObjectUtils.nullSafe(currentVoyage, Voyage.NONE);
112
-  }
113
-
114
-  /**
115
-   * Check if cargo is misdirected.
116
-   * <p/>
117
-   * <ul>
118
-   * <li>A cargo is misdirected if it is in a location that's not in the itinerary.
119
-   * <li>A cargo with no itinerary can not be misdirected.
120
-   * <li>A cargo that has received no handling events can not be misdirected.
121
-   * </ul>
122
-   *
123
-   * @return <code>true</code> if the cargo has been misdirected,
124
-   */
125
-  public boolean isMisdirected() {
126
-    return misdirected;
127
-  }
128
-
129
-  /**
130
-   * @return Estimated time of arrival
131
-   */
132
-  public Date estimatedTimeOfArrival() {
133
-    if (eta != ETA_UNKOWN) {
134
-      return new Date(eta.getTime());
135
-    } else {
136
-      return ETA_UNKOWN;
137
-    }
138
-  }
139
-
140
-  /**
141
-   * @return The next expected handling activity.
142
-   */
143
-  public HandlingActivity nextExpectedActivity() {
144
-    return nextExpectedActivity;
145
-  }
146
-
147
-  /**
148
-   * @return True if the cargo has been unloaded at the final destination.
149
-   */
150
-  public boolean isUnloadedAtDestination() {
151
-    return isUnloadedAtDestination;
152
-  }
153
-
154
-  /**
155
-   * @return Routing status.
156
-   */
157
-  public RoutingStatus routingStatus() {
158
-    return routingStatus;
159
-  }
160
-
161
-  /**
162
-   * @return When this delivery was calculated.
163
-   */
164
-  public Date calculatedAt() {
165
-    return new Date(calculatedAt.getTime());
166
-  }
167
-
168
-  // TODO add currentCarrierMovement (?)
169
-
170
-
171
-  // --- Internal calculations below ---
172
-
173
-
174
-  private TransportStatus calculateTransportStatus() {
175
-    if (lastEvent == null) {
176
-      return NOT_RECEIVED;
177
-    }
178
-
179
-    switch (lastEvent.type()) {
180
-      case LOAD:
181
-        return ONBOARD_CARRIER;
182
-      case UNLOAD:
183
-      case RECEIVE:
184
-      case CUSTOMS:
185
-        return IN_PORT;
186
-      case CLAIM:
187
-        return CLAIMED;
188
-      default:
189
-        return UNKNOWN;
190
-    }
191
-  }
192
-
193
-  private Location calculateLastKnownLocation() {
194
-    if (lastEvent != null) {
195
-      return lastEvent.location();
196
-    } else {
197
-      return null;
198
-    }
199
-  }
200
-
201
-  private Voyage calculateCurrentVoyage() {
202
-    if (transportStatus().equals(ONBOARD_CARRIER) && lastEvent != null) {
203
-      return lastEvent.voyage();
204
-    } else {
205
-      return null;
206
-    }
207
-  }
208
-
209
-  private boolean calculateMisdirectionStatus(Itinerary itinerary) {
210
-    if (lastEvent == null) {
211
-      return false;
212
-    } else {
213
-      return !itinerary.isExpected(lastEvent);
214
-    }
215
-  }
216
-
217
-  private Date calculateEta(Itinerary itinerary) {
218
-    if (onTrack()) {
219
-      return itinerary.finalArrivalDate();
220
-    } else {
221
-      return ETA_UNKOWN;
222
-    }
223
-  }
224
-
225
-  private HandlingActivity calculateNextExpectedActivity(RouteSpecification routeSpecification, Itinerary itinerary) {
226
-    if (!onTrack()) return NO_ACTIVITY;
227
-
228
-    if (lastEvent == null) return new HandlingActivity(HandlingEvent.Type.RECEIVE, routeSpecification.origin());
229
-
230
-    switch (lastEvent.type()) {
231
-
232
-      case LOAD:
233
-        for (Leg leg : itinerary.legs()) {
234
-          if (leg.loadLocation().sameIdentityAs(lastEvent.location())) {
235
-            return new HandlingActivity(HandlingEvent.Type.UNLOAD, leg.unloadLocation(), leg.voyage());
236
-          }
237
-        }
238
-
239
-        return NO_ACTIVITY;
240
-
241
-      case UNLOAD:
242
-        for (Iterator<Leg> it = itinerary.legs().iterator(); it.hasNext();) {
243
-          final Leg leg = it.next();
244
-          if (leg.unloadLocation().sameIdentityAs(lastEvent.location())) {
245
-            if (it.hasNext()) {
246
-              final Leg nextLeg = it.next();
247
-              return new HandlingActivity(HandlingEvent.Type.LOAD, nextLeg.loadLocation(), nextLeg.voyage());
248
-            } else {
249
-              return new HandlingActivity(HandlingEvent.Type.CLAIM, leg.unloadLocation());
250
-            }
251
-          }
252
-        }
253
-
254
-        return NO_ACTIVITY;
255
-
256
-      case RECEIVE:
257
-        final Leg firstLeg = itinerary.legs().iterator().next();
258
-        return new HandlingActivity(HandlingEvent.Type.LOAD, firstLeg.loadLocation(), firstLeg.voyage());
259
-
260
-      case CLAIM:
261
-      default:
262
-        return NO_ACTIVITY;
263
-    }
264
-  }
265
-
266
-  private RoutingStatus calculateRoutingStatus(Itinerary itinerary, RouteSpecification routeSpecification) {
267
-    if (itinerary == null) {
268
-      return NOT_ROUTED;
269
-    } else {
270
-      if (routeSpecification.isSatisfiedBy(itinerary)) {
271
-        return ROUTED;
272
-      } else {
273
-        return MISROUTED;
274
-      }
275
-    }
276
-  }
277
-
278
-  private boolean calculateUnloadedAtDestination(RouteSpecification routeSpecification) {
279
-    return lastEvent != null &&
280
-      HandlingEvent.Type.UNLOAD.sameValueAs(lastEvent.type()) &&
281
-      routeSpecification.destination().sameIdentityAs(lastEvent.location());
282
-  }
283
-
284
-  private boolean onTrack() {
285
-    return routingStatus.equals(ROUTED) && !misdirected;
286
-  }
287
-
288
-  @Override
289
-  public boolean sameValueAs(final Delivery other) {
290
-    return other != null && new EqualsBuilder().
291
-      append(this.transportStatus, other.transportStatus).
292
-      append(this.lastKnownLocation, other.lastKnownLocation).
293
-      append(this.currentVoyage, other.currentVoyage).
294
-      append(this.misdirected, other.misdirected).
295
-      append(this.eta, other.eta).
296
-      append(this.nextExpectedActivity, other.nextExpectedActivity).
297
-      append(this.isUnloadedAtDestination, other.isUnloadedAtDestination).
298
-      append(this.routingStatus, other.routingStatus).
299
-      append(this.calculatedAt, other.calculatedAt).
300
-      append(this.lastEvent, other.lastEvent).
301
-      isEquals();
302
-  }
303
-
304
-  @Override
305
-  public boolean equals(final Object o) {
306
-    if (this == o) return true;
307
-    if (o == null || getClass() != o.getClass()) return false;
308
-
309
-    final Delivery other = (Delivery) o;
310
-
311
-    return sameValueAs(other);
312
-  }
313
-
314
-  @Override
315
-  public int hashCode() {
316
-    return new HashCodeBuilder().
317
-      append(transportStatus).
318
-      append(lastKnownLocation).
319
-      append(currentVoyage).
320
-      append(misdirected).
321
-      append(eta).
322
-      append(nextExpectedActivity).
323
-      append(isUnloadedAtDestination).
324
-      append(routingStatus).
325
-      append(calculatedAt).
326
-      append(lastEvent).
327
-      toHashCode();
328
-  }
329
-
330
-  Delivery() {
331
-    // Needed by Hibernate
332
-  }
333
-}

+ 0
- 88
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/HandlingActivity.java Datei anzeigen

@@ -1,88 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import org.apache.commons.lang.builder.EqualsBuilder;
5
-import org.apache.commons.lang.builder.HashCodeBuilder;
6
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
7
-import se.citerus.dddsample.domain.model.location.Location;
8
-import se.citerus.dddsample.domain.model.voyage.Voyage;
9
-import se.citerus.dddsample.domain.shared.ValueObject;
10
-
11
-/**
12
- * A handling activity represents how and where a cargo can be handled,
13
- * and can be used to express predictions about what is expected to
14
- * happen to a cargo in the future.
15
- *
16
- */
17
-public class HandlingActivity implements ValueObject<HandlingActivity> {
18
-
19
-  // TODO make HandlingActivity a part of HandlingEvent too? There is some overlap. 
20
-
21
-  private HandlingEvent.Type type;
22
-  private Location location;
23
-  private Voyage voyage;
24
-
25
-  public HandlingActivity(final HandlingEvent.Type type, final Location location) {
26
-    Validate.notNull(type, "Handling event type is required");
27
-    Validate.notNull(location, "Location is required");
28
-
29
-    this.type = type;
30
-    this.location = location;
31
-  }
32
-
33
-  public HandlingActivity(final HandlingEvent.Type type, final Location location, final Voyage voyage) {
34
-    Validate.notNull(type, "Handling event type is required");
35
-    Validate.notNull(location, "Location is required");
36
-    Validate.notNull(location, "Voyage is required");
37
-
38
-    this.type = type;
39
-    this.location = location;
40
-    this.voyage = voyage;
41
-  }
42
-
43
-  public HandlingEvent.Type type() {
44
-    return type;
45
-  }
46
-
47
-  public Location location() {
48
-    return location;
49
-  }
50
-
51
-  public Voyage voyage() {
52
-    return voyage;
53
-  }
54
-
55
-  @Override
56
-  public boolean sameValueAs(final HandlingActivity other) {
57
-    return other != null && new EqualsBuilder().
58
-      append(this.type, other.type).
59
-      append(this.location, other.location).
60
-      append(this.voyage, other.voyage).
61
-      isEquals();
62
-  }
63
-
64
-  @Override
65
-  public int hashCode() {
66
-    return new HashCodeBuilder().
67
-      append(this.type).
68
-      append(this.location).
69
-      append(this.voyage).
70
-      toHashCode();
71
-  }
72
-
73
-  @Override
74
-  public boolean equals(final Object obj) {
75
-    if (obj == this) return true;
76
-    if (obj == null) return false;
77
-    if (obj.getClass() != this.getClass()) return false;
78
-
79
-    HandlingActivity other = (HandlingActivity) obj;
80
-
81
-    return sameValueAs(other);
82
-  }
83
-
84
-  HandlingActivity() {
85
-    // Needed by Hibernate
86
-  }
87
-  
88
-}

+ 0
- 165
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Itinerary.java Datei anzeigen

@@ -1,165 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
5
-import se.citerus.dddsample.domain.model.location.Location;
6
-import se.citerus.dddsample.domain.shared.ValueObject;
7
-
8
-import java.util.Collections;
9
-import java.util.Date;
10
-import java.util.List;
11
-
12
-/**
13
- * An itinerary.
14
- *
15
- */
16
-public class Itinerary implements ValueObject<Itinerary> {
17
-
18
-  private List<Leg> legs = Collections.emptyList();
19
-
20
-  static final Itinerary EMPTY_ITINERARY = new Itinerary();
21
-  private static final Date END_OF_DAYS = new Date(Long.MAX_VALUE);
22
-
23
-  /**
24
-   * Constructor.
25
-   *
26
-   * @param legs List of legs for this itinerary.
27
-   */
28
-  public Itinerary(final List<Leg> legs) {
29
-    Validate.notEmpty(legs);
30
-    Validate.noNullElements(legs);
31
-
32
-    this.legs = legs;
33
-  }
34
-
35
-  /**
36
-   * @return the legs of this itinerary, as an <b>immutable</b> list.
37
-   */
38
-  public List<Leg> legs() {
39
-    return Collections.unmodifiableList(legs);
40
-  }
41
-
42
-  /**
43
-   * Test if the given handling event is expected when executing this itinerary.
44
-   *
45
-   * @param event Event to test.
46
-   * @return <code>true</code> if the event is expected
47
-   */
48
-  public boolean isExpected(final HandlingEvent event) {
49
-    if (legs.isEmpty()) {
50
-      return true;
51
-    }
52
-
53
-    if (event.type() == HandlingEvent.Type.RECEIVE) {
54
-      //Check that the first leg's origin is the event's location
55
-      final Leg leg = legs.get(0);
56
-      return (leg.loadLocation().equals(event.location()));
57
-    }
58
-
59
-    if (event.type() == HandlingEvent.Type.LOAD) {
60
-      //Check that the there is one leg with same load location and voyage
61
-      for (Leg leg : legs) {
62
-        if (leg.loadLocation().sameIdentityAs(event.location()) &&
63
-            leg.voyage().sameIdentityAs(event.voyage()))
64
-          return true;
65
-      }
66
-      return false;
67
-    }
68
-
69
-    if (event.type() == HandlingEvent.Type.UNLOAD) {
70
-      //Check that the there is one leg with same unload location and voyage
71
-      for (Leg leg : legs) {
72
-        if (leg.unloadLocation().equals(event.location()) &&
73
-            leg.voyage().equals(event.voyage()))
74
-          return true;
75
-      }
76
-      return false;
77
-    }
78
-
79
-    if (event.type() == HandlingEvent.Type.CLAIM) {
80
-      //Check that the last leg's destination is from the event's location
81
-      final Leg leg = lastLeg();
82
-      return (leg.unloadLocation().equals(event.location()));
83
-    }
84
-
85
-    //HandlingEvent.Type.CUSTOMS;
86
-    return true;
87
-  }
88
-
89
-  /**
90
-   * @return The initial departure location.
91
-   */
92
-  Location initialDepartureLocation() {
93
-     if (legs.isEmpty()) {
94
-       return Location.UNKNOWN;
95
-     } else {
96
-       return legs.get(0).loadLocation();
97
-     }
98
-  }
99
-
100
-  /**
101
-   * @return The final arrival location.
102
-   */
103
-  Location finalArrivalLocation() {
104
-    if (legs.isEmpty()) {
105
-      return Location.UNKNOWN;
106
-    } else {
107
-      return lastLeg().unloadLocation();
108
-    }
109
-  }
110
-
111
-  /**
112
-   * @return Date when cargo arrives at final destination.
113
-   */
114
-  Date finalArrivalDate() {
115
-    final Leg lastLeg = lastLeg();
116
-
117
-    if (lastLeg == null) {
118
-      return new Date(END_OF_DAYS.getTime());
119
-    } else {
120
-      return new Date(lastLeg.unloadTime().getTime());
121
-    }
122
-  }
123
-
124
-  /**
125
-   * @return The last leg on the itinerary.
126
-   */
127
-  Leg lastLeg() {
128
-    if (legs.isEmpty()) {
129
-      return null;
130
-    } else {
131
-      return legs.get(legs.size() - 1);
132
-    }
133
-  }
134
-
135
-  /**
136
-   * @param other itinerary to compare
137
-   * @return <code>true</code> if the legs in this and the other itinerary are all equal.
138
-   */
139
-  @Override
140
-  public boolean sameValueAs(final Itinerary other) {
141
-    return other != null && legs.equals(other.legs);
142
-  }
143
-
144
-  @Override
145
-  public boolean equals(final Object o) {
146
-    if (this == o) return true;
147
-    if (o == null || getClass() != o.getClass()) return false;
148
-
149
-    final Itinerary itinerary = (Itinerary) o;
150
-
151
-    return sameValueAs(itinerary);
152
-  }
153
-
154
-  @Override
155
-  public int hashCode() {
156
-    return legs.hashCode();
157
-  }
158
-
159
-  Itinerary() {
160
-    // Needed by Hibernate
161
-  }
162
-
163
-  // Auto-generated surrogate key
164
-  private Long id;
165
-}

+ 0
- 92
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Leg.java Datei anzeigen

@@ -1,92 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import org.apache.commons.lang.builder.EqualsBuilder;
5
-import org.apache.commons.lang.builder.HashCodeBuilder;
6
-import se.citerus.dddsample.domain.model.location.Location;
7
-import se.citerus.dddsample.domain.model.voyage.Voyage;
8
-import se.citerus.dddsample.domain.shared.ValueObject;
9
-
10
-import java.util.Date;
11
-
12
-/**
13
- * An itinerary consists of one or more legs.
14
- */
15
-public class Leg implements ValueObject<Leg> {
16
-
17
-  private Voyage voyage;
18
-  private Location loadLocation;
19
-  private Location unloadLocation;
20
-  private Date loadTime;
21
-  private Date unloadTime;
22
-
23
-  public Leg(Voyage voyage, Location loadLocation, Location unloadLocation, Date loadTime, Date unloadTime) {
24
-    Validate.noNullElements(new Object[] {voyage, loadLocation, unloadLocation, loadTime, unloadTime});
25
-    
26
-    this.voyage = voyage;
27
-    this.loadLocation = loadLocation;
28
-    this.unloadLocation = unloadLocation;
29
-    this.loadTime = loadTime;
30
-    this.unloadTime = unloadTime;
31
-  }
32
-
33
-  public Voyage voyage() {
34
-    return voyage;
35
-  }
36
-
37
-  public Location loadLocation() {
38
-    return loadLocation;
39
-  }
40
-
41
-  public Location unloadLocation() {
42
-    return unloadLocation;
43
-  }
44
-
45
-  public Date loadTime() {
46
-    return new Date(loadTime.getTime());
47
-  }
48
-
49
-  public Date unloadTime() {
50
-    return new Date(unloadTime.getTime());
51
-  }
52
-
53
-  @Override
54
-  public boolean sameValueAs(final Leg other) {
55
-    return other != null && new EqualsBuilder().
56
-      append(this.voyage, other.voyage).
57
-      append(this.loadLocation, other.loadLocation).
58
-      append(this.unloadLocation, other.unloadLocation).
59
-      append(this.loadTime, other.loadTime).
60
-      append(this.unloadTime, other.unloadTime).
61
-      isEquals();
62
-  }
63
-
64
-  @Override
65
-  public boolean equals(final Object o) {
66
-    if (this == o) return true;
67
-    if (o == null || getClass() != o.getClass()) return false;
68
-
69
-    Leg leg = (Leg) o;
70
-
71
-    return sameValueAs(leg);
72
-  }
73
-
74
-  @Override
75
-  public int hashCode() {
76
-    return new HashCodeBuilder().
77
-      append(voyage).
78
-      append(loadLocation).
79
-      append(unloadLocation).
80
-      append(loadTime).
81
-      append(unloadTime).
82
-      toHashCode();
83
-  }
84
-
85
-  Leg() {
86
-    // Needed by Hibernate
87
-  }
88
-
89
-  // Auto-generated surrogate key
90
-  private Long id;
91
-
92
-}

+ 0
- 100
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/RouteSpecification.java Datei anzeigen

@@ -1,100 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import org.apache.commons.lang.builder.EqualsBuilder;
5
-import org.apache.commons.lang.builder.HashCodeBuilder;
6
-import se.citerus.dddsample.domain.model.location.Location;
7
-import se.citerus.dddsample.domain.shared.AbstractSpecification;
8
-import se.citerus.dddsample.domain.shared.ValueObject;
9
-
10
-import java.util.Date;
11
-
12
-/**
13
- * Route specification. Describes where a cargo orign and destination is,
14
- * and the arrival deadline.
15
- * 
16
- */
17
-public class RouteSpecification extends AbstractSpecification<Itinerary> implements ValueObject<RouteSpecification> {
18
-
19
-  private Location origin;
20
-  private Location destination;
21
-  private Date arrivalDeadline;
22
-
23
-  /**
24
-   * @param origin origin location - can't be the same as the destination
25
-   * @param destination destination location - can't be the same as the origin
26
-   * @param arrivalDeadline arrival deadline
27
-   */
28
-  public RouteSpecification(final Location origin, final Location destination, final Date arrivalDeadline) {
29
-    Validate.notNull(origin, "Origin is required");
30
-    Validate.notNull(destination, "Destination is required");
31
-    Validate.notNull(arrivalDeadline, "Arrival deadline is required");
32
-    Validate.isTrue(!origin.sameIdentityAs(destination), "Origin and destination can't be the same: " + origin);
33
-
34
-    this.origin = origin;
35
-    this.destination = destination;
36
-    this.arrivalDeadline = (Date) arrivalDeadline.clone();
37
-  }
38
-
39
-  /**
40
-   * @return Specified origin location.
41
-   */
42
-  public Location origin() {
43
-    return origin;
44
-  }
45
-
46
-  /**
47
-   * @return Specfied destination location.
48
-   */
49
-  public Location destination() {
50
-    return destination;
51
-  }
52
-
53
-  /**
54
-   * @return Arrival deadline.
55
-   */
56
-  public Date arrivalDeadline() {
57
-    return new Date(arrivalDeadline.getTime());
58
-  }
59
-
60
-  @Override
61
-  public boolean isSatisfiedBy(final Itinerary itinerary) {
62
-    return itinerary != null &&
63
-           origin().sameIdentityAs(itinerary.initialDepartureLocation()) &&
64
-           destination().sameIdentityAs(itinerary.finalArrivalLocation()) &&
65
-           arrivalDeadline().after(itinerary.finalArrivalDate());
66
-  }
67
-
68
-  @Override
69
-  public boolean sameValueAs(final RouteSpecification other) {
70
-    return other != null && new EqualsBuilder().
71
-      append(this.origin, other.origin).
72
-      append(this.destination, other.destination).
73
-      append(this.arrivalDeadline, other.arrivalDeadline).
74
-      isEquals();
75
-  }
76
-
77
-  @Override
78
-  public boolean equals(final Object o) {
79
-    if (this == o) return true;
80
-    if (o == null || getClass() != o.getClass()) return false;
81
-
82
-    final RouteSpecification that = (RouteSpecification) o;
83
-
84
-    return sameValueAs(that);
85
-  }
86
-
87
-  @Override
88
-  public int hashCode() {
89
-    return new HashCodeBuilder().
90
-      append(this.origin).
91
-      append(this.destination).
92
-      append(this.arrivalDeadline).
93
-      toHashCode();
94
-  }
95
-
96
-  RouteSpecification() {
97
-    // Needed by Hibernate
98
-  }
99
-  
100
-}

+ 0
- 16
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/RoutingStatus.java Datei anzeigen

@@ -1,16 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import se.citerus.dddsample.domain.shared.ValueObject;
4
-
5
-/**
6
- * Routing status. 
7
- */
8
-public enum RoutingStatus implements ValueObject<RoutingStatus> {
9
-  NOT_ROUTED, ROUTED, MISROUTED;
10
-
11
-  @Override
12
-  public boolean sameValueAs(final RoutingStatus other) {
13
-    return this.equals(other);
14
-  }
15
-  
16
-}

+ 0
- 59
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/TrackingId.java Datei anzeigen

@@ -1,59 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import se.citerus.dddsample.domain.shared.ValueObject;
5
-
6
-/**
7
- * Uniquely identifies a particular cargo. Automatically generated by the application.
8
- *  
9
- */
10
-public final class TrackingId implements ValueObject<TrackingId> {
11
-
12
-  private String id;
13
-
14
-  /**
15
-   * Constructor.
16
-   *
17
-   * @param id Id string.
18
-   */
19
-  public TrackingId(final String id) {
20
-    Validate.notNull(id);
21
-    this.id = id;
22
-  }
23
-
24
-  /**
25
-   * @return String representation of this tracking id.
26
-   */
27
-  public String idString() {
28
-    return id;
29
-  }
30
-
31
-  @Override
32
-  public boolean equals(Object o) {
33
-    if (this == o) return true;
34
-    if (o == null || getClass() != o.getClass()) return false;
35
-
36
-    TrackingId other = (TrackingId) o;
37
-
38
-    return sameValueAs(other);
39
-  }
40
-
41
-  @Override
42
-  public int hashCode() {
43
-    return id.hashCode();
44
-  }
45
-
46
-  @Override
47
-  public boolean sameValueAs(TrackingId other) {
48
-    return other != null && this.id.equals(other.id);
49
-  }
50
-
51
-  @Override
52
-  public String toString() {
53
-    return id;
54
-  }
55
-
56
-  TrackingId() {
57
-    // Needed by Hibernate
58
-  }
59
-}

+ 0
- 15
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/TransportStatus.java Datei anzeigen

@@ -1,15 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import se.citerus.dddsample.domain.shared.ValueObject;
4
-
5
-/**
6
- * Represents the different transport statuses for a cargo.
7
- */
8
-public enum TransportStatus implements ValueObject<TransportStatus> {
9
-  NOT_RECEIVED, IN_PORT, ONBOARD_CARRIER, CLAIMED, UNKNOWN;
10
-
11
-  @Override
12
-  public boolean sameValueAs(final TransportStatus other) {
13
-    return this.equals(other);
14
-  }
15
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  The cargo aggregate. Cargo is the aggregate root.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 19
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/CannotCreateHandlingEventException.java Datei anzeigen

@@ -1,19 +0,0 @@
1
-package se.citerus.dddsample.domain.model.handling;
2
-
3
-/**
4
- * If a {@link se.citerus.dddsample.domain.model.handling.HandlingEvent} can't be
5
- * created from a given set of parameters.
6
- *
7
- * It is a checked exception because it's not a programming error, but rather a
8
- * special case that the application is built to handle. It can occur during normal
9
- * program execution.
10
- */
11
-public class CannotCreateHandlingEventException extends Exception {
12
-  public CannotCreateHandlingEventException(Exception e) {
13
-    super(e);
14
-  }
15
-
16
-  public CannotCreateHandlingEventException() {
17
-    super();
18
-  }
19
-}

+ 0
- 226
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingEvent.java Datei anzeigen

@@ -1,226 +0,0 @@
1
-package se.citerus.dddsample.domain.model.handling;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import org.apache.commons.lang.builder.EqualsBuilder;
5
-import org.apache.commons.lang.builder.HashCodeBuilder;
6
-import se.citerus.dddsample.domain.model.cargo.Cargo;
7
-import se.citerus.dddsample.domain.model.location.Location;
8
-import se.citerus.dddsample.domain.model.voyage.Voyage;
9
-import se.citerus.dddsample.domain.shared.DomainEvent;
10
-import se.citerus.dddsample.domain.shared.DomainObjectUtils;
11
-import se.citerus.dddsample.domain.shared.ValueObject;
12
-
13
-import java.util.Date;
14
-
15
-/**
16
- * A HandlingEvent is used to register the event when, for instance,
17
- * a cargo is unloaded from a carrier at a some loacation at a given time.
18
- * <p/>
19
- * The HandlingEvent's are sent from different Incident Logging Applications
20
- * some time after the event occured and contain information about the
21
- * {@link se.citerus.dddsample.domain.model.cargo.TrackingId}, {@link se.citerus.dddsample.domain.model.location.Location}, timestamp of the completion of the event,
22
- * and possibly, if applicable a {@link se.citerus.dddsample.domain.model.voyage.Voyage}.
23
- * <p/>
24
- * This class is the only member, and consequently the root, of the HandlingEvent aggregate. 
25
- * <p/>
26
- * HandlingEvent's could contain information about a {@link Voyage} and if so,
27
- * the event type must be either {@link Type#LOAD} or {@link Type#UNLOAD}.
28
- * <p/>
29
- * All other events must be of {@link Type#RECEIVE}, {@link Type#CLAIM} or {@link Type#CUSTOMS}.
30
- */
31
-public final class HandlingEvent implements DomainEvent<HandlingEvent> {
32
-
33
-  private Type type;
34
-  private Voyage voyage;
35
-  private Location location;
36
-  private Date completionTime;
37
-  private Date registrationTime;
38
-  private Cargo cargo;
39
-
40
-  /**
41
-   * Handling event type. Either requires or prohibits a carrier movement
42
-   * association, it's never optional.
43
-   */
44
-  public enum Type implements ValueObject<Type> {
45
-    LOAD(true),
46
-    UNLOAD(true),
47
-    RECEIVE(false),
48
-    CLAIM(false),
49
-    CUSTOMS(false);
50
-
51
-    private final boolean voyageRequired;
52
-
53
-    /**
54
-     * Private enum constructor.
55
-     *
56
-     * @param voyageRequired whether or not a voyage is associated with this event type
57
-     */
58
-    private Type(final boolean voyageRequired) {
59
-      this.voyageRequired = voyageRequired;
60
-    }
61
-
62
-    /**
63
-     * @return True if a voyage association is required for this event type.
64
-     */
65
-    public boolean requiresVoyage() {
66
-      return voyageRequired;
67
-    }
68
-
69
-    /**
70
-     * @return True if a voyage association is prohibited for this event type.
71
-     */
72
-    public boolean prohibitsVoyage() {
73
-      return !requiresVoyage();
74
-    }
75
-
76
-    @Override
77
-    public boolean sameValueAs(Type other) {
78
-      return other != null && this.equals(other);
79
-    }
80
-
81
-  }
82
-
83
-  /**
84
-   * @param cargo            cargo
85
-   * @param completionTime   completion time, the reported time that the event actually happened (e.g. the receive took place).
86
-   * @param registrationTime registration time, the time the message is received
87
-   * @param type             type of event
88
-   * @param location         where the event took place
89
-   * @param voyage           the voyage
90
-   */
91
-  public HandlingEvent(final Cargo cargo,
92
-                       final Date completionTime,
93
-                       final Date registrationTime,
94
-                       final Type type,
95
-                       final Location location,
96
-                       final Voyage voyage) {
97
-    Validate.notNull(cargo, "Cargo is required");
98
-    Validate.notNull(completionTime, "Completion time is required");
99
-    Validate.notNull(registrationTime, "Registration time is required");
100
-    Validate.notNull(type, "Handling event type is required");
101
-    Validate.notNull(location, "Location is required");
102
-    Validate.notNull(voyage, "Voyage is required");
103
-
104
-    if (type.prohibitsVoyage()) {
105
-      throw new IllegalArgumentException("Voyage is not allowed with event type " + type);
106
-    }
107
-
108
-    this.voyage = voyage;
109
-    this.completionTime = (Date) completionTime.clone();
110
-    this.registrationTime = (Date) registrationTime.clone();
111
-    this.type = type;
112
-    this.location = location;
113
-    this.cargo = cargo;
114
-  }
115
-
116
-  /**
117
-   * @param cargo            cargo
118
-   * @param completionTime   completion time, the reported time that the event actually happened (e.g. the receive took place).
119
-   * @param registrationTime registration time, the time the message is received
120
-   * @param type             type of event
121
-   * @param location         where the event took place
122
-   */
123
-  public HandlingEvent(final Cargo cargo,
124
-                       final Date completionTime,
125
-                       final Date registrationTime,
126
-                       final Type type,
127
-                       final Location location) {
128
-    Validate.notNull(cargo, "Cargo is required");
129
-    Validate.notNull(completionTime, "Completion time is required");
130
-    Validate.notNull(registrationTime, "Registration time is required");
131
-    Validate.notNull(type, "Handling event type is required");
132
-    Validate.notNull(location, "Location is required");
133
-
134
-    if (type.requiresVoyage()) {
135
-      throw new IllegalArgumentException("Voyage is required for event type " + type);
136
-    }
137
-
138
-    this.completionTime = (Date) completionTime.clone();
139
-    this.registrationTime = (Date) registrationTime.clone();
140
-    this.type = type;
141
-    this.location = location;
142
-    this.cargo = cargo;
143
-    this.voyage = null;
144
-  }
145
-
146
-  public Type type() {
147
-    return this.type;
148
-  }
149
-
150
-  public Voyage voyage() {
151
-    return DomainObjectUtils.nullSafe(this.voyage, Voyage.NONE);
152
-  }
153
-
154
-  public Date completionTime() {
155
-    return new Date(this.completionTime.getTime());
156
-  }
157
-
158
-  public Date registrationTime() {
159
-    return new Date(this.registrationTime.getTime());
160
-  }
161
-
162
-  public Location location() {
163
-    return this.location;
164
-  }
165
-
166
-  public Cargo cargo() {
167
-    return this.cargo;
168
-  }
169
-
170
-  @Override
171
-  public boolean equals(final Object o) {
172
-    if (this == o) return true;
173
-    if (o == null || getClass() != o.getClass()) return false;
174
-
175
-    final HandlingEvent event = (HandlingEvent) o;
176
-
177
-    return sameEventAs(event);
178
-  }
179
-
180
-  @Override
181
-  public boolean sameEventAs(final HandlingEvent other) {
182
-    return other != null && new EqualsBuilder().
183
-      append(this.cargo, other.cargo).
184
-      append(this.voyage, other.voyage).
185
-      append(this.completionTime, other.completionTime).
186
-      append(this.location, other.location).
187
-      append(this.type, other.type).
188
-      isEquals();
189
-  }
190
-
191
-  @Override
192
-  public int hashCode() {
193
-    return new HashCodeBuilder().
194
-      append(cargo).
195
-      append(voyage).
196
-      append(completionTime).
197
-      append(location).
198
-      append(type).
199
-      toHashCode();
200
-  }
201
-
202
-  @Override
203
-  public String toString() {
204
-    final StringBuilder builder = new StringBuilder("\n--- Handling event ---\n").
205
-      append("Cargo: ").append(cargo.trackingId()).append("\n").
206
-      append("Type: ").append(type).append("\n").
207
-      append("Location: ").append(location.name()).append("\n").
208
-      append("Completed on: ").append(completionTime).append("\n").
209
-      append("Registered on: ").append(registrationTime).append("\n");
210
-    
211
-    if (voyage != null) {
212
-      builder.append("Voyage: ").append(voyage.voyageNumber()).append("\n");
213
-    }
214
-
215
-    return builder.toString();
216
-  }
217
-
218
-  HandlingEvent() {
219
-    // Needed by Hibernate
220
-  }
221
-
222
-
223
-  // Auto-generated surrogate key
224
-  private Long id;
225
-
226
-}

+ 0
- 89
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingEventFactory.java Datei anzeigen

@@ -1,89 +0,0 @@
1
-package se.citerus.dddsample.domain.model.handling;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.Cargo;
4
-import se.citerus.dddsample.domain.model.cargo.CargoRepository;
5
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
6
-import se.citerus.dddsample.domain.model.location.Location;
7
-import se.citerus.dddsample.domain.model.location.LocationRepository;
8
-import se.citerus.dddsample.domain.model.location.UnLocode;
9
-import se.citerus.dddsample.domain.model.voyage.Voyage;
10
-import se.citerus.dddsample.domain.model.voyage.VoyageNumber;
11
-import se.citerus.dddsample.domain.model.voyage.VoyageRepository;
12
-
13
-import java.util.Date;
14
-
15
-/**
16
- * Creates handling events.
17
- */
18
-public class HandlingEventFactory {
19
-
20
-  private final CargoRepository cargoRepository;
21
-  private final VoyageRepository voyageRepository;
22
-  private final LocationRepository locationRepository;
23
-
24
-  public HandlingEventFactory(final CargoRepository cargoRepository,
25
-                              final VoyageRepository voyageRepository,
26
-                              final LocationRepository locationRepository) {
27
-    this.cargoRepository = cargoRepository;
28
-    this.voyageRepository = voyageRepository;
29
-    this.locationRepository = locationRepository;
30
-  }
31
-
32
-  /**
33
-   * @param registrationTime  time when this event was received by the system
34
-   * @param completionTime    when the event was completed, for example finished loading
35
-   * @param trackingId        cargo tracking id
36
-   * @param voyageNumber      voyage number
37
-   * @param unlocode          United Nations Location Code for the location of the event
38
-   * @param type              type of event
39
-   * @throws UnknownVoyageException   if there's no voyage with this number
40
-   * @throws UnknownCargoException    if there's no cargo with this tracking id
41
-   * @throws UnknownLocationException if there's no location with this UN Locode
42
-   * @return A handling event.
43
-   */
44
-  public HandlingEvent createHandlingEvent(Date registrationTime, Date completionTime, TrackingId trackingId, VoyageNumber voyageNumber, UnLocode unlocode, HandlingEvent.Type type)
45
-    throws CannotCreateHandlingEventException {
46
-    final Cargo cargo = findCargo(trackingId);
47
-    final Voyage voyage = findVoyage(voyageNumber);
48
-    final Location location = findLocation(unlocode);
49
-
50
-    try {
51
-      if (voyage == null) {
52
-        return new HandlingEvent(cargo, completionTime, registrationTime, type, location);
53
-      } else {
54
-        return new HandlingEvent(cargo, completionTime, registrationTime, type, location, voyage);
55
-      }
56
-    } catch (Exception e) {
57
-      throw new CannotCreateHandlingEventException(e);
58
-    }
59
-  }
60
-
61
-  private Cargo findCargo(TrackingId trackingId) throws UnknownCargoException {
62
-    final Cargo cargo = cargoRepository.find(trackingId);
63
-    if (cargo == null) throw new UnknownCargoException(trackingId);
64
-    return cargo;
65
-  }
66
-
67
-  private Voyage findVoyage(VoyageNumber voyageNumber) throws UnknownVoyageException {
68
-    if (voyageNumber == null) {
69
-      return null;
70
-    }
71
-
72
-    final Voyage voyage = voyageRepository.find(voyageNumber);
73
-    if (voyage == null) {
74
-      throw new UnknownVoyageException(voyageNumber);
75
-    }
76
-
77
-    return voyage;
78
-  }
79
-  
80
-  private Location findLocation(final UnLocode unlocode) throws UnknownLocationException {
81
-    final Location location = locationRepository.find(unlocode);
82
-    if (location == null) {
83
-      throw new UnknownLocationException(unlocode);
84
-    }
85
-
86
-    return location;
87
-  }
88
-
89
-}

+ 0
- 24
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingEventRepository.java Datei anzeigen

@@ -1,24 +0,0 @@
1
-package se.citerus.dddsample.domain.model.handling;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
4
-
5
-/**
6
- * Handling event repository.
7
- */
8
-public interface HandlingEventRepository {
9
-
10
-  /**
11
-   * Stores a (new) handling event.
12
-   *
13
-   * @param event handling event to save
14
-   */
15
-  void store(HandlingEvent event);
16
-
17
-
18
-  /**
19
-   * @param trackingId cargo tracking id
20
-   * @return The handling history of this cargo
21
-   */
22
-  HandlingHistory lookupHandlingHistoryOfCargo(TrackingId trackingId);
23
-
24
-}

+ 0
- 74
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingHistory.java Datei anzeigen

@@ -1,74 +0,0 @@
1
-package se.citerus.dddsample.domain.model.handling;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import se.citerus.dddsample.domain.shared.ValueObject;
5
-
6
-import java.util.*;
7
-import static java.util.Collections.sort;
8
-
9
-/**
10
- * The handling history of a cargo.
11
- *
12
- */
13
-public class HandlingHistory implements ValueObject<HandlingHistory> {
14
-
15
-  private final List<HandlingEvent> handlingEvents;
16
-
17
-  public static final HandlingHistory EMPTY = new HandlingHistory(Collections.<HandlingEvent>emptyList());
18
-
19
-  public HandlingHistory(Collection<HandlingEvent> handlingEvents) {
20
-    Validate.notNull(handlingEvents, "Handling events are required");
21
-
22
-    this.handlingEvents = new ArrayList<HandlingEvent>(handlingEvents);
23
-  }
24
-
25
-  /**
26
-   * @return A distinct list (no duplicate registrations) of handling events, ordered by completion time.
27
-   */
28
-  public List<HandlingEvent> distinctEventsByCompletionTime() {
29
-    final List<HandlingEvent> ordered = new ArrayList<HandlingEvent>(
30
-      new HashSet<HandlingEvent>(handlingEvents)
31
-    );
32
-    sort(ordered, BY_COMPLETION_TIME_COMPARATOR);
33
-    return Collections.unmodifiableList(ordered);
34
-  }
35
-
36
-  /**
37
-   * @return Most recently completed event, or null if the delivery history is empty.
38
-   */
39
-  public HandlingEvent mostRecentlyCompletedEvent() {
40
-    final List<HandlingEvent> distinctEvents = distinctEventsByCompletionTime();
41
-    if (distinctEvents.isEmpty()) {
42
-      return null;
43
-    } else {
44
-      return distinctEvents.get(distinctEvents.size() - 1);
45
-    }
46
-  }
47
-
48
-  @Override
49
-  public boolean sameValueAs(HandlingHistory other) {
50
-    return other != null && this.handlingEvents.equals(other.handlingEvents);
51
-  }
52
-
53
-  @Override
54
-  public boolean equals(Object o) {
55
-    if (this == o) return true;
56
-    if (o == null || getClass() != o.getClass()) return false;
57
-
58
-    final HandlingHistory other = (HandlingHistory) o;
59
-    return sameValueAs(other);
60
-  }
61
-
62
-  @Override
63
-  public int hashCode() {
64
-    return handlingEvents.hashCode();
65
-  }
66
-
67
-  private static final Comparator<HandlingEvent> BY_COMPLETION_TIME_COMPARATOR =
68
-    new Comparator<HandlingEvent>() {
69
-      public int compare(final HandlingEvent he1, final HandlingEvent he2) {
70
-        return he1.completionTime().compareTo(he2.completionTime());
71
-      }
72
-    };
73
-
74
-}

+ 0
- 26
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/UnknownCargoException.java Datei anzeigen

@@ -1,26 +0,0 @@
1
-package se.citerus.dddsample.domain.model.handling;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
4
-
5
-/**
6
- * Thrown when trying to register an event with an unknown tracking id.
7
- */
8
-public final class UnknownCargoException extends CannotCreateHandlingEventException {
9
-
10
-  private final TrackingId trackingId;
11
-
12
-  /**
13
-   * @param trackingId cargo tracking id
14
-   */
15
-  public UnknownCargoException(final TrackingId trackingId) {
16
-    this.trackingId = trackingId;
17
-  }
18
-
19
-  /**
20
-   * {@inheritDoc}
21
-   */            
22
-  @Override
23
-  public String getMessage() {
24
-    return "No cargo with tracking id " + trackingId.idString() + " exists in the system";
25
-  }
26
-}

+ 0
- 17
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/UnknownLocationException.java Datei anzeigen

@@ -1,17 +0,0 @@
1
-package se.citerus.dddsample.domain.model.handling;
2
-
3
-import se.citerus.dddsample.domain.model.location.UnLocode;
4
-
5
-public class UnknownLocationException extends CannotCreateHandlingEventException {
6
-
7
-  private final UnLocode unlocode;
8
-
9
-  public UnknownLocationException(final UnLocode unlocode) {
10
-    this.unlocode = unlocode;
11
-  }
12
-
13
-  @Override
14
-  public String getMessage() {
15
-    return "No location with UN locode " + unlocode.idString() + " exists in the system";
16
-  }
17
-}

+ 0
- 20
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/UnknownVoyageException.java Datei anzeigen

@@ -1,20 +0,0 @@
1
-package se.citerus.dddsample.domain.model.handling;
2
-
3
-import se.citerus.dddsample.domain.model.voyage.VoyageNumber;
4
-
5
-/**
6
- * Thrown when trying to register an event with an unknown carrier movement id.
7
- */
8
-public class UnknownVoyageException extends CannotCreateHandlingEventException {
9
-
10
-  private final VoyageNumber voyageNumber;
11
-
12
-  public UnknownVoyageException(VoyageNumber voyageNumber) {
13
-    this.voyageNumber = voyageNumber;
14
-  }
15
-
16
-  @Override
17
-  public String getMessage() {
18
-    return "No voyage with number " + voyageNumber.idString() + " exists in the system";
19
-  }
20
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  The handling aggregate. HandlingEvent is the aggregate root.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 97
dddsample/src/main/java/se/citerus/dddsample/domain/model/location/Location.java Datei anzeigen

@@ -1,97 +0,0 @@
1
-package se.citerus.dddsample.domain.model.location;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import se.citerus.dddsample.domain.shared.Entity;
5
-
6
-/**
7
- * A location is our model is stops on a journey, such as cargo
8
- * origin or destination, or carrier movement endpoints.
9
- *
10
- * It is uniquely identified by a UN Locode.
11
- *
12
- */
13
-public final class Location implements Entity<Location> {
14
-
15
-  private UnLocode unLocode;
16
-  private String name;
17
-
18
-  /**
19
-   * Special Location object that marks an unknown location.
20
-   */
21
-  public static final Location UNKNOWN = new Location(
22
-    new UnLocode("XXXXX"), "Unknown location"
23
-  );
24
-
25
-  /**
26
-   * Package-level constructor, visible for test only.
27
-   *
28
-   * @param unLocode UN Locode
29
-   * @param name     location name
30
-   * @throws IllegalArgumentException if the UN Locode or name is null
31
-   */
32
-  Location(final UnLocode unLocode, final String name) {
33
-    Validate.notNull(unLocode);
34
-    Validate.notNull(name);
35
-    
36
-    this.unLocode = unLocode;
37
-    this.name = name;
38
-  }
39
-
40
-  /**
41
-   * @return UN Locode for this location.
42
-   */
43
-  public UnLocode unLocode() {
44
-    return unLocode;
45
-  }
46
-
47
-  /**
48
-   * @return Actual name of this location, e.g. "Stockholm".
49
-   */
50
-  public String name() {
51
-    return name;
52
-  }
53
-
54
-  /**
55
-   * @param object to compare
56
-   * @return Since this is an entiy this will be true iff UN locodes are equal.
57
-   */
58
-  @Override
59
-  public boolean equals(final Object object) {
60
-    if (object == null) {
61
-      return false;
62
-    }
63
-    if (this == object) {
64
-      return true;
65
-    }
66
-    if (!(object instanceof Location)) {
67
-      return false;
68
-    }
69
-    Location other = (Location) object;
70
-    return sameIdentityAs(other);
71
-  }
72
-
73
-  @Override
74
-  public boolean sameIdentityAs(final Location other) {
75
-    return this.unLocode.sameValueAs(other.unLocode);
76
-  }
77
-
78
-  /**
79
-   * @return Hash code of UN locode.
80
-   */
81
-  @Override
82
-  public int hashCode() {
83
-    return unLocode.hashCode();
84
-  }
85
-
86
-  @Override
87
-  public String toString() {
88
-    return name + " [" + unLocode + "]";
89
-  }
90
-
91
-  Location() {
92
-    // Needed by Hibernate
93
-  }
94
-
95
-  private Long id;
96
-
97
-}

+ 0
- 22
dddsample/src/main/java/se/citerus/dddsample/domain/model/location/LocationRepository.java Datei anzeigen

@@ -1,22 +0,0 @@
1
-package se.citerus.dddsample.domain.model.location;
2
-
3
-import java.util.List;
4
-
5
-public interface LocationRepository {
6
-
7
-  /**
8
-   * Finds a location using given unlocode.
9
-   *
10
-   * @param unLocode UNLocode.
11
-   * @return Location.
12
-   */
13
-  Location find(UnLocode unLocode);
14
-
15
-  /**
16
-   * Finds all locations.
17
-   *
18
-   * @return All locations.
19
-   */
20
-  List<Location> findAll();
21
-
22
-}

+ 0
- 52
dddsample/src/main/java/se/citerus/dddsample/domain/model/location/SampleLocations.java Datei anzeigen

@@ -1,52 +0,0 @@
1
-package se.citerus.dddsample.domain.model.location;
2
-
3
-import java.lang.reflect.Field;
4
-import java.util.ArrayList;
5
-import java.util.HashMap;
6
-import java.util.List;
7
-import java.util.Map;
8
-
9
-/**
10
- * Sample locations, for test purposes.
11
- * 
12
- */
13
-public class SampleLocations {
14
-
15
-  public static final Location HONGKONG = new Location(new UnLocode("CNHKG"), "Hongkong");
16
-  public static final Location MELBOURNE = new Location(new UnLocode("AUMEL"), "Melbourne");
17
-  public static final Location STOCKHOLM = new Location(new UnLocode("SESTO"), "Stockholm");
18
-  public static final Location HELSINKI = new Location(new UnLocode("FIHEL"), "Helsinki");
19
-  public static final Location CHICAGO = new Location(new UnLocode("USCHI"), "Chicago");
20
-  public static final Location TOKYO = new Location(new UnLocode("JNTKO"), "Tokyo");
21
-  public static final Location HAMBURG = new Location(new UnLocode("DEHAM"), "Hamburg");
22
-  public static final Location SHANGHAI = new Location(new UnLocode("CNSHA"), "Shanghai");
23
-  public static final Location ROTTERDAM = new Location(new UnLocode("NLRTM"), "Rotterdam");
24
-  public static final Location GOTHENBURG = new Location(new UnLocode("SEGOT"), "Göteborg");
25
-  public static final Location HANGZOU = new Location(new UnLocode("CNHGH"), "Hangzhou");
26
-  public static final Location NEWYORK = new Location(new UnLocode("USNYC"), "New York");
27
-  public static final Location DALLAS = new Location(new UnLocode("USDAL"), "Dallas");
28
-
29
-  public static final Map<UnLocode, Location> ALL = new HashMap<UnLocode, Location>();
30
-
31
-  static {
32
-    for (Field field : SampleLocations.class.getDeclaredFields()) {
33
-      if (field.getType().equals(Location.class)) {
34
-        try {
35
-          Location location = (Location) field.get(null);
36
-          ALL.put(location.unLocode(), location);
37
-        } catch (IllegalAccessException e) {
38
-          throw new RuntimeException(e);
39
-        }
40
-      }
41
-    }
42
-  }
43
-
44
-  public static List<Location> getAll() {
45
-    return new ArrayList<Location>(ALL.values());
46
-  }
47
-
48
-  public static Location lookup(UnLocode unLocode) {
49
-    return ALL.get(unLocode);
50
-  }
51
-
52
-}

+ 0
- 71
dddsample/src/main/java/se/citerus/dddsample/domain/model/location/UnLocode.java Datei anzeigen

@@ -1,71 +0,0 @@
1
-package se.citerus.dddsample.domain.model.location;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import se.citerus.dddsample.domain.shared.ValueObject;
5
-
6
-import java.util.regex.Pattern;
7
-
8
-/**
9
- * United nations location code.
10
- * <p/>
11
- * http://www.unece.org/cefact/locode/
12
- * http://www.unece.org/cefact/locode/DocColumnDescription.htm#LOCODE
13
- */
14
-public final class UnLocode implements ValueObject<UnLocode> {
15
-
16
-  private String unlocode;
17
-
18
-  // Country code is exactly two letters.
19
-  // Location code is usually three letters, but may contain the numbers 2-9 as well
20
-  private static final Pattern VALID_PATTERN = Pattern.compile("[a-zA-Z]{2}[a-zA-Z2-9]{3}");
21
-
22
-  /**
23
-   * Constructor.
24
-   *
25
-   * @param countryAndLocation Location string.
26
-   */
27
-  public UnLocode(final String countryAndLocation) {
28
-    Validate.notNull(countryAndLocation, "Country and location may not be null");
29
-    Validate.isTrue(VALID_PATTERN.matcher(countryAndLocation).matches(),
30
-      countryAndLocation + " is not a valid UN/LOCODE (does not match pattern)");
31
-
32
-    this.unlocode = countryAndLocation.toUpperCase();
33
-  }
34
-
35
-  /**
36
-   * @return country code and location code concatenated, always upper case.
37
-   */
38
-  public String idString() {
39
-    return unlocode;
40
-  }
41
-
42
-  @Override
43
-  public boolean equals(final Object o) {
44
-    if (this == o) return true;
45
-    if (o == null || getClass() != o.getClass()) return false;
46
-
47
-    UnLocode other = (UnLocode) o;
48
-
49
-    return sameValueAs(other);
50
-  }
51
-
52
-  @Override
53
-  public int hashCode() {
54
-    return unlocode.hashCode();
55
-  }
56
-
57
-  @Override
58
-  public boolean sameValueAs(UnLocode other) {
59
-    return other != null && this.unlocode.equals(other.unlocode);
60
-  }
61
-
62
-  @Override
63
-  public String toString() {
64
-    return idString();
65
-  }
66
-
67
-  UnLocode() {
68
-    // Needed by Hibernate
69
-  }
70
-
71
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/domain/model/location/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  The location aggregate. Location is the aggregate root.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 9
dddsample/src/main/java/se/citerus/dddsample/domain/model/package.html Datei anzeigen

@@ -1,9 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  The domain model. This is the heart of the application. Each aggregate is contained in
5
-  its own subpackage, along with the repository interface, factories and exceptions where
6
-  applicable.
7
-</p>
8
-</body>
9
-</html>

+ 0
- 113
dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/CarrierMovement.java Datei anzeigen

@@ -1,113 +0,0 @@
1
-package se.citerus.dddsample.domain.model.voyage;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import org.apache.commons.lang.builder.EqualsBuilder;
5
-import org.apache.commons.lang.builder.HashCodeBuilder;
6
-import se.citerus.dddsample.domain.model.location.Location;
7
-import se.citerus.dddsample.domain.shared.ValueObject;
8
-
9
-import java.util.Date;
10
-
11
-
12
-/**
13
- * A carrier movement is a vessel voyage from one location to another.
14
- */
15
-public final class CarrierMovement implements ValueObject<CarrierMovement> {
16
-
17
-  private Location departureLocation;
18
-  private Location arrivalLocation;
19
-  private Date departureTime;
20
-  private Date arrivalTime;
21
-
22
-  // Null object pattern 
23
-  public static final CarrierMovement NONE = new CarrierMovement(
24
-    Location.UNKNOWN, Location.UNKNOWN,
25
-    new Date(0), new Date(0)
26
-  );
27
-
28
-  /**
29
-   * Constructor.
30
-   *
31
-   * @param departureLocation location of departure
32
-   * @param arrivalLocation location of arrival
33
-   * @param departureTime time of departure
34
-   * @param arrivalTime time of arrival
35
-   */
36
-  // TODO make package local
37
-  public CarrierMovement(Location departureLocation,
38
-                         Location arrivalLocation,
39
-                         Date departureTime,
40
-                         Date arrivalTime) {
41
-    Validate.noNullElements(new Object[]{departureLocation, arrivalLocation, departureTime, arrivalTime});
42
-    this.departureTime = departureTime;
43
-    this.arrivalTime = arrivalTime;
44
-    this.departureLocation = departureLocation;
45
-    this.arrivalLocation = arrivalLocation;
46
-  }
47
-
48
-  /**
49
-   * @return Departure location.
50
-   */
51
-  public Location departureLocation() {
52
-    return departureLocation;
53
-  }
54
-
55
-  /**
56
-   * @return Arrival location.
57
-   */
58
-  public Location arrivalLocation() {
59
-    return arrivalLocation;
60
-  }
61
-
62
-  /**
63
-   * @return Time of departure.
64
-   */
65
-  public Date departureTime() {
66
-    return new Date(departureTime.getTime());
67
-  }
68
-
69
-  /**
70
-   * @return Time of arrival.
71
-   */
72
-  public Date arrivalTime() {
73
-    return new Date(arrivalTime.getTime());
74
-  }
75
-
76
-  @Override
77
-  public boolean equals(final Object o) {
78
-    if (this == o) return true;
79
-    if (o == null || getClass() != o.getClass()) return false;
80
-
81
-    final CarrierMovement that = (CarrierMovement) o;
82
-
83
-    return sameValueAs(that);
84
-  }
85
-
86
-  @Override
87
-  public int hashCode() {
88
-    return new HashCodeBuilder().
89
-      append(this.departureLocation).
90
-      append(this.departureTime).
91
-      append(this.arrivalLocation).
92
-      append(this.arrivalTime).
93
-      toHashCode();
94
-  }
95
-
96
-  @Override
97
-  public boolean sameValueAs(CarrierMovement other) {
98
-    return other != null && new EqualsBuilder().
99
-      append(this.departureLocation, other.departureLocation).
100
-      append(this.departureTime, other.departureTime).
101
-      append(this.arrivalLocation, other.arrivalLocation).
102
-      append(this.arrivalTime, other.arrivalTime).
103
-      isEquals();
104
-  }
105
-
106
-  CarrierMovement() {
107
-    // Needed by Hibernate
108
-  }
109
-
110
-  // Auto-generated surrogate key
111
-  private Long id;
112
-
113
-}

+ 0
- 134
dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/SampleVoyages.java Datei anzeigen

@@ -1,134 +0,0 @@
1
-package se.citerus.dddsample.domain.model.voyage;
2
-
3
-import static se.citerus.dddsample.application.util.DateTestUtil.toDate;
4
-import se.citerus.dddsample.domain.model.location.Location;
5
-import static se.citerus.dddsample.domain.model.location.SampleLocations.*;
6
-
7
-import java.lang.reflect.Field;
8
-import java.util.*;
9
-
10
-/**
11
- * Sample carrier movements, for test purposes.
12
- *
13
- */
14
-public class SampleVoyages {
15
-
16
-  public static final Voyage CM001 = createVoyage("CM001", STOCKHOLM, HAMBURG);
17
-  public static final Voyage CM002 = createVoyage("CM002", HAMBURG, HONGKONG);
18
-  public static final Voyage CM003 = createVoyage("CM003", HONGKONG, NEWYORK);
19
-  public static final Voyage CM004 = createVoyage("CM004", NEWYORK, CHICAGO);
20
-  public static final Voyage CM005 = createVoyage("CM005", CHICAGO, HAMBURG);
21
-  public static final Voyage CM006 = createVoyage("CM006", HAMBURG, HANGZOU);
22
-  private static Voyage createVoyage(String id, Location from, Location to) {
23
-    return new Voyage(new VoyageNumber(id), new Schedule(Arrays.asList(
24
-      new CarrierMovement(from, to, new Date(), new Date())
25
-    )));
26
-  }
27
-
28
-  // TODO CM00[1-6] and createVoyage are deprecated. Remove and refactor tests.
29
-
30
-  public final static Voyage v100 = new Voyage.Builder(new VoyageNumber("V100"), HONGKONG).
31
-    addMovement(TOKYO, toDate("2009-03-03"), toDate("2009-03-05")).
32
-    addMovement(NEWYORK, toDate("2009-03-06"), toDate("2009-03-09")).
33
-    build();
34
-  public final static Voyage v200 = new Voyage.Builder(new VoyageNumber("V200"), TOKYO).
35
-      addMovement(NEWYORK, toDate("2009-03-06"), toDate("2009-03-08")).
36
-      addMovement(CHICAGO, toDate("2009-03-10"), toDate("2009-03-14")).
37
-      addMovement(STOCKHOLM, toDate("2009-03-14"), toDate("2009-03-16")).
38
-      build();
39
-  public final static Voyage v300 = new Voyage.Builder(new VoyageNumber("V300"), TOKYO).
40
-        addMovement(ROTTERDAM, toDate("2009-03-08"), toDate("2009-03-11")).
41
-        addMovement(HAMBURG, toDate("2009-03-11"), toDate("2009-03-12")).
42
-        addMovement(MELBOURNE, toDate("2009-03-14"), toDate("2009-03-18")).
43
-        addMovement(TOKYO, toDate("2009-03-19"), toDate("2009-03-21")).
44
-        build();
45
-  public final static Voyage v400 = new Voyage.Builder(new VoyageNumber("V400"), HAMBURG).
46
-          addMovement(STOCKHOLM, toDate("2009-03-14"), toDate("2009-03-15")).
47
-          addMovement(HELSINKI, toDate("2009-03-15"), toDate("2009-03-16")).
48
-          addMovement(HAMBURG, toDate("2009-03-20"), toDate("2009-03-22")).
49
-          build();
50
-
51
-  /**
52
-   * Voyage number 0100S (by ship)
53
-   *
54
-   * Hongkong - Hangzou - Tokyo - Melbourne - New York
55
-   */
56
-  public static final Voyage HONGKONG_TO_NEW_YORK =
57
-    new Voyage.Builder(new VoyageNumber("0100S"), HONGKONG).
58
-      addMovement(HANGZOU, toDate("2008-10-01", "12:00"), toDate("2008-10-03", "14:30")).
59
-      addMovement(TOKYO, toDate("2008-10-03", "21:00"), toDate("2008-10-06", "06:15")).
60
-      addMovement(MELBOURNE, toDate("2008-10-06", "11:00"), toDate("2008-10-12", "11:30")).
61
-      addMovement(NEWYORK, toDate("2008-10-14", "12:00"), toDate("2008-10-23", "23:10")).
62
-      build();
63
-
64
-
65
-  /**
66
-   * Voyage number 0200T (by train)
67
-   *
68
-   * New York - Chicago - Dallas
69
-   */
70
-  public static final Voyage NEW_YORK_TO_DALLAS =
71
-    new Voyage.Builder(new VoyageNumber("0200T"), NEWYORK).
72
-      addMovement(CHICAGO, toDate("2008-10-24", "07:00"), toDate("2008-10-24", "17:45")).
73
-      addMovement(DALLAS, toDate("2008-10-24", "21:25"), toDate("2008-10-25", "19:30")).
74
-      build();
75
-
76
-  /**
77
-   * Voyage number 0300A (by airplane)
78
-   *
79
-   * Dallas - Hamburg - Stockholm - Helsinki
80
-   */
81
-  public static final Voyage DALLAS_TO_HELSINKI =
82
-    new Voyage.Builder(new VoyageNumber("0300A"), DALLAS).
83
-      addMovement(HAMBURG, toDate("2008-10-29", "03:30"), toDate("2008-10-31", "14:00")).
84
-      addMovement(STOCKHOLM, toDate("2008-11-01", "15:20"), toDate("2008-11-01", "18:40")).
85
-      addMovement(HELSINKI, toDate("2008-11-02", "09:00"), toDate("2008-11-02", "11:15")).
86
-      build();
87
-
88
-  /**
89
-   * Voyage number 0301S (by ship)
90
-   *
91
-   * Dallas - Hamburg - Stockholm - Helsinki, alternate route
92
-   */
93
-  public static final Voyage DALLAS_TO_HELSINKI_ALT =
94
-    new Voyage.Builder(new VoyageNumber("0301S"), DALLAS).
95
-      addMovement(HELSINKI, toDate("2008-10-29", "03:30"), toDate("2008-11-05", "15:45")).
96
-      build();
97
-
98
-  /**
99
-   * Voyage number 0400S (by ship)
100
-   *
101
-   * Helsinki - Rotterdam - Shanghai - Hongkong
102
-   *
103
-   */
104
-  public static final Voyage HELSINKI_TO_HONGKONG =
105
-    new Voyage.Builder(new VoyageNumber("0400S"), HELSINKI).
106
-      addMovement(ROTTERDAM, toDate("2008-11-04", "05:50"), toDate("2008-11-06", "14:10")).
107
-      addMovement(SHANGHAI, toDate("2008-11-10", "21:45"), toDate("2008-11-22", "16:40")).
108
-      addMovement(HONGKONG, toDate("2008-11-24", "07:00"), toDate("2008-11-28", "13:37")).
109
-      build();
110
-
111
-  public static final Map<VoyageNumber, Voyage> ALL = new HashMap();
112
-
113
-  static {
114
-    for (Field field : SampleVoyages.class.getDeclaredFields()) {
115
-      if (field.getType().equals(Voyage.class)) {
116
-        try {
117
-          Voyage voyage = (Voyage) field.get(null);
118
-          ALL.put(voyage.voyageNumber(), voyage);
119
-        } catch (IllegalAccessException e) {
120
-          throw new RuntimeException(e);
121
-        }
122
-      }
123
-    }
124
-  }
125
-
126
-  public static List<Voyage> getAll() {
127
-    return new ArrayList(ALL.values());
128
-  }
129
-
130
-  public static Voyage lookup(VoyageNumber voyageNumber) {
131
-    return ALL.get(voyageNumber);
132
-  }
133
-  
134
-}

+ 0
- 59
dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/Schedule.java Datei anzeigen

@@ -1,59 +0,0 @@
1
-package se.citerus.dddsample.domain.model.voyage;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import org.apache.commons.lang.builder.HashCodeBuilder;
5
-import se.citerus.dddsample.domain.shared.ValueObject;
6
-
7
-import java.util.Collections;
8
-import java.util.List;
9
-
10
-/**
11
- * A voyage schedule.
12
- * 
13
- */
14
-public class Schedule implements ValueObject<Schedule> {
15
-
16
-  private List<CarrierMovement> carrierMovements = Collections.EMPTY_LIST;
17
-
18
-  public static final Schedule EMPTY = new Schedule();
19
-
20
-  Schedule(final List<CarrierMovement> carrierMovements) {
21
-    Validate.notNull(carrierMovements);
22
-    Validate.noNullElements(carrierMovements);
23
-    Validate.notEmpty(carrierMovements);
24
-
25
-    this.carrierMovements = carrierMovements;
26
-  }
27
-
28
-  /**
29
-   * @return Carrier movements.
30
-   */
31
-  public List<CarrierMovement> carrierMovements() {
32
-    return Collections.unmodifiableList(carrierMovements);
33
-  }
34
-
35
-  @Override
36
-  public boolean sameValueAs(final Schedule other) {
37
-    return other != null && this.carrierMovements.equals(other.carrierMovements);
38
-  }
39
-
40
-  @Override
41
-  public boolean equals(final Object o) {
42
-    if (this == o) return true;
43
-    if (o == null || getClass() != o.getClass()) return false;
44
-
45
-    final Schedule that = (Schedule) o;
46
-
47
-    return sameValueAs(that);
48
-  }
49
-
50
-  @Override
51
-  public int hashCode() {
52
-    return new HashCodeBuilder().append(this.carrierMovements).toHashCode();
53
-  }
54
-
55
-  Schedule() {
56
-    // Needed by Hibernate
57
-  }
58
-
59
-}

+ 0
- 110
dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/Voyage.java Datei anzeigen

@@ -1,110 +0,0 @@
1
-package se.citerus.dddsample.domain.model.voyage;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import se.citerus.dddsample.domain.model.location.Location;
5
-import se.citerus.dddsample.domain.shared.Entity;
6
-
7
-import java.util.ArrayList;
8
-import java.util.Date;
9
-import java.util.List;
10
-
11
-/**
12
- * A Voyage.
13
- */
14
-public class Voyage implements Entity<Voyage> {
15
-
16
-  private VoyageNumber voyageNumber;
17
-  private Schedule schedule;
18
-
19
-  // Null object pattern
20
-  public static final Voyage NONE = new Voyage(
21
-    new VoyageNumber(""), Schedule.EMPTY
22
-  );
23
-
24
-  public Voyage(final VoyageNumber voyageNumber, final Schedule schedule) {
25
-    Validate.notNull(voyageNumber, "Voyage number is required");
26
-    Validate.notNull(schedule, "Schedule is required");
27
-
28
-    this.voyageNumber = voyageNumber;
29
-    this.schedule = schedule;
30
-  }
31
-
32
-  /**
33
-   * @return Voyage number.
34
-   */
35
-  public VoyageNumber voyageNumber() {
36
-    return voyageNumber;
37
-  }
38
-
39
-  /**
40
-   * @return Schedule.
41
-   */
42
-  public Schedule schedule() {
43
-    return schedule;
44
-  }
45
-
46
-  @Override
47
-  public int hashCode() {
48
-    return voyageNumber.hashCode();
49
-  }
50
-
51
-  @Override
52
-  public boolean equals(Object o) {
53
-    if (this == o) return true;
54
-    if (o == null) return false;
55
-    if (!(o instanceof Voyage)) return false;
56
-
57
-    final Voyage that = (Voyage) o;
58
-
59
-    return sameIdentityAs(that);
60
-  }
61
-
62
-  @Override
63
-  public boolean sameIdentityAs(Voyage other) {
64
-    return other != null && this.voyageNumber().sameValueAs(other.voyageNumber());
65
-  }
66
-
67
-  @Override
68
-  public String toString() {
69
-    return "Voyage " + voyageNumber;
70
-  }
71
-
72
-  Voyage() {
73
-    // Needed by Hibernate
74
-  }
75
-
76
-  // Needed by Hibernate
77
-  private Long id;
78
-
79
-  /**
80
-   * Builder pattern is used for incremental construction
81
-   * of a Voyage aggregate. This serves as an aggregate factory. 
82
-   */
83
-  public static final class Builder {
84
-
85
-    private final List<CarrierMovement> carrierMovements = new ArrayList<CarrierMovement>();
86
-    private final VoyageNumber voyageNumber;
87
-    private Location departureLocation;
88
-
89
-    public Builder(final VoyageNumber voyageNumber, final Location departureLocation) {
90
-      Validate.notNull(voyageNumber, "Voyage number is required");
91
-      Validate.notNull(departureLocation, "Departure location is required");
92
-
93
-      this.voyageNumber = voyageNumber;
94
-      this.departureLocation = departureLocation;
95
-    }
96
-
97
-    public Builder addMovement(Location arrivalLocation, Date departureTime, Date arrivalTime) {
98
-      carrierMovements.add(new CarrierMovement(departureLocation, arrivalLocation, departureTime, arrivalTime));
99
-      // Next departure location is the same as this arrival location
100
-      this.departureLocation = arrivalLocation;
101
-      return this;
102
-    }
103
-
104
-    public Voyage build() {
105
-      return new Voyage(voyageNumber, new Schedule(carrierMovements));
106
-    }
107
-
108
-  }
109
-
110
-}

+ 0
- 54
dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/VoyageNumber.java Datei anzeigen

@@ -1,54 +0,0 @@
1
-package se.citerus.dddsample.domain.model.voyage;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import se.citerus.dddsample.domain.shared.ValueObject;
5
-
6
-/**
7
- * Identifies a voyage.
8
- * 
9
- */
10
-public class VoyageNumber implements ValueObject<VoyageNumber> {
11
-
12
-  private String number;
13
-
14
-  public VoyageNumber(String number) {
15
-    Validate.notNull(number);
16
-    
17
-    this.number = number;
18
-  }
19
-
20
-  @Override
21
-  public boolean equals(Object o) {
22
-    if (this == o) return true;
23
-    if (o == null) return false;
24
-    if (!(o instanceof VoyageNumber)) return false;
25
-
26
-    final VoyageNumber other = (VoyageNumber) o;
27
-    
28
-    return sameValueAs(other);
29
-  }
30
-
31
-  @Override
32
-  public int hashCode() {
33
-    return number.hashCode();
34
-  }
35
-
36
-  @Override
37
-  public boolean sameValueAs(VoyageNumber other) {
38
-    return other != null && this.number.equals(other.number);
39
-  }
40
-
41
-  @Override
42
-  public String toString() {
43
-    return number;
44
-  }
45
-
46
-  public String idString() {
47
-    return number;
48
-  }
49
-
50
-  VoyageNumber() {
51
-    // Needed by Hibernate
52
-  }
53
-  
54
-}

+ 0
- 13
dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/VoyageRepository.java Datei anzeigen

@@ -1,13 +0,0 @@
1
-package se.citerus.dddsample.domain.model.voyage;
2
-
3
-public interface VoyageRepository {
4
-
5
-  /**
6
-   * Finds a voyage using voyage number.
7
-   *
8
-   * @param voyageNumber voyage number
9
-   * @return The voyage, or null if not found.
10
-   */
11
-  Voyage find(VoyageNumber voyageNumber);
12
-
13
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/domain/model/voyage/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  The voyage aggregate. Voyage is the aggregate root.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 14
dddsample/src/main/java/se/citerus/dddsample/domain/package.html Datei anzeigen

@@ -1,14 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  The domain model, services and repository interfaces. This is the central part of the
5
-  application. The ubiquitous language is used in classes, interfaces and method signatures,
6
-  and every concept in here is familiar to a expert in the cargo shiping domain.
7
-</p>
8
-<p>
9
-  There is no infrastructure or user interface related code here, except for things like
10
-  transactional and security metadata which is likely to be relevant to a domain expert
11
-  ("Either all of foo succeeds or none of it does", "In order to do bar you need to be a Supervisor", and so on).
12
-</p>
13
-</body>
14
-</html>

+ 0
- 20
dddsample/src/main/java/se/citerus/dddsample/domain/service/RoutingService.java Datei anzeigen

@@ -1,20 +0,0 @@
1
-package se.citerus.dddsample.domain.service;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.Itinerary;
4
-import se.citerus.dddsample.domain.model.cargo.RouteSpecification;
5
-
6
-import java.util.List;
7
-
8
-/**
9
- * Routing service.
10
- *
11
- */
12
-public interface RoutingService {
13
-
14
-  /**
15
-   * @param routeSpecification route specification
16
-   * @return A list of itineraries that satisfy the specification. May be an empty list if no route is found.
17
-   */
18
-  List<Itinerary> fetchRoutesForSpecification(RouteSpecification routeSpecification);
19
-
20
-}

+ 0
- 9
dddsample/src/main/java/se/citerus/dddsample/domain/service/package.html Datei anzeigen

@@ -1,9 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  Domain services. Those services that may be implemented purely using the domain layer
5
-  have their implementations here, other implementations may be part of the aplication
6
-  or infrastructure layers.
7
-</p>
8
-</body>
9
-</html>

+ 0
- 35
dddsample/src/main/java/se/citerus/dddsample/domain/shared/AbstractSpecification.java Datei anzeigen

@@ -1,35 +0,0 @@
1
-package se.citerus.dddsample.domain.shared;
2
-
3
-
4
-/**
5
- * Abstract base implementation of composite {@link Specification} with default
6
- * implementations for {@code and}, {@code or} and {@code not}.
7
- */
8
-public abstract class AbstractSpecification<T> implements Specification<T> {
9
-
10
-  /**
11
-   * {@inheritDoc}
12
-   */
13
-  public abstract boolean isSatisfiedBy(T t);
14
-
15
-  /**
16
-   * {@inheritDoc}
17
-   */
18
-  public Specification<T> and(final Specification<T> specification) {
19
-    return new AndSpecification<T>(this, specification);
20
-  }
21
-
22
-  /**
23
-   * {@inheritDoc}
24
-   */
25
-  public Specification<T> or(final Specification<T> specification) {
26
-    return new OrSpecification<T>(this, specification);
27
-  }
28
-
29
-  /**
30
-   * {@inheritDoc}
31
-   */
32
-  public Specification<T> not(final Specification<T> specification) {
33
-    return new NotSpecification<T>(specification);
34
-  }
35
-}

+ 0
- 28
dddsample/src/main/java/se/citerus/dddsample/domain/shared/AndSpecification.java Datei anzeigen

@@ -1,28 +0,0 @@
1
-package se.citerus.dddsample.domain.shared;
2
-
3
-/**
4
- * AND specification, used to create a new specifcation that is the AND of two other specifications.
5
- */
6
-public class AndSpecification<T> extends AbstractSpecification<T> {
7
-
8
-  private Specification<T> spec1;
9
-  private Specification<T> spec2;
10
-
11
-  /**
12
-   * Create a new AND specification based on two other spec.
13
-   *
14
-   * @param spec1 Specification one.
15
-   * @param spec2 Specification two.
16
-   */
17
-  public AndSpecification(final Specification<T> spec1, final Specification<T> spec2) {
18
-    this.spec1 = spec1;
19
-    this.spec2 = spec2;
20
-  }
21
-
22
-  /**
23
-   * {@inheritDoc}
24
-   */
25
-  public boolean isSatisfiedBy(final T t) {
26
-    return spec1.isSatisfiedBy(t) && spec2.isSatisfiedBy(t);
27
-  }
28
-}

+ 0
- 17
dddsample/src/main/java/se/citerus/dddsample/domain/shared/DomainEvent.java Datei anzeigen

@@ -1,17 +0,0 @@
1
-package se.citerus.dddsample.domain.shared;
2
-
3
-/**
4
- * A domain event is something that is unique, but does not have a lifecycle.
5
- * The identity may be explicit, for example the sequence number of a payment,
6
- * or it could be derived from various aspects of the event such as where, when and what
7
- * has happened.
8
- */
9
-public interface DomainEvent<T> {
10
-
11
-  /**
12
-   * @param other The other domain event.
13
-   * @return <code>true</code> if the given domain event and this event are regarded as being the same event.
14
-   */
15
-  boolean sameEventAs(T other);
16
-
17
-}

+ 0
- 30
dddsample/src/main/java/se/citerus/dddsample/domain/shared/DomainObjectUtils.java Datei anzeigen

@@ -1,30 +0,0 @@
1
-package se.citerus.dddsample.domain.shared;
2
-
3
-/**
4
- * Utility code for domain classes. 
5
- *
6
- */
7
-public class DomainObjectUtils {
8
-
9
-  /**
10
-   * @param actual actual value
11
-   * @param safe a null-safe value
12
-   * @param <T> type
13
-   * @return actual value, if it's not null, or safe value if the actual value is null.
14
-   */
15
-  public static <T> T nullSafe(T actual, T safe) {
16
-    return actual == null ? safe : actual;
17
-  }
18
-
19
-  // TODO wrappers for some of the commons-lang code:
20
-  //
21
-  // EqualsBuilder that uses sameIdentity/sameValue,
22
-  // better validation (varargs etc) 
23
-
24
-  /**
25
-   * Prevent instantiation.
26
-   */
27
-  private DomainObjectUtils() {
28
-  }
29
-
30
-}

+ 0
- 17
dddsample/src/main/java/se/citerus/dddsample/domain/shared/Entity.java Datei anzeigen

@@ -1,17 +0,0 @@
1
-package se.citerus.dddsample.domain.shared;
2
-
3
-/**
4
- * An entity, as explained in the DDD book.
5
- *  
6
- */
7
-public interface Entity<T> {
8
-
9
-  /**
10
-   * Entities compare by identity, not by attributes.
11
-   *
12
-   * @param other The other entity.
13
-   * @return true if the identities are the same, regardles of other attributes.
14
-   */
15
-  boolean sameIdentityAs(T other);
16
-
17
-}

+ 0
- 25
dddsample/src/main/java/se/citerus/dddsample/domain/shared/NotSpecification.java Datei anzeigen

@@ -1,25 +0,0 @@
1
-package se.citerus.dddsample.domain.shared;
2
-
3
-/**
4
- * NOT decorator, used to create a new specifcation that is the inverse (NOT) of the given spec.
5
- */
6
-public class NotSpecification<T> extends AbstractSpecification<T> {
7
-
8
-  private Specification<T> spec1;
9
-
10
-  /**
11
-   * Create a new NOT specification based on another spec.
12
-   *
13
-   * @param spec1 Specification instance to not.
14
-   */
15
-  public NotSpecification(final Specification<T> spec1) {
16
-    this.spec1 = spec1;
17
-  }
18
-
19
-  /**
20
-   * {@inheritDoc}
21
-   */
22
-  public boolean isSatisfiedBy(final T t) {
23
-    return !spec1.isSatisfiedBy(t);
24
-  }
25
-}

+ 0
- 28
dddsample/src/main/java/se/citerus/dddsample/domain/shared/OrSpecification.java Datei anzeigen

@@ -1,28 +0,0 @@
1
-package se.citerus.dddsample.domain.shared;
2
-
3
-/**
4
- * OR specification, used to create a new specifcation that is the OR of two other specifications.
5
- */
6
-public class OrSpecification<T> extends AbstractSpecification<T> {
7
-
8
-  private Specification<T> spec1;
9
-  private Specification<T> spec2;
10
-
11
-  /**
12
-   * Create a new OR specification based on two other spec.
13
-   *
14
-   * @param spec1 Specification one.
15
-   * @param spec2 Specification two.
16
-   */
17
-  public OrSpecification(final Specification<T> spec1, final Specification<T> spec2) {
18
-    this.spec1 = spec1;
19
-    this.spec2 = spec2;
20
-  }
21
-
22
-  /**
23
-   * {@inheritDoc}
24
-   */
25
-  public boolean isSatisfiedBy(final T t) {
26
-    return spec1.isSatisfiedBy(t) || spec2.isSatisfiedBy(t);
27
-  }
28
-}

+ 0
- 39
dddsample/src/main/java/se/citerus/dddsample/domain/shared/Specification.java Datei anzeigen

@@ -1,39 +0,0 @@
1
-package se.citerus.dddsample.domain.shared;
2
-
3
-/**
4
- * Specificaiton interface.
5
- * <p/>
6
- * Use {@link se.citerus.dddsample.domain.shared.AbstractSpecification} as base for creating specifications, and
7
- * only the method {@link #isSatisfiedBy(Object)} must be implemented.
8
- */
9
-public interface Specification<T> {
10
-
11
-  /**
12
-   * Check if {@code t} is satisfied by the specification.
13
-   *
14
-   * @param t Object to test.
15
-   * @return {@code true} if {@code t} satisfies the specification.
16
-   */
17
-  boolean isSatisfiedBy(T t);
18
-
19
-  /**
20
-   * Create a new specification that is the AND operation of {@code this} specification and another specification.
21
-   * @param specification Specification to AND.
22
-   * @return A new specification.
23
-   */
24
-  Specification<T> and(Specification<T> specification);
25
-
26
-  /**
27
-   * Create a new specification that is the OR operation of {@code this} specification and another specification.
28
-   * @param specification Specification to OR.
29
-   * @return A new specification.
30
-   */
31
-  Specification<T> or(Specification<T> specification);
32
-
33
-  /**
34
-   * Create a new specification that is the NOT operation of {@code this} specification.
35
-   * @param specification Specification to NOT.
36
-   * @return A new specification.
37
-   */
38
-  Specification<T> not(Specification<T> specification);
39
-}

+ 0
- 19
dddsample/src/main/java/se/citerus/dddsample/domain/shared/ValueObject.java Datei anzeigen

@@ -1,19 +0,0 @@
1
-package se.citerus.dddsample.domain.shared;
2
-
3
-import java.io.Serializable;
4
-
5
-/**
6
- * A value object, as described in the DDD book.
7
- * 
8
- */
9
-public interface ValueObject<T> extends Serializable {
10
-
11
-  /**
12
-   * Value objects compare by the values of their attributes, they don't have an identity.
13
-   *
14
-   * @param other The other value object.
15
-   * @return <code>true</code> if the given value object's and this value object's attributes are the same.
16
-   */
17
-  boolean sameValueAs(T other);
18
-
19
-}

+ 0
- 17
dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/DomainEvent.java Datei anzeigen

@@ -1,17 +0,0 @@
1
-package se.citerus.dddsample.domain.shared.experimental;
2
-
3
-/**
4
- * A domain event is something that is unique, but does not have a lifecycle.
5
- * The identity may be explicit, for example the sequence number of a payment,
6
- * or it could be derived from various aspects of the event such as where, when and what
7
- * has happened.
8
- */
9
-public interface DomainEvent<T> {
10
-
11
-  /**
12
-   * @param other The other domain event.
13
-   * @return <code>true</code> if the given domain event and this event are regarded as being the same event.
14
-   */
15
-  boolean sameEventAs(T other);
16
-
17
-}

+ 0
- 24
dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/Entity.java Datei anzeigen

@@ -1,24 +0,0 @@
1
-package se.citerus.dddsample.domain.shared.experimental;
2
-
3
-/**
4
- * An entity, as explained in the DDD book.
5
- *
6
- */
7
-public interface Entity<T,ID> {
8
-
9
-  /**
10
-   * Entities compare by identity, not by attributes.
11
-   *
12
-   * @param other The other entity.
13
-   * @return true if the identities are the same, regardles of other attributes.
14
-   */
15
-  boolean sameIdentityAs(T other);
16
-
17
-  /**
18
-   * Entities have an identity.
19
-   *
20
-   * @return The identity of this entity.
21
-   */
22
-  ID identity();
23
-
24
-}

+ 0
- 71
dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/EntitySupport.java Datei anzeigen

@@ -1,71 +0,0 @@
1
-package se.citerus.dddsample.domain.shared.experimental;
2
-
3
-import java.lang.reflect.Field;
4
-
5
-/**
6
- * Base class for entities.
7
- *
8
- */
9
-public abstract class EntitySupport<T extends Entity, ID> implements Entity<T, ID> {
10
-
11
-    private static Field identityField;
12
-
13
-    @Override
14
-    public final boolean sameIdentityAs(final T other) {
15
-        return other != null && this.identity().equals(other.identity());
16
-    }
17
-
18
-    @Override
19
-    public final ID identity() {
20
-        if (identityField == null) {
21
-            identityField = identityFieldLazyDetermination(this.getClass());
22
-        }
23
-
24
-        try {
25
-            return (ID) identityField.get(this);
26
-        } catch (IllegalAccessException e) {
27
-            throw new RuntimeException(e);
28
-        }
29
-    }
30
-
31
-    private static Field identityFieldLazyDetermination(final Class cls) {
32
-        Field identityField = null;
33
-
34
-        for (Field field : cls.getDeclaredFields()) {
35
-            if (field.getAnnotation(Identity.class) != null) {
36
-                field.setAccessible(true);
37
-                if (identityField != null) {
38
-                    throw new IllegalStateException("Only one field can be annotated with " + Identity.class);
39
-                } else {
40
-                    identityField = field;
41
-                }
42
-            }
43
-        }
44
-
45
-        if (identityField == null) {
46
-            if (cls == Object.class) {
47
-                throw new IllegalStateException(
48
-                  "This class, or one of its superclasses, " +
49
-                  "must have a unique field annotated with " + Identity.class);
50
-            } else {
51
-                return identityFieldLazyDetermination(cls.getSuperclass());
52
-            }
53
-        }
54
-
55
-        return identityField;
56
-    }
57
-
58
-    @Override
59
-    public final int hashCode() {
60
-        return identity().hashCode();
61
-    }
62
-
63
-    @Override
64
-    public final boolean equals(final Object o) {
65
-        if (this == o) return true;
66
-        if (o == null || getClass() != o.getClass()) return false;
67
-
68
-        return sameIdentityAs((T) o);
69
-    }
70
-
71
-}

+ 0
- 15
dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/Identity.java Datei anzeigen

@@ -1,15 +0,0 @@
1
-package se.citerus.dddsample.domain.shared.experimental;
2
-
3
-import java.lang.annotation.ElementType;
4
-import java.lang.annotation.Retention;
5
-import java.lang.annotation.RetentionPolicy;
6
-import java.lang.annotation.Target;
7
-
8
-/**
9
- * Every class that inherits from {@link se.citerus.dddsample.domain.shared.experimental.EntitySupport}
10
- * must have exactly one field annotated with this annotation.
11
- */
12
-@Retention(RetentionPolicy.RUNTIME)
13
-@Target(ElementType.FIELD)
14
-public @interface Identity {
15
-}

+ 0
- 24
dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/ValueObject.java Datei anzeigen

@@ -1,24 +0,0 @@
1
-package se.citerus.dddsample.domain.shared.experimental;
2
-
3
-/**
4
- * A value object.
5
- *
6
- */
7
-public interface ValueObject<T> {
8
-
9
-  /**
10
-   * Value objects compare by the values of their attributes, they don't have an identity.
11
-   *
12
-   * @param other The other value object.
13
-   * @return <code>true</code> if the given value object's and this value object's attributes are the same.
14
-   */
15
-  boolean sameValueAs(T other);
16
-
17
-  /**
18
-   * Value objects can be freely copied.
19
-   *
20
-   * @return A safe, deep copy of this value object.
21
-   */
22
-  T copy();
23
-
24
-}

+ 0
- 60
dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/ValueObjectSupport.java Datei anzeigen

@@ -1,60 +0,0 @@
1
-package se.citerus.dddsample.domain.shared.experimental;
2
-
3
-import org.apache.commons.lang.builder.EqualsBuilder;
4
-import org.apache.commons.lang.builder.HashCodeBuilder;
5
-import se.citerus.dddsample.domain.shared.ValueObject;
6
-
7
-/**
8
- * Base class for value objects.
9
- *
10
- * @param <T>
11
- */
12
-public abstract class ValueObjectSupport<T extends ValueObject> implements ValueObject<T> {
13
-
14
-  private transient int cachedHashCode = 0;
15
-
16
-  /**
17
-   * @param other The other value object.
18
-   * @return True if all non-transient fields are equal.
19
-   */
20
-  @Override
21
-  public final boolean sameValueAs(final T other) {
22
-    return other != null && EqualsBuilder.reflectionEquals(this, other, false);
23
-  }
24
-
25
-  /**
26
-   * @return Hash code built from all non-transient fields.
27
-   */
28
-  @Override
29
-  public final int hashCode() {
30
-    // Using a local variable to ensure that we only do a single read
31
-    // of the cachedHashCode field, to avoid race conditions.
32
-    // It doesn't matter if several threads compute the hash code and overwrite
33
-    // each other, but it's important that we never return 0, which could happen
34
-    // with multiple reads of the cachedHashCode field.
35
-    //
36
-    // See java.lang.String.hashCode()
37
-    int h = cachedHashCode;
38
-    if (h == 0) {
39
-      // Lazy initialization of hash code.
40
-      // Value objects are immutable, so the hash code never changes.
41
-      h = HashCodeBuilder.reflectionHashCode(this, false);
42
-      cachedHashCode = h;
43
-    }
44
-
45
-    return h;
46
-  }
47
-
48
-  /**
49
-   * @param o other object
50
-   * @return True if other object has the same value as this value object.
51
-   */
52
-  @Override
53
-  public final boolean equals(final Object o) {
54
-    if (this == o) return true;
55
-    if (o == null || getClass() != o.getClass()) return false;
56
-
57
-    return sameValueAs((T) o);
58
-  }
59
-
60
-}

+ 0
- 8
dddsample/src/main/java/se/citerus/dddsample/domain/shared/experimental/package.html Datei anzeigen

@@ -1,8 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-	Experimental versions of pattern interfaces and support code for the domain layer.
5
-	Not used in the application.
6
-</p>
7
-</body>
8
-</html>

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/domain/shared/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-	Pattern interfaces and support code for the domain layer.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 39
dddsample/src/main/java/se/citerus/dddsample/infrastructure/messaging/jms/CargoHandledConsumer.java Datei anzeigen

@@ -1,39 +0,0 @@
1
-package se.citerus.dddsample.infrastructure.messaging.jms;
2
-
3
-import org.apache.commons.logging.Log;
4
-import org.apache.commons.logging.LogFactory;
5
-import se.citerus.dddsample.application.CargoInspectionService;
6
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
7
-
8
-import javax.jms.Message;
9
-import javax.jms.MessageListener;
10
-import javax.jms.TextMessage;
11
-
12
-/**
13
- * Consumes JMS messages and delegates notification of misdirected
14
- * cargo to the tracking service.
15
- *
16
- * This is a programmatic hook into the JMS infrastructure to
17
- * make cargo inspection message-driven.
18
- */
19
-public class CargoHandledConsumer implements MessageListener {
20
-
21
-  private CargoInspectionService cargoInspectionService;
22
-  private final Log logger = LogFactory.getLog(getClass());
23
-
24
-  @Override  
25
-  public void onMessage(final Message message) {
26
-    try {
27
-      final TextMessage textMessage = (TextMessage) message;
28
-      final String trackingidString = textMessage.getText();
29
-      
30
-      cargoInspectionService.inspectCargo(new TrackingId(trackingidString));
31
-    } catch (Exception e) {
32
-      logger.error(e, e);
33
-    }
34
-  }
35
-
36
-  public void setCargoInspectionService(CargoInspectionService cargoInspectionService) {
37
-    this.cargoInspectionService = cargoInspectionService;
38
-  }
39
-}

+ 0
- 43
dddsample/src/main/java/se/citerus/dddsample/infrastructure/messaging/jms/HandlingEventRegistrationAttemptConsumer.java Datei anzeigen

@@ -1,43 +0,0 @@
1
-package se.citerus.dddsample.infrastructure.messaging.jms;
2
-
3
-import org.apache.commons.logging.Log;
4
-import org.apache.commons.logging.LogFactory;
5
-import se.citerus.dddsample.application.HandlingEventService;
6
-import se.citerus.dddsample.interfaces.handling.HandlingEventRegistrationAttempt;
7
-
8
-import javax.jms.Message;
9
-import javax.jms.MessageListener;
10
-import javax.jms.ObjectMessage;
11
-
12
-/**
13
- * Consumes handling event registration attempt messages and delegates to
14
- * proper registration.
15
- * 
16
- */
17
-public class HandlingEventRegistrationAttemptConsumer implements MessageListener {
18
-
19
-  private HandlingEventService handlingEventService;
20
-  private static final Log logger = LogFactory.getLog(HandlingEventRegistrationAttemptConsumer.class);
21
-
22
-  @Override
23
-  public void onMessage(final Message message) {
24
-    try {
25
-      final ObjectMessage om = (ObjectMessage) message;
26
-      HandlingEventRegistrationAttempt attempt = (HandlingEventRegistrationAttempt) om.getObject();
27
-      handlingEventService.registerHandlingEvent(
28
-        attempt.getCompletionTime(),
29
-        attempt.getTrackingId(),
30
-        attempt.getVoyageNumber(),
31
-        attempt.getUnLocode(),
32
-        attempt.getType()
33
-      );
34
-    } catch (Exception e) {
35
-      logger.error(e, e);
36
-    }
37
-  }
38
-
39
-  public void setHandlingEventService(HandlingEventService handlingEventService) {
40
-    this.handlingEventService = handlingEventService;
41
-  }
42
-
43
-}

+ 0
- 95
dddsample/src/main/java/se/citerus/dddsample/infrastructure/messaging/jms/JmsApplicationEventsImpl.java Datei anzeigen

@@ -1,95 +0,0 @@
1
-package se.citerus.dddsample.infrastructure.messaging.jms;
2
-
3
-import org.apache.commons.logging.Log;
4
-import org.apache.commons.logging.LogFactory;
5
-import org.springframework.jms.core.JmsOperations;
6
-import org.springframework.jms.core.MessageCreator;
7
-import se.citerus.dddsample.application.ApplicationEvents;
8
-import se.citerus.dddsample.domain.model.cargo.Cargo;
9
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
10
-import se.citerus.dddsample.interfaces.handling.HandlingEventRegistrationAttempt;
11
-
12
-import javax.jms.Destination;
13
-import javax.jms.JMSException;
14
-import javax.jms.Message;
15
-import javax.jms.Session;
16
-
17
-/**
18
- * JMS based implementation.
19
- */
20
-public final class JmsApplicationEventsImpl implements ApplicationEvents {
21
-
22
-  private JmsOperations jmsOperations;
23
-  private Destination cargoHandledQueue;
24
-  private Destination misdirectedCargoQueue;
25
-  private Destination deliveredCargoQueue;
26
-  private Destination rejectedRegistrationAttemptsQueue;
27
-  private Destination handlingEventQueue;
28
-
29
-  private static final Log logger = LogFactory.getLog(JmsApplicationEventsImpl.class);
30
-
31
-  @Override
32
-  public void cargoWasHandled(final HandlingEvent event) {
33
-    final Cargo cargo = event.cargo();
34
-    logger.info("Cargo was handled " + cargo);
35
-    jmsOperations.send(cargoHandledQueue, new MessageCreator() {
36
-      public Message createMessage(final Session session) throws JMSException {
37
-        return session.createTextMessage(cargo.trackingId().idString());
38
-      }
39
-    });
40
-  }
41
-
42
-  @Override
43
-  public void cargoWasMisdirected(final Cargo cargo) {
44
-    logger.info("Cargo was misdirected " + cargo);
45
-    jmsOperations.send(misdirectedCargoQueue, new MessageCreator() {
46
-      public Message createMessage(Session session) throws JMSException {
47
-        return session.createTextMessage(cargo.trackingId().idString());
48
-      }
49
-    });
50
-  }
51
-
52
-  @Override
53
-  public void cargoHasArrived(final Cargo cargo) {
54
-    logger.info("Cargo has arrived " + cargo);
55
-    jmsOperations.send(deliveredCargoQueue, new MessageCreator() {
56
-      public Message createMessage(Session session) throws JMSException {
57
-        return session.createTextMessage(cargo.trackingId().idString());
58
-      }
59
-    });
60
-  }
61
-
62
-  @Override
63
-  public void receivedHandlingEventRegistrationAttempt(final HandlingEventRegistrationAttempt attempt) {
64
-    logger.info("Received handling event registration attempt " + attempt);
65
-    jmsOperations.send(handlingEventQueue, new MessageCreator() {
66
-      public Message createMessage(Session session) throws JMSException {
67
-        return session.createObjectMessage(attempt);
68
-      }
69
-    });
70
-  }
71
-
72
-  public void setJmsOperations(JmsOperations jmsOperations) {
73
-    this.jmsOperations = jmsOperations;
74
-  }
75
-
76
-  public void setCargoHandledQueue(Destination destination) {
77
-    this.cargoHandledQueue = destination;
78
-  }
79
-
80
-  public void setMisdirectedCargoQueue(Destination destination) {
81
-    this.misdirectedCargoQueue = destination;
82
-  }
83
-
84
-  public void setDeliveredCargoQueue(Destination destination) {
85
-    this.deliveredCargoQueue = destination;
86
-  }
87
-
88
-  public void setRejectedRegistrationAttemptsQueue(Destination destination) {
89
-    this.rejectedRegistrationAttemptsQueue = destination;
90
-  }
91
-
92
-  public void setHandlingEventQueue(Destination destination) {
93
-    this.handlingEventQueue = destination;
94
-  }
95
-}

+ 0
- 18
dddsample/src/main/java/se/citerus/dddsample/infrastructure/messaging/jms/SimpleLoggingConsumer.java Datei anzeigen

@@ -1,18 +0,0 @@
1
-package se.citerus.dddsample.infrastructure.messaging.jms;
2
-
3
-import org.apache.commons.logging.Log;
4
-import org.apache.commons.logging.LogFactory;
5
-
6
-import javax.jms.Message;
7
-import javax.jms.MessageListener;
8
-
9
-public class SimpleLoggingConsumer implements MessageListener {
10
-
11
-  private final Log logger = LogFactory.getLog(SimpleLoggingConsumer.class);
12
-
13
-  @Override
14
-  public void onMessage(Message message) {
15
-    logger.debug("Received JMS message: " + message);
16
-  }
17
-
18
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/infrastructure/messaging/jms/package.html Datei anzeigen

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-    Asynchronous messaging implemented using JMS. This is part of the infrastructure.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 42
dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/CargoRepositoryHibernate.java Datei anzeigen

@@ -1,42 +0,0 @@
1
-package se.citerus.dddsample.infrastructure.persistence.hibernate;
2
-
3
-import org.springframework.stereotype.Repository;
4
-import se.citerus.dddsample.domain.model.cargo.Cargo;
5
-import se.citerus.dddsample.domain.model.cargo.CargoRepository;
6
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
7
-
8
-import java.util.List;
9
-import java.util.UUID;
10
-
11
-/**
12
- * Hibernate implementation of CargoRepository.
13
- */
14
-@Repository
15
-public class CargoRepositoryHibernate extends HibernateRepository implements CargoRepository {
16
-
17
-  public Cargo find(TrackingId tid) {
18
-    return (Cargo) getSession().
19
-      createQuery("from Cargo where trackingId = :tid").
20
-      setParameter("tid", tid).
21
-      uniqueResult();
22
-  }
23
-
24
-  public void store(Cargo cargo) {
25
-    getSession().saveOrUpdate(cargo);
26
-    // Delete-orphan does not seem to work correctly when the parent is a component
27
-    getSession().createSQLQuery("delete from Leg where cargo_id = null").executeUpdate();
28
-  }
29
-
30
-  public TrackingId nextTrackingId() {
31
-    // TODO use an actual DB sequence here, UUID is for in-mem
32
-    final String random = UUID.randomUUID().toString().toUpperCase();
33
-    return new TrackingId(
34
-      random.substring(0, random.indexOf("-"))
35
-    );
36
-  }
37
-
38
-  public List<Cargo> findAll() {
39
-    return getSession().createQuery("from Cargo").list();
40
-  }
41
-
42
-}

+ 0
- 30
dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/HandlingEventRepositoryHibernate.java Datei anzeigen

@@ -1,30 +0,0 @@
1
-package se.citerus.dddsample.infrastructure.persistence.hibernate;
2
-
3
-import org.springframework.stereotype.Repository;
4
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
5
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
6
-import se.citerus.dddsample.domain.model.handling.HandlingEventRepository;
7
-import se.citerus.dddsample.domain.model.handling.HandlingHistory;
8
-
9
-/**
10
- * Hibernate implementation of HandlingEventRepository.
11
- *
12
- */
13
-@Repository
14
-public class HandlingEventRepositoryHibernate extends HibernateRepository implements HandlingEventRepository {
15
-
16
-  @Override
17
-  public void store(final HandlingEvent event) {
18
-    getSession().save(event);
19
-  }
20
-
21
-  @Override
22
-  public HandlingHistory lookupHandlingHistoryOfCargo(final TrackingId trackingId) {
23
-    return new HandlingHistory(getSession().createQuery(
24
-            "from HandlingEvent where cargo.trackingId = :tid").
25
-            setParameter("tid", trackingId).
26
-            list()
27
-    );
28
-  }
29
-
30
-}

+ 0
- 23
dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/HibernateRepository.java Datei anzeigen

@@ -1,23 +0,0 @@
1
-package se.citerus.dddsample.infrastructure.persistence.hibernate;
2
-
3
-import org.hibernate.Session;
4
-import org.hibernate.SessionFactory;
5
-import org.springframework.beans.factory.annotation.Required;
6
-
7
-/**
8
- * Functionality common to all Hibernate repositories.
9
- */
10
-public abstract class HibernateRepository {
11
-
12
-  private SessionFactory sessionFactory;
13
-
14
-  @Required
15
-  public void setSessionFactory(final SessionFactory sessionFactory) {
16
-    this.sessionFactory = sessionFactory;
17
-  }
18
-
19
-  protected Session getSession() {
20
-    return sessionFactory.getCurrentSession();
21
-  }
22
-
23
-}

+ 0
- 24
dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/LocationRepositoryHibernate.java Datei anzeigen

@@ -1,24 +0,0 @@
1
-package se.citerus.dddsample.infrastructure.persistence.hibernate;
2
-
3
-import org.springframework.stereotype.Repository;
4
-import se.citerus.dddsample.domain.model.location.Location;
5
-import se.citerus.dddsample.domain.model.location.LocationRepository;
6
-import se.citerus.dddsample.domain.model.location.UnLocode;
7
-
8
-import java.util.List;
9
-
10
-@Repository
11
-public final class LocationRepositoryHibernate extends HibernateRepository implements LocationRepository {
12
-
13
-  public Location find(final UnLocode unLocode) {
14
-    return (Location) getSession().
15
-      createQuery("from Location where unLocode = ?").
16
-      setParameter(0, unLocode).
17
-      uniqueResult();
18
-  }
19
-
20
-  public List<Location> findAll() {
21
-    return getSession().createQuery("from Location").list();
22
-  }
23
-
24
-}

+ 0
- 21
dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/VoyageRepositoryHibernate.java Datei anzeigen

@@ -1,21 +0,0 @@
1
-package se.citerus.dddsample.infrastructure.persistence.hibernate;
2
-
3
-import org.springframework.stereotype.Repository;
4
-import se.citerus.dddsample.domain.model.voyage.Voyage;
5
-import se.citerus.dddsample.domain.model.voyage.VoyageNumber;
6
-import se.citerus.dddsample.domain.model.voyage.VoyageRepository;
7
-
8
-/**
9
- * Hibernate implementation of CarrierMovementRepository.
10
- */
11
-@Repository
12
-public final class VoyageRepositoryHibernate extends HibernateRepository implements VoyageRepository {
13
-
14
-  public Voyage find(final VoyageNumber voyageNumber) {
15
-    return (Voyage) getSession().
16
-      createQuery("from Voyage where voyageNumber = :vn").
17
-      setParameter("vn", voyageNumber).
18
-      uniqueResult();
19
-  }
20
-
21
-}

+ 0
- 0
dddsample/src/main/java/se/citerus/dddsample/infrastructure/persistence/hibernate/package.html Datei anzeigen


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.