|
|
@@ -214,7 +214,7 @@ public class Cargo extends EntitySupport<Cargo,TrackingId> {
|
|
214
|
214
|
* @return Customs clearance point.
|
|
215
|
215
|
*/
|
|
216
|
216
|
public Location customsClearancePoint() {
|
|
217
|
|
- if (itinerary == null) {
|
|
|
217
|
+ if (routingStatus() == NOT_ROUTED) {
|
|
218
|
218
|
return Location.NONE;
|
|
219
|
219
|
} else {
|
|
220
|
220
|
return customsZone().entryPoint(itinerary.locations());
|
|
|
@@ -247,7 +247,7 @@ public class Cargo extends EntitySupport<Cargo,TrackingId> {
|
|
247
|
247
|
public Location earliestReroutingLocation() {
|
|
248
|
248
|
if (isMisdirected()) {
|
|
249
|
249
|
if (transportStatus() == ONBOARD_CARRIER) {
|
|
250
|
|
- return currentVoyage().arrivalLocationAfterDepartureFrom(lastKnownLocation());
|
|
|
250
|
+ return currentVoyage().arrivalLocationWhenDepartedFrom(lastKnownLocation());
|
|
251
|
251
|
} else {
|
|
252
|
252
|
return lastKnownLocation();
|
|
253
|
253
|
}
|
|
|
@@ -262,13 +262,11 @@ public class Cargo extends EntitySupport<Cargo,TrackingId> {
|
|
262
|
262
|
* that describes a continuous route even if the cargo is currently misdirected.
|
|
263
|
263
|
*/
|
|
264
|
264
|
public Itinerary itineraryMergedWith(final Itinerary other) {
|
|
265
|
|
- if (this.itinerary == null) {
|
|
|
265
|
+ if (routingStatus() == NOT_ROUTED) {
|
|
266
|
266
|
return other;
|
|
267
|
|
- }
|
|
268
|
|
-
|
|
269
|
|
- if (isMisdirected() && transportStatus() == ONBOARD_CARRIER) {
|
|
|
267
|
+ } else if (isMisdirected() && transportStatus() == ONBOARD_CARRIER) {
|
|
270
|
268
|
final Leg currentLeg = Leg.deriveLeg(
|
|
271
|
|
- currentVoyage(), lastKnownLocation(), currentVoyage().arrivalLocationAfterDepartureFrom(lastKnownLocation())
|
|
|
269
|
+ currentVoyage(), lastKnownLocation(), currentVoyage().arrivalLocationWhenDepartedFrom(lastKnownLocation())
|
|
272
|
270
|
);
|
|
273
|
271
|
|
|
274
|
272
|
return this.itinerary().
|
|
|
@@ -284,7 +282,9 @@ public class Cargo extends EntitySupport<Cargo,TrackingId> {
|
|
284
|
282
|
|
|
285
|
283
|
private boolean succedsMostRecentActivity(final HandlingActivity newHandlingActivity) {
|
|
286
|
284
|
if (delivery.hasBeenHandled()) {
|
|
287
|
|
- final HandlingActivity priorActivity = itinerary.strictlyPriorOf(delivery.mostRecentPhysicalHandlingActivity(), newHandlingActivity);
|
|
|
285
|
+ final HandlingActivity priorActivity = itinerary.strictlyPriorOf(
|
|
|
286
|
+ delivery.mostRecentPhysicalHandlingActivity(), newHandlingActivity
|
|
|
287
|
+ );
|
|
288
|
288
|
return !newHandlingActivity.sameValueAs(priorActivity);
|
|
289
|
289
|
} else {
|
|
290
|
290
|
return true;
|