예제 #1
0
 /**
  * Create {@link HashTag}.
  *
  * @param name tag name
  * @return {@link HashTag}.
  */
 public final HashTag createHashTag(final String name) {
   final HashTag hashTag = new HashTag();
   hashTag.setHashTag(ValidationUtils.removeNonAlphanumericCharacters(name));
   hashTag.setHits(1L); // FIXME: should be parametrized ?
   hashTag.setSize(12L); // FIXME: should be parametrized ?
   hashTag.setUpdatedDate(Calendar.getInstance().getTime());
   getHashTagDao().saveOrUpdate(hashTag);
   return hashTag;
 }
예제 #2
0
 /*
  * (non-Javadoc)
  *
  * @see
  * org.encuestame.core.service.imp.IStatisticsService#getHashTagHitsbyName
  * (java.lang.String, org.encuestame.utils.enums.TypeSearchResult,
  * javax.servlet.http.HttpServletRequest)
  */
 public HashTagDetailStats getHashTagHitsbyName(
     final String tagName,
     final TypeSearchResult filterBy,
     final HttpServletRequest request,
     final SearchPeriods periods)
     throws EnMeNoResultsFoundException {
   final HashTag tag = getHashTag(tagName, true);
   final Long hits = this.getTotalHits(tag.getHashTagId(), TypeSearchResult.HASHTAG, periods);
   final HashTagDetailStats detailStatItem =
       this.createHashTagDetailButtonStats(
           HashTagRate.LBL_HITS, hits, HashTagRate.SUB_LBL_TIMES, request);
   return detailStatItem;
 }
예제 #3
0
 /*
  * (non-Javadoc)
  *
  * @see org.encuestame.core.service.imp.IStatisticsService#
  * getTotalHitsUsagebyHashTagAndDateRange(java.lang.String,
  * java.lang.Integer, javax.servlet.http.HttpServletRequest)
  */
 public List<HashTagDetailStats> getTotalHitsUsagebyHashTagAndDateRange(
     final String hashTagName, final SearchPeriods period, final HttpServletRequest request)
     throws EnMeNoResultsFoundException, EnMeSearchException {
   List<Hit> hashTagHits = new ArrayList<Hit>();
   List<HashTagDetailStats> tagDetailStatsByHits = new ArrayList<HashTagDetailStats>();
   final HashTag tag = this.getHashTag(hashTagName, Boolean.TRUE);
   List<ItemStatDetail> itemStatDetailByHits = new ArrayList<ItemStatDetail>();
   if (tag != null) {
     hashTagHits = getFrontEndDao().getHashTagHitsbyDateRange(tag.getHashTagId(), period.toDays());
   }
   itemStatDetailByHits.addAll(ConvertDomainBean.convertHitListToItemDetailBean(hashTagHits));
   tagDetailStatsByHits = this.compareList(itemStatDetailByHits, period, request);
   return tagDetailStatsByHits;
 }
예제 #4
0
  /*
   * (non-Javadoc)
   *
   * @see org.encuestame.core.service.imp.IStatisticsService#
   * getTotalUsagebyHashtagAndDateRangeGraph(java.lang.String,
   * org.encuestame.utils.enums.SearchPeriods,
   * javax.servlet.http.HttpServletRequest)
   */
  public List<HashTagListGraphData> getTotalUsagebyHashtagAndDateRangeListGraph(
      final String hashTagName, final SearchPeriods period, final HttpServletRequest request)
      throws EnMeNoResultsFoundException, EnMeSearchException {
    // Check if the hashtag exists
    /*
       labels : ["January","February","March","April","May","June","July"],
               datasets : [
                   {
                       fillColor : "rgba(220,220,220,0.5)",
                       strokeColor : "rgba(220,220,220,1)",
                       pointColor : "rgba(220,220,220,1)",
                       pointStrokeColor : "#fff",
                       data : [65,59,90,81,56,55,40]
                   }
               ]
    */
    final HashTag tag = this.getHashTag(hashTagName, true);
    final List<Object[]> tweetPollsByDateRange = new ArrayList<Object[]>();
    final List<Object[]> pollsByDateRange = new ArrayList<Object[]>();
    final List<Object[]> surveysByDateRange = new ArrayList<Object[]>();
    final List<ItemStatDetail> itemStatDetailByUsage = new ArrayList<ItemStatDetail>();
    // If the tag exists then obtains the total
    final List<HashTagListGraphData> tagDetailStatsByTagName =
        new ArrayList<HashTagListGraphData>();

    // from database
    tweetPollsByDateRange.addAll(this.getTweetPollsRangeStats(tag.getHashTag(), period));
    pollsByDateRange.addAll(this.getPollsRangeStats(tag.getHashTag(), period));
    surveysByDateRange.addAll(this.getSurveysRangeStats(tag.getHashTag(), period));

    // object conversion
    itemStatDetailByUsage.addAll(
        ConvertDomainBean.convertObjectListToItemDetailBean(tweetPollsByDateRange));
    itemStatDetailByUsage.addAll(
        ConvertDomainBean.convertObjectListToItemDetailBean(pollsByDateRange));
    itemStatDetailByUsage.addAll(
        ConvertDomainBean.convertObjectListToItemDetailBean(surveysByDateRange));

    tagDetailStatsByTagName.addAll(
        this.groupListItemStatDetail(itemStatDetailByUsage, period, request));

    return tagDetailStatsByTagName;
  }
예제 #5
0
 /*
  * (non-Javadoc)
  *
  * @see org.encuestame.core.service.imp.IStatisticsService#
  * getTotalUsagebyHashTagAndDateRange(java.lang.String, java.lang.Integer,
  * javax.servlet.http.HttpServletRequest)
  */
 public List<HashTagDetailStats> getTotalUsagebyHashTagAndDateRange(
     final String hashTagName, final SearchPeriods period, final HttpServletRequest request)
     throws EnMeNoResultsFoundException, EnMeSearchException {
   // Check if the hashtag exists
   final HashTag tag = this.getHashTag(hashTagName, true);
   List tweetPollsByDateRange = new ArrayList();
   List<Poll> pollsByDateRange = new ArrayList<Poll>();
   List<Survey> surveysByDateRange = new ArrayList<Survey>();
   List<ItemStatDetail> itemStatDetailByUsage = new ArrayList<ItemStatDetail>();
   // If the tag exists then obtains the total
   List<HashTagDetailStats> tagDetailStatsByTagName = new ArrayList<HashTagDetailStats>();
   tweetPollsByDateRange =
       this.getTotalTweetPollUsageByHashTagAndDateRange(tag.getHashTag(), period);
   pollsByDateRange = this.getTotalPollUsageByHashTagAndDateRange(tag.getHashTag(), period);
   surveysByDateRange = this.getTotalSurveyUsageByHashTagAndDateRange(tag.getHashTag(), period);
   itemStatDetailByUsage.addAll(
       ConvertDomainBean.convertObjectTweetPollListToItemDetailBean(tweetPollsByDateRange));
   itemStatDetailByUsage.addAll(
       ConvertDomainBean.convertPollListToItemDetailBean(pollsByDateRange));
   itemStatDetailByUsage.addAll(
       ConvertDomainBean.convertSurveyListToItemDetailBean(surveysByDateRange));
   tagDetailStatsByTagName = this.compareList(itemStatDetailByUsage, period, request);
   return tagDetailStatsByTagName;
 }