Procházet zdrojové kódy

Null check, removed unused methods.

peter_backlund před 16 roky
rodič
revize
f6417be445

+ 4
- 0
dddsample/tracking/core/src/main/java/se/citerus/dddsample/tracking/core/domain/model/cargo/Cargo.java Zobrazit soubor

@@ -262,6 +262,10 @@ 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) {
266
+      return other;
267
+    }
268
+
265 269
     if (isMisdirected() && transportStatus() == ONBOARD_CARRIER) {
266 270
       final Leg currentLeg = Leg.deriveLeg(
267 271
         currentVoyage(), lastKnownLocation(), currentVoyage().arrivalLocationAfterDepartureFrom(lastKnownLocation())

+ 0
- 16
dddsample/tracking/core/src/main/java/se/citerus/dddsample/tracking/core/domain/model/cargo/Leg.java Zobrazit soubor

@@ -115,22 +115,6 @@ public class Leg extends ValueObjectSupport<Leg> {
115 115
     return false;
116 116
   }
117 117
 
118
-  Leg ifLoadLocationSameAs(final HandlingActivity handlingActivity) {
119
-    if (loadLocation.sameAs(handlingActivity.location())) {
120
-      return this;
121
-    } else {
122
-      return null;
123
-    }
124
-  }
125
-
126
-  Leg ifUnloadLocationSameAs(final HandlingActivity handlingActivity) {
127
-    if (unloadLocation.sameAs(handlingActivity.location())) {
128
-      return this;
129
-    } else {
130
-      return null;
131
-    }
132
-  }
133
-
134 118
   HandlingActivity deriveLoadActivity() {
135 119
     return loadOnto(voyage).in(loadLocation);
136 120
   }