|
|
@@ -31,17 +31,25 @@ public class TrackingServiceImpl implements TrackingService {
|
|
31
|
31
|
return;
|
|
32
|
32
|
}
|
|
33
|
33
|
|
|
34
|
|
- // TODO: more elaborate notifications, such as email to affected customer
|
|
35
|
34
|
if (cargo.isMisdirected()) {
|
|
36
|
|
- logger.info("Cargo " + trackingId + " has been misdirected. " +
|
|
37
|
|
- "Last event was " + cargo.deliveryHistory().lastEvent());
|
|
|
35
|
+ handleMisdirectedCargo(cargo);
|
|
38
|
36
|
}
|
|
39
|
37
|
if (cargo.isUnloadedAtDestination()) {
|
|
40
|
|
- logger.info("Cargo " + trackingId + " has been unloaded " +
|
|
41
|
|
- "at its final destination " + cargo.destination());
|
|
|
38
|
+ notifyCustomerOfAvailability(cargo);
|
|
42
|
39
|
}
|
|
43
|
40
|
}
|
|
44
|
41
|
|
|
|
42
|
+ private void notifyCustomerOfAvailability(Cargo cargo) {
|
|
|
43
|
+ // TODO: more elaborate notifications
|
|
|
44
|
+ logger.info("Cargo " + cargo.trackingId() + " has been unloaded " +
|
|
|
45
|
+ "at its final destination " + cargo.destination());
|
|
|
46
|
+ }
|
|
|
47
|
+
|
|
|
48
|
+ private void handleMisdirectedCargo(Cargo cargo) {
|
|
|
49
|
+ logger.info("Cargo " + cargo.trackingId() + " has been misdirected. " +
|
|
|
50
|
+ "Last event was " + cargo.deliveryHistory().lastEvent());
|
|
|
51
|
+ }
|
|
|
52
|
+
|
|
45
|
53
|
public void setCargoRepository(CargoRepository cargoRepository) {
|
|
46
|
54
|
this.cargoRepository = cargoRepository;
|
|
47
|
55
|
}
|