+ * It is used as a message queue element. */ public final class HandlingEventRegistrationAttempt implements Serializable { - private final Instant registrationTime; - private final Instant completionTime; - private final TrackingId trackingId; - private final VoyageNumber voyageNumber; - private final HandlingEvent.Type type; - private final UnLocode unLocode; + private final Instant registrationTime; + private final Instant completionTime; + private final TrackingId trackingId; + private final VoyageNumber voyageNumber; + private final HandlingEvent.Type type; + private final UnLocode unLocode; - public HandlingEventRegistrationAttempt(final Instant registrationDate, - final Instant completionDate, - final TrackingId trackingId, - final VoyageNumber voyageNumber, - final HandlingEvent.Type type, - final UnLocode unLocode) { - this.registrationTime = registrationDate; - this.completionTime = completionDate; - this.trackingId = trackingId; - this.voyageNumber = voyageNumber; - this.type = type; - this.unLocode = unLocode; - } + public HandlingEventRegistrationAttempt(@NonNull Instant registrationTime, + @NonNull Instant completionTime, + @NonNull TrackingId trackingId, + @NonNull VoyageNumber voyageNumber, + @NonNull HandlingEvent.Type type, + @NonNull UnLocode unLocode) { + this.registrationTime = registrationTime; + this.completionTime = completionTime; + this.trackingId = trackingId; + this.voyageNumber = voyageNumber; + this.type = type; + this.unLocode = unLocode; + } - public Instant getCompletionTime() { - return completionTime; - } + public Instant getCompletionTime() { + return completionTime; + } - public TrackingId getTrackingId() { - return trackingId; - } + public TrackingId getTrackingId() { + return trackingId; + } - public VoyageNumber getVoyageNumber() { - return voyageNumber; - } + public VoyageNumber getVoyageNumber() { + return voyageNumber; + } - public HandlingEvent.Type getType() { - return type; - } + public HandlingEvent.Type getType() { + return type; + } - public UnLocode getUnLocode() { - return unLocode; - } + public UnLocode getUnLocode() { + return unLocode; + } - public Instant getRegistrationTime() { - return registrationTime; - } + public Instant getRegistrationTime() { + return registrationTime; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + } - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); - } - } diff --git a/src/main/java/se/citerus/dddsample/interfaces/handling/HandlingReportParser.java b/src/main/java/se/citerus/dddsample/interfaces/handling/HandlingReportParser.java index 4d822d0fe..fca5187e4 100644 --- a/src/main/java/se/citerus/dddsample/interfaces/handling/HandlingReportParser.java +++ b/src/main/java/se/citerus/dddsample/interfaces/handling/HandlingReportParser.java @@ -7,11 +7,13 @@ import se.citerus.dddsample.domain.model.voyage.VoyageNumber; import se.citerus.dddsample.interfaces.handling.ws.HandlingReport; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.*; import java.time.format.DateTimeParseException; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.Optional; import static java.util.Collections.emptyList; import static java.util.stream.Collectors.toList; diff --git a/src/main/java/se/citerus/dddsample/interfaces/handling/file/UploadDirectoryScanner.java b/src/main/java/se/citerus/dddsample/interfaces/handling/file/UploadDirectoryScanner.java index b1f15d9c2..adc80e0d1 100644 --- a/src/main/java/se/citerus/dddsample/interfaces/handling/file/UploadDirectoryScanner.java +++ b/src/main/java/se/citerus/dddsample/interfaces/handling/file/UploadDirectoryScanner.java @@ -17,7 +17,10 @@ import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.time.Instant; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.TimerTask; import static se.citerus.dddsample.interfaces.handling.HandlingReportParser.*; diff --git a/src/main/java/se/citerus/dddsample/interfaces/handling/ws/HandlingReportServiceImpl.java b/src/main/java/se/citerus/dddsample/interfaces/handling/ws/HandlingReportServiceImpl.java index 025b3ea37..21a27ef1f 100644 --- a/src/main/java/se/citerus/dddsample/interfaces/handling/ws/HandlingReportServiceImpl.java +++ b/src/main/java/se/citerus/dddsample/interfaces/handling/ws/HandlingReportServiceImpl.java @@ -1,5 +1,6 @@ package se.citerus.dddsample.interfaces.handling.ws; +import jakarta.validation.Valid; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.ResponseEntity; @@ -9,7 +10,6 @@ import se.citerus.dddsample.application.ApplicationEvents; import se.citerus.dddsample.interfaces.handling.HandlingEventRegistrationAttempt; -import javax.validation.Valid; import java.lang.invoke.MethodHandles; import java.util.List; diff --git a/src/main/java/se/citerus/dddsample/interfaces/tracking/CargoTrackingController.java b/src/main/java/se/citerus/dddsample/interfaces/tracking/CargoTrackingController.java index 4b051909d..b7eb1b604 100644 --- a/src/main/java/se/citerus/dddsample/interfaces/tracking/CargoTrackingController.java +++ b/src/main/java/se/citerus/dddsample/interfaces/tracking/CargoTrackingController.java @@ -1,6 +1,8 @@ package se.citerus.dddsample.interfaces.tracking; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.context.MessageSource; +import org.springframework.lang.NonNull; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.RequestMapping; @@ -12,7 +14,6 @@ import se.citerus.dddsample.domain.model.handling.HandlingEvent; import se.citerus.dddsample.domain.model.handling.HandlingEventRepository; -import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Locale; import java.util.Map; @@ -28,35 +29,41 @@ * helps us shield the domain model classes. *
*
- * @eee se.citerus.dddsample.application.web.CargoTrackingViewAdapter
+ * @see CargoTrackingViewAdapter
* @see se.citerus.dddsample.interfaces.booking.web.CargoAdminController
*/
@Controller
@RequestMapping("/track")
public final class CargoTrackingController {
- private CargoRepository cargoRepository;
- private HandlingEventRepository handlingEventRepository;
- private MessageSource messageSource;
+ private final CargoRepository cargoRepository;
+ private final HandlingEventRepository handlingEventRepository;
+ private final MessageSource messageSource;
+ private final TrackCommandValidator trackCommandValidator;
- public CargoTrackingController(CargoRepository cargoRepository, HandlingEventRepository handlingEventRepository, MessageSource messageSource) {
+ public CargoTrackingController(@NonNull CargoRepository cargoRepository,
+ @NonNull HandlingEventRepository handlingEventRepository,
+ @NonNull MessageSource messageSource,
+ @NonNull TrackCommandValidator trackCommandValidator) {
this.cargoRepository = cargoRepository;
this.handlingEventRepository = handlingEventRepository;
this.messageSource = messageSource;
+ this.trackCommandValidator = trackCommandValidator;
}
@RequestMapping(method = RequestMethod.GET)
- public String get(final Map