Package org.fluxtream.core

Examples of org.fluxtream.core.SimpleTimeInterval


                c.set(Calendar.YEAR,year);
            }
            c.set(Calendar.DAY_OF_YEAR,newDay);
            DayMetadata dayMetaEnd = metadataService.getDayMetadata(guest.getId(), year + "-" + datePartFormat.format(c.get(Calendar.MONTH) + 1) +
                                                                                          "-" + datePartFormat.format(c.get(Calendar.DAY_OF_MONTH)));
            return Response.ok(gson.toJson(getPhotos(guest, new SimpleTimeInterval(dayMetaStart.start,dayMetaEnd.end,TimeUnit.WEEK,dayMetaStart.getTimeInterval().getMainTimeZone())))).build();
        } catch (Exception e){
            return Response.serverError().entity("Could not get photos: " + e.getMessage()).build();
        }
    }
View Full Code Here


            if (AuthHelper.getGuest().getId()!=guest.getId())
                throw new RuntimeException("Attempt to access another user's photos");
            DayMetadata dayMetaStart = metadataService.getDayMetadata(guest.getId(), year + "-01-01");

            DayMetadata dayMetaEnd = metadataService.getDayMetadata(guest.getId(), year + "-12-31");
            return Response.ok(gson.toJson(getPhotos(guest, new SimpleTimeInterval(dayMetaStart.start,dayMetaEnd.end,TimeUnit.YEAR,dayMetaStart.getTimeInterval().getMainTimeZone())))).build();
        } catch (Exception e){
            return Response.serverError().entity("Could not get photos: " + e.getMessage()).build();
        }

    }
View Full Code Here

            // first use Level and Offset to calculate the desired start and end times
            final long startTimeMillis = (long)(LevelOffsetHelper.offsetAtLevelToUnixTime(level, offset) * 1000);
            final long endTimeMillis = (long)(LevelOffsetHelper.offsetAtLevelToUnixTime(level, offset + 1) * 1000);

            final TimeInterval timeInterval = new SimpleTimeInterval(startTimeMillis, endTimeMillis, TimeUnit.ARBITRARY, TimeZone.getTimeZone("UTC"));

            // fetch the photos for this time interval, and for the desired device/channel
            final TagFilter tagFilter = TagFilter.create(Tag.parseTagsIntoStrings(tagsStr, Tag.COMMA_DELIMITER), tagFilteringStrategy);
            final SortedSet<PhotoService.Photo> photos = photoService.getPhotos(uid, timeInterval, connectorPrettyName, objectTypeName, tagFilter);

View Full Code Here

                break;
            }
        }
        if (objectType != null){
            String objectTypeName = apiKey.getConnector().getName() + "-" + objectType.getName();
            final TimeInterval timeInterval = new SimpleTimeInterval(startMillis, endMillis, TimeUnit.ARBITRARY, TimeZone.getTimeZone("UTC"));

            List<AbstractFacet> facets = getFacetsInTimespanOrderedByEnd(timeInterval,apiKey,objectType);


            for (AbstractFacet facet : facets){
View Full Code Here

            }
        }
        if (objectType == null)
            return new ArrayList<AbstractFacetVO<AbstractFacet>>();

        TimeInterval timeInterval = new SimpleTimeInterval(start, end, TimeUnit.ARBITRARY, TimeZone.getTimeZone("UTC"));

        List<AbstractFacet> facets = getFacetsInTimespan(timeInterval,apiKey,objectType);

        return getFacetVOsForFacets(facets,timeInterval,guestSettings);
    }
View Full Code Here

            // first use Level and Offset to calculate the desired start and end times
            final long startTimeMillis = (long)(LevelOffsetHelper.offsetAtLevelToUnixTime(level, offset) * 1000);
            final long endTimeMillis = (long)(LevelOffsetHelper.offsetAtLevelToUnixTime(level, offset + 1) * 1000);

            final TimeInterval timeInterval = new SimpleTimeInterval(startTimeMillis, endTimeMillis, TimeUnit.ARBITRARY, TimeZone.getTimeZone("UTC"));

            // fetch the photos for this time interval, and for the desired device/channel
            final TagFilter tagFilter = TagFilter.create(Tag.parseTagsIntoStrings(tagsStr, Tag.COMMA_DELIMITER), tagFilteringStrategy);
            final SortedSet<PhotoService.Photo> photos = photoService.getPhotos(uid, timeInterval, connectorPrettyName, objectTypeName, tagFilter);

View Full Code Here

  @Override
  public void storeInitialHistory(ApiKey apiKey) {
        logger.info("module=updateQueue component=bodytrackStorageService action=storeInitialHistory" +
                    " guestId=" + apiKey.getGuestId() + " connector=" + apiKey.getConnector().getName());
    TimeInterval timeInterval = new SimpleTimeInterval(0,
        System.currentTimeMillis(), TimeUnit.ARBITRARY, TimeZone.getDefault());
    List<AbstractFacet> facets = apiDataService.getApiDataFacets(apiKey, null, timeInterval);
    storeApiData(apiKey.getGuestId(), facets);
  }
View Full Code Here

    @Override
    public void storeInitialHistory(ApiKey apiKey, int objectTypes) {
        logger.info("module=updateQueue component=bodytrackStorageService action=storeInitialHistory" +
                " objectTypes=" + objectTypes +
                " guestId=" + apiKey.getGuestId() + " connector=" + apiKey.getConnector().getName());
        TimeInterval timeInterval = new SimpleTimeInterval(0,
                System.currentTimeMillis(), TimeUnit.ARBITRARY, TimeZone.getDefault());
        final ObjectType[] objectTypesForValue = apiKey.getConnector().getObjectTypesForValue(objectTypes);
        for (ObjectType objectType : objectTypesForValue) {
            List<AbstractFacet> facets = apiDataService.getApiDataFacets(apiKey, objectType, timeInterval);
            storeApiData(apiKey.getGuestId(), facets);
View Full Code Here

            Class<? extends AbstractFacetVO<AbstractFacet>> jsonFacetClass = AbstractFacetVO.getFacetVOClass(facet);
            AbstractInstantFacetVO<AbstractFacet> facetVo = (AbstractInstantFacetVO<AbstractFacet>)jsonFacetClass.newInstance();

            final TimeInterval actualTimeInterval;
            if (timeInterval == null) {
                actualTimeInterval = new SimpleTimeInterval(facet.start, facet.start, TimeUnit.ARBITRARY, TimeZone.getTimeZone("UTC"));
            }
            else {
                actualTimeInterval = timeInterval;
            }
View Full Code Here

        final PhotoFacetFinderStrategy photoFacetFinderStrategy = getPhotoFacetFinderStrategyFromObjectType(objectType);
        final AbstractFacet oldestFacet = photoFacetFinderStrategy.findOldest(apiKey, objectType);
        final AbstractFacet newestFacet = photoFacetFinderStrategy.findLatest(apiKey, objectType);

        if (oldestFacet != null && newestFacet != null) {
            return new SimpleTimeInterval(oldestFacet.start, newestFacet.start, TimeUnit.ARBITRARY, TimeZone.getTimeZone("UTC"));
        }

        return null;
    }
View Full Code Here

TOP

Related Classes of org.fluxtream.core.SimpleTimeInterval

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.