Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. protected ModelAndView onSubmit( final HttpServletRequest request,
  2. final HttpServletResponse response, final Object command,
  3. final BindException errors ) {
  4. final PlannerInfoFormBean plannerinfoFormbean = (PlannerInfoFormBean)command;
  5. String rfp = null;
  6. // try {
  7. validateObject( plannerinfoFormbean, ErrorCodes.SYSTEM_NOT_AVAILABLE.getCode() );
  8. rfp = request.getParameter( "rfp" );
  9. final EmailOptions emailOpt = new EmailOptions();
  10. final Guest guest = plannerinfoFormbean.getGuest();
  11. String phoneNumber = guest.getPhone().getNumber();
  12. phoneNumber = removeSpecialCharacters( phoneNumber );
  13. guest.getPhone().setNumber( phoneNumber );
  14. validateObject( guest, ErrorCodes.SYSTEM_NOT_AVAILABLE.getCode() );
  15. guest.setEmailOptions( emailOpt );
  16.  
  17. //Get the country code and search Country object and set the Display name
  18. Map<String, BasePopulator> populatorMap = this.getPopulators();
  19. BasePopulator countryPopulator = populatorMap.get("countryPopulator");
  20. List<Country> countries = countryPopulator.getPopulator(request);
  21. for(Country country : countries) {
  22. if(country.getCode().equals(plannerinfoFormbean.getSelectedCountryCode())) {
  23. guest.getAddress().getCountry().setCode(country.getCode());
  24. guest.getAddress().getCountry().setIsoCode(country.getIsoCode());
  25. guest.getAddress().getCountry().setName(country.getName());
  26. break;
  27. }
  28. }
  29.  
  30. if ( StringUtils.isSet( plannerinfoFormbean.getProvince() )
  31. && guest.getAddress() != null && guest.getAddress().getState() != null ) {
  32. guest.getAddress().getState().setName( plannerinfoFormbean.getProvince() );
  33. }
  34. final ReservationDTO reservationDTO = (ReservationDTO)request.getSession()
  35. .getAttribute( EasyMeetingsConstants.RESERVATION_DTO );
  36. //TODO
  37. request.getSession().setAttribute("bookingPersonalInfoSessionAttr","bookingPersonalInfoSessionAttrValue");
  38.  
  39. validateObject( reservationDTO, ErrorCodes.SESSION_EXPIRED.getCode() );
  40. if ( LOGGER.isDebugEnabled() ) {
  41. LOGGER.debug( "Booking Personal Info Controller...ReservationDTO....."
  42. + reservationDTO );
  43. }
  44. reservationDTO.setGuest( guest );
  45. reservationDTO.setEventName( plannerinfoFormbean.getEventName() );
  46. reservationDTO.setCompanyName( plannerinfoFormbean.getCompany() );
  47. request.getSession().setAttribute(
  48. EasyMeetingsConstants.RESERVATION_DTO, reservationDTO );
  49.  
  50. String spReq = plannerinfoFormbean.getSpecialReq();
  51. spReq = spReq.replaceAll( "\r", "\\\\r" );
  52. spReq = spReq.replaceAll( "\n", "\\\\n" );
  53. request.getSession().setAttribute( EasyMeetingsConstants.SPECIAL_REQ, spReq );
  54. // } catch( final Exception ex ) {
  55. // LOGGER.error( "Exception in Booking personal information page.", ex );
  56. // plannerinfoFormbean.setErrorCode( ErrorCodes.INPUT_INVALID_ERROR.getCode() );
  57. // final Map<String, Object> modelMap = new HashMap<String, Object>();
  58. // modelMap.put( "plannerinfoFormBean", plannerinfoFormbean );
  59. // view = this.getFormView();
  60. //
  61. // ModelAndView modelAndView = new ModelAndView( view ).addAllObjects( modelMap );
  62. // try {
  63. // modelAndView = showForm( request, response, errors ).addAllObjects( modelMap );
  64. // } catch( Exception e ) {
  65. // LOGGER.error( "Error binder not found .", e );
  66. // }
  67. // return modelAndView;
  68. // }
  69. String successView = null;
  70. if ( rfp != null ) {
  71. successView = UrlGeneratorUtils.generateSecureUrl(
  72. request, "rfpsleeping?hotelMnemonic=ATLDC" );
  73. } else {
  74.  
  75. successView = UrlGeneratorUtils.generateSecureUrl(
  76. request, "bookingpaymentcontroller" );
  77. }
  78. request.getSession().setAttribute("workDamnit", "foo");
  79. //TODO
  80. return new ModelAndView( new RedirectView( successView ) );
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement