|
|
@@ -34,28 +34,28 @@ public final class HandlingEventServiceImpl implements HandlingEventService {
|
|
34
|
34
|
}
|
|
35
|
35
|
|
|
36
|
36
|
@Override
|
|
37
|
|
- @Transactional(rollbackFor = CannotCreateHandlingEventException.class)
|
|
|
37
|
+ @Transactional
|
|
38
|
38
|
public void registerHandlingEvent(final Date completionTime, final TrackingId trackingId,
|
|
39
|
39
|
final VoyageNumber voyageNumber, final UnLocode unLocode,
|
|
40
|
40
|
final HandlingEvent.Type type) throws CannotCreateHandlingEventException {
|
|
41
|
41
|
|
|
42
|
42
|
/* Using a factory to create a HandlingEvent (aggregate). This is where
|
|
43
|
43
|
it is determined wether the incoming data, the attempt, actually is capable
|
|
44
|
|
- of representing a real handling event. */
|
|
45
|
|
- final HandlingEvent event = handlingEventFactory.createHandlingEvent(
|
|
|
44
|
+ of representing a real handling handlingEvent. */
|
|
|
45
|
+ final HandlingEvent handlingEvent = handlingEventFactory.createHandlingEvent(
|
|
46
|
46
|
completionTime, trackingId, voyageNumber, unLocode, type
|
|
47
|
47
|
);
|
|
48
|
48
|
|
|
49
|
|
- /* Store the new handling event, which updates the persistent
|
|
50
|
|
- state of the handling event aggregate (but not the cargo aggregate -
|
|
|
49
|
+ /* Store the new handling handlingEvent, which updates the persistent
|
|
|
50
|
+ state of the handling handlingEvent aggregate (but not the cargo aggregate -
|
|
51
|
51
|
that happens asynchronously!)
|
|
52
|
52
|
*/
|
|
53
|
|
- handlingEventRepository.store(event);
|
|
|
53
|
+ handlingEventRepository.store(handlingEvent);
|
|
54
|
54
|
|
|
55
|
|
- /* Publish an event stating that a cargo has been handled. */
|
|
56
|
|
- systemEvents.notifyOfHandlingEvent(event);
|
|
|
55
|
+ /* Publish a system event */
|
|
|
56
|
+ systemEvents.notifyOfHandlingEvent(handlingEvent);
|
|
57
|
57
|
|
|
58
|
|
- logger.info("Registered handling event");
|
|
|
58
|
+ logger.info("Registered handling event: " + handlingEvent);
|
|
59
|
59
|
}
|
|
60
|
60
|
|
|
61
|
61
|
}
|