Esempio n. 1
0
 private void populateSelectedVehicle(HttpServletRequest request, Vehicle veh) {
   SelectedVehicle selVeh = (SelectedVehicle) request.getAttribute(DLRConstants.SELECTED_VEHICLE);
   if (selVeh == null) {
     selVeh = new SelectedVehicle();
   }
   selVeh.setDisplaySelectedVehicleInfo(true);
   selVeh.setVin(veh.getVin());
   request.setAttribute(DLRConstants.SELECTED_VEHICLE, selVeh);
 }
Esempio n. 2
0
 public ModelAndView saveVehicle(
     HttpServletRequest request, HttpServletResponse response, VehicleInfoBean formBean)
     throws Exception {
   ModelAndView model = null;
   Vehicle dataBean = null;
   if (getVehicleIdFromSession(request) != null) {
     dataBean = vehicleBusiness.findAndKeepVehicleByID(new Long(getVehicleIdFromSession(request)));
   } else {
     dataBean = new Vehicle();
   }
   helper.convertFormBeanToDataBean(formBean, dataBean);
   vehicleBusiness.saveVehicle(dataBean);
   request.getSession().setAttribute(LiConstants.SESSION_VEHICLE_ID, dataBean.getId().toString());
   if (formBean.getTitleContext() != null && formBean.getTitleContext().booleanValue()) {
     model =
         new ModelAndView(
             new RedirectView(
                 "processOriginalTitle.do?formAction=addVehicle&_vehicleId=" + dataBean.getId()));
   } else {
     model = new ModelAndView(new RedirectView(VEHICLE_VIEW_BASIC_RECORD));
   }
   return model;
 }
  @Override
  protected Object formBackingObject(HttpServletRequest request) throws Exception {
    Vehicle vehicle = null;
    // Get the vehicle ID from the Request.
    String vehicleId = (String) request.getParameter(VTRConstants.VEHICLEID);
    Long vehId = Long.parseLong(vehicleId);

    // activating the Customer Tab
    request.setAttribute("customerActiveBoolean", true);
    String transactionId = request.getParameter(VTRConstants.TRANSACTION_ID);

    TransactionDetail transDetail =
        vehicleTitlingBusiness.findAndKeepTransactionDetailById(Long.parseLong(transactionId));
    Long titleId =
        vehicleTitlingBusiness.findAndKeepTitleIdByTransactionId(Long.valueOf(transactionId));
    if (request.getParameter(VTRConstants.VEHICLEID) != null) {
      vehicle =
          vehicleTitlingBusiness.findAndKeepVehicleRegistrationDetailsByVehicleId(vehId, titleId);
      vehicle.getTitleList().addAll(vehicle.getTitles());
      // Setting the header attributes in the request
      request.setAttribute(VTRConstants.YEAR, vehicle.getYear());
      request.setAttribute(VTRConstants.MAKE, vehicle.getMake());
      request.setAttribute(VTRConstants.MODEL, vehicle.getModel());
      request.setAttribute(VTRConstants.VIN, vehicle.getVin());
      if (vehicle == null) {
        vehicle = new Vehicle();
      }
    } else {
      vehicle = new Vehicle();
    }

    request.setAttribute(
        VTRConstants.ADD_VEHICLE_CONTINUE_TO_TITLE, transDetail.getContinueToTitle());
    request.setAttribute(
        VTRConstants.ADD_VEHICLE_CONTINUE_TO_REG, transDetail.getContinueToRegFromTitling());

    return vehicle;
  }