// Path: src/main/java/se/citerus/dddsample/interfaces/booking/facade/BookingServiceFacade.java
// public interface BookingServiceFacade {
// 
//   String bookNewCargo(String origin, String destination, Date arrivalDeadline) throws RemoteException;
// 
//   CargoRoutingDTO loadCargoForRouting(String trackingId) throws RemoteException;
// 
//   void assignCargoToRoute(String trackingId, RouteCandidateDTO route) throws RemoteException;
// 
//   void changeDestination(String trackingId, String destinationUnLocode) throws RemoteException;
// 
//   List<RouteCandidateDTO> requestPossibleRoutesForCargo(String trackingId) throws RemoteException;
// 
//   List<LocationDTO> listShippingLocations() throws RemoteException;
// 
//   List<CargoRoutingDTO> listAllCargos() throws RemoteException;
// 
// }


import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import se.citerus.dddsample.interfaces.booking.facade.BookingServiceFacade;
import se.citerus.dddsample.interfaces.booking.facade.dto.CargoRoutingDTO;
import se.citerus.dddsample.interfaces.booking.facade.dto.LegDTO;
import se.citerus.dddsample.interfaces.booking.facade.dto.LocationDTO;
import se.citerus.dddsample.interfaces.booking.facade.dto.RouteCandidateDTO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
package se.citerus.dddsample.interfaces.booking.web;



/**
 * Handles cargo booking and routing. Operates against a dedicated remoting service facade,
 * and could easily be rewritten as a thick Swing client. Completely separated from the domain layer,
 * unlike the tracking user interface.
 * <p>
 * In order to successfully keep the domain model shielded from user interface considerations,
 * this approach is generally preferred to the one taken in the tracking controller. However,
 * there is never any one perfect solution for all situations, so we've chosen to demonstrate
 * two polarized ways to build user interfaces.
 *
 * @see se.citerus.dddsample.interfaces.tracking.CargoTrackingController
 */
@Controller
@RequestMapping("/admin")
public final class CargoAdminController {

// Path: src/main/java/se/citerus/dddsample/interfaces/booking/facade/BookingServiceFacade.java
// public interface BookingServiceFacade {
// 
//   String bookNewCargo(String origin, String destination, Date arrivalDeadline) throws RemoteException;
// 
//   CargoRoutingDTO loadCargoForRouting(String trackingId) throws RemoteException;
// 
//   void assignCargoToRoute(String trackingId, RouteCandidateDTO route) throws RemoteException;
// 
//   void changeDestination(String trackingId, String destinationUnLocode) throws RemoteException;
// 
//   List<RouteCandidateDTO> requestPossibleRoutesForCargo(String trackingId) throws RemoteException;
// 
//   List<LocationDTO> listShippingLocations() throws RemoteException;
// 
//   List<CargoRoutingDTO> listAllCargos() throws RemoteException;
// 
// }


// Path: src/main/java/se/citerus/dddsample/interfaces/booking/web/CargoAdminController.java
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import se.citerus.dddsample.interfaces.booking.facade.BookingServiceFacade;
import se.citerus.dddsample.interfaces.booking.facade.dto.CargoRoutingDTO;
import se.citerus.dddsample.interfaces.booking.facade.dto.LegDTO;
import se.citerus.dddsample.interfaces.booking.facade.dto.LocationDTO;
import se.citerus.dddsample.interfaces.booking.facade.dto.RouteCandidateDTO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

package se.citerus.dddsample.interfaces.booking.web;



/**
 * Handles cargo booking and routing. Operates against a dedicated remoting service facade,
 * and could easily be rewritten as a thick Swing client. Completely separated from the domain layer,
 * unlike the tracking user interface.
 * <p>
 * In order to successfully keep the domain model shielded from user interface considerations,
 * this approach is generally preferred to the one taken in the tracking controller. However,
 * there is never any one perfect solution for all situations, so we've chosen to demonstrate
 * two polarized ways to build user interfaces.
 *
 * @see se.citerus.dddsample.interfaces.tracking.CargoTrackingController
 */
@Controller
@RequestMapping("/admin")
public final class CargoAdminController {

    private BookingServiceFacade bookingServiceFacade;