Examples of PostalGeolocation


Examples of com.oracle.demo.ops.domain.PostalGeolocation

    if (CACHE_ENABLED)
    {
      try
      {
        cache = CacheFactory.getCache(CACHE_NAME);
        PostalGeolocation fromCache = null;

        if (cache != null)
        {
          fromCache = (PostalGeolocation) cache.get(pPostalCode);

          if (fromCache != null)
          {
            return fromCache;
          }
        }
        else
        {
          System.out.println("Unable to find CACHE");
        }

      }
      catch (Exception e)
      {
        e.printStackTrace();
      }
    }

    PostalGeolocation location;

    try

    {
      GoogleGeocodeResponse response = lookupAddressFromGoogle(pPostalCode+", USA");
View Full Code Here

Examples of com.oracle.demo.ops.domain.PostalGeolocation

  {
    if (response != null
        && response.getStatus() != null
        && response.getStatus().equals("OK"))
    {
      PostalGeolocation location = new PostalGeolocation();
      List<GoogleGeocodeResponse.Results.Address_Components> addressComponents;

      for (GoogleGeocodeResponse.Results result : response.getResults())
      {
        addressComponents = result.getAddress_components();

        for (GoogleGeocodeResponse.Results.Address_Components addressComponent : addressComponents)
        {

          for (String str : addressComponent.getTypes())
          {
            if (str.equalsIgnoreCase("locality"))
            {
              location.setCity(addressComponent.getShort_name());
            }
            else if (str.equalsIgnoreCase("administrative_area_level_1"))
            {
              location.setState(addressComponent.getShort_name());
            }
            else if (str.equalsIgnoreCase("postal_code"))
            {
              location.setPostalCode(addressComponent.getShort_name());
            }
          }

        }

        location.setLatitude(result.getGeometry().getLocation().getLat());
        location.setLongitude(result.getGeometry().getLocation().getLng());
      }

      return location;
    }
View Full Code Here

Examples of com.oracle.demo.ops.domain.PostalGeolocation

          continue;
        }
        try
        {
          //"zip","city","state","latitude","longitude","timezone","dst"
          PostalGeolocation geo = new PostalGeolocation();
          geo.setPostalCode(st.nextToken()); //zip
          geo.setCity(st.nextToken()); //city
          geo.setState(st.nextToken()); //state

          String strLat = st.nextToken(); //lat
          geo.setLatitude(Double.parseDouble(strLat));

          String strLng = st.nextToken(); //lat
          geo.setLongitude(Double.parseDouble(strLng)); //lng
          em.persist(geo);
        }
        catch (Exception e)
        {
          System.out.println("Unable to parse line: " + line);
View Full Code Here

Examples of com.oracle.demo.ops.domain.PostalGeolocation

  @Override
  public void validate(FacesContext pFacesContext, UIComponent pUIComponent, Object o) throws ValidatorException
  {
    if (o instanceof String)
    {
      PostalGeolocation geo = geoManager.findByPostalCode((String) o);

      if (geo == null)
      {
        pFacesContext.addMessage(null,
                                 new FacesMessage(FacesMessage.SEVERITY_WARN,
View Full Code Here

Examples of com.oracle.demo.ops.domain.PostalGeolocation

  public void update(Address pFromAddress, Address pToAddress)
  {
    List<PostalGeolocation> geoList = new ArrayList<PostalGeolocation>(2);

    PostalGeolocation fromGeo = geoService.lookupByPostalCode(pFromAddress.getPostalCode());
    PostalGeolocation toGeo = geoService.lookupByPostalCode(pToAddress.getPostalCode());

    geoList.add(fromGeo);
    geoList.add(toGeo);

    updateModel(geoList);
View Full Code Here

Examples of com.oracle.demo.ops.domain.PostalGeolocation

      if (event.getLocation() == null || event.getLocation().equals("United States"))
      {
        continue;
      }

      PostalGeolocation geo = geoService.lookupByPostalCode(event.getLocation());

      if (geo != null)
      {
        geoList.add(geo);
      }
View Full Code Here

Examples of com.oracle.demo.ops.domain.PostalGeolocation

      mMapModel.addOverlay(polyline);

      if (false && postalLocations.size() > 3)
      {
        PostalGeolocation[] geolocations = postalLocations.toArray(new PostalGeolocation[postalLocations.size()]);
        PostalGeolocation lastGeo = geolocations[geolocations.length - 1];
        PostalGeolocation secondToLastGeo = null;

        for (int x = geolocations.length - 2; x >= 0; x--)
        {
          PostalGeolocation geolocation = geolocations[x];

          if (!(lastGeo.getPostalCode() == null)
              && !(geolocation.getPostalCode() == null)
              && !lastGeo.getPostalCode().equals(geolocation.getPostalCode()))
          {
            secondToLastGeo = geolocation;
            break;
          }
        }
View Full Code Here

Examples of com.oracle.demo.ops.domain.PostalGeolocation

      FacesContext.getCurrentInstance().addMessage(null, msg);
    }
    else
    {
      PostalGeolocation geo = geoService.lookupByPostalCode(address.getPostalCode());

      if (geo != null)
      {
        address.setCity(geo.getCity());
        address.setState(geo.getState());
        address.setPostalCode(geo.getPostalCode());
      }
      else
      {
        FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_WARN,
                                            "Postal code not found: [" + address.getPostalCode() + "]",
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.