|
|
@@ -3,7 +3,6 @@ package se.citerus.dddsample.infrastructure.routing;
|
|
3
|
3
|
import com.partner.pathfinder.api.GraphTraversalService;
|
|
4
|
4
|
import com.partner.pathfinder.api.TransitEdge;
|
|
5
|
5
|
import com.partner.pathfinder.api.TransitPath;
|
|
6
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
7
|
6
|
import se.citerus.dddsample.domain.model.cargo.Itinerary;
|
|
8
|
7
|
import se.citerus.dddsample.domain.model.cargo.Leg;
|
|
9
|
8
|
import se.citerus.dddsample.domain.model.cargo.RouteSpecification;
|
|
|
@@ -30,11 +29,12 @@ public class ExternalRoutingService implements RoutingService {
|
|
30
|
29
|
private LocationRepository locationRepository;
|
|
31
|
30
|
private VoyageRepository voyageRepository;
|
|
32
|
31
|
|
|
33
|
|
- @Transactional(readOnly = true)
|
|
34
|
32
|
public List<Itinerary> fetchRoutesForSpecification(RouteSpecification routeSpecification) {
|
|
35
|
33
|
final Location origin = routeSpecification.origin();
|
|
36
|
34
|
final Location destination = routeSpecification.destination();
|
|
37
|
35
|
|
|
|
36
|
+ // TODO send arrival deadline too
|
|
|
37
|
+
|
|
38
|
38
|
final List<TransitPath> transitPaths = graphTraversalService.findShortestPath(
|
|
39
|
39
|
origin.unLocode().idString(),
|
|
40
|
40
|
destination.unLocode().idString()
|
|
|
@@ -47,6 +47,8 @@ public class ExternalRoutingService implements RoutingService {
|
|
47
|
47
|
// Use the specification to safe-guard against invalid itineraries
|
|
48
|
48
|
if (routeSpecification.isSatisfiedBy(itinerary)) {
|
|
49
|
49
|
itineraries.add(itinerary);
|
|
|
50
|
+ } else {
|
|
|
51
|
+ // TODO log warning/error? Fail?
|
|
50
|
52
|
}
|
|
51
|
53
|
}
|
|
52
|
54
|
|