1 package se.citerus.dddsample.application;
2
3 import se.citerus.dddsample.domain.model.cargo.Itinerary;
4 import se.citerus.dddsample.domain.model.cargo.TrackingId;
5 import se.citerus.dddsample.domain.model.location.UnLocode;
6
7 import java.util.Date;
8 import java.util.List;
9
10 /**
11 * Cargo booking service.
12 */
13 public interface BookingService {
14
15 /**
16 * Registers a new cargo in the tracking system, not yet routed.
17 *
18 * @param origin cargo origin
19 * @param destination cargo destination
20 * @param arrivalDeadline arrival deadline
21 * @return Cargo tracking id
22 */
23 TrackingId bookNewCargo(UnLocode origin, UnLocode destination, Date arrivalDeadline);
24
25 /**
26 * Requests a list of itineraries describing possible routes for this cargo.
27 *
28 * @param trackingId cargo tracking id
29 * @return A list of possible itineraries for this cargo
30 */
31 List<Itinerary> requestPossibleRoutesForCargo(TrackingId trackingId);
32
33 /**
34 * @param itinerary itinerary describing the selected route
35 * @param trackingId cargo tracking id
36 */
37 void assignCargoToRoute(Itinerary itinerary, TrackingId trackingId);
38
39 /**
40 * Changes the destination of a cargo.
41 *
42 * @param trackingId cargo tracking id
43 * @param unLocode UN locode of new destination
44 */
45 void changeDestination(TrackingId trackingId, UnLocode unLocode);
46
47 }