|
|
@@ -39,11 +39,11 @@ public class CargoServiceImpl implements CargoService {
|
|
39
|
39
|
}
|
|
40
|
40
|
|
|
41
|
41
|
@Transactional(readOnly = true)
|
|
42
|
|
- public List<String> shippingLocations() {
|
|
|
42
|
+ public List<UnLocode> shippingLocations() {
|
|
43
|
43
|
List<Location> allLocations = locationRepository.findAll();
|
|
44
|
|
- List<String> unlocodes = new ArrayList<String>(allLocations.size());
|
|
|
44
|
+ List<UnLocode> unlocodes = new ArrayList<UnLocode>(allLocations.size());
|
|
45
|
45
|
for (Location location : allLocations) {
|
|
46
|
|
- unlocodes.add(location.unLocode().idString());
|
|
|
46
|
+ unlocodes.add(location.unLocode());
|
|
47
|
47
|
}
|
|
48
|
48
|
return unlocodes;
|
|
49
|
49
|
}
|
|
|
@@ -177,7 +177,8 @@ public class CargoServiceImpl implements CargoService {
|
|
177
|
177
|
locationRepository.find(new UnLocode(legDTO.getTo())))
|
|
178
|
178
|
);
|
|
179
|
179
|
}
|
|
180
|
|
-
|
|
|
180
|
+ // TODO: delete orphaned itineraries manually.
|
|
|
181
|
+ // Can't cascade delete-orphan for many-to-one using mapping directives.
|
|
181
|
182
|
cargo.setItinerary(new Itinerary(legs));
|
|
182
|
183
|
cargoRepository.save(cargo);
|
|
183
|
184
|
}
|