Пример #1
0
 /*
  * (non-Javadoc)
  * @see org.encuestame.core.service.imp.IStatisticsService#getTotalSocialLinksbyHashTagUsageAndDateRangeListGraph(java.lang.String, org.encuestame.utils.enums.SearchPeriods, javax.servlet.http.HttpServletRequest)
  */
 @Override
 public List<HashTagListGraphData> getTotalSocialLinksbyHashTagUsageAndDateRangeListGraph(
     String tagName, SearchPeriods period, HttpServletRequest request)
     throws EnMeSearchException, EnMeNoResultsFoundException {
   List<HashTagListGraphData> tagDetailStatsBySocial = new ArrayList<HashTagListGraphData>();
   List<ItemStatDetail> tpSocialSavePublishedDetail = new ArrayList<ItemStatDetail>();
   List<TweetPollSavedPublishedStatus> tpSavedPublished =
       new ArrayList<TweetPollSavedPublishedStatus>();
   if (period == null) {
     throw new EnMeSearchException("search params required.");
   } else {
     final List<TweetPoll> tpolls =
         getTweetPollsByHashTag(tagName, null, null, TypeSearchResult.HASHTAG, period);
     for (TweetPoll tweetPoll : tpolls) {
       final ItemStatDetail statDetail = new ItemStatDetail();
       tpSavedPublished =
           getTweetPollDao()
               .getSocialLinksByTypeAndDateRange(
                   tweetPoll, null, null, TypeSearchResult.TWEETPOLL);
       statDetail.setDate(tweetPoll.getCreateDate());
       statDetail.setItemId(Long.valueOf(tpSavedPublished.size()));
       // FIXME: itemId should be the id of something, now store a "total" value.
       // tpSocialSavePublishedDetail.addAll(ConvertDomainBean.convertTweetPollSavedPublishedStatusListToItemDetailBean(tpSavedPublished));
       tpSocialSavePublishedDetail.add(statDetail);
     }
     this.removeDuplicatleItemOutOfRange(tpSocialSavePublishedDetail, period.toDays());
     tagDetailStatsBySocial.addAll(
         this.groupListItemStatDetail(tpSocialSavePublishedDetail, period, request));
     return tagDetailStatsBySocial;
   }
 }
Пример #2
0
 /**
  * @param itemList
  * @param period
  * @param request
  * @return
  * @throws EnMeNoResultsFoundException
  * @throws EnMeSearchException
  */
 private List<HashTagListGraphData> groupListItemStatDetail(
     final List<ItemStatDetail> itemList,
     final SearchPeriods period,
     final HttpServletRequest request)
     throws EnMeNoResultsFoundException, EnMeSearchException {
   final List<HashTagListGraphData> tagDetailStatsCompare = new ArrayList<HashTagListGraphData>();
   for (ItemStatDetail item : itemList) {
     int month = DateUtil.getValueCurrentMonthOfTheYear(item.getDate());
     int year = DateUtil.getValueCurrentYear(item.getDate());
     int day = DateUtil.getValueCurrentDateOfTheMonths(item.getDate());
     Long value = item.getItemId();
     tagDetailStatsCompare.add(this.createHastagItemDetailGraph(year, value, month, day));
   }
   return this.groupHashTagListGraphData(tagDetailStatsCompare);
 }