|
|
@@ -28,12 +28,20 @@ import java.util.Properties;
|
|
28
|
28
|
*/
|
|
29
|
29
|
public class ExternalRoutingService implements RoutingService {
|
|
30
|
30
|
|
|
31
|
|
- private GraphTraversalService graphTraversalService;
|
|
32
|
|
- private LocationRepository locationRepository;
|
|
33
|
|
- private VoyageRepository voyageRepository;
|
|
|
31
|
+ private final GraphTraversalService graphTraversalService;
|
|
|
32
|
+ private final LocationRepository locationRepository;
|
|
|
33
|
+ private final VoyageRepository voyageRepository;
|
|
34
|
34
|
private static final Log log = LogFactory.getLog(ExternalRoutingService.class);
|
|
35
|
35
|
|
|
36
|
|
- public List<Itinerary> fetchRoutesForSpecification(RouteSpecification routeSpecification) {
|
|
|
36
|
+ public ExternalRoutingService(final GraphTraversalService graphTraversalService,
|
|
|
37
|
+ final LocationRepository locationRepository,
|
|
|
38
|
+ final VoyageRepository voyageRepository) {
|
|
|
39
|
+ this.graphTraversalService = graphTraversalService;
|
|
|
40
|
+ this.locationRepository = locationRepository;
|
|
|
41
|
+ this.voyageRepository = voyageRepository;
|
|
|
42
|
+ }
|
|
|
43
|
+
|
|
|
44
|
+ public List<Itinerary> fetchRoutesForSpecification(final RouteSpecification routeSpecification) {
|
|
37
|
45
|
/*
|
|
38
|
46
|
The RouteSpecification is picked apart and adapted to the external API.
|
|
39
|
47
|
*/
|
|
|
@@ -81,7 +89,7 @@ public class ExternalRoutingService implements RoutingService {
|
|
81
|
89
|
return new Itinerary(legs);
|
|
82
|
90
|
}
|
|
83
|
91
|
|
|
84
|
|
- private Leg toLeg(TransitEdge edge) {
|
|
|
92
|
+ private Leg toLeg(final TransitEdge edge) {
|
|
85
|
93
|
return new Leg(
|
|
86
|
94
|
voyageRepository.find(new VoyageNumber(edge.getVoyageNumber())),
|
|
87
|
95
|
locationRepository.find(new UnLocode(edge.getFromUnLocode())),
|
|
|
@@ -90,16 +98,4 @@ public class ExternalRoutingService implements RoutingService {
|
|
90
|
98
|
);
|
|
91
|
99
|
}
|
|
92
|
100
|
|
|
93
|
|
- public void setGraphTraversalService(GraphTraversalService graphTraversalService) {
|
|
94
|
|
- this.graphTraversalService = graphTraversalService;
|
|
95
|
|
- }
|
|
96
|
|
-
|
|
97
|
|
- public void setLocationRepository(LocationRepository locationRepository) {
|
|
98
|
|
- this.locationRepository = locationRepository;
|
|
99
|
|
- }
|
|
100
|
|
-
|
|
101
|
|
- public void setVoyageRepository(VoyageRepository voyageRepository) {
|
|
102
|
|
- this.voyageRepository = voyageRepository;
|
|
103
|
|
- }
|
|
104
|
|
-
|
|
105
|
101
|
}
|