Package org.fluxtream.core.connectors.location

Examples of org.fluxtream.core.connectors.location.LocationFacet


            jParser.nextToken();
        GoogleLatitudeUpdater updater = new GoogleLatitudeUpdater();
        final ArrayList<LocationFacet> locations = new ArrayList<LocationFacet>();
        updater.parseLocation(null, jParser, locations);
        assertTrue(locations.size()==1);
        final LocationFacet locationFacet = locations.get(0);
        assertTrue(locationFacet.timestampMs==1376053800229l);
        assertTrue(locationFacet.latitude==50.8261000f);
        assertTrue(locationFacet.longitude==4.3543660f);
        assertTrue(locationFacet.accuracy==10);
    }
View Full Code Here


    return timeZone;
  }

  @Override
  public TimeZone getCurrentTimeZone(long guestId) {
    LocationFacet lastLocation = getLastLocation(guestId, System.currentTimeMillis());
    if (lastLocation != null) {
      TimeZone timeZone = getTimeZone(lastLocation.latitude,
          lastLocation.longitude);
      return timeZone;
    }
View Full Code Here

        return JPAUtils.find(em, DayMetadata.class,"context.all",guestId);
    }

  @Override
  public LocationFacet getLastLocation(long guestId, long time) {
    LocationFacet lastSeen = JPAUtils.findUnique(em, LocationFacet.class,
                                                     "location.lastSeen", guestId, time);
    return lastSeen;
  }
View Full Code Here

        // local vars: current city and current day
        String currentDate = "";
        Point2D.Double anchorLocation = new Point2D.Double(locationResources.get(0).latitude, locationResources.get(0).longitude);
        City anchorCity = getClosestCity(anchorLocation.x, anchorLocation.y);
        int count = 0;
        LocationFacet lastLocationResourceMatchingAnchor=locationResources.get(0);
        long start = locationResources.get(0).start;

        for (LocationFacet locationResource : locationResources) {
            try {
                City newCity = anchorCity;
View Full Code Here

      String dbLocation = env.get("geoIpDb.location");
      geoIpLookupService = new LookupService(dbLocation,
          LookupService.GEOIP_MEMORY_CACHE);
    }

        LocationFacet locationFacet = new LocationFacet(1);
        long time = System.currentTimeMillis();
        locationFacet.guestId = guestId;
        locationFacet.timestampMs = time;
        locationFacet.start = time;
        locationFacet.end = time;
View Full Code Here

                .append(pad(seconds)).append(".000").toString();
    }

    private void addLocation(final UpdateInfo updateInfo, final List<LocationFacet> locationResources,
                             final FlickrPhotoFacet facet, final DateTime dateTime) {
        LocationFacet locationResource = new LocationFacet();
        locationResource.guestId = facet.guestId;
        locationResource.latitude = facet.latitude;
        locationResource.longitude = facet.longitude;
        locationResource.source = LocationFacet.Source.FLICKR;
        locationResource.timestampMs = dateTime.getMillis();
View Full Code Here

        while (!jParser.getCurrentName().equals("locations"))
            jParser.nextToken();
    }

    void parseLocation(final ApiKey apiKey, final JsonParser jParser, final List<LocationFacet> locations) throws IOException {
        LocationFacet locationFacet = new LocationFacet();
        if (apiKey!=null) {
            locationFacet.apiKeyId = apiKey.getId();
            locationFacet.guestId = apiKey.getGuestId();
        }
View Full Code Here

                    if(latitude==null || longitude==null || accuracy==null || latitude<DatastoreTile.TILE_BREAK_THRESH || longitude<DatastoreTile.TILE_BREAK_THRESH || accuracy<DatastoreTile.TILE_BREAK_THRESH ) {
                        continue;
                    }
                    // Process location
                    LocationFacet locationFacet = new LocationFacet(updateInfo.apiKey.getId());
                    locationFacet.source=LocationFacet.Source.FLUXTREAM_CAPTURE;
                    locationFacet.api = updateInfo.apiKey.getConnector().value();
                    locationFacet.start = locationFacet.end = locationFacet.timestampMs = (long)(thisTime*1000.0);
                    locationFacet.latitude = latitude;
                    locationFacet.longitude = longitude;
View Full Code Here

        }
    }

    private void addGuestLocation(final UpdateInfo updateInfo, final Double latitude, final Double longitude,
                                  final Double altitude, final Long timestamp, final String noteGuid) {
        LocationFacet locationFacet = new LocationFacet(updateInfo.apiKey.getId());
        locationFacet.latitude = latitude.floatValue();
        locationFacet.longitude = longitude.floatValue();
        if (altitude!=null)
            locationFacet.altitude = altitude.intValue();
        locationFacet.timestampMs = timestamp;
View Full Code Here

        List<LocationFacet> locationFacets = new ArrayList<LocationFacet>();
        // timeZone is computed based on first location for each batch of trackPoints
        Connector connector = Connector.getConnector("moves");
        for (int i=0; i<trackPoints.size(); i++) {
            JSONObject trackPoint = trackPoints.getJSONObject(i);
            LocationFacet locationFacet = new LocationFacet(updateInfo.apiKey.getId());
            locationFacet.latitude = (float) trackPoint.getDouble("lat");
            locationFacet.longitude = (float) trackPoint.getDouble("lon");
            // The two lines below would calculate the timezone if we cared, but the
            // timestamps from Moves are already in GMT, so don't mess with the timezone
            //if (timeZone==null)
View Full Code Here

TOP

Related Classes of org.fluxtream.core.connectors.location.LocationFacet

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.