|
|
@@ -3,7 +3,32 @@ package se.citerus.dddsample.domain;
|
|
3
|
3
|
import org.apache.commons.lang.Validate;
|
|
4
|
4
|
|
|
5
|
5
|
/**
|
|
6
|
|
- * A Cargo.
|
|
|
6
|
+ * A Cargo. This is the central class in the domain model,
|
|
|
7
|
+ * and it is the root of the Cargo-Itinerary-Leg-DeliveryHistory aggregate.
|
|
|
8
|
+ *
|
|
|
9
|
+ * A cargo is identified by a unique tracking id, and it always has an origin
|
|
|
10
|
+ * and a destination. The life cycle of a cargo begins with the booking procedure,
|
|
|
11
|
+ * when the tracking id is assigned. During a (short) period of time, between booking
|
|
|
12
|
+ * and initial routing, the cargo has no itinerary.
|
|
|
13
|
+ *
|
|
|
14
|
+ * The booking clerk requests a list of possible routes, matching a route specification,
|
|
|
15
|
+ * and assigns the cargo to one route. An itinerary listing the legs of the route
|
|
|
16
|
+ * is attached to the cargo.
|
|
|
17
|
+ *
|
|
|
18
|
+ * A cargo can be re-routed during transport, on demand of the customer, in which case
|
|
|
19
|
+ * the destination is changed and a new route is requested. The old itinerary,
|
|
|
20
|
+ * being a value object, is discarded and a new one is attached.
|
|
|
21
|
+ *
|
|
|
22
|
+ * It may also happen that a cargo is accidentally misrouted, which should notify the proper
|
|
|
23
|
+ * personnel and also trigger a re-routing procedure.
|
|
|
24
|
+ *
|
|
|
25
|
+ * The life cycle of a cargo ends when the cargo is claimed by the customer.
|
|
|
26
|
+ *
|
|
|
27
|
+ * The cargo aggregate, and the entre domain model, is built to solve the problem
|
|
|
28
|
+ * of booking and tracking cargo. All important buisness rules for determining whether
|
|
|
29
|
+ * or not a cargo is misrouted, what the current status of the cargo is (on board carrier,
|
|
|
30
|
+ * in port etc), are captured in this aggregate.
|
|
|
31
|
+ *
|
|
7
|
32
|
*/
|
|
8
|
33
|
public final class Cargo implements Entity<Cargo> {
|
|
9
|
34
|
|