Procházet zdrojové kódy

[maven-release-plugin] copy for tag register-app-1.0-RC1

peter_backlund před 18 roky
rodič
revize
e5ac88ed52
100 změnil soubory, kde provedl 0 přidání a 4881 odebrání
  1. 0
    0
      assembly.xml
  2. 0
    221
      dddsample/checkstyle.xml
  3. 0
    264
      dddsample/doc/dddsample-format-eclipse.pref
  4. binární
      dddsample/doc/deployment.png
  5. binární
      dddsample/doc/description.pdf
  6. binární
      dddsample/doc/domain.png
  7. binární
      dddsample/doc/tracking.jpg
  8. 0
    403
      dddsample/pom.xml
  9. 0
    40
      dddsample/src/main/java/se/citerus/dddsample/application/messaging/HandlingEventMessageDelegate.java
  10. 0
    38
      dddsample/src/main/java/se/citerus/dddsample/application/messaging/JmsDomainEventNotifierImpl.java
  11. 0
    25
      dddsample/src/main/java/se/citerus/dddsample/application/messaging/ThreadBasedDomainEventNotifierImpl.java
  12. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/application/messaging/package.html
  13. 0
    14
      dddsample/src/main/java/se/citerus/dddsample/application/package.html
  14. 0
    62
      dddsample/src/main/java/se/citerus/dddsample/application/persistence/CargoRepositoryHibernate.java
  15. 0
    21
      dddsample/src/main/java/se/citerus/dddsample/application/persistence/CarrierMovementRepositoryHibernate.java
  16. 0
    28
      dddsample/src/main/java/se/citerus/dddsample/application/persistence/HandlingEventRepositoryHibernate.java
  17. 0
    23
      dddsample/src/main/java/se/citerus/dddsample/application/persistence/HibernateRepository.java
  18. 0
    24
      dddsample/src/main/java/se/citerus/dddsample/application/persistence/LocationRepositoryHibernate.java
  19. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/application/persistence/package.html
  20. 0
    30
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/BookingServiceFacade.java
  21. 0
    99
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/BookingServiceFacadeImpl.java
  22. 0
    59
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/CargoRoutingDTO.java
  23. 0
    54
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/HandlingEventDTO.java
  24. 0
    29
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/ItineraryCandidateDTO.java
  25. 0
    39
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/LegDTO.java
  26. 0
    26
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/LocationDTO.java
  27. 0
    28
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/assembler/CargoRoutingDTOAssembler.java
  28. 0
    48
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/assembler/ItineraryCandidateDTOAssembler.java
  29. 0
    22
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/assembler/LocationDTOAssembler.java
  30. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/assembler/package.html
  31. 0
    43
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/package.html
  32. 0
    8
      dddsample/src/main/java/se/citerus/dddsample/application/remoting/package.html
  33. 0
    79
      dddsample/src/main/java/se/citerus/dddsample/application/routing/ExternalRoutingService.java
  34. 0
    9
      dddsample/src/main/java/se/citerus/dddsample/application/routing/package.html
  35. 0
    211
      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
    22
      dddsample/src/main/java/se/citerus/dddsample/application/ws/HandlingEventServiceEndpoint.java
  38. 0
    102
      dddsample/src/main/java/se/citerus/dddsample/application/ws/HandlingEventServiceEndpointImpl.java
  39. 0
    21
      dddsample/src/main/java/se/citerus/dddsample/application/ws/InvalidEventTypeException.java
  40. 0
    8
      dddsample/src/main/java/se/citerus/dddsample/application/ws/package.html
  41. 0
    17
      dddsample/src/main/java/se/citerus/dddsample/domain/model/DomainEvent.java
  42. 0
    17
      dddsample/src/main/java/se/citerus/dddsample/domain/model/Entity.java
  43. 0
    6
      dddsample/src/main/java/se/citerus/dddsample/domain/model/Specification.java
  44. 0
    17
      dddsample/src/main/java/se/citerus/dddsample/domain/model/ValueObject.java
  45. 0
    230
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Cargo.java
  46. 0
    38
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/CargoRepository.java
  47. 0
    109
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/DeliveryHistory.java
  48. 0
    130
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Itinerary.java
  49. 0
    80
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Leg.java
  50. 0
    99
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/RouteSpecification.java
  51. 0
    8
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/StatusCode.java
  52. 0
    53
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/TrackingId.java
  53. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/package.html
  54. 0
    72
      dddsample/src/main/java/se/citerus/dddsample/domain/model/carrier/CarrierMovement.java
  55. 0
    55
      dddsample/src/main/java/se/citerus/dddsample/domain/model/carrier/CarrierMovementId.java
  56. 0
    13
      dddsample/src/main/java/se/citerus/dddsample/domain/model/carrier/CarrierMovementRepository.java
  57. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/domain/model/carrier/package.html
  58. 0
    183
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingEvent.java
  59. 0
    26
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingEventRepository.java
  60. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/package.html
  61. 0
    99
      dddsample/src/main/java/se/citerus/dddsample/domain/model/location/Location.java
  62. 0
    22
      dddsample/src/main/java/se/citerus/dddsample/domain/model/location/LocationRepository.java
  63. 0
    71
      dddsample/src/main/java/se/citerus/dddsample/domain/model/location/UnLocode.java
  64. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/domain/model/location/package.html
  65. 0
    8
      dddsample/src/main/java/se/citerus/dddsample/domain/model/package.html
  66. 0
    14
      dddsample/src/main/java/se/citerus/dddsample/domain/package.html
  67. 0
    39
      dddsample/src/main/java/se/citerus/dddsample/domain/service/BookingService.java
  68. 0
    22
      dddsample/src/main/java/se/citerus/dddsample/domain/service/DomainEventNotifier.java
  69. 0
    30
      dddsample/src/main/java/se/citerus/dddsample/domain/service/HandlingEventService.java
  70. 0
    20
      dddsample/src/main/java/se/citerus/dddsample/domain/service/RoutingService.java
  71. 0
    29
      dddsample/src/main/java/se/citerus/dddsample/domain/service/TrackingService.java
  72. 0
    20
      dddsample/src/main/java/se/citerus/dddsample/domain/service/UnknownCarrierMovementIdException.java
  73. 0
    17
      dddsample/src/main/java/se/citerus/dddsample/domain/service/UnknownLocationException.java
  74. 0
    20
      dddsample/src/main/java/se/citerus/dddsample/domain/service/UnknownTrackingIdException.java
  75. 0
    78
      dddsample/src/main/java/se/citerus/dddsample/domain/service/impl/BookingServiceImpl.java
  76. 0
    106
      dddsample/src/main/java/se/citerus/dddsample/domain/service/impl/HandlingEventServiceImpl.java
  77. 0
    58
      dddsample/src/main/java/se/citerus/dddsample/domain/service/impl/TrackingServiceImpl.java
  78. 0
    9
      dddsample/src/main/java/se/citerus/dddsample/domain/service/package.html
  79. 0
    106
      dddsample/src/main/java/se/citerus/dddsample/ui/CargoAdminController.java
  80. 0
    65
      dddsample/src/main/java/se/citerus/dddsample/ui/CargoTrackingController.java
  81. 0
    168
      dddsample/src/main/java/se/citerus/dddsample/ui/CargoTrackingViewAdapter.java
  82. 0
    27
      dddsample/src/main/java/se/citerus/dddsample/ui/command/RegistrationCommand.java
  83. 0
    70
      dddsample/src/main/java/se/citerus/dddsample/ui/command/RouteAssignmentCommand.java
  84. 0
    25
      dddsample/src/main/java/se/citerus/dddsample/ui/command/TrackCommand.java
  85. 0
    21
      dddsample/src/main/java/se/citerus/dddsample/ui/command/TrackCommandValidator.java
  86. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/ui/command/package.html
  87. 0
    7
      dddsample/src/main/java/se/citerus/dddsample/ui/package.html
  88. 0
    14
      dddsample/src/main/java/se/citerus/routingteam/GraphTraversalService.java
  89. 0
    39
      dddsample/src/main/java/se/citerus/routingteam/TransitEdge.java
  90. 0
    29
      dddsample/src/main/java/se/citerus/routingteam/TransitPath.java
  91. 0
    43
      dddsample/src/main/java/se/citerus/routingteam/internal/GraphDAO.java
  92. 0
    71
      dddsample/src/main/java/se/citerus/routingteam/internal/GraphTraversalServiceImpl.java
  93. 0
    7
      dddsample/src/main/java/se/citerus/routingteam/internal/package.html
  94. 0
    14
      dddsample/src/main/java/se/citerus/routingteam/package.html
  95. 0
    42
      dddsample/src/main/resources/context-messaging-jms.xml
  96. 0
    11
      dddsample/src/main/resources/context-messaging-thread.xml
  97. 0
    44
      dddsample/src/main/resources/context-persistence-hibernate.xml
  98. 0
    19
      dddsample/src/main/resources/context-persistence-in-mem.xml
  99. 0
    81
      dddsample/src/main/resources/context-remote.xml
  100. 0
    0
      dddsample/src/main/resources/context-routingteam.xml

register-app/assembly.xml → assembly.xml Zobrazit soubor


+ 0
- 221
dddsample/checkstyle.xml Zobrazit soubor

@@ -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/doc/dddsample-format-eclipse.pref Zobrazit soubor

@@ -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>

binární
dddsample/doc/deployment.png Zobrazit soubor


binární
dddsample/doc/description.pdf Zobrazit soubor


binární
dddsample/doc/domain.png Zobrazit soubor


binární
dddsample/doc/tracking.jpg Zobrazit soubor


+ 0
- 403
dddsample/pom.xml Zobrazit soubor

@@ -1,403 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project xmlns="http://maven.apache.org/POM/4.0.0"
3
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5
-  <modelVersion>4.0.0</modelVersion>
6
-  <groupId>se.citerus</groupId>
7
-  <artifactId>dddsample</artifactId>
8
-  <packaging>war</packaging>
9
-  <name>DDDSample</name>
10
-  <version>1.0-SNAPSHOT</version>
11
-  <description>This application shows a few key concepts of
12
-    Domain Driven Design implemented in Enterprise Java.
13
-  </description>
14
-  <url>http://dddsample.sourceforge.net</url>
15
-  <distributionManagement>
16
-    <site>
17
-      <id>sf</id>
18
-      <url>scp://shell.sf.net/home/groups/d/dd/dddsample/htdocs</url>
19
-    </site>
20
-  </distributionManagement>
21
-  <ciManagement/>
22
-  <repositories>
23
-    <repository>
24
-      <id>maven2-repository.dev.java.net</id>
25
-      <name>Java.net Repository for Maven</name>
26
-      <url>http://download.java.net/maven/2</url>
27
-      <layout>default</layout>
28
-    </repository>
29
-    <repository>
30
-      <id>maven-repository.dev.java.net</id>
31
-      <name>Java.net Repository for Maven 1</name>
32
-      <url>http://download.java.net/maven/1</url>
33
-      <layout>legacy</layout>
34
-    </repository>
35
-  </repositories>
36
-  <pluginRepositories>
37
-    <pluginRepository>
38
-      <id>maven2-repository.dev.java.net</id>
39
-      <name>Java.net Repository for Maven</name>
40
-      <url>http://download.java.net/maven/2</url>
41
-    </pluginRepository>
42
-  </pluginRepositories>
43
-  <developers>
44
-    <developer>
45
-      <id>eric_evans</id>
46
-      <name>Eric Evans</name>
47
-      <email>eric at domainlanguage dot com</email>
48
-      <organization>Domain Language, Inc.</organization>
49
-      <organizationUrl>http://www.domainlanguage.com</organizationUrl>
50
-      <timezone>-8</timezone>
51
-    </developer>
52
-    <developer>
53
-      <id>peba</id>
54
-      <name>Peter Backlund</name>
55
-      <email>peter.backlund@citerus.se</email>
56
-      <organization>Citerus</organization>
57
-      <organizationUrl>http://www.citerus.se</organizationUrl>
58
-      <timezone>+1</timezone>
59
-    </developer>
60
-    <developer>
61
-      <id>patrikfr</id>
62
-      <name>Patrik Fredriksson</name>
63
-      <email>patrikfr@users.sourceforge.net</email>
64
-      <organization>Citerus</organization>
65
-      <organizationUrl>http://www.citerus.se</organizationUrl>
66
-      <timezone>+1</timezone>
67
-    </developer>
68
-    <developer>
69
-      <id>jeham</id>
70
-      <name>Jesper Hammarback</name>
71
-      <email>jeham@users.sourceforge.net</email>
72
-      <organization>Citerus</organization>
73
-      <organizationUrl>http://www.citerus.se</organizationUrl>
74
-      <timezone>+1</timezone>
75
-    </developer>
76
-    <developer>
77
-      <id>jorgen_falk</id>
78
-      <name>Jorgen Falk</name>
79
-      <email>jorgen.falk@citerus.se</email>
80
-      <organization>Citerus</organization>
81
-      <organizationUrl>http://www.citerus.se</organizationUrl>
82
-      <timezone>+1</timezone>
83
-    </developer>
84
-  </developers>
85
-  <licenses>
86
-    <license>
87
-      <name>MIT</name>
88
-      <url>http://www.opensource.org/licenses/mit-license.php</url>
89
-      <distribution>repo</distribution>
90
-    </license>
91
-  </licenses>
92
-  <scm>
93
-    <developerConnection>scm:svn:https://dddsample.svn.sourceforge.net/svnroot/dddsample</developerConnection>
94
-    <url>http://ddd.sventon.org</url>
95
-  </scm>
96
-  <properties>
97
-    <spring.version>2.5.1</spring.version>
98
-  </properties>
99
-  <build>
100
-    <plugins>
101
-      <!-- Compiler -->
102
-      <plugin>
103
-        <artifactId>maven-compiler-plugin</artifactId>
104
-        <configuration>
105
-          <source>1.5</source>
106
-          <target>1.5</target>
107
-          <encoding>UTF-8</encoding>
108
-        </configuration>
109
-      </plugin>
110
-
111
-      <!-- Jetty servlet container: http://jetty.mortbay.com/maven-plugin -->
112
-      <plugin>
113
-        <groupId>org.mortbay.jetty</groupId>
114
-        <artifactId>maven-jetty-plugin</artifactId>
115
-        <version>6.1.4</version>
116
-        <configuration>
117
-          <scanIntervalSeconds>3</scanIntervalSeconds>
118
-        </configuration>
119
-      </plugin>
120
-
121
-      <!-- JAX-WS generation plugin -->
122
-      <plugin>
123
-        <groupId>org.codehaus.mojo</groupId>
124
-        <artifactId>jaxws-maven-plugin</artifactId>
125
-        <version>1.9</version>
126
-        <executions>
127
-          <execution>
128
-            <goals>
129
-              <goal>wsgen</goal>
130
-            </goals>
131
-          </execution>
132
-        </executions>
133
-        <configuration>
134
-          <sei>se.citerus.dddsample.application.ws.HandlingEventServiceEndpointImpl</sei>
135
-          <genWsdl>true</genWsdl>
136
-        </configuration>
137
-      </plugin>
138
-
139
-      <!-- Jar plugin for generation of WS Client classes -->
140
-      <plugin>
141
-        <artifactId>maven-jar-plugin</artifactId>
142
-        <executions>
143
-          <execution>
144
-            <phase>package</phase>
145
-            <goals>
146
-              <goal>jar</goal>
147
-            </goals>
148
-            <configuration>
149
-              <classifier>ws-client</classifier>
150
-              <includes>
151
-                <include>**/se/citerus/dddsample/application/ws/**</include>
152
-              </includes>
153
-            </configuration>
154
-          </execution>
155
-        </executions>
156
-      </plugin>
157
-
158
-      <plugin>
159
-        <artifactId>maven-assembly-plugin</artifactId>
160
-        <configuration>
161
-          <descriptorRefs>
162
-            <descriptorRef>src</descriptorRef>
163
-          </descriptorRefs>
164
-        </configuration>
165
-      </plugin>
166
-
167
-    </plugins>
168
-  </build>
169
-  <dependencies>
170
-    <dependency>
171
-      <groupId>junit</groupId>
172
-      <artifactId>junit</artifactId>
173
-      <version>4.4</version>
174
-      <scope>test</scope>
175
-    </dependency>
176
-    <dependency>
177
-      <groupId>org.springframework</groupId>
178
-      <artifactId>spring-webmvc</artifactId>
179
-      <version>${spring.version}</version>
180
-    </dependency>
181
-    <dependency>
182
-      <groupId>org.springframework</groupId>
183
-      <artifactId>spring-orm</artifactId>
184
-      <version>${spring.version}</version>
185
-    </dependency>
186
-    <dependency>
187
-      <groupId>org.springframework</groupId>
188
-      <artifactId>spring-jdbc</artifactId>
189
-      <version>${spring.version}</version>
190
-    </dependency>
191
-    <dependency>
192
-      <groupId>org.springframework</groupId>
193
-      <artifactId>spring-aop</artifactId>
194
-      <version>${spring.version}</version>
195
-    </dependency>
196
-    <dependency>
197
-      <groupId>org.springframework</groupId>
198
-      <artifactId>spring-jms</artifactId>
199
-      <version>${spring.version}</version>
200
-    </dependency>
201
-    <dependency>
202
-      <groupId>org.springframework</groupId>
203
-      <artifactId>spring-test</artifactId>
204
-      <version>${spring.version}</version>
205
-      <scope>test</scope>
206
-    </dependency>
207
-    <dependency>
208
-      <groupId>org.hibernate</groupId>
209
-      <artifactId>hibernate</artifactId>
210
-      <version>3.2.5.ga</version>
211
-    </dependency>
212
-    <dependency>
213
-      <groupId>org.hibernate</groupId>
214
-      <artifactId>hibernate-annotations</artifactId>
215
-      <version>3.3.0.ga</version>
216
-    </dependency>
217
-    <dependency>
218
-      <groupId>org.hibernate</groupId>
219
-      <artifactId>hibernate-commons-annotations</artifactId>
220
-      <version>3.3.0.ga</version>
221
-    </dependency>
222
-    <dependency>
223
-      <groupId>commons-lang</groupId>
224
-      <artifactId>commons-lang</artifactId>
225
-      <version>2.3</version>
226
-    </dependency>
227
-    <dependency>
228
-      <groupId>commons-io</groupId>
229
-      <artifactId>commons-io</artifactId>
230
-      <version>1.3.1</version>
231
-    </dependency>
232
-    <dependency>
233
-      <groupId>commons-logging</groupId>
234
-      <artifactId>commons-logging</artifactId>
235
-      <version>1.1</version>
236
-      <exclusions>
237
-        <exclusion>
238
-          <groupId>avalon-framework</groupId>
239
-          <artifactId>avalon-framework</artifactId>
240
-        </exclusion>
241
-        <exclusion>
242
-          <groupId>logkit</groupId>
243
-          <artifactId>logkit</artifactId>
244
-        </exclusion>
245
-      </exclusions>
246
-    </dependency>
247
-    <dependency>
248
-      <groupId>commons-dbcp</groupId>
249
-      <artifactId>commons-dbcp</artifactId>
250
-      <version>1.2.2</version>
251
-    </dependency>
252
-    <dependency>
253
-      <groupId>hsqldb</groupId>
254
-      <artifactId>hsqldb</artifactId>
255
-      <version>1.8.0.7</version>
256
-    </dependency>
257
-    <dependency>
258
-      <groupId>javax.servlet</groupId>
259
-      <artifactId>servlet-api</artifactId>
260
-      <version>2.5</version>
261
-      <scope>provided</scope>
262
-    </dependency>
263
-    <dependency>
264
-      <groupId>taglibs</groupId>
265
-      <artifactId>standard</artifactId>
266
-      <version>1.1.2</version>
267
-    </dependency>
268
-    <dependency>
269
-      <groupId>javax.servlet</groupId>
270
-      <artifactId>jstl</artifactId>
271
-      <version>1.1.2</version>
272
-    </dependency>
273
-    <dependency>
274
-      <groupId>opensymphony</groupId>
275
-      <artifactId>sitemesh</artifactId>
276
-      <version>2.3</version>
277
-      <scope>runtime</scope>
278
-    </dependency>
279
-    <dependency>
280
-      <groupId>org.apache.activemq</groupId>
281
-      <artifactId>activemq-core</artifactId>
282
-      <version>5.0.0</version>
283
-      <exclusions>
284
-        <!--
285
-          This is a snapshot dependency, with no published pom.
286
-          It does not appear to be needed either:
287
-          
288
-          http://mail-archives.apache.org/mod_mbox/activemq-commits/200610.mbox/%3C20061005025744.0C6591A981A@eris.apache.org%3E
289
-        -->
290
-        <exclusion>
291
-          <groupId>org.apache.activemq</groupId>
292
-          <artifactId>activeio-core</artifactId>
293
-        </exclusion>
294
-        <exclusion>
295
-          <groupId>javax.xml</groupId>
296
-          <artifactId>jaxb-api</artifactId>
297
-        </exclusion>
298
-      </exclusions>
299
-    </dependency>
300
-    <dependency>
301
-      <groupId>org.easymock</groupId>
302
-      <artifactId>easymock</artifactId>
303
-      <version>2.3</version>
304
-      <scope>test</scope>
305
-    </dependency>
306
-
307
-    <!-- JAX-WS integration with Spring. Lots of broken pom files unfortunately,
308
-      so we need a few excluded-and-overridden dependencies.
309
-      This problem will mostly go away when we move to Java 6.
310
-
311
-      javax.activation is excluded because of class loading issues with Jetty:
312
-      http://jira.codehaus.org/browse/JETTY-420
313
-      -->
314
-    <dependency>
315
-      <groupId>org.jvnet.jax-ws-commons.spring</groupId>
316
-      <artifactId>jaxws-spring</artifactId>
317
-      <version>1.8</version>
318
-      <exclusions>
319
-        <exclusion>
320
-          <groupId>org.springframework</groupId>
321
-          <artifactId>spring</artifactId>
322
-        </exclusion>
323
-        <exclusion>
324
-          <groupId>com.sun.xml.stream.buffer</groupId>
325
-          <artifactId>streambuffer</artifactId>
326
-        </exclusion>
327
-        <exclusion>
328
-          <groupId>org.jvnet.staxex</groupId>
329
-          <artifactId>stax-ex</artifactId>
330
-        </exclusion>
331
-        <exclusion>
332
-          <groupId>javax.activation</groupId>
333
-          <artifactId>activation</artifactId>
334
-        </exclusion>
335
-      </exclusions>
336
-    </dependency>
337
-    <dependency>
338
-      <groupId>org.jvnet.staxex</groupId>
339
-      <artifactId>stax-ex</artifactId>
340
-      <version>1.2</version>
341
-      <scope>runtime</scope>
342
-      <exclusions>
343
-        <exclusion>
344
-          <groupId>javax.activation</groupId>
345
-          <artifactId>activation</artifactId>
346
-        </exclusion>
347
-      </exclusions>
348
-    </dependency>
349
-    <dependency>
350
-      <groupId>com.sun.xml.stream.buffer</groupId>
351
-      <artifactId>streambuffer</artifactId>
352
-      <version>0.7</version>
353
-      <scope>runtime</scope>
354
-      <exclusions>
355
-        <exclusion>
356
-          <groupId>javax.activation</groupId>
357
-          <artifactId>activation</artifactId>
358
-        </exclusion>
359
-      </exclusions>
360
-    </dependency>
361
-    <dependency>
362
-      <groupId>com.sun.xml.ws</groupId>
363
-      <artifactId>jaxws-rt</artifactId>
364
-      <version>2.1.3</version>
365
-      <scope>runtime</scope>
366
-    </dependency>
367
-    <dependency>
368
-      <groupId>com.sun.istack</groupId>
369
-      <artifactId>istack-commons-runtime</artifactId>
370
-      <version>1.0</version>
371
-      <scope>runtime</scope>
372
-    </dependency>
373
-  </dependencies>
374
-
375
-  <reporting>
376
-    <plugins>
377
-      <!-- Javadoc -->
378
-      <plugin>
379
-        <artifactId>maven-javadoc-plugin</artifactId>
380
-      </plugin>
381
-      <!-- Source code cross reference -->
382
-      <plugin>
383
-        <artifactId>maven-jxr-plugin</artifactId>
384
-      </plugin>
385
-      <!-- Test report -->
386
-      <plugin>
387
-        <artifactId>maven-surefire-report-plugin</artifactId>
388
-      </plugin>
389
-      <!-- Test coverage -->
390
-      <plugin>
391
-        <groupId>org.codehaus.mojo</groupId>
392
-        <artifactId>cobertura-maven-plugin</artifactId>
393
-      </plugin>
394
-      <!-- CheckStyle report -->
395
-      <plugin>
396
-        <artifactId>maven-checkstyle-plugin</artifactId>
397
-        <configuration>
398
-          <configLocation>checkstyle.xml</configLocation>
399
-        </configuration>
400
-      </plugin>
401
-    </plugins>
402
-  </reporting>
403
-</project>

+ 0
- 40
dddsample/src/main/java/se/citerus/dddsample/application/messaging/HandlingEventMessageDelegate.java Zobrazit soubor

@@ -1,40 +0,0 @@
1
-package se.citerus.dddsample.application.messaging;
2
-
3
-import org.apache.commons.logging.Log;
4
-import org.apache.commons.logging.LogFactory;
5
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
6
-import se.citerus.dddsample.domain.service.TrackingService;
7
-
8
-import javax.jms.JMSException;
9
-import javax.jms.Message;
10
-import javax.jms.MessageListener;
11
-
12
-/**
13
- * Consumes JMS messages and delegates notification of misdirected
14
- * cargo to the cargo service.
15
- * <p/>
16
- * This point of this is to decouple the tracking service from JMS,
17
- * and to allow a thread-based messaging implementation to live in
18
- * parallell.
19
- */
20
-public class HandlingEventMessageDelegate implements MessageListener {
21
-
22
-  private TrackingService trackingService;
23
-  private final Log logger = LogFactory.getLog(getClass());
24
-
25
-  public void onMessage(final Message message) {
26
-    if (logger.isDebugEnabled()) {
27
-      logger.debug("Received message " + message);
28
-    }
29
-    try {
30
-      String tidString = message.getStringProperty(JmsDomainEventNotifierImpl.TRACKING_ID_KEY);
31
-      trackingService.inspectCargo(new TrackingId(tidString));
32
-    } catch (JMSException e) {
33
-      logger.error(e, e);
34
-    }
35
-  }
36
-
37
-  public void setTrackingService(TrackingService trackingService) {
38
-    this.trackingService = trackingService;
39
-  }
40
-}

