Package ca.coolman.location

Examples of ca.coolman.location.LookupLocation


      }

      // Use location if provided, otherwise use either reverse IP or
      // Geocode depending on availability of sensor.
      if (adsComponent.getLocation() != null) {
        LookupLocation lloc = new LookupLocation();
        parseLocation(lloc, loc, adsComponent.getLocation());
        setLocation(lloc);
      } else {
        if (loc == null) {
          LocationLookupService lookup = LocationLookupService.createLookupByIP();
          LookupLocation lloc = lookup.getLocation(new IPAddress(null));
          if (lloc.getLookupStatus() == LookupLocation.STATUS_OK) {
            setLocation(lloc);
          }
        } else {
          LocationLookupService lookup = LocationLookupService.createLookupByGeocode();
          LookupLocation lloc = lookup.getLocation(new Coordinate(loc));
          if (lloc.getLookupStatus() != LookupLocation.STATUS_OK) {
            lloc.setLatitude(loc.getLatitude());
            lloc.setLongtitude(loc.getLongtitude());
          }
        }
      }
    }
    setPost(false);
View Full Code Here


    //addArgument(ARG_USERID, adsComponent.);
  }

 
  private void addLocationArgument() {
    LookupLocation loc = getLocation();
    if (loc != null) {
      double d = loc.getLatitude();
      if (d != 0d) {
        addArgument(ARG_LATITUDE, Double.toString(loc.getLatitude()));
        addArgument(ARG_LONGITUDE, Double.toString(loc.getLongtitude()));
      }
      String s = loc.getCountryCode();
      if (s != null && s.length() > 0) {
        addArgument(ARG_COUNTRY, s);
      } else {
        s = loc.getCountryName();
        if (s != null && s.length() > 0) {
          addArgument(ARG_COUNTRY, s);
        }
      }
      s = loc.getRegionName();
      if (s != null && s.length() > 0) {
        addArgument(ARG_REGION, s);
      }
      s = loc.getCityName();
      if (s != null && s.length() > 0) {
        addArgument(ARG_CITY, s);
      }
    }
  }
View Full Code Here

TOP

Related Classes of ca.coolman.location.LookupLocation

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.