package se.citerus.dddsample.interfaces.tracking; import org.springframework.context.MessageSource; import org.springframework.stereotype.Controller; import org.springframework.validation.BindException; import org.springframework.validation.BindingResult; import org.springframework.validation.Errors; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.support.RequestContextUtils; import se.citerus.dddsample.domain.model.cargo.Cargo; import se.citerus.dddsample.domain.model.cargo.CargoRepository; import se.citerus.dddsample.domain.model.cargo.TrackingId; import se.citerus.dddsample.domain.model.handling.HandlingEvent; import se.citerus.dddsample.domain.model.handling.HandlingEventRepository; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; /** * Controller for tracking cargo. This interface sits immediately on top of the * domain layer, unlike the booking interface which has a a remote facade and supporting * DTOs in between. *
* An adapter class, designed for the tracking use case, is used to wrap the domain model * to make it easier to work with in a web page rendering context. We do not want to apply * view rendering constraints to the design of our domain model, and the adapter * helps us shield the domain model classes. * * * @eee se.citerus.dddsample.application.web.CargoTrackingViewAdapter * @see se.citerus.dddsample.interfaces.booking.web.CargoAdminController * */ @Controller public final class CargoTrackingController { private CargoRepository cargoRepository; private HandlingEventRepository handlingEventRepository; private MessageSource messageSource; @RequestMapping(method = RequestMethod.GET) public Map