+ 0
- 38
dddsample/src/main/java/se/citerus/dddsample/application/messaging/JmsDomainEventNotifierImpl.java Zobrazit soubor

@@ -1,38 +0,0 @@
1
-package se.citerus.dddsample.application.messaging;
2
-
3
-import org.springframework.jms.core.JmsOperations;
4
-import org.springframework.jms.core.MessageCreator;
5
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
6
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
7
-import se.citerus.dddsample.domain.service.DomainEventNotifier;
8
-
9
-import javax.jms.*;
10
-
11
-/**
12
- * JMS based implementation.
13
- */
14
-public final class JmsDomainEventNotifierImpl implements DomainEventNotifier {
15
-  private JmsOperations jmsOperations;
16
-  private Destination destination;
17
-  public static final String TRACKING_ID_KEY = TrackingId.class.getName() + ".KEY";
18
-
19
-  public void cargoWasHandled(final HandlingEvent event) {
20
-    jmsOperations.send(destination, new MessageCreator() {
21
-      // TODO: richer message type
22
-      public Message createMessage(final Session session) throws JMSException {
23
-        final MapMessage message = session.createMapMessage();
24
-        message.setStringProperty(TRACKING_ID_KEY, event.cargo().trackingId().idString());
25
-        return message;
26
-      }
27
-
28
-    });
29
-  }
30
-
31
-  public void setJmsOperations(final JmsOperations jmsOperations) {
32
-    this.jmsOperations = jmsOperations;
33
-  }
34
-
35
-  public void setDestination(final Destination destination) {
36
-    this.destination = destination;
37
-  }
38
-}

+ 0
- 25
dddsample/src/main/java/se/citerus/dddsample/application/messaging/ThreadBasedDomainEventNotifierImpl.java Zobrazit soubor

