Package org.fluxtream.core

Examples of org.fluxtream.core.TimeInterval


            // 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

                final double defaultTimeForNullTimeIntervals = System.currentTimeMillis() / 1000;

                for (final String channelName : photoChannelTimeRanges.keySet()) {
                    final ChannelSpecs channelSpecs = new ChannelSpecs();
                    final TimeInterval timeInterval = photoChannelTimeRanges.get(channelName);

                    // mark this channel as a photo channel so that the grapher can properly render it as a photo channel
                    channelSpecs.channelType = PhotoService.DEFAULT_PHOTOS_CHANNEL_NAME;
                    final String[] connectorNameAndObjectTypeName = channelName.split("\\.");
                    if (connectorNameAndObjectTypeName.length > 1) {
                        channelSpecs.objectTypeName = connectorNameAndObjectTypeName[1];
                    }

                    channelSpecs.channel_bounds = new ChannelBounds();
                    if (timeInterval == null) {
                        channelSpecs.channel_bounds.min_time = defaultTimeForNullTimeIntervals;
                        channelSpecs.channel_bounds.max_time = defaultTimeForNullTimeIntervals;
                    }
                    else {
                        channelSpecs.channel_bounds.min_time = timeInterval.getStart() / 1000;
                        channelSpecs.channel_bounds.max_time = timeInterval.getEnd() / 1000;
                    }
                    channelSpecs.channel_bounds.min_value = .6;
                    channelSpecs.channel_bounds.max_value = 1;

                    infoResponse.channel_specs.put(channelName, channelSpecs);
View Full Code Here

            if (!photoChannelTimeRanges.isEmpty()) {
                final double defaultTimeForNullTimeIntervals = System.currentTimeMillis() / 1000;

                for (final String channelName : photoChannelTimeRanges.keySet()) {
                    final ChannelSpecs channelSpecs = new ChannelSpecs();
                    final TimeInterval timeInterval = photoChannelTimeRanges.get(channelName);

                    // mark this channel as a photo channel so that the grapher can properly render it as a photo channel
                    channelSpecs.channelType = PhotoService.DEFAULT_PHOTOS_CHANNEL_NAME;
                    final String[] connectorNameAndObjectTypeName = channelName.split("\\.");
                    if (connectorNameAndObjectTypeName.length > 1) {
                        channelSpecs.objectTypeName = connectorNameAndObjectTypeName[1];
                    }

                    channelSpecs.channel_bounds = new ChannelBounds();
                    if (timeInterval == null) {
                        channelSpecs.channel_bounds.min_time = defaultTimeForNullTimeIntervals;
                        channelSpecs.channel_bounds.max_time = defaultTimeForNullTimeIntervals;
                    }
                    else {
                        channelSpecs.channel_bounds.min_time = timeInterval.getStart() / 1000;
                        channelSpecs.channel_bounds.max_time = timeInterval.getEnd() / 1000;
                    }
                    channelSpecs.channel_bounds.min_value = .6;
                    channelSpecs.channel_bounds.max_value = 1;

                    infoResponse.channel_specs.put(channelName, channelSpecs);
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

                (coachee == null || coachee.hasAccessToConnector(connector.getName())) && connector.hasImageObjectType()) {
                // Check the object types, if any, to find the image object type(s)
                ObjectType[] objectTypes = apiKey.getConnector().objectTypes();
                if (objectTypes == null) {
                    final String channelName = constructChannelName(connector, null);
                    final TimeInterval timeInterval = constructTimeIntervalFromOldestAndNewestFacets(apiKey, null);
                    photoChannelTimeRanges.put(channelName, timeInterval);
                }
                else {
                    for (ObjectType objectType : objectTypes) {
                        if (objectType.isImageType()) {
                            final String channelName = constructChannelName(connector, objectType);
                            final TimeInterval timeInterval = constructTimeIntervalFromOldestAndNewestFacets(apiKey, objectType);
                            photoChannelTimeRanges.put(channelName, timeInterval);
                        }
                    }
                }
            }
View Full Code Here

        GuestSettings settings = settingsService.getSettings(apiKey.getGuestId());
        for (AbstractFacet facet : facets) {
            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

TOP

Related Classes of org.fluxtream.core.TimeInterval

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.