Exemplo n.º 1
0
 public ModelAndView updateVehicle(HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   ModelAndView model = new ModelAndView(LiConstants.JSP_ADD_VEHICLE);
   Vehicle dataBean =
       vehicleBusiness.findAndKeepVehicleByID(new Long(getVehicleIdFromSession(request)));
   VehicleInfoBean formBean = new VehicleInfoBean();
   helper.convertDataBeanToFormBean(dataBean, formBean);
   formBean.setVinVerifiedFlag(true);
   model.addObject(VEHICLE_PARAM, formBean);
   loadReferenceData(request, model);
   populateSelectedVehicle(request, dataBean);
   return model;
 }
Exemplo 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;
 }