@@ -1,25 +0,0 @@
1
-package se.citerus.dddsample.application.messaging;
2
-
3
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
4
-import se.citerus.dddsample.domain.service.DomainEventNotifier;
5
-import se.citerus.dddsample.domain.service.TrackingService;
6
-
7
-/**
8
- * Thread based implementation.
9
- */
10
-public class ThreadBasedDomainEventNotifierImpl implements DomainEventNotifier {
11
-
12
-  private TrackingService trackingService;
13
-
14
-  public void cargoWasHandled(final HandlingEvent event) {
15
-    new Thread(new Runnable() {
16
-      public void run() {
17
-        trackingService.inspectCargo(event.cargo().trackingId());
18
-      }
19
-    }).start();
20
-  }
21
-
22
-  public void setTrackingService(TrackingService trackingService) {
23
-    this.trackingService = trackingService;
24
-  }
25
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/application/messaging/package.html Zobrazit soubor

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

+ 0
- 14
dddsample/src/main/java/se/citerus/dddsample/application/package.html Zobrazit soubor

@@ -1,14 +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. This includes code that directly depends on external libraries
6
-  such as Hibernate and Spring MVC, implementations of JMS interfaces, remoting and so on.
7
-</p>
8
-<p>
9
-  This part is very technology-heavy and generally not comprehensible to the domain expert,
10
-  unlike the domain part. It is thin in terms of knowledge of domain business logic,
11
-  although it may be large in terms of lines of code.
12
-</p>
13
-</body>
14
-</html>

+ 0
- 62
dddsample/src/main/java/se/citerus/dddsample/application/persistence/CargoRepositoryHibernate.java Zobrazit soubor

@@ -1,62 +0,0 @@
1
-package se.citerus.dddsample.application.persistence;
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.Itinerary;
7
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
8
-
9
-import java.util.List;
10
-import java.util.UUID;
11
-
12
-/**
13
- * Hibernate implementation of CargoRepository.
14
- */
15
-@Repository
16
-public class CargoRepositoryHibernate extends HibernateRepository implements CargoRepository {
17
-
18
-  public Cargo find(TrackingId tid) {
19
-    // Query for id and then perform a standard load().
20
-    // This way we use the metadata-defined way of loading the aggregate
21
-    // in an efficient way (generally a complete aggregate at a time),
22
-    // and we can benefi from the identifier-keyed second level cache
23
-    // without havng to cache individual queries.
24
-    Long id = (Long) getSession().
25
-       createQuery("select id from Cargo where trackingId = :tid").
26
-       setParameter("tid", tid).
27
-       uniqueResult();
28
-
29
-    if (id != null) {
30
-      return (Cargo) getSession().get(Cargo.class, id);
31
-    } else {
32
-      return null;
33
-    }
34
-
35
-
36
-  }
37
-
38
-  public void save(Cargo cargo) {
39
-    getSession().persist(cargo);
40
-
41
-    // Delete orphaned itineraries - conceptually the responsibility
42
-    // of the Cargo aggregate
43
-    final List<Itinerary> orphans = getSession().
44
-       createQuery("from Itinerary where cargo = null").
45
-       list();
46
-    for (Itinerary orphan : orphans) {
47
-      getSession().delete(orphan);
48
-    }
49
-  }
50
-
51
-  public TrackingId nextTrackingId() {
52
-    final String random = UUID.randomUUID().toString().toUpperCase();
53
-    return new TrackingId(
54
-       random.substring(0, random.indexOf("-"))
55
-    );
56
-  }
57
-
58
-  public List<Cargo> findAll() {
59
-    return getSession().createQuery("from Cargo").list();
60
-  }
61
-
62
-}

+ 0
- 21
dddsample/src/main/java/se/citerus/dddsample/application/persistence/CarrierMovementRepositoryHibernate.java Zobrazit soubor

@@ -1,21 +0,0 @@
1
-package se.citerus.dddsample.application.persistence;
2
-
3
-import org.springframework.stereotype.Repository;
4
-import se.citerus.dddsample.domain.model.carrier.CarrierMovement;
5
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementId;
6
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementRepository;
7
-
8
-/**
9
- * Hibernate implementation of CarrierMovementRepository.
10
- */
11
-@Repository
12
-public final class CarrierMovementRepositoryHibernate extends HibernateRepository implements CarrierMovementRepository {
13
-
14
-  public CarrierMovement find(final CarrierMovementId carrierMovementId) {
15
-    return (CarrierMovement) getSession().
16
-      createQuery("from CarrierMovement where carrierMovementId = ?").
17
-      setParameter(0, carrierMovementId).
18
-      uniqueResult();
19
-  }
20
-
21
-}

+ 0
- 28
dddsample/src/main/java/se/citerus/dddsample/application/persistence/HandlingEventRepositoryHibernate.java Zobrazit soubor

@@ -1,28 +0,0 @@
1
-package se.citerus.dddsample.application.persistence;
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
-
8
-import java.util.List;
9
-
10
-/**
11
- * Hibernate implementation of HandlingEventRepository.
12
- *
13
- */
14
-@Repository
15
-public class HandlingEventRepositoryHibernate extends HibernateRepository implements HandlingEventRepository {
16
-
17
-  public void save(HandlingEvent event) {
18
-    getSession().save(event);
19
-  }
20
-
21
-  public List<HandlingEvent> findEventsForCargo(TrackingId tid) {
22
-    return getSession().createQuery(
23
-            "from HandlingEvent where cargo.trackingId = :tid order by completionTime").
24
-            setParameter("tid", tid).
25
-            list();
26
-  }
27
-
28
-}

+ 0
- 23
dddsample/src/main/java/se/citerus/dddsample/application/persistence/HibernateRepository.java Zobrazit soubor

@@ -1,23 +0,0 @@
1
-package se.citerus.dddsample.application.persistence;
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/application/persistence/LocationRepositoryHibernate.java Zobrazit soubor

@@ -1,24 +0,0 @@
1
-package se.citerus.dddsample.application.persistence;
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
- 7
dddsample/src/main/java/se/citerus/dddsample/application/persistence/package.html Zobrazit soubor

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  Hibernate implementations of the repository interfaces. This is part of the infrastructure.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 30
dddsample/src/main/java/se/citerus/dddsample/application/remoting/BookingServiceFacade.java Zobrazit soubor

@@ -1,30 +0,0 @@
1
-package se.citerus.dddsample.application.remoting;
2
-
3
-import se.citerus.dddsample.application.remoting.dto.CargoRoutingDTO;
4
-import se.citerus.dddsample.application.remoting.dto.ItineraryCandidateDTO;
5
-import se.citerus.dddsample.application.remoting.dto.LocationDTO;
6
-
7
-import java.rmi.Remote;
8
-import java.rmi.RemoteException;
9
-import java.util.List;
10
-
11
-/**
12
- * This facade shields the domain layer - model, services, repositories -
13
- * from concerns about such things as the user interface and remoting.
14
- * It is an application service.
15
- */
16
-public interface BookingServiceFacade extends Remote {
17
-
18
-  String registerNewCargo(String origin, String destination) throws RemoteException;
19
-
20
-  CargoRoutingDTO loadCargoForRouting(String trackingId) throws RemoteException;
21
-
22
-  void assignCargoToRoute(String trackingId, ItineraryCandidateDTO itinerary) throws RemoteException;
23
-
24
-  List<ItineraryCandidateDTO> requestPossibleRoutesForCargo(String trackingId) throws RemoteException;
25
-
26
-  List<LocationDTO> listShippingLocations() throws RemoteException;
27
-
28
-  List<CargoRoutingDTO> listAllCargos() throws RemoteException;
29
-
30
-}

+ 0
- 99
dddsample/src/main/java/se/citerus/dddsample/application/remoting/BookingServiceFacadeImpl.java Zobrazit soubor

@@ -1,99 +0,0 @@
1
-package se.citerus.dddsample.application.remoting;
2
-
3
-import se.citerus.dddsample.application.remoting.dto.CargoRoutingDTO;
4
-import se.citerus.dddsample.application.remoting.dto.ItineraryCandidateDTO;
5
-import se.citerus.dddsample.application.remoting.dto.LocationDTO;
6
-import se.citerus.dddsample.application.remoting.dto.assembler.CargoRoutingDTOAssembler;
7
-import se.citerus.dddsample.application.remoting.dto.assembler.ItineraryCandidateDTOAssembler;
8
-import se.citerus.dddsample.application.remoting.dto.assembler.LocationDTOAssembler;
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.Itinerary;
12
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
13
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementRepository;
14
-import se.citerus.dddsample.domain.model.location.Location;
15
-import se.citerus.dddsample.domain.model.location.LocationRepository;
16
-import se.citerus.dddsample.domain.model.location.UnLocode;
17
-import se.citerus.dddsample.domain.service.BookingService;
18
-
19
-import java.rmi.RemoteException;
20
-import java.util.ArrayList;
21
-import java.util.List;
22
-
23
-
24
-/**
25
- * This implementation has additional support from the infrastructure, for exposing as an RMI
26
- * service and for keeping the OR-mapper unit-of-work open during DTO assembly,
27
- * analogous to the view rendering for web interfaces.
28
- *
29
- * See context-remote.xml.  
30
- */
31
-public class BookingServiceFacadeImpl implements BookingServiceFacade {
32
-
33
-  private BookingService bookingService;
34
-  private LocationRepository locationRepository;
35
-  private CargoRepository cargoRepository;
36
-  private CarrierMovementRepository carrierMovementRepository;
37
-
38
-  public List<LocationDTO> listShippingLocations() {
39
-    final List<Location> allLocations = locationRepository.findAll();
40
-    final LocationDTOAssembler assembler = new LocationDTOAssembler();
41
-    return assembler.toDTOList(allLocations);
42
-  }
43
-
44
-  public String registerNewCargo(String origin, String destination) {
45
-    TrackingId trackingId = bookingService.bookNewCargo(new UnLocode(origin), new UnLocode(destination));
46
-    return trackingId.idString();
47
-  }
48
-
49
-  public CargoRoutingDTO loadCargoForRouting(String trackingId) {
50
-    // TODO lock
51
-    final Cargo cargo = cargoRepository.find(new TrackingId(trackingId));
52
-    final CargoRoutingDTOAssembler assembler = new CargoRoutingDTOAssembler();
53
-    return assembler.toDTO(cargo);
54
-  }
55
-
56
-  public void assignCargoToRoute(String trackingId, ItineraryCandidateDTO itineraryCandidateDTO) {
57
-    final Itinerary itinerary = new ItineraryCandidateDTOAssembler().fromDTO(itineraryCandidateDTO, carrierMovementRepository, locationRepository);
58
-    bookingService.assignCargoToRoute(new TrackingId(trackingId), itinerary);
59
-    // TODO unlock
60
-  }
61
-
62
-  public List<CargoRoutingDTO> listAllCargos() {
63
-    final List<Cargo> cargoList = cargoRepository.findAll();
64
-    final List<CargoRoutingDTO> dtoList = new ArrayList<CargoRoutingDTO>(cargoList.size());
65
-    final CargoRoutingDTOAssembler assembler = new CargoRoutingDTOAssembler();
66
-    for (Cargo cargo : cargoList) {
67
-      dtoList.add(assembler.toDTO(cargo));
68
-    }
69
-    return dtoList;
70
-  }
71
-
72
-  public List<ItineraryCandidateDTO> requestPossibleRoutesForCargo(String trackingId) throws RemoteException {
73
-    final List<Itinerary> itineraries = bookingService.requestPossibleRoutesForCargo(new TrackingId(trackingId));
74
-
75
-    final List<ItineraryCandidateDTO> itineraryCandidates = new ArrayList<ItineraryCandidateDTO>(itineraries.size());
76
-    final ItineraryCandidateDTOAssembler dtoAssembler = new ItineraryCandidateDTOAssembler();
77
-    for (Itinerary itinerary : itineraries) {
78
-      itineraryCandidates.add(dtoAssembler.toDTO(itinerary));
79
-    }
80
-
81
-    return itineraryCandidates;
82
-  }
83
-
84
-  public void setBookingService(BookingService bookingService) {
85
-    this.bookingService = bookingService;
86
-  }
87
-
88
-  public void setLocationRepository(LocationRepository locationRepository) {
89
-    this.locationRepository = locationRepository;
90
-  }
91
-
92
-  public void setCargoRepository(CargoRepository cargoRepository) {
93
-    this.cargoRepository = cargoRepository;
94
-  }
95
-
96
-  public void setCarrierMovementRepository(CarrierMovementRepository carrierMovementRepository) {
97
-    this.carrierMovementRepository = carrierMovementRepository;
98
-  }
99
-}

+ 0
- 59
dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/CargoRoutingDTO.java Zobrazit soubor

@@ -1,59 +0,0 @@
1
-package se.citerus.dddsample.application.remoting.dto;
2
-
3
-import java.io.Serializable;
4
-import java.util.ArrayList;
5
-import java.util.Collections;
6
-import java.util.List;
7
-
8
-/**
9
- * DTO for registering and routing a cargo.
10
- */
11
-public final class CargoRoutingDTO implements Serializable {
12
-
13
-  private final String trackingId;
14
-  private final String origin;
15
-  private final String finalDestination;
16
-  private final List<LegDTO> legs;
17
-
18
-  /**
19
-   * Constructor.
20
-   *
21
-   * @param trackingId
22
-   * @param origin
23
-   * @param finalDestination
24
-   */
25
-  public CargoRoutingDTO(final String trackingId, final String origin, final String finalDestination) {
26
-    this.trackingId = trackingId;
27
-    this.origin = origin;
28
-    this.finalDestination = finalDestination;
29
-    this.legs = new ArrayList<LegDTO>();
30
-  }
31
-
32
-  public String getTrackingId() {
33
-    return trackingId;
34
-  }
35
-
36
-  public String getOrigin() {
37
-    return origin;
38
-  }
39
-
40
-  public String getFinalDestination() {
41
-    return finalDestination;
42
-  }
43
-
44
-  public void addLeg(final String carrierMovementId, final String from, final String to) {
45
-    legs.add(new LegDTO(carrierMovementId, from, to));
46
-  }
47
-
48
-  /**
49
-   * @return An unmodifiable list DTOs.
50
-   */
51
-  public List<LegDTO> getLegs() {
52
-    return Collections.unmodifiableList(legs);
53
-  }
54
-
55
-  public boolean isRouted() {
56
-    return !legs.isEmpty();
57
-  }
58
-
59
-}

+ 0
- 54
dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/HandlingEventDTO.java Zobrazit soubor

@@ -1,54 +0,0 @@
1
-package se.citerus.dddsample.application.remoting.dto;
2
-
3
-import java.io.Serializable;
4
-import java.util.Date;
5
-
6
-/**
7
- * DTO for a handling event.
8
- */
9
-public final class HandlingEventDTO implements Serializable {
10
-
11
-  private final String type;
12
-  private final String location;
13
-  private final String carrier;
14
-  private final Date time;
15
-  private boolean expected;
16
-
17
-  /**
18
-   * Constructor.
19
-   *
20
-   * @param location
21
-   * @param type
22
-   * @param carrier
23
-   * @param time
24
-   * @param expected
25
-   */
26
-  public HandlingEventDTO(final String location, final String type, final String carrier, final Date time,
27
-                          final boolean expected) {
28
-    this.location = location;
29
-    this.type = type;
30
-    this.carrier = carrier;
31
-    this.time = time;
32
-    this.expected = expected;
33
-  }
34
-
35
-  public String getLocation() {
36
-    return location;
37
-  }
38
-
39
-  public Date getTime() {
40
-    return time;
41
-  }
42
-
43
-  public String getType() {
44
-    return type;
45
-  }
46
-
47
-  public String getCarrier() {
48
-    return carrier;
49
-  }
50
-
51
-  public boolean isExpected() {
52
-    return expected;
53
-  }
54
-}

+ 0
- 29
dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/ItineraryCandidateDTO.java Zobrazit soubor

@@ -1,29 +0,0 @@
1
-package se.citerus.dddsample.application.remoting.dto;
2
-
3
-import java.io.Serializable;
4
-import java.util.Collections;
5
-import java.util.List;
6
-
7
-/**
8
- * DTO for presenting and selecting an itinerary from a collection of candidates.
9
- */
10
-public final class ItineraryCandidateDTO implements Serializable {
11
-
12
-  private final List<LegDTO> legs;
13
-
14
-  /**
15
-   * Constructor.
16
-   *
17
-   * @param legs The legs for this itinerary.
18
-   */
19
-  public ItineraryCandidateDTO(final List<LegDTO> legs) {
20
-    this.legs = legs;
21
-  }
22
-
23
-  /**
24
-   * @return An unmodifiable list DTOs.
25
-   */
26
-  public List<LegDTO> getLegs() {
27
-    return Collections.unmodifiableList(legs);
28
-  }
29
-}

+ 0
- 39
dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/LegDTO.java Zobrazit soubor

@@ -1,39 +0,0 @@
1
-package se.citerus.dddsample.application.remoting.dto;
2
-
3
-import java.io.Serializable;
4
-
5
-/**
6
- * DTO for a leg in an itinerary.
7
- */
8
-public final class LegDTO implements Serializable {
9
-
10
-  private final String carrierMovementId;
11
-  private final String from;
12
-  private final String to;
13
-
14
-  /**
15
-   * Constructor.
16
-   *
17
-   * @param carrierMovementId
18
-   * @param from
19
-   * @param to
20
-   */
21
-  public LegDTO(final String carrierMovementId, final String from, final String to) {
22
-    this.carrierMovementId = carrierMovementId;
23
-    this.from = from;
24
-    this.to = to;
25
-  }
26
-
27
-  public String getCarrierMovementId() {
28
-    return carrierMovementId;
29
-  }
30
-
31
-  public String getFrom() {
32
-    return from;
33
-  }
34
-
35
-  public String getTo() {
36
-    return to;
37
-  }
38
-
39
-}

+ 0
- 26
dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/LocationDTO.java Zobrazit soubor

@@ -1,26 +0,0 @@
1
-package se.citerus.dddsample.application.remoting.dto;
2
-
3
-import java.io.Serializable;
4
-
5
-/**
6
- * Location DTO.
7
- */
8
-public class LocationDTO implements Serializable {
9
-
10
-  private final String unLocode;
11
-  private final String name;
12
-
13
-  public LocationDTO(String unLocode, String name) {
14
-    this.unLocode = unLocode;
15
-    this.name = name;
16
-  }
17
-
18
-  public String getUnLocode() {
19
-    return unLocode;
20
-  }
21
-
22
-  public String getName() {
23
-    return name;
24
-  }
25
-  
26
-}

+ 0
- 28
dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/assembler/CargoRoutingDTOAssembler.java Zobrazit soubor

@@ -1,28 +0,0 @@
1
-package se.citerus.dddsample.application.remoting.dto.assembler;
2
-
3
-import se.citerus.dddsample.application.remoting.dto.CargoRoutingDTO;
4
-import se.citerus.dddsample.domain.model.cargo.Cargo;
5
-import se.citerus.dddsample.domain.model.cargo.Leg;
6
-
7
-/**
8
- * Assembler class for the CargoRoutingDTO.
9
- */
10
-public class CargoRoutingDTOAssembler {
11
-
12
-  public CargoRoutingDTO toDTO(final Cargo cargo) {
13
-    final CargoRoutingDTO dto = new CargoRoutingDTO(
14
-      cargo.trackingId().idString(),
15
-      cargo.origin().toString(),
16
-      cargo.destination().toString()
17
-    );
18
-    for (Leg leg : cargo.itinerary().legs()) {
19
-      dto.addLeg(
20
-        leg.carrierMovement().carrierMovementId().idString(),
21
-        leg.from().toString(),
22
-        leg.to().toString()
23
-      );
24
-    }
25
-    return dto;
26
-  }
27
-
28
-}

+ 0
- 48
dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/assembler/ItineraryCandidateDTOAssembler.java Zobrazit soubor

@@ -1,48 +0,0 @@
1
-package se.citerus.dddsample.application.remoting.dto.assembler;
2
-
3
-import se.citerus.dddsample.application.remoting.dto.ItineraryCandidateDTO;
4
-import se.citerus.dddsample.application.remoting.dto.LegDTO;
5
-import se.citerus.dddsample.domain.model.cargo.Itinerary;
6
-import se.citerus.dddsample.domain.model.cargo.Leg;
7
-import se.citerus.dddsample.domain.model.carrier.CarrierMovement;
8
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementId;
9
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementRepository;
10
-import se.citerus.dddsample.domain.model.location.Location;
11
-import se.citerus.dddsample.domain.model.location.LocationRepository;
12
-import se.citerus.dddsample.domain.model.location.UnLocode;
13
-
14
-import java.util.ArrayList;
15
-import java.util.List;
16
-
17
-/**
18
- * Assembler class for the ItineraryCandidateDTO.
19
- */
20
-public class ItineraryCandidateDTOAssembler {
21
-  
22
-  public ItineraryCandidateDTO toDTO(final Itinerary itinerary) {
23
-    final List<LegDTO> legDTOs = new ArrayList<se.citerus.dddsample.application.remoting.dto.LegDTO>(itinerary.legs().size());
24
-    for (Leg leg : itinerary.legs()) {
25
-      legDTOs.add(toLegDTO(leg));
26
-    }
27
-    return new ItineraryCandidateDTO(legDTOs);
28
-  }
29
-
30
-  protected LegDTO toLegDTO(final Leg leg) {
31
-    final CarrierMovementId carrierMovementId = leg.carrierMovement().carrierMovementId();
32
-    final UnLocode from = leg.from().unLocode();
33
-    final UnLocode to = leg.to().unLocode();
34
-    return new LegDTO(carrierMovementId.idString(), from.idString(), to.idString());
35
-  }
36
-
37
-  public Itinerary fromDTO(ItineraryCandidateDTO itineraryCandidateDTO, CarrierMovementRepository carrierMovementRepository, LocationRepository locationRepository) {
38
-    final List<Leg> legs = new ArrayList<Leg>(itineraryCandidateDTO.getLegs().size());
39
-    for (LegDTO legDTO : itineraryCandidateDTO.getLegs()) {
40
-      final CarrierMovementId carrierMovementId = new CarrierMovementId(legDTO.getCarrierMovementId());
41
-      final CarrierMovement carrierMovement = carrierMovementRepository.find(carrierMovementId);
42
-      final Location from = locationRepository.find(new UnLocode(legDTO.getFrom()));
43
-      final Location to = locationRepository.find(new UnLocode(legDTO.getTo()));
44
-      legs.add(new Leg(carrierMovement, from, to));
45
-    }
46
-    return new Itinerary(legs);
47
-  }
48
-}

+ 0
- 22
dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/assembler/LocationDTOAssembler.java Zobrazit soubor

@@ -1,22 +0,0 @@
1
-package se.citerus.dddsample.application.remoting.dto.assembler;
2
-
3
-import se.citerus.dddsample.application.remoting.dto.LocationDTO;
4
-import se.citerus.dddsample.domain.model.location.Location;
5
-
6
-import java.util.ArrayList;
7
-import java.util.List;
8
-
9
-public class LocationDTOAssembler {
10
-
11
-  public LocationDTO toDTO(Location location) {
12
-    return new LocationDTO(location.unLocode().idString(), location.name());
13
-  }
14
-
15
-  public List<LocationDTO> toDTOList(List<Location> allLocations) {
16
-    final List<LocationDTO> dtoList = new ArrayList<LocationDTO>(allLocations.size());
17
-    for (Location location : allLocations) {
18
-      dtoList.add(toDTO(location));
19
-    }
20
-    return dtoList;
21
-  }
22
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/assembler/package.html Zobrazit soubor

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

+ 0
- 43
dddsample/src/main/java/se/citerus/dddsample/application/remoting/dto/package.html Zobrazit soubor

@@ -1,43 +0,0 @@
1
-<html>
2
-<body>
3
-<p>DTOs for the remote booking client API.</p>
4
-<!--
5
-<p>
6
-  DTOs are designed in a use case-driven fashion, closely related to the service layer interface.
7
-  They represent a particular section of the domain model, which may cross aggregate boundaries.
8
-  They have no behaviour and are immutable.
9
-</p>
10
-<p>
11
-  The reason for using DTOs is mainly to loosen the coupling of the application and the user interface.
12
-  It allows us to build the domain model completely without having to conforming to any UI-related conventions
13
-  or requirements, such as JavaBean getter methods or no-args constructors. We also avoid exposing functionality that is internal
14
-  to the domain model to the UI layer.
15
-</p>
16
-<p>
17
-  Futhermore, we have a clear contract for what part of the object graph is loaded from the database
18
-  when the service layer call returns. If domain model objects are passed on to the UI layer, it will
19
-  be necessary to keep the database access window (the Hibernate session in this case) open during the entire processing of
20
-  the view (the Open Session In View pattern), otherwise an uninitialized part of the model could
21
-  accidentally be accessed, causing an error. For example, if the UI layer were to receive a Cargo instance,
22
-  that could be navigated to access the Itinerary, iterate over the Legs of the itinerary, access the Leg's CarrierMovement and
23
-  then the CarrierMovement's Location and so on.
24
-  In addition to effectively tying the UI layer and the rest of the aplication to the same JVM,
25
-  letting the UI layer decide when to initialize data may be very inefficient. DTOs are a natural way
26
-  of loading only the relevant data for a particular use case, and blocking access to the rest.
27
-</p>
28
-<p>
29
-  Using DTOs also makes the service layer reusable across different kinds of frontends: web, rich clients, other backend systems etc.
30
-  Remember that classes that are persisted with Hibernate or similar technologies are modified in runtime,
31
-  so that for example collection-valued fields are swapped for customized implementations that allow lazy loading.
32
-  If these persisted domain model classes are to be deserialized in another JVM, those O/R-mapping-specific classes need to be available
33
-  there as well, which is not very elegant.
34
-</p>
35
-<p>
36
-  One caveat though: The usefulness of DTOs may vary with the degree of vertical separation in the application. If it's very
37
-  unlikely that your application will use anything other than a web interface, and that it otherwise are
38
-  no problems running the web layer together with the rest of the application, you may want to avoid the
39
-  overhead of maintaining several similar sets of classes.  
40
-</p>
41
--->
42
-</body>
43
-</html>

+ 0
- 8
dddsample/src/main/java/se/citerus/dddsample/application/remoting/package.html Zobrazit soubor

@@ -1,8 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  Remote service facades with supporting DTO classes and assemblers. Sits on top of the domain service
5
-  layer, and forms the boundary of the O/R-mapper unit-of-work scope when sending data to the user interface.   
6
-</p>
7
-</body>
8
-</html>

+ 0
- 79
dddsample/src/main/java/se/citerus/dddsample/application/routing/ExternalRoutingService.java Zobrazit soubor

@@ -1,79 +0,0 @@
1
-package se.citerus.dddsample.application.routing;
2
-
3
-import org.springframework.transaction.annotation.Transactional;
4
-import se.citerus.dddsample.domain.model.cargo.Itinerary;
5
-import se.citerus.dddsample.domain.model.cargo.Leg;
6
-import se.citerus.dddsample.domain.model.cargo.RouteSpecification;
7
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementId;
8
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementRepository;
9
-import se.citerus.dddsample.domain.model.location.Location;
10
-import se.citerus.dddsample.domain.model.location.LocationRepository;
11
-import se.citerus.dddsample.domain.model.location.UnLocode;
12
-import se.citerus.dddsample.domain.service.RoutingService;
13
-import se.citerus.routingteam.GraphTraversalService;
14
-import se.citerus.routingteam.TransitEdge;
15
-import se.citerus.routingteam.TransitPath;
16
-
17
-import java.util.ArrayList;
18
-import java.util.List;
19
-
20
-/**
21
- * Our end of the routing service. This is basically a data model
22
- * translation layer between our domain model and the API put forward
23
- * by the routing team, which operates in a different context from us.
24
- *
25
- */
26
-public class ExternalRoutingService implements RoutingService {
27
-
28
-  private GraphTraversalService graphTraversalService;
29
-  private LocationRepository locationRepository;
30
-  private CarrierMovementRepository carrierMovementRepository;
31
-
32
-  @Transactional(readOnly = true)
33
-  public List<Itinerary> fetchRoutesForSpecification(RouteSpecification routeSpecification) {
34
-    final Location origin = routeSpecification.origin();
35
-    final Location destination = routeSpecification.destination();
36
-
37
-    final List<TransitPath> transitPaths = graphTraversalService.findShortestPath(
38
-      origin.unLocode().idString(),
39
-      destination.unLocode().idString()
40
-    );
41
-    
42
-    final List<Itinerary> itineraries = new ArrayList<Itinerary>(transitPaths.size());
43
-
44
-    for (TransitPath transitPath : transitPaths) {
45
-      final Itinerary itinerary = toItinerary(transitPath);
46
-      itineraries.add(itinerary);
47
-    }
48
-
49
-    return itineraries;
50
-  }
51
-
52
-  private Itinerary toItinerary(TransitPath transitPath) {
53
-    List<Leg> legs = new ArrayList(transitPath.getTransitEdges().size());
54
-    for (TransitEdge edge : transitPath.getTransitEdges()) {
55
-      legs.add(toLeg(edge));
56
-    }
57
-    return new Itinerary(legs);
58
-  }
59
-
60
-  private Leg toLeg(TransitEdge edge) {
61
-    return new Leg(
62
-      carrierMovementRepository.find(new CarrierMovementId(edge.getCarrierMovementId())),
63
-      locationRepository.find(new UnLocode(edge.getFromUnLocode())),
64
-      locationRepository.find(new UnLocode(edge.getToUnLocode()))
65
-    );
66
-  }
67
-
68
-  public void setGraphTraversalService(GraphTraversalService graphTraversalService) {
69
-    this.graphTraversalService = graphTraversalService;
70
-  }
71
-
72
-  public void setLocationRepository(LocationRepository locationRepository) {
73
-    this.locationRepository = locationRepository;
74
-  }
75
-
76
-  public void setCarrierMovementRepository(CarrierMovementRepository carrierMovementRepository) {
77
-    this.carrierMovementRepository = carrierMovementRepository;
78
-  }
79
-}

+ 0
- 9
dddsample/src/main/java/se/citerus/dddsample/application/routing/package.html Zobrazit soubor

@@ -1,9 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  The routing service interface, which is part of the domain layer, is implemented by translating
5
-  our model and delegating work to a remote service in a different context. The recieved routing data
6
-  is also translated back to our model, forming a cargo itinerary.
7
-</p>
8
-</body>
9
-</html>

+ 0
- 211
dddsample/src/main/java/se/citerus/dddsample/application/util/SampleDataGenerator.java Zobrazit soubor

@@ -1,211 +0,0 @@
1
-package se.citerus.dddsample.application.util;
2
-
3
-import org.springframework.beans.factory.BeanFactoryUtils;
4
-import org.springframework.jdbc.core.JdbcTemplate;
5
-import org.springframework.transaction.PlatformTransactionManager;
6
-import org.springframework.transaction.TransactionStatus;
7
-import org.springframework.transaction.support.TransactionCallbackWithoutResult;
8
-import org.springframework.transaction.support.TransactionTemplate;
9
-import org.springframework.web.context.WebApplicationContext;
10
-import org.springframework.web.context.support.WebApplicationContextUtils;
11
-
12
-import javax.servlet.ServletContextEvent;
13
-import javax.servlet.ServletContextListener;
14
-import javax.sql.DataSource;
15
-import java.sql.Timestamp;
16
-import java.text.ParseException;
17
-import java.text.SimpleDateFormat;
18
-import java.util.Date;
19
-
20
-/**
21
- * Provides sample data.
22
- */
23
-public class SampleDataGenerator implements ServletContextListener {
24
-
25
-  private static final Timestamp base; 
26
-  static {
27
-    try {
28
-      Date date = new SimpleDateFormat("yyyy-MM-dd").parse("2008-01-01");
29
-      base = new Timestamp(date.getTime() - 1000L * 60 * 60 * 24 * 100);
30
-    } catch (ParseException e) {
31
-      throw new RuntimeException(e);
32
-    }
33
-  }
34
-
35
-  private static void loadHandlingEventData(JdbcTemplate jdbcTemplate) {
36
-    String handlingEventSql =
37
-      "insert into HandlingEvent (completionTime, registrationTime, type, location_id, carrierMovement_id, cargo_id) " +
38
-      "values (?, ?, ?, ?, ?, ?)";
39
-
40
-    Object[][] handlingEventArgs = {
41
-        //XYZ (SESTO-FIHEL-DEHAM-CNHKG-JPTOK-AUMEL)
42
-        {ts(0),     ts((0)),    "RECEIVE",  1,  null,  1},
43
-        {ts((4)),   ts((5)),    "LOAD",     1,  1,     1},
44
-        {ts((14)),  ts((14)),   "UNLOAD",   5,  1,     1},
45
-        {ts((15)),  ts((15)),   "LOAD",     5,  2,     1},
46
-        {ts((30)),  ts((30)),   "UNLOAD",   6,  2,     1},
47
-        {ts((33)),  ts((33)),   "LOAD",     6,  3,     1},
48
-        {ts((34)),  ts((34)),   "UNLOAD",   3,  3,     1},
49
-        {ts((60)),  ts((60)),   "LOAD",     3,  4,     1},
50
-        {ts((70)),  ts((71)),   "UNLOAD",   4,  4,     1},
51
-        {ts((75)),  ts((75)),   "LOAD",     4,  5,     1},
52
-        {ts((88)),  ts((88)),   "UNLOAD",   2,  5,     1},
53
-        {ts((100)), ts((102)),  "CLAIM",    2,  null,  1},
54
-
55
-        //ZYX (AUMEL - USCHI - DEHAM -)
56
-        {ts((200)),   ts((201)),  "RECEIVE",  2,  null,  3},
57
-        {ts((202)),   ts((202)),  "LOAD",     2,  7,     3},
58
-        {ts((208)),   ts((208)),  "UNLOAD",   7,  7,     3},
59
-        {ts((212)),   ts((212)),  "LOAD",     7,  8,     3},
60
-        {ts((230)),   ts((230)),  "UNLOAD",   6,  8,     3},
61
-        {ts((235)),   ts((235)),  "LOAD",     6,  9,     3},
62
-
63
-        //ABC
64
-        {ts((20)),  ts((21)),   "CLAIM",    2,  null,  2},
65
-
66
-        //CBA
67
-        {ts((0)),   ts((1)),    "RECEIVE",  2,  null,  4},
68
-        {ts((10)),  ts((11)),   "LOAD",     2,  7,     4},
69
-        {ts((20)),  ts((21)),   "UNLOAD",   7,  7,     4},
70
-
71
-        //FGH
72
-        {ts(100),   ts(160),    "RECEIVE",  3,  null,   5},
73
-        {ts(150),   ts(110),    "LOAD",     3,  10,     5},
74
-
75
-        // JKL
76
-        {ts(200),   ts(220),    "RECEIVE",  6,  null,   6},
77
-        {ts(300),   ts(330),    "LOAD",     6,  12,     6},
78
-        {ts(400),   ts(440),    "UNLOAD",   5,  12,     6}  // Unexpected event
79
-    };
80
-    executeUpdate(jdbcTemplate, handlingEventSql, handlingEventArgs);
81
-  }
82
-
83
-  private static void loadCarrierMovementData(JdbcTemplate jdbcTemplate) {
84
-    String carrierMovementSql =
85
-      "insert into CarrierMovement (id, carrier_movement_id, from_id, to_id) " +
86
-      "values (?,?,?,?)";
87
-
88
-    Object[][] carrierMovementArgs = {
89
-     // SESTO-FIHEL-DEHAM-CNHKG-JPTOK-AUMEL
90
-      {1, "CAR_001",1,5},
91
-      {2, "CAR_002",5,6},
92
-      {3, "CAR_003",6,3},
93
-      {4, "CAR_004",3,4},
94
-      {5, "CAR_005",4,2},
95
-
96
-      // FIHEL - SESTO
97
-      {6, "CAR_006",5,1},
98
-
99
-      // AUMEL - USCHI - DEHAM - SESTO
100
-      {7, "CAR_007",2,7},
101
-      {8, "CAR_008",7,6},
102
-      {9, "CAR_009",6,1},
103
-
104
-      // CNHKG - AUMEL
105
-      {10,"CAR_010",3,2},
106
-      // AUMEL - FIHEL
107
-      {11,"CAR_011",2,5},
108
-      // DEHAM - SESTO
109
-      {12,"CAR_020",6,1},
110
-      // SESTO - USCHI
111
-      {13,"CAR_021",1,7},
112
-      // USCHI - JPTKO
113
-      {14,"CAR_022",7,4}
114
-    };
115
-    executeUpdate(jdbcTemplate, carrierMovementSql, carrierMovementArgs);
116
-  }
117
-
118
-  private static void loadCargoData(JdbcTemplate jdbcTemplate) {
119
-    String cargoSql =
120
-      "insert into Cargo (id, tracking_id, origin_id, destination_id) " +
121
-      "values (?, ?, ?, ?)";
122
-
123
-    Object[][] cargoArgs = {
124
-      {1, "XYZ", 1, 2},
125
-      {2, "ABC", 1, 5},
126
-      {3, "ZYX", 2, 1},
127
-      {4, "CBA", 5, 1},
128
-      {5, "FGH", 3, 5},
129
-      {6, "JKL", 6, 4}
130
-    };
131
-    executeUpdate(jdbcTemplate, cargoSql, cargoArgs);
132
-  }
133
-
134
-  private static void loadLocationData(JdbcTemplate jdbcTemplate) {
135
-    String locationSql =
136
-      "insert into Location (id, unlocode, name) " +
137
-      "values (?, ?, ?)";
138
-
139
-    Object[][] locationArgs = {
140
-      {1, "SESTO", "Stockholm"},
141
-      {2, "AUMEL", "Melbourne"},
142
-      {3, "CNHKG", "Hongkong"},
143
-      {4, "JPTOK", "Tokyo"},
144
-      {5, "FIHEL", "Helsinki"},
145
-      {6, "DEHAM", "Hamburg"},
146
-      {7, "USCHI", "Chicago"}
147
-    };
148
-    executeUpdate(jdbcTemplate, locationSql, locationArgs);
149
-  }
150
-
151
-  private static void loadItineraryData(JdbcTemplate jdbcTemplate) {
152
-    String itinerarySql = "insert into Itinerary (id, cargo_id) values (?,?)";
153
-
154
-    Object[][] itineraryArgs = {
155
-      {1, 5},
156
-      {2, 6}
157
-    };
158
-    executeUpdate(jdbcTemplate, itinerarySql, itineraryArgs);
159
-
160
-    String legSql =
161
-      "insert into Leg (id, itinerary_id, carrierMovement_id, from_id, to_id, leg_index) " +
162
-      "values (?,?,?,?,?,?)";
163
-
164
-    Object [][] legArgs = {
165
-      // Cargo 5: Hongkong - Melbourne - Stockholm - Helsinki
166
-      {1,1,10,3,2,0},
167
-      {2,1,11,2,1,1},
168
-      {3,1,11,1,5,2},
169
-      // Cargo 6: Hamburg - Stockholm - Chicago - Tokyo
170
-      {4,2,12,6,1,0},
171
-      {5,2,13,1,7,1},
172
-      {6,2,14,7,4,2}
173
-    };
174
-    executeUpdate(jdbcTemplate, legSql, legArgs);
175
-  }
176
-
177
-  public void contextInitialized(ServletContextEvent event) {
178
-    WebApplicationContext context = WebApplicationContextUtils.getRequiredWebApplicationContext(event.getServletContext());
179
-    DataSource dataSource = (DataSource) BeanFactoryUtils.beanOfType(context, DataSource.class);
180
-    PlatformTransactionManager transactionManager = (PlatformTransactionManager) BeanFactoryUtils.beanOfType(context, PlatformTransactionManager.class);
181
-    loadSampleData(new JdbcTemplate(dataSource), new TransactionTemplate(transactionManager));
182
-  }
183
-
184
-  public void contextDestroyed(ServletContextEvent event) {}
185
-
186
-  public static void loadSampleData(final JdbcTemplate jdbcTemplate, TransactionTemplate transactionTemplate) {
187
-    transactionTemplate.execute(new TransactionCallbackWithoutResult() {
188
-      protected void doInTransactionWithoutResult(TransactionStatus status) {
189
-        loadLocationData(jdbcTemplate);
190
-        loadCarrierMovementData(jdbcTemplate);
191
-        loadCargoData(jdbcTemplate);
192
-        loadItineraryData(jdbcTemplate);
193
-        loadHandlingEventData(jdbcTemplate);
194
-      }
195
-    });
196
-  }
197
-
198
-  private static void executeUpdate(JdbcTemplate jdbcTemplate, String sql, Object[][] args) {
199
-    for (Object[] arg : args) {
200
-      jdbcTemplate.update(sql, arg);
201
-    }
202
-  }
203
-
204
-  private static Timestamp ts(int hours) {
205
-    return new Timestamp(base.getTime() + 1000L * 60 * 60 * hours);
206
-  }
207
-
208
-  public static Date offset(int hours) {
209
-    return new Date(ts(hours).getTime());
210
-  }
211
-}

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

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

+ 0
- 22
dddsample/src/main/java/se/citerus/dddsample/application/ws/HandlingEventServiceEndpoint.java Zobrazit soubor

@@ -1,22 +0,0 @@
1
-package se.citerus.dddsample.application.ws;
2
-
3
-import javax.jws.WebService;
4
-
5
-/**
6
- * Web service endpoint for handling event registration.
7
- */
8
-@WebService
9
-public interface HandlingEventServiceEndpoint {
10
-
11
-  /**
12
-   * Register an cargo handling event.
13
-   *
14
-   * @param completionTime    time when event occured, for example a the loading of cargo was completed
15
-   * @param trackingId        tracking id of the cargo
16
-   * @param carrierMovementId carrier movement id, if applicable
17
-   * @param unlocode          United Nations Location Code for the location where the event occured
18
-   * @param eventType         type of event
19
-   */
20
-  void register(String completionTime, String trackingId, String carrierMovementId, String unlocode, String eventType);
21
-
22
-}

+ 0
- 102
dddsample/src/main/java/se/citerus/dddsample/application/ws/HandlingEventServiceEndpointImpl.java Zobrazit soubor

@@ -1,102 +0,0 @@
1
-package se.citerus.dddsample.application.ws;
2
-
3
-import org.apache.commons.lang.StringUtils;
4
-import org.apache.commons.logging.Log;
5
-import org.apache.commons.logging.LogFactory;
6
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
7
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementId;
8
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
9
-import se.citerus.dddsample.domain.model.location.UnLocode;
10
-import se.citerus.dddsample.domain.service.HandlingEventService;
11
-import se.citerus.dddsample.domain.service.UnknownCarrierMovementIdException;
12
-import se.citerus.dddsample.domain.service.UnknownTrackingIdException;
13
-
14
-import javax.jws.WebService;
15
-import java.text.ParseException;
16
-import java.text.SimpleDateFormat;
17
-import java.util.Date;
18
-
19
-@WebService(endpointInterface = "se.citerus.dddsample.application.ws.HandlingEventServiceEndpoint")
20
-public class HandlingEventServiceEndpointImpl implements HandlingEventServiceEndpoint {
21
-
22
-  private HandlingEventService handlingEventService;
23
-  private final Log logger = LogFactory.getLog(getClass());
24
-  protected static final String ISO_8601_FORMAT = "yyyy-mm-dd HH:MM:SS.SSS";
25
-
26
-  public void register(final String completionTime, final String trackingId, final String carrierMovementId,
27
-                       final String unlocode, final String eventType) {
28
-    try {
29
-      Date date = parseIso8601Date(completionTime);
30
-      TrackingId tid = new TrackingId(trackingId);
31
-      CarrierMovementId cid;
32
-      if (StringUtils.isNotEmpty(carrierMovementId)) {
33
-        cid = new CarrierMovementId(carrierMovementId);
34
-      } else {
35
-        cid = null;
36
-      }
37
-      HandlingEvent.Type type = parseEventType(eventType);
38
-
39
-      UnLocode ul = new UnLocode(unlocode);
40
-
41
-      handlingEventService.register(date, tid, cid, ul, type);
42
-
43
-    } catch (IllegalArgumentException iae) {
44
-      handleIllegalArgument(iae);
45
-
46
-    } catch (ParseException pe) {
47
-      handleInvalidDateFormat(completionTime);
48
-
49
-    } catch (UnknownTrackingIdException utid) {
50
-      handleUnknownTrackingId(utid);
51
-
52
-    } catch (UnknownCarrierMovementIdException ucmi) {
53
-      handleUnknownCarrierMovementId(ucmi);
54
-
55
-    } catch (InvalidEventTypeException iete) {
56
-      handleInvalidEventType(iete);
57
-
58
-    } catch (Exception e) {
59
-      handleOtherError(e);
60
-    }
61
-  }
62
-
63
-  private void handleIllegalArgument(IllegalArgumentException iae) {
64
-    logger.error(iae, iae);
65
-  }
66
-
67
-  private void handleOtherError(Exception e) {
68
-    logger.error(e, e);
69
-  }
70
-
71
-  private void handleInvalidEventType(InvalidEventTypeException iete) {
72
-    logger.error(iete, iete);
73
-  }
74
-
75
-  private void handleInvalidDateFormat(String completionTime) {
76
-    logger.error("Invalid date format: " + completionTime + ", must be on ISO 8601 format: " + ISO_8601_FORMAT);
77
-  }
78
-
79
-  private HandlingEvent.Type parseEventType(final String eventType) throws InvalidEventTypeException {
80
-    try {
81
-      return HandlingEvent.Type.valueOf(eventType);
82
-    } catch (IllegalArgumentException e) {
83
-      throw new InvalidEventTypeException(eventType);
84
-    }
85
-  }
86
-
87
-  private void handleUnknownCarrierMovementId(UnknownCarrierMovementIdException e) {
88
-    logger.info("Placing event in retry queue due to: " + e.getMessage());
89
-  }
90
-
91
-  private void handleUnknownTrackingId(Exception e) {
92
-    logger.info("Placing event in retry queue due to: " + e.getMessage());
93
-  }
94
-
95
-  private Date parseIso8601Date(final String completionTime) throws ParseException {
96
-    return new SimpleDateFormat(ISO_8601_FORMAT).parse(completionTime);
97
-  }
98
-
99
-  public void setHandlingEventService(final HandlingEventService handlingEventService) {
100
-    this.handlingEventService = handlingEventService;
101
-  }
102
-}

+ 0
- 21
dddsample/src/main/java/se/citerus/dddsample/application/ws/InvalidEventTypeException.java Zobrazit soubor

@@ -1,21 +0,0 @@
1
-package se.citerus.dddsample.application.ws;
2
-
3
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
4
-
5
-import java.util.Arrays;
6
-
7
-/**
8
- * Thrown when trying to register an event with an invalid type.
9
- *
10
- */
11
-public class InvalidEventTypeException extends Throwable {
12
-  private String eventType;
13
-
14
-  public InvalidEventTypeException(String eventType) {
15
-    this.eventType = eventType;
16
-  }
17
-
18
-  public String getMessage() {
19
-    return "Invalid event type: " + eventType + ". Valid types are: " + Arrays.deepToString(HandlingEvent.Type.values());
20
-  }
21
-}

+ 0
- 8
dddsample/src/main/java/se/citerus/dddsample/application/ws/package.html Zobrazit soubor

@@ -1,8 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  The web service interface for registering handling events, implemented using JAX-WS.
5
-  This is an Open Host Service with data model translation and basic validation, and part of the infrastructure. 
6
-</p>
7
-</body>
8
-</html>

+ 0
- 17
dddsample/src/main/java/se/citerus/dddsample/domain/model/DomainEvent.java Zobrazit soubor

@@ -1,17 +0,0 @@
1
-package se.citerus.dddsample.domain.model;
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
- 17
dddsample/src/main/java/se/citerus/dddsample/domain/model/Entity.java Zobrazit soubor

@@ -1,17 +0,0 @@
1
-package se.citerus.dddsample.domain.model;
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
- 6
dddsample/src/main/java/se/citerus/dddsample/domain/model/Specification.java Zobrazit soubor

@@ -1,6 +0,0 @@
1
-package se.citerus.dddsample.domain.model;
2
-
3
-public interface Specification<T> {
4
-  // TODO replace with Specification project dependency
5
-  boolean isSatisfiedBy(T t);
6
-}

+ 0
- 17
dddsample/src/main/java/se/citerus/dddsample/domain/model/ValueObject.java Zobrazit soubor

@@ -1,17 +0,0 @@
1
-package se.citerus.dddsample.domain.model;
2
-
3
-/**
4
- * A value object, as described in the DDD book.
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
-}

+ 0
- 230
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Cargo.java Zobrazit soubor

@@ -1,230 +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.Entity;
5
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
6
-import se.citerus.dddsample.domain.model.location.Location;
7
-
8
-/**
9
- * A Cargo. This is the central class in the domain model,
10
- * and it is the root of the Cargo-Itinerary-Leg-DeliveryHistory aggregate.
11
- *
12
- * A cargo is identified by a unique tracking id, and it always has an origin
13
- * and a destination. The life cycle of a cargo begins with the booking procedure,
14
- * when the tracking id is assigned. During a (short) period of time, between booking
15
- * and initial routing, the cargo has no itinerary.
16
- *
17
- * The booking clerk requests a list of possible routes, matching a route specification,
18
- * and assigns the cargo to one route. An itinerary listing the legs of the route
19
- * is attached to the cargo.
20
- *
21
- * A cargo can be re-routed during transport, on demand of the customer, in which case
22
- * the destination is changed and a new route is requested. The old itinerary,
23
- * being a value object, is discarded and a new one is attached.
24
- *
25
- * It may also happen that a cargo is accidentally misrouted, which should notify the proper
26
- * personnel and also trigger a re-routing procedure.
27
- *
28
- * The life cycle of a cargo ends when the cargo is claimed by the customer.
29
- *
30
- * The cargo aggregate, and the entre domain model, is built to solve the problem
31
- * of booking and tracking cargo. All important business rules for determining whether
32
- * or not a cargo is misrouted, what the current status of the cargo is (on board carrier,
33
- * in port etc), are captured in this aggregate.
34
- *
35
- */
36
-public final class Cargo implements Entity<Cargo> {
37
-
38
-  private TrackingId trackingId;
39
-  private Location origin;
40
-  private Location destination;
41
-  private Itinerary itinerary;
42
-  private DeliveryHistory deliveryHistory;
43
-
44
-  /**
45
-   * @param trackingId tracking id
46
-   * @param origin origin location
47
-   * @param destination destination location
48
-   */
49
-  public Cargo(final TrackingId trackingId, final Location origin, final Location destination) {
50
-    Validate.notNull(trackingId);
51
-    Validate.notNull(origin);
52
-    Validate.notNull(destination);
53
-
54
-    this.trackingId = trackingId;
55
-    this.origin = origin;
56
-    this.destination = destination;
57
-  }
58
-
59
-  /**
60
-   * The tracking id is the identity of this entity, and is unique.
61
-   * 
62
-   * @return Tracking id.
63
-   */
64
-  public TrackingId trackingId() {
65
-    return this.trackingId;
66
-  }
67
-
68
-  /**
69
-   * @return Origin location.
70
-   */
71
-  public Location origin() {
72
-    return this.origin;
73
-  }
74
-
75
-  /**
76
-   * @param newDestination the new destination. May not be null.
77
-   */
78
-  public void changeDestination(final Location newDestination) {
79
-    Validate.notNull(newDestination);
80
-
81
-    this.destination = newDestination;
82
-  }
83
-
84
-  /**
85
-   * @return Destination of the cargo.
86
-   */
87
-  public Location destination() {
88
-    return this.destination;
89
-  }
90
-
91
-  /**
92
-   * @return The delivery history. Never null.
93
-   */
94
-  public DeliveryHistory deliveryHistory() {
95
-    return nullSafe(this.deliveryHistory, DeliveryHistory.EMPTY_DELIVERY_HISTORY);
96
-  }
97
-
98
-  /**
99
-   * @return The itinerary. Never null.
100
-   */
101
-  public Itinerary itinerary() {
102
-    return nullSafe(this.itinerary, Itinerary.EMPTY_ITINERARY);
103
-  }
104
-
105
-  /**
106
-   * @return Last known location of the cargo, or Location.UNKNOWN if the delivery history is empty.
107
-   */
108
-  public Location lastKnownLocation() {
109
-    final HandlingEvent lastEvent = deliveryHistory().lastEvent();
110
-    if (lastEvent != null) {
111
-      return lastEvent.location();
112
-    } else {
113
-      return Location.UNKNOWN;
114
-    }
115
-  }
116
-
117
-  /**
118
-   * @return True if the cargo has arrived at its final destination.
119
-   */
120
-  public boolean hasArrived() {
121
-    return destination.equals(lastKnownLocation());
122
-  }
123
-
124
-  /**
125
-   * Attach a new itinerary to this cargo.
126
-   *
127
-   * @param itinerary an itinerary. May not be null.
128
-   */
129
-  public void attachItinerary(final Itinerary itinerary) {
130
-    Validate.notNull(itinerary);
131
-
132
-    // Decouple the old itinerary from this cargo
133
-    itinerary().setCargo(null);
134
-    // Couple this cargo and the new itinerary
135
-    this.itinerary = itinerary;
136
-    this.itinerary.setCargo(this);
137
-  }
138
-
139
-  /**
140
-   * Detaches the current itinerary from the cargo.
141
-   */
142
-  public void detachItinerary() {
143
-    itinerary().setCargo(null);
144
-    this.itinerary = null;
145
-  }
146
-
147
-  /**
148
-   * @param deliveryHistory Cargo delivery history
149
-   */
150
-  void setDeliveryHistory(final DeliveryHistory deliveryHistory) {
151
-    Validate.notNull(deliveryHistory);
152
-    this.deliveryHistory = deliveryHistory;
153
-  }
154
-
155
-  /**
156
-   * Check if cargo is misdirected.
157
-   * <p/>
158
-   * <ul>
159
-   * <li>A cargo is misdirected if it is in a location that's not in the itinerary.
160
-   * <li>A cargo with no itinerary can not be misdirected.
161
-   * <li>A cargo that has received no handling events can not be misdirected.
162
-   * </ul>
163
-   *
164
-   * @return <code>true</code> if the cargo has been misdirected,
165
-   */
166
-  public boolean isMisdirected() {
167
-    final HandlingEvent lastEvent = deliveryHistory().lastEvent();
168
-    if (lastEvent == null) {
169
-      return false;
170
-    } else {                                          
171
-      return !itinerary().isExpected(lastEvent);
172
-    }
173
-  }
174
-
175
-  /**
176
-   * Does not take into account the possibility of the cargo having been
177
-   * (errouneously) loaded onto another carrier after it has been unloaded
178
-   * at the final destination.
179
-   *
180
-   * @return True if the cargo has been unloaded at the final destination.
181
-   */
182
-  public boolean isUnloadedAtDestination() {
183
-    for (HandlingEvent event : deliveryHistory().eventsOrderedByCompletionTime()) {
184
-      if (HandlingEvent.Type.UNLOAD.equals(event.type())
185
-        && destination.equals(event.location())) {
186
-        return true;
187
-      }
188
-    }
189
-    return false;
190
-  }
191
-
192
-  public boolean sameIdentityAs(final Cargo other) {
193
-    return other != null && trackingId.sameValueAs(other.trackingId);
194
-  }
195
-
196
-  /**
197
-   * @param object to compare
198
-   * @return True if they have the same identity
199
-   * @see #sameIdentityAs(Cargo)
200
-   */
201
-  @Override
202
-  public boolean equals(final Object object) {
203
-    if (!(object instanceof Cargo)) {
204
-      return false;
205
-    }
206
-    final Cargo other = (Cargo) object;
207
-    return sameIdentityAs(other);
208
-  }
209
-
210
-  /**
211
-   * @return Hash code of tracking id.
212
-   */
213
-  @Override
214
-  public int hashCode() {
215
-    return trackingId.hashCode();
216
-  }
217
-
218
-  // Utility for Null Object Pattern - should be moved out of this class
219
-  private <T> T nullSafe(T actual, T safe) {
220
-    return actual == null ? safe : actual;
221
-  }
222
-
223
-  Cargo() {
224
-    // Needed by Hibernate
225
-  }
226
-
227
-  // Auto-generated surrogate key
228
-  private Long id;
229
-
230
-}

+ 0
- 38
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/CargoRepository.java Zobrazit soubor

@@ -1,38 +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 save(Cargo cargo);
28
-
29
-  /**
30
-   * TODO
31
-   * this is too complex a procedure to belong in the repository -
32
-   * introduce a TrackingIdFactory (or perhaps a CargoFactory).
33
-   *
34
-   * @return A new generated tracking Id.
35
-   */
36
-  TrackingId nextTrackingId();
37
-
38
-}

+ 0
- 109
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/DeliveryHistory.java Zobrazit soubor

@@ -1,109 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-import se.citerus.dddsample.domain.model.ValueObject;
4
-import static se.citerus.dddsample.domain.model.cargo.StatusCode.*;
5
-import se.citerus.dddsample.domain.model.carrier.CarrierMovement;
6
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
7
-import se.citerus.dddsample.domain.model.location.Location;
8
-
9
-import java.util.*;
10
-
11
-/**
12
- * The delivery history of a cargo.
13
- *
14
- * This is a value object.
15
- */
16
-public final class DeliveryHistory implements ValueObject<DeliveryHistory> {
17
-
18
-  private Set<HandlingEvent> events;
19
-
20
-  public static final DeliveryHistory EMPTY_DELIVERY_HISTORY = new DeliveryHistory(Collections.EMPTY_SET);
21
-
22
-  DeliveryHistory(final Collection<HandlingEvent> events) {
23
-    this.events = new HashSet<HandlingEvent>(events);
24
-  }
25
-
26
-  /**
27
-   * @return An <b>unmodifiable</b> list of handling events, ordered by the time the events occured.
28
-   */
29
-  public List<HandlingEvent> eventsOrderedByCompletionTime() {
30
-    final List<HandlingEvent> eventList = new ArrayList<HandlingEvent>(events);
31
-    Collections.sort(eventList, HandlingEvent.BY_COMPLETION_TIME_COMPARATOR);
32
-    return Collections.unmodifiableList(eventList);
33
-  }
34
-
35
-  /**
36
-   * @return The last event of the delivery history, or null is history is empty.
37
-   */
38
-  public HandlingEvent lastEvent() {
39
-    if (events.isEmpty()) {
40
-      return null;
41
-    } else {
42
-      final List<HandlingEvent> orderedEvents = eventsOrderedByCompletionTime();
43
-      return orderedEvents.get(orderedEvents.size() - 1);
44
-    }
45
-  }
46
-
47
-  public StatusCode status() {
48
-    if (lastEvent() == null)
49
-      return NOT_RECEIVED;
50
-
51
-    final HandlingEvent.Type type = lastEvent().type();
52
-    
53
-    switch (type) {
54
-      case LOAD:
55
-        return ONBOARD_CARRIER;
56
-
57
-      case UNLOAD:
58
-      case RECEIVE:
59
-      case CUSTOMS:
60
-        return IN_PORT;
61
-
62
-      case CLAIM:
63
-        return CLAIMED;
64
-
65
-      default:
66
-        return null;
67
-    }
68
-  }
69
-
70
-  public Location currentLocation() {
71
-    if (status().equals(IN_PORT)) {
72
-      return lastEvent().location();
73
-    } else {
74
-      return null;
75
-    }
76
-  }
77
-
78
-  public CarrierMovement currentCarrierMovement() {
79
-    if (status().equals(ONBOARD_CARRIER)) {
80
-      return lastEvent().carrierMovement();
81
-    } else {
82
-      return null;
83
-    }
84
-  }
85
-
86
-  public boolean sameValueAs(DeliveryHistory other) {
87
-    return other != null && events.equals(other.events);
88
-  }
89
-
90
-  @Override
91
-  public boolean equals(Object o) {
92
-    if (this == o) return true;
93
-    if (o == null || getClass() != o.getClass()) return false;
94
-
95
-    final DeliveryHistory other = (DeliveryHistory) o;
96
-
97
-    return sameValueAs(other);
98
-  }
99
-
100
-  @Override
101
-  public int hashCode() {
102
-    return events.hashCode();
103
-  }
104
-
105
-  DeliveryHistory() {
106
-    // Needed by Hibernate
107
-  }
108
-
109
-}

+ 0
- 130
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Itinerary.java Zobrazit soubor

@@ -1,130 +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.ValueObject;
5
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
6
-
7
-import java.util.Collections;
8
-import java.util.List;
9
-
10
-/**
11
- * An itinerary.
12
- * 
13
- */
14
-public final class Itinerary implements ValueObject<Itinerary> {
15
-
16
-  private Cargo cargo;
17
-  private List<Leg> legs = Collections.emptyList();
18
-
19
-  static final Itinerary EMPTY_ITINERARY = new Itinerary();
20
-
21
-  /**
22
-   * Constructor.
23
-   *
24
-   * @param legs List of legs for this itinerary.
25
-   */
26
-  public Itinerary(final List<Leg> legs) {
27
-    Validate.notEmpty(legs);
28
-    Validate.noNullElements(legs);
29
-    
30
-    this.legs = Collections.unmodifiableList(legs);
31
-  }
32
-
33
-  /**
34
-   * For maintaing referential integrity inside the Cargo aggregate,
35
-   * with package level visibility. 
36
-   *
37
-   * @see Cargo#attachItinerary(Itinerary)
38
-   * @see Cargo#detachItinerary()
39
-   *  
40
-   * @param cargo the cargo that this itinerary is for
41
-   */
42
-  void setCargo(Cargo cargo) {
43
-    this.cargo = cargo;
44
-  }
45
-  
46
-  /**
47
-   * @return the legs of this itinerary, as an <b>immutable</b> list.
48
-   */
49
-  public List<Leg> legs() {
50
-    return legs;
51
-  }
52
-
53
-  /**
54
-   * Test if the given handling event is expected when executing this itinerary.
55
-   *
56
-   * @param event Event to test.
57
-   * @return <code>true</code> if the event is expected
58
-   */
59
-  public boolean isExpected(final HandlingEvent event) {
60
-    if (legs.isEmpty()) {
61
-      return true;
62
-    }
63
-
64
-    if (event.type() == HandlingEvent.Type.RECEIVE) {
65
-      //Check that the first leg's origin is the event's location
66
-      final Leg leg = legs.get(0);
67
-      return (leg.from().equals(event.location()));
68
-    }
69
-
70
-    if (event.type() == HandlingEvent.Type.LOAD) {
71
-      //Check that the there is one leg with same from location and carrier movement
72
-      for (Leg leg : legs) {
73
-        if (leg.from().equals(event.location())
74
-          && leg.carrierMovement().equals(event.carrierMovement()))
75
-          return true;
76
-      }
77
-      return false;
78
-    }
79
-
80
-    if (event.type() == HandlingEvent.Type.UNLOAD) {
81
-      //Check that the there is one leg with same to loc and carrier movement
82
-      for (Leg leg : legs) {
83
-        if (leg.to().equals(event.location())
84
-          && leg.carrierMovement().equals(event.carrierMovement()))
85
-          return true;
86
-      }
87
-      return false;
88
-    }
89
-
90
-    if (event.type() == HandlingEvent.Type.CLAIM) {
91
-      //Check that the last leg's destination is from the event's location
92
-      final Leg leg = legs.get(legs.size() - 1);
93
-      return (leg.to().equals(event.location()));
94
-    }
95
-
96
-    //HandlingEvent.Type.CUSTOMS;
97
-    return true;
98
-  }
99
-
100
-  /**
101
-   * @param other itinerary to compare
102
-   * @return <code>true</code> if the legs in this and the other itinerary are all equal.
103
-   */
104
-  public boolean sameValueAs(final Itinerary other) {
105
-    return other != null && legs.equals(other.legs);
106
-  }
107
-
108
-  @Override
109
-  public boolean equals(final Object o) {
110
-    if (this == o) return true;
111
-    if (o == null || getClass() != o.getClass()) return false;
112
-
113
-    final Itinerary itinerary = (Itinerary) o;
114
-
115
-    return sameValueAs(itinerary);
116
-  }
117
-
118
-  @Override
119
-  public int hashCode() {
120
-    return legs.hashCode();
121
-  }
122
-
123
-  Itinerary() {
124
-    // Needed by Hibernate
125
-  }
126
-
127
-  // Auto-generated surrogate key
128
-  private Long id;
129
-
130
-}

+ 0
- 80
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Leg.java Zobrazit soubor

@@ -1,80 +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.ValueObject;
7
-import se.citerus.dddsample.domain.model.carrier.CarrierMovement;
8
-import se.citerus.dddsample.domain.model.location.Location;
9
-
10
-/**
11
- * An itinerary consists of one or more legs.
12
- */
13
-public final class Leg implements ValueObject<Leg> {
14
-
15
-  private CarrierMovement carrierMovement;
16
-  private Location from;
17
-  private Location to;
18
-
19
-  /**
20
-   * Constructor.
21
-   *
22
-   * @param carrierMovement
23
-   * @param from
24
-   * @param to
25
-   */
26
-  public Leg(final CarrierMovement carrierMovement, final Location from, final Location to) {
27
-    Validate.noNullElements(new Object[]{carrierMovement, from, to});
28
-    this.carrierMovement = carrierMovement;
29
-    this.from = from;
30
-    this.to = to;
31
-  }
32
-
33
-  public Location from() {
34
-    return from;
35
-  }
36
-
37
-  public Location to() {
38
-    return to;
39
-  }
40
-
41
-  public CarrierMovement carrierMovement() {
42
-    return carrierMovement;
43
-  }
44
-
45
-
46
-  public boolean sameValueAs(final Leg other) {
47
-    return other != null && new EqualsBuilder().
48
-      append(this.carrierMovement, other.carrierMovement).
49
-      append(this.from, other.from).
50
-      append(this.to, other.to).
51
-      isEquals();
52
-  }
53
-
54
-  @Override
55
-  public boolean equals(final Object o) {
56
-    if (this == o) return true;
57
-    if (o == null || getClass() != o.getClass()) return false;
58
-
59
-    Leg leg = (Leg) o;
60
-
61
-    return sameValueAs(leg);
62
-  }
63
-
64
-  @Override
65
-  public int hashCode() {
66
-    return new HashCodeBuilder().
67
-      append(carrierMovement).
68
-      append(from).
69
-      append(to).
70
-      toHashCode();
71
-  }
72
-
73
-  Leg() {
74
-    // Needed by Hibernate
75
-  }
76
-
77
-  // Auto-generated surrogate key
78
-  private Long id;
79
-
80
-}

+ 0
- 99
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/RouteSpecification.java Zobrazit soubor

@@ -1,99 +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.Specification;
7
-import se.citerus.dddsample.domain.model.ValueObject;
8
-import se.citerus.dddsample.domain.model.location.Location;
9
-
10
-import java.util.Date;
11
-
12
-/**
13
- * Route specification.
14
- * 
15
- */
16
-public class RouteSpecification implements ValueObject<RouteSpecification>, Specification<Itinerary> {
17
-  private Location origin;
18
-  private Location destination;
19
-  private Date arrivalDeadline;
20
-
21
-  /**
22
-   * Factory for creatig a route specification for a cargo, from cargo
23
-   * origin to cargo destination. Use for initial routing.
24
-   *
25
-   * @param cargo cargo
26
-   * @param arrivalDeadline arrival deadline
27
-   * @return A route specification for this cargo and arrival deadline
28
-   */
29
-  public static RouteSpecification forCargo(Cargo cargo, Date arrivalDeadline) {
30
-    Validate.notNull(cargo);
31
-    Validate.notNull(arrivalDeadline);
32
-
33
-    return new RouteSpecification(cargo.origin(), cargo.destination(), arrivalDeadline);
34
-  }
35
-
36
-  /**
37
-   * Factory for creating a route specfication from an explicit destination,
38
-   * for rerouting a cargo.
39
-   *
40
-   * @param from
41
-   * @param cargo
42
-   * @param arrivalDeadline
43
-   * @return
44
-   */
45
-  public static RouteSpecification forReroutedCargo(Location from, Cargo cargo, Date arrivalDeadline) {
46
-    Validate.notNull(from);
47
-    Validate.notNull(cargo);
48
-    Validate.notNull(arrivalDeadline);
49
-
50
-    return new RouteSpecification(from, cargo.destination(), arrivalDeadline);
51
-  }
52
-
53
-  private RouteSpecification(Location origin, Location destination, Date arrivalDeadline) {
54
-    this.origin = origin;
55
-    this.destination = destination;
56
-    this.arrivalDeadline = arrivalDeadline;
57
-  }
58
-
59
-  public Location origin() {
60
-    return origin;
61
-  }
62
-
63
-  public Location destination() {
64
-    return destination;
65
-  }
66
-
67
-  public boolean isSatisfiedBy(Itinerary itinerary) {
68
-    // TODO implement
69
-    return true;
70
-  }
71
-
72
-  public boolean sameValueAs(RouteSpecification other) {
73
-    return other != null && new EqualsBuilder().
74
-      append(this.origin, other.origin).
75
-      append(this.destination, other.destination).
76
-      append(this.arrivalDeadline, other.arrivalDeadline).
77
-      isEquals();
78
-  }
79
-
80
-  @Override
81
-  public boolean equals(Object o) {
82
-    if (this == o) return true;
83
-    if (o == null || getClass() != o.getClass()) return false;
84
-
85
-    RouteSpecification that = (RouteSpecification) o;
86
-
87
-    return sameValueAs(that);
88
-  }
89
-
90
-  @Override
91
-  public int hashCode() {
92
-    return new HashCodeBuilder().
93
-      append(this.origin).
94
-      append(this.destination).
95
-      append(this.arrivalDeadline).
96
-      toHashCode();
97
-  }
98
-  
99
-}

+ 0
- 8
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/StatusCode.java Zobrazit soubor

@@ -1,8 +0,0 @@
1
-package se.citerus.dddsample.domain.model.cargo;
2
-
3
-/**
4
- * Represents the different status codes for a cargo.
5
- */
6
-public enum StatusCode {
7
-  NOT_RECEIVED, IN_PORT, ONBOARD_CARRIER, CLAIMED, UNKNOWN
8
-}

+ 0
- 53
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/TrackingId.java Zobrazit soubor

@@ -1,53 +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.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
-  public boolean sameValueAs(TrackingId other) {
47
-    return other != null && this.id.equals(other.id);
48
-  }
49
-
50
-  TrackingId() {
51
-    // Needed by Hibernate
52
-  }
53
-}

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

