|
|
@@ -3,6 +3,7 @@ package se.citerus.dddsample.application.impl;
|
|
3
|
3
|
import org.apache.commons.lang.Validate;
|
|
4
|
4
|
import org.apache.commons.logging.Log;
|
|
5
|
5
|
import org.apache.commons.logging.LogFactory;
|
|
|
6
|
+import org.springframework.transaction.annotation.Transactional;
|
|
6
|
7
|
import se.citerus.dddsample.application.BookingService;
|
|
7
|
8
|
import se.citerus.dddsample.domain.model.cargo.*;
|
|
8
|
9
|
import se.citerus.dddsample.domain.model.location.Location;
|
|
|
@@ -26,6 +27,8 @@ public final class BookingServiceImpl implements BookingService {
|
|
26
|
27
|
this.routingService = routingService;
|
|
27
|
28
|
}
|
|
28
|
29
|
|
|
|
30
|
+ @Override
|
|
|
31
|
+ @Transactional
|
|
29
|
32
|
public TrackingId bookNewCargo(final UnLocode originUnLocode, final UnLocode destinationUnLocode) {
|
|
30
|
33
|
Validate.notNull(originUnLocode);
|
|
31
|
34
|
Validate.notNull(destinationUnLocode);
|
|
|
@@ -42,9 +45,11 @@ public final class BookingServiceImpl implements BookingService {
|
|
42
|
45
|
return cargo.trackingId();
|
|
43
|
46
|
}
|
|
44
|
47
|
|
|
|
48
|
+ @Override
|
|
|
49
|
+ @Transactional
|
|
45
|
50
|
public List<Itinerary> requestPossibleRoutesForCargo(TrackingId trackingId) {
|
|
46
|
51
|
Validate.notNull(trackingId);
|
|
47
|
|
-
|
|
|
52
|
+
|
|
48
|
53
|
final Cargo cargo = cargoRepository.find(trackingId);
|
|
49
|
54
|
final RouteSpecification routeSpecification = new RouteSpecification(cargo.origin(), cargo.destination(), new Date());
|
|
50
|
55
|
|