|
|
@@ -26,7 +26,7 @@ public class RoutingServiceImpl implements RoutingService {
|
|
26
|
26
|
Random random = new Random();
|
|
27
|
27
|
|
|
28
|
28
|
@Transactional(readOnly = true)
|
|
29
|
|
- public List<ItineraryCandidateDTO> calculatePossibleRoutes(TrackingId trackingId, Specification specification) {
|
|
|
29
|
+ public List<ItineraryCandidateDTO> calculatePossibleRoutes(TrackingId trackingId, RouteSpecification routeSpecification) {
|
|
30
|
30
|
final Cargo cargo = cargoRepository.find(trackingId);
|
|
31
|
31
|
if (cargo == null) {
|
|
32
|
32
|
return Collections.emptyList();
|
|
|
@@ -35,7 +35,7 @@ public class RoutingServiceImpl implements RoutingService {
|
|
35
|
35
|
List<Location> allLocations = locationRepository.findAll();
|
|
36
|
36
|
|
|
37
|
37
|
allLocations.remove(cargo.origin());
|
|
38
|
|
- allLocations.remove(cargo.finalDestination());
|
|
|
38
|
+ allLocations.remove(cargo.destination());
|
|
39
|
39
|
|
|
40
|
40
|
final int candidateCount = getRandomNumberOfCandidates();
|
|
41
|
41
|
final List<ItineraryCandidateDTO> candidates = new ArrayList<ItineraryCandidateDTO>(candidateCount);
|
|
|
@@ -54,7 +54,7 @@ public class RoutingServiceImpl implements RoutingService {
|
|
54
|
54
|
}
|
|
55
|
55
|
|
|
56
|
56
|
final Location lastLegFrom = allLocations.get(allLocations.size() - 1);
|
|
57
|
|
- legs.add(new Leg(getRandomCarrierMovement(), lastLegFrom, cargo.finalDestination()));
|
|
|
57
|
+ legs.add(new Leg(getRandomCarrierMovement(), lastLegFrom, cargo.destination()));
|
|
58
|
58
|
|
|
59
|
59
|
final Itinerary itinerary = new Itinerary(legs);
|
|
60
|
60
|
candidates.add(assembler.toDTO(itinerary));
|