@@ -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
- 72
dddsample/src/main/java/se/citerus/dddsample/domain/model/carrier/CarrierMovement.java Zobrazit soubor

@@ -1,72 +0,0 @@
1
-package se.citerus.dddsample.domain.model.carrier;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import se.citerus.dddsample.domain.model.Entity;
5
-import se.citerus.dddsample.domain.model.location.Location;
6
-
7
-
8
-/**
9
- * A carrier movement is a vessel voyage from one location to another.
10
- */
11
-public final class CarrierMovement implements Entity<CarrierMovement> {
12
-
13
-  private CarrierMovementId carrierMovementId;
14
-  private Location from;
15
-  private Location to;
16
-
17
-  /**
18
-   * Constructor.
19
-   *
20
-   * @param carrierMovementId
21
-   * @param from
22
-   * @param to
23
-   */
24
-  public CarrierMovement(final CarrierMovementId carrierMovementId, final Location from, final Location to) {
25
-    Validate.noNullElements(new Object[]{carrierMovementId, from, to});
26
-    this.carrierMovementId = carrierMovementId;
27
-    this.from = from;
28
-    this.to = to;
29
-  }
30
-
31
-  public CarrierMovementId carrierMovementId() {
32
-    return carrierMovementId;
33
-  }
34
-
35
-  public Location from() {
36
-    return from;
37
-  }
38
-
39
-  public Location to() {
40
-    return to;
41
-  }
42
-
43
-  public boolean sameIdentityAs(final CarrierMovement other) {
44
-    return carrierMovementId.sameValueAs(other.carrierMovementId);
45
-  }
46
-
47
-  @Override
48
-  public boolean equals(final Object o) {
49
-    if (this == o) return true;
50
-    if (o == null || getClass() != o.getClass()) return false;
51
-
52
-    final CarrierMovement that = (CarrierMovement) o;
53
-
54
-    return sameIdentityAs(that);
55
-  }
56
-
57
-  /**
58
-   * @return Hashcode of carrier movement id.
59
-   */
60
-  @Override
61
-  public int hashCode() {
62
-    return carrierMovementId.hashCode();
63
-  }
64
-
65
-  CarrierMovement() {
66
-    // Needed by Hibernate
67
-  }
68
-
69
-  // Auto-generated surrogate key
70
-  private Long id;
71
-
72
-}

