Просмотр исходного кода

Variable name change, removed explicit rollback in annotation (made exception unchecked).

peter_backlund 17 лет назад
Родитель
Сommit
813a0c1b36

+ 9
- 9
dddsample/tracking/core/src/main/java/se/citerus/dddsample/tracking/core/application/handling/HandlingEventServiceImpl.java Просмотреть файл

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

+ 1
- 1
dddsample/tracking/core/src/main/java/se/citerus/dddsample/tracking/core/domain/model/handling/CannotCreateHandlingEventException.java Просмотреть файл

@@ -8,7 +8,7 @@ package se.citerus.dddsample.tracking.core.domain.model.handling;
8 8
  * special case that the application is built to handle. It can occur during normal
9 9
  * program execution.
10 10
  */
11
-public class CannotCreateHandlingEventException extends Exception {
11
+public class CannotCreateHandlingEventException extends RuntimeException {
12 12
   public CannotCreateHandlingEventException(Exception e) {
13 13
     super(e);
14 14
   }