@Override public String bookNewCargo(String origin, String destination, Date arrivalDeadline) { TrackingId trackingId = bookingService.bookNewCargo( new UnLocode(origin), new UnLocode(destination), arrivalDeadline); return trackingId.idString(); }
@Override public void assignCargoToRoute(String trackingIdStr, RouteCandidateDTO routeCandidateDTO) { final Itinerary itinerary = new ItineraryCandidateDTOAssembler() .fromDTO(routeCandidateDTO, voyageRepository, locationRepository); final TrackingId trackingId = new TrackingId(trackingIdStr); bookingService.assignCargoToRoute(itinerary, trackingId); }
@Override public List<RouteCandidateDTO> requestPossibleRoutesForCargo(String trackingId) throws RemoteException { final List<Itinerary> itineraries = bookingService.requestPossibleRoutesForCargo(new TrackingId(trackingId)); final List<RouteCandidateDTO> routeCandidates = new ArrayList<RouteCandidateDTO>(itineraries.size()); final ItineraryCandidateDTOAssembler dtoAssembler = new ItineraryCandidateDTOAssembler(); for (Itinerary itinerary : itineraries) { routeCandidates.add(dtoAssembler.toDTO(itinerary)); } return routeCandidates; }
@Override public void changeDestination(String trackingId, String destinationUnLocode) throws RemoteException { bookingService.changeDestination(new TrackingId(trackingId), new UnLocode(destinationUnLocode)); }