+ 0
- 55
dddsample/src/main/java/se/citerus/dddsample/domain/model/carrier/CarrierMovementId.java Zobrazit soubor

@@ -1,55 +0,0 @@
1
-package se.citerus.dddsample.domain.model.carrier;
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.ValueObject;
7
-
8
-/**
9
- * Identifies a particular carrier movement, such as a flight number.
10
- */
11
-public final class CarrierMovementId implements ValueObject<CarrierMovementId> {
12
-
13
-  private String id;
14
-
15
-  /**
16
-   * Constructor.
17
-   *
18
-   * @param id Id string.
19
-   */
20
-  public CarrierMovementId(final String id) {
21
-    Validate.notNull(id);
22
-    this.id = id;
23
-  }
24
-
25
-  /**
26
-   * @return String representation of this carrier movement id.
27
-   */
28
-  public String idString() {
29
-    return id;
30
-  }
31
-
32
-  public boolean sameValueAs(CarrierMovementId other) {
33
-    return other != null && this.id.equals(other.id);
34
-  }
35
-
36
-  @Override
37
-  public boolean equals(final Object obj) {
38
-    return EqualsBuilder.reflectionEquals(this, obj);
39
-  }
40
-
41
-  @Override
42
-  public int hashCode() {
43
-    return HashCodeBuilder.reflectionHashCode(this);
44
-  }
45
-
46
-  @Override
47
-  public String toString() {
48
-    return idString();
49
-  }
50
-
51
-  CarrierMovementId() {
52
-    // Needed by hibernate
53
-   }
54
-  
55
-}

+ 0
- 13
dddsample/src/main/java/se/citerus/dddsample/domain/model/carrier/CarrierMovementRepository.java Zobrazit soubor

@@ -1,13 +0,0 @@
1
-package se.citerus.dddsample.domain.model.carrier;
2
-
3
-public interface CarrierMovementRepository {
4
-
5
-  /**
6
-   * Finds a carrier movement using given id.
7
-   *
8
-   * @param carrierMovementId Id
9
-   * @return The carrier movement.
10
-   */
11
-  CarrierMovement find(CarrierMovementId carrierMovementId);
12
-
13
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/domain/model/carrier/package.html Zobrazit soubor

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

+ 0
- 183
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingEvent.java Zobrazit soubor

@@ -1,183 +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.DomainEvent;
7
-import se.citerus.dddsample.domain.model.cargo.Cargo;
8
-import se.citerus.dddsample.domain.model.carrier.CarrierMovement;
9
-import se.citerus.dddsample.domain.model.location.Location;
10
-
11
-import java.util.Comparator;
12
-import java.util.Date;
13
-
14
-/**
15
- * A HandlingEvent is used to register the event when, for instance,
16
- * a cargo is unloaded from a carrier at a some loacation at a given time.
17
- * <p/>
18
- * The HandlingEvent's are sent from different Incident Logging Applications
19
- * some time after the event occured and contain information about the
20
- * {@link se.citerus.dddsample.domain.model.cargo.TrackingId}, {@link se.citerus.dddsample.domain.model.location.Location}, timestamp of the completion of the event,
21
- * and possibly, if applicable a {@link se.citerus.dddsample.domain.model.carrier.CarrierMovement}.
22
- * <p/>
23
- * This class is the only member, and consequently the root, of the HandlingEvent aggregate. 
24
- * <p/>
25
- * HandlingEvent's could contain information about a {@link CarrierMovement} and if so,
26
- * the event type must be either {@link Type#LOAD} or {@link Type#UNLOAD}.
27
- * <p/>
28
- * All other events must be of {@link Type#RECEIVE}, {@link Type#CLAIM} or {@link Type#CUSTOMS}.
29
- */
30
-public final class HandlingEvent implements DomainEvent<HandlingEvent> {
31
-
32
-  /**
33
-   * Comparator used to be able to sort HandlingEvents according to their completion time
34
-   */
35
-  public static final Comparator<HandlingEvent> BY_COMPLETION_TIME_COMPARATOR = new Comparator<HandlingEvent>() {
36
-    public int compare(final HandlingEvent o1, final HandlingEvent o2) {
37
-      return o1.completionTime().compareTo(o2.completionTime());
38
-    }
39
-  };
40
-
41
-  private Type type;
42
-  private CarrierMovement carrierMovement;
43
-  private Location location;
44
-  private Date completionTime;
45
-  private Date registrationTime;
46
-  private Cargo cargo;
47
-
48
-  /**
49
-   * Handling event type. Either requires or prohibits a carrier movement
50
-   * association, it's never optional.
51
-   */
52
-  public enum Type {
53
-    LOAD(true),
54
-    UNLOAD(true),
55
-    RECEIVE(false),
56
-    CLAIM(false),
57
-    CUSTOMS(false);
58
-
59
-    private boolean carrierMovementRequired;
60
-
61
-    /**
62
-     * Private enum constructor.
63
-     *
64
-     * @param carrierMovementRequired whether or not a carrier movement is associated with this event type
65
-     */
66
-    private Type(final boolean carrierMovementRequired) {
67
-      this.carrierMovementRequired = carrierMovementRequired;
68
-    }
69
-
70
-    /**
71
-     * @return True if a carrier movement association is required for this event type.
72
-     */
73
-    public boolean requiresCarrierMovement() {
74
-      return carrierMovementRequired;
75
-    }
76
-
77
-    /**
78
-     * @return True if a carrier movement association is prohibited for this event type.
79
-     */
80
-    public boolean prohibitsCarrierMovement() {
81
-      return !requiresCarrierMovement();
82
-    }
83
-  }
84
-
85
-  /**
86
-   * @param cargo            cargo
87
-   * @param completionTime   completion time, the reported time that the event actually happened (e.g. the receive took place).
88
-   * @param registrationTime registration time, the time the message is received
89
-   * @param type             type of event. Legal values are LOAD and UNLOAD
90
-   * @param location         where the event took place
91
-   * @param carrierMovement  carrier movement.
92
-   */
93
-  public HandlingEvent(final Cargo cargo, final Date completionTime, final Date registrationTime, final Type type,
94
-                       final Location location, final CarrierMovement carrierMovement) {
95
-    Validate.noNullElements(new Object[]{cargo, completionTime, registrationTime, type, location});
96
-    this.registrationTime = registrationTime;
97
-    this.completionTime = completionTime;
98
-    this.type = type;
99
-    this.cargo = cargo;
100
-    this.location = location;
101
-    this.carrierMovement = carrierMovement;
102
-
103
-    validateType();
104
-  }
105
-
106
-  public Type type() {
107
-    return this.type;
108
-  }
109
-
110
-  public CarrierMovement carrierMovement() {
111
-    return this.carrierMovement;
112
-  }
113
-
114
-  public Date completionTime() {
115
-    return this.completionTime;
116
-  }
117
-
118
-  public Date registrationTime() {
119
-    return this.registrationTime;
120
-  }
121
-
122
-  public Location location() {
123
-    return this.location;
124
-  }
125
-
126
-  public Cargo cargo() {
127
-    return this.cargo;
128
-  }
129
-
130
-  @Override
131
-  public boolean equals(final Object o) {
132
-    if (this == o) return true;
133
-    if (o == null || getClass() != o.getClass()) return false;
134
-
135
-    final HandlingEvent event = (HandlingEvent) o;
136
-
137
-    return sameEventAs(event);
138
-  }
139
-
140
-  public boolean sameEventAs(final HandlingEvent other) {
141
-    return other != null && new EqualsBuilder().
142
-      append(this.cargo, other.cargo).
143
-      append(this.carrierMovement, other.carrierMovement).
144
-      append(this.completionTime, other.completionTime).
145
-      append(this.location, other.location).
146
-      append(this.type, other.type).
147
-      isEquals();
148
-  }
149
-
150
-  @Override
151
-  public int hashCode() {
152
-    return new HashCodeBuilder().
153
-      append(cargo).
154
-      append(carrierMovement).
155
-      append(completionTime).
156
-      append(location).
157
-      append(type).
158
-      toHashCode();
159
-  }
160
-
161
-  /**
162
-   * Validate that the event type is compatible with the carrier movement value.
163
-   * <p/>
164
-   * Only certain types of events may be associated with a carrier movement.
165
-   */
166
-  private void validateType() {
167
-    if (type.requiresCarrierMovement() && carrierMovement == null) {
168
-      throw new IllegalArgumentException("Carrier movement is required for event type " + type);
169
-    }
170
-    if (type.prohibitsCarrierMovement() && carrierMovement != null) {
171
-      throw new IllegalArgumentException("Carrier movement is not allowed with event type " + type);
172
-    }
173
-  }
174
-
175
-  // Needed by Hibernate
176
-  HandlingEvent() {
177
-  }
178
-
179
-
180
-  // Auto-generated surrogate key
181
-  private Long id;
182
-
183
-}

+ 0
- 26
dddsample/src/main/java/se/citerus/dddsample/domain/model/handling/HandlingEventRepository.java Zobrazit soubor

@@ -1,26 +0,0 @@
1
-package se.citerus.dddsample.domain.model.handling;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
4
-
5
-import java.util.List;
6
-
7
-/**
8
- * Handling event repository.
9
- */
10
-public interface HandlingEventRepository {
11
-
12
-  /**
13
-   * Saves a (new) handling event.
14
-   *
15
-   * @param event handling event to save
16
-   */
17
-  void save(final HandlingEvent event);
18
-
19
-
20
-  // TODO: remove this in 1.0 branch, it's not used anywhere
21
-  /**
22
-   * @param trackingId cargo tracking id
23
-   * @return All handling events for this cargo, ordered by completion time.
24
-   */
25
-  List<HandlingEvent> findEventsForCargo(final TrackingId trackingId);
26
-}

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

@@ -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
- 99
dddsample/src/main/java/se/citerus/dddsample/domain/model/location/Location.java Zobrazit soubor

@@ -1,99 +0,0 @@
1
-package se.citerus.dddsample.domain.model.location;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import se.citerus.dddsample.domain.model.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(new UnLocode("XXXXX"), "Unknown location");
22
-
23
-  /**
24
-   * Package-level constructor, visible for test only.
25
-   *
26
-   * @param unLocode UN Locode
27
-   * @param name     location name
28
-   * @throws IllegalArgumentException if the UN Locode or name is null
29
-   */
30
-  Location(final UnLocode unLocode, final String name) {
31
-    Validate.notNull(unLocode);
32
-    Validate.notNull(name);
33
-    
34
-    this.unLocode = unLocode;
35
-    this.name = name;
36
-  }
37
-
38
-  /**
39
-   * @return UN Locode for this location.
40
-   */
41
-  public UnLocode unLocode() {
42
-    return unLocode;
43
-  }
44
-
45
-  /**
46
-   * @return Actual name of this location, e.g. "Stockholm".
47
-   */
48
-  public String name() {
49
-    return name;
50
-  }
51
-
52
-  /**
53
-   * @param object to compare
54
-   * @return Since this is an entiy this will be true iff UN locodes are equal.
55
-   */
56
-  @Override
57
-  public boolean equals(final Object object) {
58
-    if (object == null) {
59
-      return false;
60
-    }
61
-    if (this == UNKNOWN || object == UNKNOWN) {
62
-      return this == object;
63
-    }
64
-    if (!(object instanceof Location)) {
65
-      return false;
66
-    }
67
-    Location other = (Location) object;
68
-    return sameIdentityAs(other);
69
-  }
70
-
71
-  public boolean sameIdentityAs(final Location other) {
72
-    return this.unLocode.sameValueAs(other.unLocode);
73
-  }
74
-
75
-  /**
76
-   * @return Hash code of UN locode.
77
-   */
78
-  @Override
79
-  public int hashCode() {
80
-    return unLocode.hashCode();
81
-  }
82
-
83
-  /**
84
-   * @return Unlocode and name, on the format "SESTO (Stockholm)"
85
-   */
86
-  @Override
87
-  public String toString() {
88
-    // TODO: this feels like presentation logic and is very inconsistent, move to DTO assembler
89
-    return unLocode.idString() + " (" + name + ")";
90
-  }
91
-
92
-
93
-  Location() {
94
-    // Needed by Hibernate
95
-  }
96
-
97
-  private Long id;
98
-
99
-}

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

@@ -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
- 71
dddsample/src/main/java/se/citerus/dddsample/domain/model/location/UnLocode.java Zobrazit soubor

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

@@ -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
- 8
dddsample/src/main/java/se/citerus/dddsample/domain/model/package.html Zobrazit soubor

@@ -1,8 +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.
6
-</p>
7
-</body>
8
-</html>

+ 0
- 14
dddsample/src/main/java/se/citerus/dddsample/domain/package.html Zobrazit soubor

@@ -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
- 39
dddsample/src/main/java/se/citerus/dddsample/domain/service/BookingService.java Zobrazit soubor

@@ -1,39 +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.TrackingId;
5
-import se.citerus.dddsample.domain.model.location.UnLocode;
6
-
7
-import java.util.List;
8
-
9
-/**
10
- * Cargo booking service.
11
- */
12
-public interface BookingService {
13
-
14
-  /**
15
-   * Registers a new cargo in the tracking system, not yet routed.
16
-   *
17
-   * @param origin      cargo origin
18
-   * @param destination cargo destination
19
-   * @return Cargo tracking id
20
-   */
21
-  TrackingId bookNewCargo(UnLocode origin, UnLocode destination);
22
-
23
-  /**
24
-   * Requests a list of itineraries describing possible routes for this cargo.
25
-   * 
26
-   * @param trackingId cargo tracking id
27
-   * @return A list of possible itineraries for this cargo 
28
-   */
29
-  List<Itinerary> requestPossibleRoutesForCargo(TrackingId trackingId);
30
-
31
-  /**
32
-   * Assigns a cargo to route.
33
-   *
34
-   * @param trackingId cargo tracking id
35
-   * @param itinerary  the new itinerary describing the route
36
-   */
37
-  void assignCargoToRoute(TrackingId trackingId, Itinerary itinerary);
38
-
39
-}

+ 0
- 22
dddsample/src/main/java/se/citerus/dddsample/domain/service/DomainEventNotifier.java Zobrazit soubor

@@ -1,22 +0,0 @@
1
-package se.citerus.dddsample.domain.service;
2
-
3
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
4
-
5
-/**
6
- * This interface provides a way to let other parts
7
- * of the system know about domain events that have occurred.
8
- * <p/>
9
- * All method signatures are expressed in the ubiquitous language.    
10
- * <p/>
11
- * It may be implemented synchronously or asynchronously, using
12
- * for example JMS.
13
- */
14
-public interface DomainEventNotifier {
15
-
16
-  /**
17
-   * A cargo has been handled.
18
-   *
19
-   * @param event handling event
20
-   */
21
-  void cargoWasHandled(HandlingEvent event);
22
-}

+ 0
- 30
dddsample/src/main/java/se/citerus/dddsample/domain/service/HandlingEventService.java Zobrazit soubor

@@ -1,30 +0,0 @@
1
-package se.citerus.dddsample.domain.service;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
4
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementId;
5
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
6
-import se.citerus.dddsample.domain.model.location.UnLocode;
7
-
8
-import java.util.Date;
9
-
10
-
11
-/**
12
- * Handling event service.
13
- */
14
-public interface HandlingEventService {
15
-
16
-  /**
17
-   * @param completionTime    when the event was completed, for example finished loading
18
-   * @param trackingId        tracking id
19
-   * @param carrierMovementId carrier movement id, if applicable (may be null)
20
-   * @param unlocode          United Nations Location Code for the location of the event
21
-   * @param type              type of event
22
-   * @throws UnknownCarrierMovementIdException
23
-   *                                    if there's not carrier movement with this id
24
-   * @throws UnknownTrackingIdException if there's no cargo with this tracking id
25
-   * @throws UnknownLocationException   if there's no location with this UN Locode
26
-   */
27
-  void register(Date completionTime, TrackingId trackingId, CarrierMovementId carrierMovementId, UnLocode unlocode, HandlingEvent.Type type)
28
-  throws UnknownCarrierMovementIdException, UnknownTrackingIdException, UnknownLocationException;
29
-
30
-}

+ 0
- 20
dddsample/src/main/java/se/citerus/dddsample/domain/service/RoutingService.java Zobrazit soubor

@@ -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
- 29
dddsample/src/main/java/se/citerus/dddsample/domain/service/TrackingService.java Zobrazit soubor

@@ -1,29 +0,0 @@
1
-package se.citerus.dddsample.domain.service;
2
-
3
-import se.citerus.dddsample.domain.model.cargo.Cargo;
4
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
5
-
6
-/**
7
- * Cargo tracking service.
8
- *
9
- */
10
-public interface TrackingService {
11
-
12
-  /**
13
-   * Track a particular cargo.
14
-   *
15
-   * @param trackingId cargo tracking id
16
-   * @return A cargo and its delivery history, or null if no cargo with given tracking id is found.
17
-   */
18
-  Cargo track(TrackingId trackingId);
19
-
20
-  /**
21
-   * Inspect cargo and send relevant notifications to interested parties,
22
-   * for example if a cargo has been misdirected, or unloaded
23
-   * at the final destination.
24
-   *
25
-   * @param trackingId cargo tracking id
26
-   */
27
-  void inspectCargo(TrackingId trackingId);
28
-
29
-}

+ 0
- 20
dddsample/src/main/java/se/citerus/dddsample/domain/service/UnknownCarrierMovementIdException.java Zobrazit soubor

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

+ 0
- 17
dddsample/src/main/java/se/citerus/dddsample/domain/service/UnknownLocationException.java Zobrazit soubor

