Package org.fluxtream.core.metadata

Examples of org.fluxtream.core.metadata.DayMetadata


                                     @ApiParam(value="Date (yyyy-mm-dd)", required=true) @PathParam("date") String date){
        try{
            Guest guest = guestService.getGuest(username);
            if (AuthHelper.getGuest().getId()!=guest.getId())
                throw new RuntimeException("Attempt to access another user's photos");
            DayMetadata dayMeta = metadataService.getDayMetadata(guest.getId(), date);
            return Response.ok(gson.toJson(getPhotos(guest, dayMeta.getTimeInterval()))).build();
        } catch (Exception e){
            return Response.serverError().entity("Could not get guest addresses: " + e.getMessage()).build();
        }
    }
View Full Code Here


            c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
            Guest guest = guestService.getGuest(username);
            if (AuthHelper.getGuest().getId()!=guest.getId())
                throw new RuntimeException("Attempt to access another user's photos");
            DecimalFormat datePartFormat = new DecimalFormat("00");
            DayMetadata dayMetaStart = metadataService.getDayMetadata(guest.getId(), year + "-" + datePartFormat.format(c.get(Calendar.MONTH) + 1) +
                                                                                          "-" + datePartFormat.format(c.get(Calendar.DAY_OF_MONTH)));
            int newDay = c.get(Calendar.DAY_OF_YEAR) + 6;
            if (newDay > (isLeapYear(year) ? 366 : 365)){
                newDay -= isLeapYear(year) ? 366 : 365;
                year += 1;
                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

        try{

            Guest guest = guestService.getGuest(username);
            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

    }

    List<DayMetadata> getDayMetadataForDates(final long guestId, final TreeSet<String> dates) {
        List<DayMetadata> metadata = new ArrayList<DayMetadata>();
        for (String date : dates) {
            final DayMetadata dayMetadata = getDayMetadata(guestId, date);
            metadata.add(dayMetadata);
        }
        return metadata;
    }
View Full Code Here

        VisitedCity previousInferredCity = null, nextInferredCity = null;
        if (cities.size()==0) {
            previousInferredCity = searchCityBeforeDate(guestId, date);
            nextInferredCity = searchCityAfterDate(guestId, date);
            if (previousInferredCity==null&&nextInferredCity==null) {
                DayMetadata info = new DayMetadata(date);
                return info;
            }
        }
        final VisitedCity consensusVisitedCity = getConsensusVisitedCity(cities, previousInferredCity, nextInferredCity);
        TreeMap<String, TimeZone> consensusTimezoneMap = new TreeMap<String, TimeZone>();
        consensusTimezoneMap.put(date, TimeZone.getTimeZone(consensusVisitedCity.city.geo_timezone));
        TimezoneMap timezoneMap = TimezoneMap.fromConsensusTimezoneMap(consensusTimezoneMap);
        List<VisitedCity> consensusVisitedCities = Arrays.asList(consensusVisitedCity);
        DayMetadata info = new DayMetadata(consensusVisitedCity, previousInferredCity, nextInferredCity, consensusTimezoneMap, timezoneMap, cities, consensusVisitedCities, date);
        return info;
    }
View Full Code Here

                public int compare(final VisitedCity o1, final VisitedCity o2) {
                    return o1.date.compareTo(o2.date);
                }
            });
        for (String date : dates) {
            final DayMetadata dayMetadata = getDayMetadata(guestId, date);
            final VisitedCity consensusVisitedCity = dayMetadata.consensusVisitedCity;
            // Explicitely set the date on this visitedCity to enable time boundaries checking
            VisitedCity copy = new VisitedCity(consensusVisitedCity);
            copy.setDate(date);
            copy.start = copy.getDayStart();
View Full Code Here

    return lastSeen;
  }

  @Override
  public TimeZone getTimeZone(long guestId, String date) {
        final DayMetadata dayMetadata = getDayMetadata(guestId, date);
        return dayMetadata.getTimeInterval().getMainTimeZone();
  }
View Full Code Here

        final ObjectType ot = ObjectType.getObjectType(connector, objectType);
        final AbstractFacet facet = em.find(ot.facetClass(), facetId);
        final GuestSettings guestSettings = settingsService.getSettings(facet.guestId);
        final TimeZone timeZone = metadataService.getTimeZone(facet.guestId, facet.start);
        final String date = TimeUtils.dateFormatter.withZone(DateTimeZone.forTimeZone(timeZone)).print(facet.start);
        final DayMetadata dayMetadata = metadataService.getDayMetadata(facet.guestId, date);
        try {
            final AbstractFacetVO<AbstractFacet> vo = AbstractFacetVO.getFacetVOClass((AbstractFacet)facet).newInstance();
            vo.extractValues(facet, dayMetadata.getTimeInterval(), guestSettings);
            return vo;
        }
        catch (Exception e) {
            e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
            return null;
View Full Code Here

            return Response.status(401).entity("You are no longer logged in").build();
        long guestId = guest.getId();

        GuestSettings settings = settingsService.getSettings(guestId);

        DayMetadata dayMetadata = metadataService.getDayMetadata(guestId, date);
        WeatherModel model = new WeatherModel(settings.temperatureUnit);
        model.tbounds = getStartEndResponseBoundaries(dayMetadata.start, dayMetadata.end);

        City city = dayMetadata.consensusVisitedCity.city;
        if (city != null){
View Full Code Here

        if (guest==null)
            return Response.status(401).entity("You are no longer logged in").build();
        long guestId = guest.getId();

        long then = System.currentTimeMillis();
        DayMetadata dayMetadata = metadataService.getDayMetadata(guestId, date);
        CalendarModel calendarModel = CalendarModel.fromState(guestId, metadataService, "date/" + date);
        DigestModel digest = new DigestModel(TimeUnit.DAY, dayMetadata, env, calendarModel);

        digest.metadata.timeUnit = "DAY";
        if (filter == null) {
View Full Code Here

TOP

Related Classes of org.fluxtream.core.metadata.DayMetadata

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.