|
|
@@ -12,10 +12,7 @@ import org.springframework.web.context.WebApplicationContext;
|
|
12
|
12
|
import org.springframework.web.context.support.WebApplicationContextUtils;
|
|
13
|
13
|
import static se.citerus.dddsample.tracking.core.application.util.DateTestUtil.toDate;
|
|
14
|
14
|
import se.citerus.dddsample.tracking.core.domain.model.cargo.*;
|
|
15
|
|
-import se.citerus.dddsample.tracking.core.domain.model.handling.CannotCreateHandlingEventException;
|
|
16
|
|
-import se.citerus.dddsample.tracking.core.domain.model.handling.HandlingEvent;
|
|
17
|
|
-import se.citerus.dddsample.tracking.core.domain.model.handling.HandlingEventFactory;
|
|
18
|
|
-import se.citerus.dddsample.tracking.core.domain.model.handling.HandlingEventRepository;
|
|
|
15
|
+import se.citerus.dddsample.tracking.core.domain.model.handling.*;
|
|
19
|
16
|
import se.citerus.dddsample.tracking.core.domain.model.location.Location;
|
|
20
|
17
|
import se.citerus.dddsample.tracking.core.domain.model.location.LocationRepository;
|
|
21
|
18
|
import se.citerus.dddsample.tracking.core.domain.model.location.SampleLocations;
|
|
|
@@ -49,47 +46,47 @@ public class SampleDataGenerator implements ServletContextListener {
|
|
49
|
46
|
|
|
50
|
47
|
private static void loadHandlingEventData(JdbcTemplate jdbcTemplate) {
|
|
51
|
48
|
String handlingEventSql =
|
|
52
|
|
- "insert into HandlingEvent (sequence_number, completionTime, registrationTime, type, location_id, voyage_id, cargo_id) " +
|
|
53
|
|
- "values (?, ?, ?, ?, ?, ?, ?)";
|
|
|
49
|
+ "insert into HandlingEvent (sequence_number, completionTime, registrationTime, type, location_id, voyage_id, cargo_id, operator_code) " +
|
|
|
50
|
+ "values (?, ?, ?, ?, ?, ?, ?,?)";
|
|
54
|
51
|
|
|
55
|
52
|
Object[][] handlingEventArgs = {
|
|
56
|
53
|
//XYZ (SESTO-FIHEL-DEHAM-CNHKG-JPTOK-AUMEL)
|
|
57
|
|
- {1, ts(0), ts((0)), "RECEIVE", 1, null, 1},
|
|
58
|
|
- {2, ts((4)), ts((5)), "LOAD", 1, 1, 1},
|
|
59
|
|
- {3, ts((14)), ts((14)), "UNLOAD", 5, 1, 1},
|
|
60
|
|
- {4, ts((15)), ts((15)), "LOAD", 5, 1, 1},
|
|
61
|
|
- {5, ts((30)), ts((30)), "UNLOAD", 6, 1, 1},
|
|
62
|
|
- {6, ts((33)), ts((33)), "LOAD", 6, 1, 1},
|
|
63
|
|
- {7, ts((34)), ts((34)), "UNLOAD", 3, 1, 1},
|
|
64
|
|
- {8, ts((60)), ts((60)), "LOAD", 3, 1, 1},
|
|
65
|
|
- {9, ts((70)), ts((71)), "UNLOAD", 4, 1, 1},
|
|
66
|
|
- {10, ts((75)), ts((75)), "LOAD", 4, 1, 1},
|
|
67
|
|
- {11, ts((88)), ts((88)), "UNLOAD", 2, 1, 1},
|
|
68
|
|
- {12, ts((100)), ts((102)), "CLAIM", 2, null, 1},
|
|
|
54
|
+ {1, ts(0), ts((0)), "RECEIVE", 1, null, 1, null},
|
|
|
55
|
+ {2, ts((4)), ts((5)), "LOAD", 1, 1, 1, "AS34F"},
|
|
|
56
|
+ {3, ts((14)), ts((14)), "UNLOAD", 5, 1, 1, "AS34F"},
|
|
|
57
|
+ {4, ts((15)), ts((15)), "LOAD", 5, 1, 1, "AS34F"},
|
|
|
58
|
+ {5, ts((30)), ts((30)), "UNLOAD", 6, 1, 1, "AS34F"},
|
|
|
59
|
+ {6, ts((33)), ts((33)), "LOAD", 6, 1, 1, "AS34F"},
|
|
|
60
|
+ {7, ts((34)), ts((34)), "UNLOAD", 3, 1, 1, "AS34F"},
|
|
|
61
|
+ {8, ts((60)), ts((60)), "LOAD", 3, 1, 1, "AS34F"},
|
|
|
62
|
+ {9, ts((70)), ts((71)), "UNLOAD", 4, 1, 1, "AS34F"},
|
|
|
63
|
+ {10, ts((75)), ts((75)), "LOAD", 4, 1, 1, "AS34F"},
|
|
|
64
|
+ {11, ts((88)), ts((88)), "UNLOAD", 2, 1, 1, "AS34F"},
|
|
|
65
|
+ {12, ts((100)), ts((102)), "CLAIM", 2, null, 1, null},
|
|
69
|
66
|
|
|
70
|
67
|
//ZYX (AUMEL - USCHI - DEHAM -)
|
|
71
|
|
- {13, ts((200)), ts((201)), "RECEIVE", 2, null, 3},
|
|
72
|
|
- {14, ts((202)), ts((202)), "LOAD", 2, 2, 3},
|
|
73
|
|
- {15, ts((208)), ts((208)), "UNLOAD", 7, 2, 3},
|
|
74
|
|
- {16, ts((212)), ts((212)), "LOAD", 7, 2, 3},
|
|
75
|
|
- {17, ts((230)), ts((230)), "UNLOAD", 6, 2, 3},
|
|
76
|
|
- {18, ts((235)), ts((235)), "LOAD", 6, 2, 3},
|
|
|
68
|
+ {13, ts((200)), ts((201)), "RECEIVE", 2, null, 3, null},
|
|
|
69
|
+ {14, ts((202)), ts((202)), "LOAD", 2, 2, 3, "AS34F"},
|
|
|
70
|
+ {15, ts((208)), ts((208)), "UNLOAD", 7, 2, 3, "AS34F"},
|
|
|
71
|
+ {16, ts((212)), ts((212)), "LOAD", 7, 2, 3, "AS34F"},
|
|
|
72
|
+ {17, ts((230)), ts((230)), "UNLOAD", 6, 2, 3, "AS34F"},
|
|
|
73
|
+ {18, ts((235)), ts((235)), "LOAD", 6, 2, 3, "AS34F"},
|
|
77
|
74
|
|
|
78
|
75
|
//ABC
|
|
79
|
|
- {19, ts((20)), ts((21)), "CLAIM", 2, null, 2},
|
|
|
76
|
+ {19, ts((20)), ts((21)), "CLAIM", 2, null, 2, null},
|
|
80
|
77
|
|
|
81
|
78
|
//CBA
|
|
82
|
|
- {20, ts((0)), ts((1)), "RECEIVE", 2, null, 4},
|
|
83
|
|
- {21, ts((10)), ts((11)), "LOAD", 2, 2, 4},
|
|
84
|
|
- {22, ts((20)), ts((21)), "UNLOAD", 7, 2, 4},
|
|
|
79
|
+ {20, ts((0)), ts((1)), "RECEIVE", 2, null, 4, null},
|
|
|
80
|
+ {21, ts((10)), ts((11)), "LOAD", 2, 2, 4, "AS34F"},
|
|
|
81
|
+ {22, ts((20)), ts((21)), "UNLOAD", 7, 2, 4, "AS34F"},
|
|
85
|
82
|
|
|
86
|
83
|
//FGH
|
|
87
|
|
- {23, ts(100), ts(160), "RECEIVE", 3, null, 5},
|
|
88
|
|
- {24, ts(150), ts(110), "LOAD", 3, 3, 5},
|
|
|
84
|
+ {23, ts(100), ts(160), "RECEIVE", 3, null, 5, null},
|
|
|
85
|
+ {24, ts(150), ts(110), "LOAD", 3, 3, 5, "AS34F"},
|
|
89
|
86
|
|
|
90
|
87
|
// JKL
|
|
91
|
|
- {25, ts(200), ts(220), "RECEIVE", 6, null, 6},
|
|
92
|
|
- {26, ts(300), ts(330), "LOAD", 6, 3, 6},
|
|
|
88
|
+ {25, ts(200), ts(220), "RECEIVE", 6, null, 6, null},
|
|
|
89
|
+ {26, ts(300), ts(330), "LOAD", 6, 3, 6, "AS34F"},
|
|
93
|
90
|
{27, ts(400), ts(440), "UNLOAD", 5, 3, 6} // Unexpected event
|
|
94
|
91
|
};
|
|
95
|
92
|
executeUpdate(jdbcTemplate, handlingEventSql, handlingEventArgs);
|
|
|
@@ -235,17 +232,17 @@ public class SampleDataGenerator implements ServletContextListener {
|
|
235
|
232
|
|
|
236
|
233
|
try {
|
|
237
|
234
|
HandlingEvent event1 = handlingEventFactory.createHandlingEvent(
|
|
238
|
|
- toDate("2009-03-01"), trackingId, null, HONGKONG.unLocode(), HandlingEvent.Type.RECEIVE
|
|
|
235
|
+ toDate("2009-03-01"), trackingId, null, HONGKONG.unLocode(), HandlingEvent.Type.RECEIVE, new OperatorCode("ABCDE")
|
|
239
|
236
|
);
|
|
240
|
237
|
session.save(event1);
|
|
241
|
238
|
|
|
242
|
239
|
HandlingEvent event2 = handlingEventFactory.createHandlingEvent(
|
|
243
|
|
- toDate("2009-03-02"), trackingId, HONGKONG_TO_NEW_YORK.voyageNumber(), HONGKONG.unLocode(), HandlingEvent.Type.LOAD
|
|
|
240
|
+ toDate("2009-03-02"), trackingId, HONGKONG_TO_NEW_YORK.voyageNumber(), HONGKONG.unLocode(), HandlingEvent.Type.LOAD, new OperatorCode("ABCDE")
|
|
244
|
241
|
);
|
|
245
|
242
|
session.save(event2);
|
|
246
|
243
|
|
|
247
|
244
|
HandlingEvent event3 = handlingEventFactory.createHandlingEvent(
|
|
248
|
|
- toDate("2009-03-05"), trackingId, HONGKONG_TO_NEW_YORK.voyageNumber(), NEWYORK.unLocode(), HandlingEvent.Type.UNLOAD
|
|
|
245
|
+ toDate("2009-03-05"), trackingId, HONGKONG_TO_NEW_YORK.voyageNumber(), NEWYORK.unLocode(), HandlingEvent.Type.UNLOAD, new OperatorCode("ABCDE")
|
|
249
|
246
|
);
|
|
250
|
247
|
session.save(event3);
|
|
251
|
248
|
} catch (CannotCreateHandlingEventException e) {
|
|
|
@@ -273,22 +270,22 @@ public class SampleDataGenerator implements ServletContextListener {
|
|
273
|
270
|
|
|
274
|
271
|
try {
|
|
275
|
272
|
HandlingEvent event1 = handlingEventFactory.createHandlingEvent(
|
|
276
|
|
- toDate("2009-03-01"), trackingId1, null, HANGZOU.unLocode(), HandlingEvent.Type.RECEIVE
|
|
|
273
|
+ toDate("2009-03-01"), trackingId1, null, HANGZOU.unLocode(), HandlingEvent.Type.RECEIVE, new OperatorCode("ABCDE")
|
|
277
|
274
|
);
|
|
278
|
275
|
session.save(event1);
|
|
279
|
276
|
|
|
280
|
277
|
HandlingEvent event2 = handlingEventFactory.createHandlingEvent(
|
|
281
|
|
- toDate("2009-03-03"), trackingId1, HONGKONG_TO_NEW_YORK.voyageNumber(), HANGZOU.unLocode(), HandlingEvent.Type.LOAD
|
|
|
278
|
+ toDate("2009-03-03"), trackingId1, HONGKONG_TO_NEW_YORK.voyageNumber(), HANGZOU.unLocode(), HandlingEvent.Type.LOAD, new OperatorCode("ABCDE")
|
|
282
|
279
|
);
|
|
283
|
280
|
session.save(event2);
|
|
284
|
281
|
|
|
285
|
282
|
HandlingEvent event3 = handlingEventFactory.createHandlingEvent(
|
|
286
|
|
- toDate("2009-03-05"), trackingId1, HONGKONG_TO_NEW_YORK.voyageNumber(), NEWYORK.unLocode(), HandlingEvent.Type.UNLOAD
|
|
|
283
|
+ toDate("2009-03-05"), trackingId1, HONGKONG_TO_NEW_YORK.voyageNumber(), NEWYORK.unLocode(), HandlingEvent.Type.UNLOAD, new OperatorCode("ABCDE")
|
|
287
|
284
|
);
|
|
288
|
285
|
session.save(event3);
|
|
289
|
286
|
|
|
290
|
287
|
HandlingEvent event4 = handlingEventFactory.createHandlingEvent(
|
|
291
|
|
- toDate("2009-03-06"), trackingId1, HONGKONG_TO_NEW_YORK.voyageNumber(), NEWYORK.unLocode(), HandlingEvent.Type.LOAD
|
|
|
288
|
+ toDate("2009-03-06"), trackingId1, HONGKONG_TO_NEW_YORK.voyageNumber(), NEWYORK.unLocode(), HandlingEvent.Type.LOAD, new OperatorCode("ABCDE")
|
|
292
|
289
|
);
|
|
293
|
290
|
session.save(event4);
|
|
294
|
291
|
|