@@ -1,17 +0,0 @@
1
-package se.citerus.dddsample.domain.service;
2
-
3
-import se.citerus.dddsample.domain.model.location.UnLocode;
4
-
5
-public class UnknownLocationException extends Exception {
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/service/UnknownTrackingIdException.java Zobrazit soubor

@@ -1,20 +0,0 @@
1
-package se.citerus.dddsample.domain.service;
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 UnknownTrackingIdException extends Exception {
9
-
10
-  private final TrackingId trackingId;
11
-
12
-  public UnknownTrackingIdException(final TrackingId trackingId) {
13
-    this.trackingId = trackingId;
14
-  }
15
-
16
-  @Override
17
-  public String getMessage() {
18
-    return "No cargo with tracking id " + trackingId.idString() + " exists in the system";
19
-  }
20
-}

+ 0
- 78
dddsample/src/main/java/se/citerus/dddsample/domain/service/impl/BookingServiceImpl.java Zobrazit soubor

@@ -1,78 +0,0 @@
1
-package se.citerus.dddsample.domain.service.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.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.BookingService;
12
-import se.citerus.dddsample.domain.service.RoutingService;
13
-
14
-import java.util.Date;
15
-import java.util.List;
16
-
17
-public final class BookingServiceImpl implements BookingService {
18
-
19
-  private CargoRepository cargoRepository;
20
-  private LocationRepository locationRepository;
21
-  private RoutingService routingService;
22
-
23
-  private final Log logger = LogFactory.getLog(getClass());
24
-
25
-  @Transactional(readOnly = false)
26
-  public TrackingId bookNewCargo(final UnLocode originUnLocode, final UnLocode destinationUnLocode) {
27
-    Validate.notNull(originUnLocode);
28
-    Validate.notNull(destinationUnLocode);
29
-
30
-    final TrackingId trackingId = cargoRepository.nextTrackingId();
31
-    final Location origin = locationRepository.find(originUnLocode);
32
-    final Location destination = locationRepository.find(destinationUnLocode);
33
-    Cargo cargo = new Cargo(trackingId, origin, destination);
34
-
35
-    cargoRepository.save(cargo);
36
-    logger.info("Registered new cargo with tracking id " + cargo.trackingId().idString());
37
-
38
-    return cargo.trackingId();
39
-  }
40
-
41
-  @Transactional(readOnly = true)
42
-  public List<Itinerary> requestPossibleRoutesForCargo(TrackingId trackingId) {
43
-    Validate.notNull(trackingId);
44
-    
45
-    final Cargo cargo = cargoRepository.find(trackingId);
46
-    final RouteSpecification routeSpecification = RouteSpecification.forCargo(cargo, new Date());
47
-
48
-    return routingService.fetchRoutesForSpecification(routeSpecification);
49
-  }
50
-
51
-  @Transactional(readOnly = false)
52
-  public void assignCargoToRoute(final TrackingId trackingId, final Itinerary newItinerary) {
53
-    Validate.notNull(trackingId);
54
-    Validate.notNull(newItinerary);
55
-
56
-    final Cargo cargo = cargoRepository.find(trackingId);
57
-    if (cargo == null) {
58
-      throw new IllegalArgumentException("Can't assign itinerary to non-existing cargo " + trackingId);
59
-    }
60
-
61
-    cargo.attachItinerary(newItinerary);
62
-    cargoRepository.save(cargo);
63
-
64
-    logger.info("Assigned cargo " + trackingId + " to new route");
65
-  }
66
-
67
-  public void setCargoRepository(final CargoRepository cargoRepository) {
68
-    this.cargoRepository = cargoRepository;
69
-  }
70
-
71
-  public void setLocationRepository(final LocationRepository locationRepository) {
72
-    this.locationRepository = locationRepository;
73
-  }
74
-
75
-  public void setRoutingService(RoutingService routingService) {
76
-    this.routingService = routingService;
77
-  }
78
-}

+ 0
- 106
dddsample/src/main/java/se/citerus/dddsample/domain/service/impl/HandlingEventServiceImpl.java Zobrazit soubor

@@ -1,106 +0,0 @@
1
-package se.citerus.dddsample.domain.service.impl;
2
-
3
-import org.apache.commons.lang.Validate;
4
-import org.springframework.transaction.annotation.Transactional;
5
-import se.citerus.dddsample.domain.model.cargo.Cargo;
6
-import se.citerus.dddsample.domain.model.cargo.CargoRepository;
7
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
8
-import se.citerus.dddsample.domain.model.carrier.CarrierMovement;
9
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementId;
10
-import se.citerus.dddsample.domain.model.carrier.CarrierMovementRepository;
11
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
12
-import se.citerus.dddsample.domain.model.handling.HandlingEventRepository;
13
-import se.citerus.dddsample.domain.model.location.Location;
14
-import se.citerus.dddsample.domain.model.location.LocationRepository;
15
-import se.citerus.dddsample.domain.model.location.UnLocode;
16
-import se.citerus.dddsample.domain.service.*;
17
-
18
-import java.util.Date;
19
-
20
-public final class HandlingEventServiceImpl implements HandlingEventService {
21
-  private CargoRepository cargoRepository;
22
-  private CarrierMovementRepository carrierMovementRepository;
23
-  private HandlingEventRepository handlingEventRepository;
24
-  private LocationRepository locationRepository;
25
-  private DomainEventNotifier domainEventNotifier;
26
-
27
-  @Transactional(readOnly = false)
28
-  public void register(final Date completionTime, final TrackingId trackingId, final CarrierMovementId carrierMovementId,
29
-                       final UnLocode unlocode, final HandlingEvent.Type type)
30
-    throws UnknownCarrierMovementIdException, UnknownTrackingIdException, UnknownLocationException {
31
-
32
-    // Carrier movement may be null for certain event types
33
-    Validate.noNullElements(new Object[]{trackingId, unlocode, type});
34
-
35
-    Cargo cargo = cargoRepository.find(trackingId);
36
-    if (cargo == null) throw new UnknownTrackingIdException(trackingId);
37
-
38
-    final CarrierMovement carrierMovement = findCarrierMovement(carrierMovementId);
39
-    final Location location = findLocation(unlocode);
40
-    final Date registrationTime = new Date();
41
-
42
-    final HandlingEvent event = new HandlingEvent(cargo, completionTime, registrationTime, type, location, carrierMovement);
43
-
44
-    /*
45
-      NOTE:
46
-        The cargo instance that's loaded and associated with the handling event is
47
-        in an inconsitent state, because the cargo delivery history's collection of
48
-        events does not contain the event created here. However, this is not a problem,
49
-        because cargo is in a different aggregate from handling event.
50
-
51
-        The rules of an aggregate dictate that all consistency rules within the aggregate
52
-        are enforced synchronously in the transaction, but consistency rules of other aggregates
53
-        are enforced by asynchronous updates, after the commit of this transaction.
54
-     */
55
-    handlingEventRepository.save(event);
56
-
57
-    domainEventNotifier.cargoWasHandled(event);
58
-  }
59
-
60
-  private CarrierMovement findCarrierMovement(final CarrierMovementId carrierMovementId)
61
-    throws UnknownCarrierMovementIdException {
62
-
63
-    if (carrierMovementId == null) {
64
-      return null;
65
-    }
66
-    final CarrierMovement carrierMovement = carrierMovementRepository.find(carrierMovementId);
67
-    if (carrierMovement == null) {
68
-      throw new UnknownCarrierMovementIdException(carrierMovementId);
69
-    }
70
-
71
-    return carrierMovement;
72
-  }
73
-
74
-  private Location findLocation(final UnLocode unlocode) throws UnknownLocationException {
75
-    if (unlocode == null) {
76
-      return Location.UNKNOWN;
77
-    }
78
-
79
-    final Location location = locationRepository.find(unlocode);
80
-    if (location == null) {
81
-      throw new UnknownLocationException(unlocode);
82
-    }
83
-
84
-    return location;
85
-  }
86
-
87
-  public void setCargoRepository(final CargoRepository cargoRepository) {
88
-    this.cargoRepository = cargoRepository;
89
-  }
90
-
91
-  public void setCarrierMovementRepository(final CarrierMovementRepository carrierMovementRepository) {
92
-    this.carrierMovementRepository = carrierMovementRepository;
93
-  }
94
-
95
-  public void setHandlingEventRepository(final HandlingEventRepository handlingEventRepository) {
96
-    this.handlingEventRepository = handlingEventRepository;
97
-  }
98
-
99
-  public void setLocationRepository(final LocationRepository locationRepository) {
100
-    this.locationRepository = locationRepository;
101
-  }
102
-
103
-  public void setDomainEventNotifier(DomainEventNotifier domainEventNotifier) {
104
-    this.domainEventNotifier = domainEventNotifier;
105
-  }
106
-}

+ 0
- 58
dddsample/src/main/java/se/citerus/dddsample/domain/service/impl/TrackingServiceImpl.java Zobrazit soubor

@@ -1,58 +0,0 @@
1
-package se.citerus.dddsample.domain.service.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.domain.model.cargo.Cargo;
8
-import se.citerus.dddsample.domain.model.cargo.CargoRepository;
9
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
10
-import se.citerus.dddsample.domain.service.TrackingService;
11
-
12
-public class TrackingServiceImpl implements TrackingService {
13
-
14
-  private CargoRepository cargoRepository;
15
-
16
-  private final Log logger = LogFactory.getLog(getClass());
17
-
18
-  @Transactional(readOnly = true)
19
-  public Cargo track(final TrackingId trackingId) {
20
-    Validate.notNull(trackingId);
21
-
22
-    return cargoRepository.find(trackingId);
23
-  }
24
-
25
-  @Transactional(readOnly = true)
26
-  public void inspectCargo(final TrackingId trackingId) {
27
-    Validate.notNull(trackingId);
28
-
29
-    final Cargo cargo = cargoRepository.find(trackingId);
30
-    if (cargo == null) {
31
-      logger.warn("Can't notify listeners for non-existing cargo " + trackingId);
32
-      return;
33
-    }
34
-
35
-    if (cargo.isMisdirected()) {
36
-      handleMisdirectedCargo(cargo);
37
-    }
38
-    if (cargo.isUnloadedAtDestination()) {
39
-      notifyCustomerOfAvailability(cargo);
40
-    }
41
-  }
42
-
43
-  private void notifyCustomerOfAvailability(Cargo cargo) {
44
-    // TODO: more elaborate notifications
45
-    logger.info("Cargo " + cargo.trackingId() + " has been unloaded " +
46
-      "at its final destination " + cargo.destination());
47
-  }
48
-
49
-  private void handleMisdirectedCargo(Cargo cargo) {
50
-    logger.info("Cargo " + cargo.trackingId() + " has been misdirected. " +
51
-      "Last event was " + cargo.deliveryHistory().lastEvent());
52
-  }
53
-
54
-  public void setCargoRepository(CargoRepository cargoRepository) {
55
-    this.cargoRepository = cargoRepository;
56
-  }
57
-
58
-}

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

@@ -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
- 106
dddsample/src/main/java/se/citerus/dddsample/ui/CargoAdminController.java Zobrazit soubor

@@ -1,106 +0,0 @@
1
-package se.citerus.dddsample.ui;
2
-
3
-import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
4
-import se.citerus.dddsample.application.remoting.BookingServiceFacade;
5
-import se.citerus.dddsample.application.remoting.dto.CargoRoutingDTO;
6
-import se.citerus.dddsample.application.remoting.dto.ItineraryCandidateDTO;
7
-import se.citerus.dddsample.application.remoting.dto.LegDTO;
8
-import se.citerus.dddsample.application.remoting.dto.LocationDTO;
9
-import se.citerus.dddsample.ui.command.RegistrationCommand;
10
-import se.citerus.dddsample.ui.command.RouteAssignmentCommand;
11
-
12
-import javax.servlet.http.HttpServletRequest;
13
-import javax.servlet.http.HttpServletResponse;
14
-import java.util.ArrayList;
15
-import java.util.HashMap;
16
-import java.util.List;
17
-import java.util.Map;
18
-
19
-/**
20
- * Handles cargo booking and routing. Operates against a dedicated remoting service facade,
21
- * and could easily be rewritten as a thick Swing client. Completely separated from the domain layer,
22
- * unlike the tracking user interface.
23
- * <p/>
24
- * In order to successfully keep the domain model shielded from user interface considerations,
25
- * this approach is generally preferred to the one taken in the tracking controller. However,
26
- * there is never any one perfect solution for all situations, so we've chosen to demonstrate
27
- * two polarized ways to build user interfaces.   
28
- *
29
- * @see CargoTrackingController
30
- */
31
-public final class CargoAdminController extends MultiActionController {
32
-
33
-  private BookingServiceFacade bookingServiceFacade;
34
-
35
-  public Map registrationForm(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
36
-    final Map<String, Object> map = new HashMap<String, Object>();
37
-    final List<LocationDTO> dtoList = bookingServiceFacade.listShippingLocations();
38
-
39
-    final List<String> unLocodeStrings = new ArrayList<String>();
40
-
41
-    for (LocationDTO dto : dtoList) {
42
-      unLocodeStrings.add(dto.getUnLocode());
43
-    }
44
-
45
-    map.put("unlocodes", unLocodeStrings);
46
-    return map;
47
-  }
48
-
49
-  public void register(final HttpServletRequest request, final HttpServletResponse response,
50
-                       final RegistrationCommand command) throws Exception {
51
-
52
-    final String trackingId = bookingServiceFacade.registerNewCargo(
53
-      command.getOriginUnlocode(), command.getDestinationUnlocode()
54
-    );
55
-    response.sendRedirect("show.html?trackingId=" + trackingId);
56
-  }
57
-
58
-  public Map list(HttpServletRequest request, HttpServletResponse response) throws Exception {
59
-    final Map<String, Object> map = new HashMap<String, Object>();
60
-    final List<CargoRoutingDTO> cargoList = bookingServiceFacade.listAllCargos();
61
-
62
-    map.put("cargoList", cargoList);
63
-    return map;
64
-  }
65
-
66
-  public Map show(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
67
-    final Map<String, Object> map = new HashMap<String, Object>();
68
-    final String trackingId = request.getParameter("trackingId");
69
-    final CargoRoutingDTO dto = bookingServiceFacade.loadCargoForRouting(trackingId);
70
-    map.put("cargo", dto);
71
-    return map;
72
-  }
73
-
74
-  public Map selectItinerary(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
75
-    final Map<String, Object> map = new HashMap<String, Object>();
76
-    final String trackingId = request.getParameter("trackingId");
77
-    final List<ItineraryCandidateDTO> itineraryCandidates = bookingServiceFacade.requestPossibleRoutesForCargo(trackingId);
78
-
79
-    if (request.getParameter("spec") != null) {
80
-      map.put("itineraryCandidates", itineraryCandidates);
81
-    }
82
-
83
-    final CargoRoutingDTO cargoDTO = bookingServiceFacade.loadCargoForRouting(trackingId);
84
-    map.put("origin", cargoDTO.getOrigin());
85
-    map.put("destination", cargoDTO.getFinalDestination());
86
-    map.put("trackingId", trackingId);
87
-    return map;
88
-  }
89
-
90
-  public void assignItinerary(final HttpServletRequest request, final HttpServletResponse response, RouteAssignmentCommand command) throws Exception {
91
-    final List<LegDTO> legDTOs = new ArrayList<LegDTO>(command.getLegs().size());
92
-    for (RouteAssignmentCommand.LegCommand leg : command.getLegs()) {
93
-      legDTOs.add(new LegDTO(leg.getCarrierMovementId(), leg.getFromUnLocode(), leg.getToUnLocode()));
94
-    }
95
-
96
-    final ItineraryCandidateDTO selectedItinerary = new ItineraryCandidateDTO(legDTOs);
97
-
98
-    bookingServiceFacade.assignCargoToRoute(command.getTrackingId(), selectedItinerary);
99
-
100
-    response.sendRedirect("list.html");
101
-  }
102
-
103
-  public void setBookingServiceFacade(BookingServiceFacade bookingServiceFacade) {
104
-    this.bookingServiceFacade = bookingServiceFacade;
105
-  }
106
-}

+ 0
- 65
dddsample/src/main/java/se/citerus/dddsample/ui/CargoTrackingController.java Zobrazit soubor

@@ -1,65 +0,0 @@
1
-package se.citerus.dddsample.ui;
2
-
3
-import org.springframework.context.MessageSource;
4
-import org.springframework.validation.BindException;
5
-import org.springframework.web.servlet.ModelAndView;
6
-import org.springframework.web.servlet.mvc.SimpleFormController;
7
-import org.springframework.web.servlet.support.RequestContextUtils;
8
-import se.citerus.dddsample.domain.model.cargo.Cargo;
9
-import se.citerus.dddsample.domain.model.cargo.TrackingId;
10
-import se.citerus.dddsample.domain.service.TrackingService;
11
-import se.citerus.dddsample.ui.command.TrackCommand;
12
-
13
-import javax.servlet.http.HttpServletRequest;
14
-import javax.servlet.http.HttpServletResponse;
15
-import java.util.HashMap;
16
-import java.util.Locale;
17
-import java.util.Map;
18
-
19
-/**
20
- * Controller for tracking cargo. This interface sits immediately on top of the
21
- * domain layer, unlike the booking interface which has a a remote facade and supporting
22
- * DTOs in between.
23
- * <p/>
24
- * An adapter class, designed for the tracking use case, is used to wrap the domain model
25
- * to make it easier to work with in a web page rendering context. We do not want to apply
26
- * view rendering constraints to the design of our domain model, and the adapter
27
- * helps us shield the domain model classes. 
28
- * <p/>
29
- *
30
- * @eee se.citerus.dddsample.application.web.CargoTrackingViewAdapter
31
- * @see CargoAdminController
32
- *
33
- */
34
-public final class CargoTrackingController extends SimpleFormController {
35
-
36
-  private TrackingService trackingService;
37
-
38
-  public CargoTrackingController() {
39
-    setCommandClass(TrackCommand.class);
40
-  }
41
-
42
-  @Override
43
-  protected ModelAndView onSubmit(final HttpServletRequest request, final HttpServletResponse response,
44
-                                  final Object command, final BindException errors) throws Exception {
45
-
46
-    final TrackCommand trackCommand = (TrackCommand) command;
47
-    final String trackingIdString = trackCommand.getTrackingId();
48
-    final Cargo cargo = trackingService.track(new TrackingId(trackingIdString));
49
-
50
-    final Map<String, CargoTrackingViewAdapter> model = new HashMap();
51
-    if (cargo != null) {
52
-      final MessageSource messageSource = getApplicationContext();
53
-      final Locale locale = RequestContextUtils.getLocale(request);
54
-      model.put("cargo", new CargoTrackingViewAdapter(cargo, messageSource, locale));
55
-    } else {
56
-      errors.rejectValue("trackingId", "cargo.unknown_id", new Object[]{trackCommand.getTrackingId()},
57
-        "Unknown tracking id");
58
-    }
59
-    return showForm(request, response, errors, model);
60
-  }
61
-
62
-  public void setTrackingService(TrackingService trackingService) {
63
-    this.trackingService = trackingService;
64
-  }
65
-}

+ 0
- 168
dddsample/src/main/java/se/citerus/dddsample/ui/CargoTrackingViewAdapter.java Zobrazit soubor

@@ -1,168 +0,0 @@
1
-package se.citerus.dddsample.ui;
2
-
3
-import org.springframework.context.MessageSource;
4
-import se.citerus.dddsample.domain.model.cargo.Cargo;
5
-import se.citerus.dddsample.domain.model.cargo.DeliveryHistory;
6
-import se.citerus.dddsample.domain.model.carrier.CarrierMovement;
7
-import se.citerus.dddsample.domain.model.handling.HandlingEvent;
8
-import se.citerus.dddsample.domain.model.location.Location;
9
-
10
-import java.text.SimpleDateFormat;
11
-import java.util.ArrayList;
12
-import java.util.Collections;
13
-import java.util.List;
14
-import java.util.Locale;
15
-
16
-/**
17
- * View adapter for displaying a cargo in a tracking context.
18
- */
19
-public final class CargoTrackingViewAdapter {
20
-
21
-  private final Cargo cargo;
22
-  private final MessageSource messageSource;
23
-  private final Locale locale;
24
-  private final List<HandlingEventViewAdapter> events;
25
-
26
-  /**
27
-   * Constructor.
28
-   *
29
-   * @param cargo
30
-   * @param messageSource
31
-   * @param locale
32
-   */
33
-  public CargoTrackingViewAdapter(Cargo cargo, MessageSource messageSource, Locale locale) {
34
-    this.messageSource = messageSource;
35
-    this.locale = locale;
36
-    this.cargo = cargo;
37
-
38
-    final List<HandlingEvent> handlingEvents = cargo.deliveryHistory().eventsOrderedByCompletionTime();
39
-    this.events = new ArrayList<HandlingEventViewAdapter>(handlingEvents.size());
40
-    for (HandlingEvent handlingEvent : handlingEvents) {
41
-      events.add(new HandlingEventViewAdapter(handlingEvent));
42
-    }
43
-  }
44
-
45
-  /**
46
-   * @param location a location
47
-   * @return A formatted string for displaying the location.
48
-   */
49
-  private String getDisplayText(Location location) {
50
-    return location.unLocode().idString() + " (" + location.name() + ")";
51
-  }
52
-
53
-  /**
54
-   * @return An unmodifiable list of handling event view adapters.
55
-   */
56
-  public List<HandlingEventViewAdapter> getEvents() {
57
-    return Collections.unmodifiableList(events);
58
-  }
59
-
60
-  /**
61
-   * @return A translated string describing the cargo status. 
62
-   */
63
-  public String getStatusText() {
64
-    final DeliveryHistory deliveryHistory = cargo.deliveryHistory();
65
-    final String code = "cargo.status." + deliveryHistory.status().name();
66
-
67
-    final Object[] args;
68
-    switch (deliveryHistory.status()) {
69
-      case IN_PORT:
70
-        args = new Object[] {getDisplayText(deliveryHistory.currentLocation())};
71
-        break;
72
-      case ONBOARD_CARRIER:
73
-        args = new Object[] {deliveryHistory.currentCarrierMovement().carrierMovementId().idString()};
74
-        break;
75
-      case CLAIMED:
76
-      case NOT_RECEIVED:
77
-      case UNKNOWN:
78
-      default:
79
-        args = null;
80
-        break;
81
-    }
82
-    
83
-    return messageSource.getMessage(code, args, "[Unknown status]", locale);
84
-  }
85
-
86
-  /**
87
-   * @return Cargo destination location.
88
-   */
89
-  public String getDestination() {
90
-    return getDisplayText(cargo.destination());
91
-  }
92
-
93
-  /**
94
-   * @return Cargo osigin location.
95
-   */
96
-  public String getOrigin() {
97
-    return getDisplayText(cargo.origin());
98
-  }
99
-
100
-  /**
101
-   * @return Cargo tracking id.
102
-   */
103
-  public String getTrackingId() {
104
-    return cargo.trackingId().idString();
105
-  }
106
-
107
-  /**
108
-   * @return True if cargo is misdirected.
109
-   */
110
-  public boolean isMisdirected() {
111
-    return cargo.isMisdirected();
112
-  }
113
-
114
-  /**
115
-   * Handling event view adapter component.
116
-   */
117
-  public final class HandlingEventViewAdapter {
118
-
119
-    private final HandlingEvent handlingEvent;
120
-    private final String FORMAT = "yyyy-MM-dd hh:mm";
121
-
122
-    /**
123
-     * Constructor.
124
-     *
125
-     * @param handlingEvent handling event
126
-     */
127
-    public HandlingEventViewAdapter(HandlingEvent handlingEvent) {
128
-      this.handlingEvent = handlingEvent;
129
-    }
130
-
131
-    /**
132
-     * @return Location where the event occurred.
133
-     */
134
-    public String getLocation() {
135
-      return handlingEvent.location().unLocode().idString();
136
-    }
137
-
138
-    /**
139
-     * @return Time when the event was completed.
140
-     */
141
-    public String getTime() {
142
-      return new SimpleDateFormat(FORMAT).format(handlingEvent.completionTime());
143
-    }
144
-
145
-    /**
146
-     * @return Type of event.
147
-     */
148
-    public String getType() {
149
-      return handlingEvent.type().toString();
150
-    }
151
-
152
-    /**
153
-     * @return Carrier movement id, or empty string if not applicable.
154
-     */
155
-    public String getCarrierMovement() {
156
-      final CarrierMovement cm = handlingEvent.carrierMovement();
157
-      return cm != null ? cm.carrierMovementId().toString() : "";
158
-    }
159
-
160
-    /**
161
-     * @return True if the event was expected, according to the cargo's itinerary.
162
-     */
163
-    public boolean isExpected() {
164
-      return cargo.itinerary().isExpected(handlingEvent);
165
-    }
166
-
167
-  }
168
-}

+ 0
- 27
dddsample/src/main/java/se/citerus/dddsample/ui/command/RegistrationCommand.java Zobrazit soubor

@@ -1,27 +0,0 @@
1
-package se.citerus.dddsample.ui.command;
2
-
3
-/**
4
- *
5
- */
6
-public final class RegistrationCommand {
7
-
8
-  private String originUnlocode;
9
-  private String destinationUnlocode;
10
-
11
-  public String getOriginUnlocode() {
12
-    return originUnlocode;
13
-  }
14
-
15
-  public void setOriginUnlocode(final String originUnlocode) {
16
-    this.originUnlocode = originUnlocode;
17
-  }
18
-
19
-  public String getDestinationUnlocode() {
20
-    return destinationUnlocode;
21
-  }
22
-
23
-  public void setDestinationUnlocode(final String destinationUnlocode) {
24
-    this.destinationUnlocode = destinationUnlocode;
25
-  }
26
-
27
-}

+ 0
- 70
dddsample/src/main/java/se/citerus/dddsample/ui/command/RouteAssignmentCommand.java Zobrazit soubor

@@ -1,70 +0,0 @@
1
-package se.citerus.dddsample.ui.command;
2
-
3
-import org.apache.commons.collections.Factory;
4
-import org.apache.commons.collections.ListUtils;
5
-
6
-import java.util.ArrayList;
7
-import java.util.List;
8
-
9
-public class RouteAssignmentCommand {
10
-
11
-  private String trackingId;
12
-  private List<LegCommand> legs = ListUtils.lazyList(
13
-    new ArrayList(), LegCommand.factory()
14
-  );
15
-
16
-  public String getTrackingId() {
17
-    return trackingId;
18
-  }
19
-
20
-  public void setTrackingId(String trackingId) {
21
-    this.trackingId = trackingId;
22
-  }
23
-
24
-  public List<LegCommand> getLegs() {
25
-    return legs;
26
-  }
27
-
28
-  public void setLegs(List<LegCommand> legs) {
29
-    this.legs = legs;
30
-  }
31
-
32
-  public static final class LegCommand {
33
-    private String carrierMovementId;
34
-    private String fromUnLocode;
35
-    private String toUnLocode;
36
-
37
-    public String getCarrierMovementId() {
38
-      return carrierMovementId;
39
-    }
40
-
41
-    public void setCarrierMovementId(final String carrierMovementId) {
42
-      this.carrierMovementId = carrierMovementId;
43
-    }
44
-
45
-    public String getFromUnLocode() {
46
-      return fromUnLocode;
47
-    }
48
-
49
-    public void setFromUnLocode(final String fromUnLocode) {
50
-      this.fromUnLocode = fromUnLocode;
51
-    }
52
-
53
-    public String getToUnLocode() {
54
-      return toUnLocode;
55
-    }
56
-
57
-    public void setToUnLocode(final String toUnLocode) {
58
-      this.toUnLocode = toUnLocode;
59
-    }
60
-
61
-    public static Factory factory() {
62
-      return new Factory() {
63
-        public Object create() {
64
-          return new LegCommand();
65
-        }
66
-      };
67
-    }
68
-    
69
-  }
70
-}

+ 0
- 25
dddsample/src/main/java/se/citerus/dddsample/ui/command/TrackCommand.java Zobrazit soubor

@@ -1,25 +0,0 @@
1
-package se.citerus.dddsample.ui.command;
2
-
3
-import org.apache.commons.lang.builder.ToStringBuilder;
4
-import static org.apache.commons.lang.builder.ToStringStyle.MULTI_LINE_STYLE;
5
-
6
-public final class TrackCommand {
7
-
8
-  /**
9
-   * The tracking id.
10
-   */
11
-  private String trackingId;
12
-
13
-  public String getTrackingId() {
14
-    return trackingId;
15
-  }
16
-
17
-  public void setTrackingId(final String trackingId) {
18
-    this.trackingId = trackingId;
19
-  }
20
-
21
-  @Override
22
-  public String toString() {
23
-    return ToStringBuilder.reflectionToString(this, MULTI_LINE_STYLE);
24
-  }
25
-}

+ 0
- 21
dddsample/src/main/java/se/citerus/dddsample/ui/command/TrackCommandValidator.java Zobrazit soubor

@@ -1,21 +0,0 @@
1
-package se.citerus.dddsample.ui.command;
2
-
3
-import org.springframework.validation.Errors;
4
-import org.springframework.validation.ValidationUtils;
5
-import org.springframework.validation.Validator;
6
-
7
-/**
8
- * Validator for {@link TrackCommand}s.
9
- */
10
-public final class TrackCommandValidator implements Validator {
11
-
12
-  public boolean supports(final Class clazz) {
13
-    return TrackCommand.class.isAssignableFrom(clazz);
14
-  }
15
-
16
-  public void validate(final Object object, final Errors errors) {
17
-    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "trackingId", "error.required", "Required");
18
-  }
19
-
20
-}
21
-

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/ui/command/package.html Zobrazit soubor

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  Command classes for web data binding and form handling.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 7
dddsample/src/main/java/se/citerus/dddsample/ui/package.html Zobrazit soubor

