Package org.gtugs.domain

Examples of org.gtugs.domain.Guest


  }

  @Override
  protected void onBind(HttpServletRequest request, Object command) throws
      Exception {
    Guest guest = (Guest) command;
    guest.setCachedLocation(guest.getLocation());
  }
View Full Code Here


    guest.setCachedLocation(guest.getLocation());
  }

  @Override
  public ModelAndView onSubmit(Object command) throws ServletException {
    Guest guest = (Guest) command;

    guestManager.storeGuest(guest);
    locationManager.incrementOrStoreLocation(guest.getLatitude(),
        guest.getLongitude());

    //return new ModelAndView(
        //new RedirectView("/signUp.jsp?cc=" + guest.getCountry()));
    return new ModelAndView(new RedirectView("/signUp.jsp"));
  }
View Full Code Here

  public boolean supports(Class c) {
    return Guest.class.equals(c);
  }

  public void validate(Object obj, Errors errors) {
    Guest guest = (Guest) obj;
    boolean locationErrors = false;

    if (guest == null) {
      errors.rejectValue("name", "error.name-required", null, "Required");
    }
    else {
      if (guest.getName() == null || guest.getName().equals("")) {
        errors.rejectValue("name", "error.name-required", null, "Required");
      }
      if (guest.getEmail() == null || guest.getEmail().equals("")) {
        errors.rejectValue("email", "error.email-required", null, "Required");
      } else if (!isValidEmail(guest.getEmail())) {
        errors.rejectValue("email", "error.invalid-email", null, "Invalid");
      }
      if (guest.getLocation() == null || guest.getLocation().equals("")) {
        errors.rejectValue("location", "error.location-required", null, "Required");
        locationErrors = true;
      }
      if (guest.getInterest() == null || guest.getInterest().equals("")) {
        errors.rejectValue("interest", "error.interest-required", null, "Required");
      }

      if (!locationErrors) {
        Point point = mapsService.getCoordinates(guest.getLocation(),
            guest.getCountry());
        if (point == null) {
          errors.rejectValue("location", "error.geocoding-failed", null, "Geocoding failed");
          errors.rejectValue("country", "error.geocoding-failed", null, "Geocoding failed");
        } else {
          guest.setLatitude(point.getLatitude());
          guest.setLongitude(point.getLongitude());
        }
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.gtugs.domain.Guest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.