|
|
@@ -4,7 +4,7 @@ import org.apache.commons.lang.Validate;
|
|
4
|
4
|
import org.apache.commons.logging.Log;
|
|
5
|
5
|
import org.apache.commons.logging.LogFactory;
|
|
6
|
6
|
import org.springframework.transaction.annotation.Transactional;
|
|
7
|
|
-import se.citerus.dddsample.application.SystemEvents;
|
|
|
7
|
+import se.citerus.dddsample.application.ApplicationEvents;
|
|
8
|
8
|
import se.citerus.dddsample.application.TrackingService;
|
|
9
|
9
|
import se.citerus.dddsample.domain.model.cargo.Cargo;
|
|
10
|
10
|
import se.citerus.dddsample.domain.model.cargo.CargoRepository;
|
|
|
@@ -12,18 +12,18 @@ import se.citerus.dddsample.domain.model.cargo.TrackingId;
|
|
12
|
12
|
|
|
13
|
13
|
public class TrackingServiceImpl implements TrackingService {
|
|
14
|
14
|
|
|
15
|
|
- private final SystemEvents systemEvents;
|
|
|
15
|
+ private final ApplicationEvents applicationEvents;
|
|
16
|
16
|
private final CargoRepository cargoRepository;
|
|
17
|
17
|
private final Log logger = LogFactory.getLog(getClass());
|
|
18
|
18
|
|
|
19
|
|
- public TrackingServiceImpl(SystemEvents systemEvents, CargoRepository cargoRepository) {
|
|
20
|
|
- this.systemEvents = systemEvents;
|
|
|
19
|
+ public TrackingServiceImpl(final ApplicationEvents applicationEvents, final CargoRepository cargoRepository) {
|
|
|
20
|
+ this.applicationEvents = applicationEvents;
|
|
21
|
21
|
this.cargoRepository = cargoRepository;
|
|
22
|
22
|
}
|
|
23
|
23
|
|
|
24
|
24
|
@Override
|
|
25
|
25
|
@Transactional(readOnly = true)
|
|
26
|
|
- public void onCargoHandled(final TrackingId trackingId) {
|
|
|
26
|
+ public void inspectCargo(final TrackingId trackingId) {
|
|
27
|
27
|
Validate.notNull(trackingId, "Tracking ID is required");
|
|
28
|
28
|
|
|
29
|
29
|
final Cargo cargo = cargoRepository.find(trackingId);
|
|
|
@@ -35,11 +35,11 @@ public class TrackingServiceImpl implements TrackingService {
|
|
35
|
35
|
// TODO cargo delivery status update would happen here
|
|
36
|
36
|
|
|
37
|
37
|
if (cargo.isMisdirected()) {
|
|
38
|
|
- systemEvents.cargoWasMisdirected(cargo);
|
|
|
38
|
+ applicationEvents.cargoWasMisdirected(cargo);
|
|
39
|
39
|
}
|
|
40
|
40
|
|
|
41
|
41
|
if (cargo.isUnloadedAtDestination()) {
|
|
42
|
|
- systemEvents.cargoHasArrived(cargo);
|
|
|
42
|
+ applicationEvents.cargoHasArrived(cargo);
|
|
43
|
43
|
}
|
|
44
|
44
|
}
|
|
45
|
45
|
|