Package org.gtugs.domain

Examples of org.gtugs.domain.Point


      JSONObject placemark =
          (JSONObject) ((JSONArray) root.get("Placemark")).get(0);
      JSONArray coordinates =
          (JSONArray) ((JSONObject) placemark.get("Point")).get("coordinates");

      Point point = new Point();
      point.setLatitude((Double) coordinates.get(1));
      point.setLongitude((Double) coordinates.get(0));

      return point;
    } catch (MalformedURLException ex) {
      return null;
    } catch (NullPointerException ex) {
View Full Code Here


      return;
    }

    response.getWriter().println(chapter.getName());

    Point point = mapsService.getCoordinates(chapter.getCity(),
        chapter.getState(), chapter.getCountry());
    if (point == null) {
      response.getWriter().println("Geocode update failed: point not found");
      return;
    } else {
      chapter.setLatitude(point.getLatitude());
      chapter.setLongitude(point.getLongitude());

      PersistenceManager pm = PMF.get().getPersistenceManager();
      try {
        pm.makePersistent(chapter);
      } catch (Exception e) {
        response.getWriter().println("Geocode update failed: JDO error");
        return;
      } finally {
        pm.close();
      }
    }

    chapter = null;
    chapter = retrieveChapter(chapterId);

    if (chapter == null) {
      response.getWriter().println("Geocode update failed: chapter not found");
      return;
    }

    response.getWriter().println("Geocode update succeeded");
    response.getWriter().println(point.getLatitude() + ", " + point.getLongitude());
    response.getWriter().println(chapter.getLatitude() + ", " + chapter.getLongitude());
  }
View Full Code Here

          event.getDescription().equals("")) {
        errors.rejectValue("description", null, null, "Description required");
      }

      if (!locationErrors) {
        Point point = mapsService.getCoordinates(event.getStreetAddress(),
            event.getCity(), event.getState(), event.getCountry());
        if (point == null) {
          errors.rejectValue("streetAddress", null, null, "Geocoding failed: given address may be invalid or geocoding service may be offline");
          errors.rejectValue("city", null, null, "Geocoding failed: given address may be invalid or geocoding service may be offline");
          errors.rejectValue("state", null, null, "Geocoding failed: given address may be invalid or geocoding service may be offline");
          errors.rejectValue("country", null, null, "Geocoding failed: given address may be invalid or geocoding service may be offline");
        } else {
          event.setLatitude(point.getLatitude());
          event.setLongitude(point.getLongitude());
        }
      }
    }
  }
View Full Code Here

      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

      if (chapter.getStatus() == null || chapter.getStatus().equals("")) {
        errors.rejectValue("status", null, null, "Status required");
      }

      if (!locationErrors) {
        Point point = mapsService.getCoordinates(chapter.getCity(),
            chapter.getState(), chapter.getCountry());
        if (point == null) {
          errors.rejectValue("city", null, null, "Geocoding failed: given address may be invalid or geocoding service may be offline");
          errors.rejectValue("state", null, null, "Geocoding failed: given address may be invalid or geocoding service may be offline");
          errors.rejectValue("country", null, null, "Geocoding failed: given address may be invalid or geocoding service may be offline");
        } else {
          chapter.setLatitude(point.getLatitude());
          chapter.setLongitude(point.getLongitude());
        }
      }

      if ((chapter.getWebsite() == null || chapter.getWebsite().equals("")) &&
          (chapter.getMailingList() == null ||
View Full Code Here

TOP

Related Classes of org.gtugs.domain.Point

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.