@@ -1,7 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  Web user interfaces for tracking and booking cargo. Uses Spring MVC.
5
-</p>
6
-</body>
7
-</html>

+ 0
- 14
dddsample/src/main/java/se/citerus/routingteam/GraphTraversalService.java Zobrazit soubor

@@ -1,14 +0,0 @@
1
-package se.citerus.routingteam;
2
-
3
-import java.util.List;
4
-
5
-/**
6
- * Part of the external graph traversal API exposed by the routing team
7
- * and used by us (booking and tracking team).
8
- * 
9
- */
10
-public interface GraphTraversalService {
11
-
12
-  List<TransitPath> findShortestPath(String originUnLocode, String destinationUnLocode);
13
-
14
-}

+ 0
- 39
dddsample/src/main/java/se/citerus/routingteam/TransitEdge.java Zobrazit soubor

@@ -1,39 +0,0 @@
1
-package se.citerus.routingteam;
2
-
3
-import java.io.Serializable;
4
-
5
-/**
6
- * DTO for a leg in an itinerary.
7
- */
8
-public final class TransitEdge implements Serializable {
9
-
10
-  private final String carrierMovementId;
11
-  private final String fromUnLocode;
12
-  private final String toUnLocode;
13
-
14
-  /**
15
-   * Constructor.
16
-   *
17
-   * @param carrierMovementId
18
-   * @param fromUnLocode
19
-   * @param toUnLocode
20
-   */
21
-  public TransitEdge(final String carrierMovementId, final String fromUnLocode, final String toUnLocode) {
22
-    this.carrierMovementId = carrierMovementId;
23
-    this.fromUnLocode = fromUnLocode;
24
-    this.toUnLocode = toUnLocode;
25
-  }
26
-
27
-  public String getCarrierMovementId() {
28
-    return carrierMovementId;
29
-  }
30
-
31
-  public String getFromUnLocode() {
32
-    return fromUnLocode;
33
-  }
34
-
35
-  public String getToUnLocode() {
36
-    return toUnLocode;
37
-  }
38
-
39
-}

+ 0
- 29
dddsample/src/main/java/se/citerus/routingteam/TransitPath.java Zobrazit soubor

@@ -1,29 +0,0 @@
1
-package se.citerus.routingteam;
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
- 43
dddsample/src/main/java/se/citerus/routingteam/internal/GraphDAO.java Zobrazit soubor

@@ -1,43 +0,0 @@
1
-package se.citerus.routingteam.internal;
2
-
3
-import org.springframework.jdbc.core.JdbcTemplate;
4
-import org.springframework.jdbc.core.RowCallbackHandler;
5
-
6
-import javax.sql.DataSource;
7
-import java.sql.ResultSet;
8
-import java.sql.SQLException;
9
-import java.util.ArrayList;
10
-import java.util.List;
11
-
12
-public class GraphDAO {
13
-
14
-  private final JdbcTemplate jt;
15
-
16
-  public GraphDAO(DataSource dataSource) {
17
-    jt = new JdbcTemplate(dataSource);
18
-  }
19
-
20
-  public List<String> listLocations() {
21
-    final List<String> result = new ArrayList();
22
-
23
-    jt.query("select unlocode from location", new RowCallbackHandler() {
24
-      public void processRow(ResultSet resultSet) throws SQLException {
25
-        result.add(resultSet.getString("unlocode"));
26
-      }
27
-    });
28
-
29
-    return result;
30
-  }
31
-
32
-  public void storeCarrierMovementId(String cmId, String from, String to) {
33
-    final String locationSql = "select id from location where unlocode = ?";
34
-
35
-    final Long fromId = jt.queryForLong(locationSql, new Object[]{ from });
36
-    final Long toId = jt.queryForLong(locationSql, new Object[]{ to });
37
-
38
-    final Object[] params = {cmId, fromId, toId};
39
-    jt.update(
40
-      "insert into CarrierMovement (carrier_movement_id,from_id,to_id) " +
41
-      "values (?,?,?)", params);
42
-  }
43
-}

+ 0
- 71
dddsample/src/main/java/se/citerus/routingteam/internal/GraphTraversalServiceImpl.java Zobrazit soubor

@@ -1,71 +0,0 @@
1
-package se.citerus.routingteam.internal;
2
-
3
-import se.citerus.routingteam.GraphTraversalService;
4
-import se.citerus.routingteam.TransitEdge;
5
-import se.citerus.routingteam.TransitPath;
6
-
7
-import java.util.*;
8
-
9
-public class GraphTraversalServiceImpl implements GraphTraversalService {
10
-
11
-  private GraphDAO dao;
12
-  private Random random;
13
-
14
-  public GraphTraversalServiceImpl(GraphDAO dao) {
15
-    this.dao = dao;
16
-    this.random = new Random();
17
-  }
18
-
19
-  public List<TransitPath> findShortestPath(String originUnLocode, String destinationUnLocode) {
20
-    List<String> allVertices = dao.listLocations();
21
-    allVertices.remove(originUnLocode);
22
-    allVertices.remove(destinationUnLocode);
23
-
24
-    final int candidateCount = getRandomNumberOfCandidates();
25
-    final List<TransitPath> candidates = new ArrayList<TransitPath>(candidateCount);
26
-
27
-    for (int i = 0; i < candidateCount; i++) {
28
-      allVertices = getRandomChunkOfLocations(allVertices);
29
-      final List<TransitEdge> transitEdges = new ArrayList<TransitEdge>(allVertices.size() - 1);
30
-      final String firstLegTo = allVertices.get(0);
31
-
32
-      transitEdges.add(new TransitEdge(
33
-        getRandomCarrierMovementId(originUnLocode, firstLegTo),
34
-        originUnLocode, firstLegTo));
35
-
36
-      for (int j = 0; j < allVertices.size() - 1; j++) {
37
-        final String curr = allVertices.get(j);
38
-        final String next = allVertices.get(j + 1);
39
-        transitEdges.add(new TransitEdge(getRandomCarrierMovementId(curr, next), curr, next));
40
-      }
41
-
42
-      final String lastLegFrom = allVertices.get(allVertices.size() - 1);
43
-      transitEdges.add(new TransitEdge(
44
-        getRandomCarrierMovementId(lastLegFrom, destinationUnLocode),
45
-        lastLegFrom, destinationUnLocode));
46
-
47
-      candidates.add(new TransitPath(transitEdges));
48
-    }
49
-
50
-    return candidates;
51
-  }
52
-
53
-  private String getRandomCarrierMovementId(String from, String to) {
54
-    final String random = UUID.randomUUID().toString().toUpperCase();
55
-    final String cmId =  random.substring(0, 4);
56
-    dao.storeCarrierMovementId(cmId, from, to);
57
-    return cmId;
58
-  }
59
-
60
-  private int getRandomNumberOfCandidates() {
61
-    return 1 + random.nextInt(4);
62
-  }
63
-
64
-  private List<String> getRandomChunkOfLocations(List<String> allLocations) {
65
-    Collections.shuffle(allLocations);
66
-    final int total = allLocations.size();
67
-    final int chunk = total > 4 ? (total - 4) + random.nextInt(5) : total;
68
-    return allLocations.subList(0, chunk);
69
-  }
70
-
71
-}

+ 0
- 7
dddsample/src/main/java/se/citerus/routingteam/internal/package.html Zobrazit soubor

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

+ 0
- 14
dddsample/src/main/java/se/citerus/routingteam/package.html Zobrazit soubor

@@ -1,14 +0,0 @@
1
-<html>
2
-<body>
3
-<p>
4
-  This is the routing team 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 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
- 42
dddsample/src/main/resources/context-messaging-jms.xml Zobrazit soubor

@@ -1,42 +0,0 @@
1
-<?xml version="1.0"?>
2
-
3
-<beans xmlns="http://www.springframework.org/schema/beans"
4
-       xmlns:jms="http://www.springframework.org/schema/jms"
5
-       xmlns:amq="http://activemq.org/config/1.0"
6
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7
-       xsi:schemaLocation="
8
-        http://activemq.org/config/1.0 http://activemq.apache.org/schema/core/activemq-core-5.0.0.xsd
9
-        http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-2.5.xsd
10
-        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
11
-
12
-
13
-  <amq:broker useJmx="false" persistent="false">
14
-    <amq:transportConnectors>
15
-      <amq:transportConnector uri="tcp://localhost:0"/>
16
-    </amq:transportConnectors>
17
-  </amq:broker>
18
-
19
-  <amq:connectionFactory id="jmsConnectionFactory" brokerURL="vm://localhost"/>
20
-
21
-  <amq:topic id="handlingEventTopic" name="HandlingEventTopic" physicalName="HandlingEventTopic"/>
22
-
23
-  <bean id="handlingEventMessageDelegate" class="se.citerus.dddsample.application.messaging.HandlingEventMessageDelegate">
24
-    <property name="trackingService" ref="trackingService"/>
25
-  </bean>
26
-
27
-  <bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
28
-    <property name="connectionFactory" ref="jmsConnectionFactory"/>
29
-    <property name="destination" ref="handlingEventTopic"/>
30
-    <property name="messageListener" ref="handlingEventMessageDelegate"/>
31
-  </bean>
32
-
33
-  <bean id="jmsOperations" class="org.springframework.jms.core.JmsTemplate">
34
-    <property name="connectionFactory" ref="jmsConnectionFactory"/>
35
-  </bean>
36
-
37
-  <bean id="domainEventNotifier" class="se.citerus.dddsample.application.messaging.JmsDomainEventNotifierImpl">
38
-    <property name="jmsOperations" ref="jmsOperations"/>
39
-    <property name="destination" ref="handlingEventTopic"/>
40
-  </bean>
41
-  
42
-</beans>

+ 0
- 11
dddsample/src/main/resources/context-messaging-thread.xml Zobrazit soubor

@@ -1,11 +0,0 @@
1
-<?xml version="1.0"?>
2
-
3
-<beans xmlns="http://www.springframework.org/schema/beans"
4
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
6
-
7
-  <bean id="domainEventNotifier" class="se.citerus.dddsample.application.messaging.ThreadBasedDomainEventNotifierImpl">
8
-    <property name="bookingService" ref="bookingService"/>
9
-  </bean>
10
-
11
-</beans>

+ 0
- 44
dddsample/src/main/resources/context-persistence-hibernate.xml Zobrazit soubor

@@ -1,44 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-
3
-<beans xmlns="http://www.springframework.org/schema/beans"
4
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
6
-
7
-  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
8
-    <property name="location" value="classpath:jdbc.properties"/>
9
-  </bean>
10
-
11
-  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
12
-    <property name="url" value="${hibernate.connection.url}"/>
13
-    <property name="driverClassName" value="${hibernate.connection.driver_class}"/>
14
-    <property name="username" value="${hibernate.connection.username}"/>
15
-    <property name="password" value="${hibernate.connection.password}"/>
16
-    <property name="initialSize" value="4"/>
17
-    <property name="defaultAutoCommit" value="false"/>
18
-  </bean>
19
-
20
-  <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
21
-    <property name="dataSource" ref="dataSource"/>
22
-    <property name="configLocation" value="classpath:hibernate.cfg.xml"/>
23
-  </bean>
24
-
25
-  <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
26
-    <property name="sessionFactory" ref="sessionFactory"/>
27
-  </bean>
28
-  
29
-  <bean id="cargoRepository" class="se.citerus.dddsample.application.persistence.CargoRepositoryHibernate">
30
-    <property name="sessionFactory" ref="sessionFactory"/>
31
-  </bean>
32
-
33
-  <bean id="handlingEventRepository" class="se.citerus.dddsample.application.persistence.HandlingEventRepositoryHibernate">
34
-    <property name="sessionFactory" ref="sessionFactory"/>
35
-  </bean>
36
-
37
-  <bean id="carrierMovementRepository" class="se.citerus.dddsample.application.persistence.CarrierMovementRepositoryHibernate">
38
-    <property name="sessionFactory" ref="sessionFactory"/>
39
-  </bean>
40
-
41
-  <bean id="locationRepository" class="se.citerus.dddsample.application.persistence.LocationRepositoryHibernate">
42
-    <property name="sessionFactory" ref="sessionFactory"/>
43
-  </bean>
44
-</beans>

+ 0
- 19
dddsample/src/main/resources/context-persistence-in-mem.xml Zobrazit soubor

@@ -1,19 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-
3
-<beans xmlns="http://www.springframework.org/schema/beans"
4
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
-       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
6
-
7
-  <bean id="transactionManager" class="se.citerus.dddsample.application.service.InMemTransactionManager"/>
8
-
9
-  <bean id="cargoRepository" class="se.citerus.dddsample.application.persistence.CargoRepositoryInMem" init-method="init">
10
-    <property name="handlingEventRepository" ref="handlingEventRepository"/>
11
-  </bean>
12
-
13
-  <bean id="handlingEventRepository" class="se.citerus.dddsample.application.persistence.HandlingEventRepositoryInMem" init-method="init"/>
14
-
15
-  <bean id="carrierMovementRepository" class="se.citerus.dddsample.application.persistence.CarrierMovementRepositoryInMem" init-method="setup"/>
16
-
17
-  <bean id="locationRepository" class="se.citerus.dddsample.application.persistence.LocationRepositoryInMem"/>
18
-
19
-</beans>

+ 0
- 81
dddsample/src/main/resources/context-remote.xml Zobrazit soubor

@@ -1,81 +0,0 @@
1
-<?xml version="1.0"?>
2
-
3
-<beans xmlns="http://www.springframework.org/schema/beans"
4
-       xmlns:ws="http://jax-ws.dev.java.net/spring/core"
5
-       xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
6
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7
-       xmlns:aop="http://www.springframework.org/schema/aop"
8
-       xsi:schemaLocation="
9
-        http://jax-ws.dev.java.net/spring/core https://jax-ws.dev.java.net/spring/core.xsd
10
-        http://jax-ws.dev.java.net/spring/servlet https://jax-ws.dev.java.net/spring/servlet.xsd
11
-        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
12
-        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
13
-
14
-
15
-  <!-- Handling event registration web service -->
16
-
17
-  
18
-  <wss:bindings id="jax-ws.http">
19
-    <wss:bindings>
20
-      <wss:binding url="/ws/RegisterEvent">
21
-        <wss:service>
22
-          <ws:service bean="#handlingEventServiceEndpoint"/>
23
-        </wss:service>
24
-      </wss:binding>
25
-    </wss:bindings>
26
-  </wss:bindings>
27
-
28
-  <bean id="handlingEventServiceEndpoint" class="se.citerus.dddsample.application.ws.HandlingEventServiceEndpointImpl">
29
-    <property name="handlingEventService" ref="handlingEventService"/>
30
-  </bean>
31
-
32
-
33
-  <!-- Booking service facade -->
34
-
35
-  
36
-  <!-- Hibernate interceptor -->
37
-  <bean id="hibernateInterceptor" class="org.springframework.orm.hibernate3.HibernateInterceptor">
38
-    <property name="sessionFactory" ref="sessionFactory"/>
39
-  </bean>
40
-
41
-  <!-- Facade wrapped with Hibernate interceptor -->
42
-  <bean id="bookingServiceFacade" class="org.springframework.aop.framework.ProxyFactoryBean">
43
-    <property name="interceptorNames">
44
-      <list>
45
-        <value>hibernateInterceptor</value>
46
-      </list>
47
-    </property>
48
-    <property name="target">
49
-      <bean class="se.citerus.dddsample.application.remoting.BookingServiceFacadeImpl">
50
-        <property name="bookingService" ref="bookingService"/>
51
-        <property name="cargoRepository" ref="cargoRepository"/>
52
-        <property name="locationRepository" ref="locationRepository"/>
53
-        <property name="carrierMovementRepository" ref="carrierMovementRepository"/>
54
-      </bean>
55
-    </property>
56
-  </bean>
57
-
58
-  <!-- Wrap all methods with Hibernate interceptor
59
-  TODO: add necessary aspectj deps and replace config above with this
60
-  
61
-  <bean id="bookingServiceFacade" class="se.citerus.dddsample.application.remote.BookingServiceFacadeImpl">
62
-    <property name="bookingService" ref="bookingService"/>
63
-    <property name="cargoRepository" ref="cargoRepository"/>
64
-    <property name="locationRepository" ref="locationRepository"/>
65
-    <property name="carrierMovementRepository" ref="carrierMovementRepository"/>
66
-  </bean>
67
-
68
-  <aop:config>
69
-    <aop:advisor advice-ref="hibernateInterceptor"
70
-                 pointcut="execution (* se.citerus.dddsample.application.remote.BookingServiceFacadeImpl(..))"/>
71
-  </aop:config>
72
-  -->
73
-
74
-  <!-- RMI exposure -->
75
-  <bean id="rmiBookingServiceFacade" class="org.springframework.remoting.rmi.RmiServiceExporter">
76
-    <property name="serviceInterface" value="se.citerus.dddsample.application.remoting.BookingServiceFacade"/>
77
-    <property name="service" ref="bookingServiceFacade"/>
78
-    <property name="serviceName" value="BookingService"/>
79
-  </bean>
80
-
81
-</beans>

+ 0
- 0
dddsample/src/main/resources/context-routingteam.xml Zobrazit soubor


Některé soubory nejsou zobrazny, neboť je v této revizi změněno mnoho souborů