Package org.encuestame.persistence.domain

Examples of org.encuestame.persistence.domain.HashTag


            throws EnMeNoResultsFoundException {
        log.debug("Adding hashtag to TP "+tweetPoll.getTweetPollId());
        log.debug("Adding hashTagBean to TP "+hashTagBean.getHashTagName());
        //validate the hashtag bean.
        hashTagBean.setHashTagName(ValidationUtils.removeNonAlphanumericCharacters(hashTagBean.getHashTagName()));
        HashTag hashtag = getHashTag(hashTagBean.getHashTagName(), false);
        if (hashtag == null) {
            hashtag = createHashTag(hashTagBean.getHashTagName().toLowerCase());
            tweetPoll.getHashTags().add(hashtag);
            getTweetPollDao().saveOrUpdate(tweetPoll);
            log.debug("Added new hashtag done :"+hashtag.getHashTagId());
            return hashtag;
        } else {
            tweetPoll.getHashTags().add(hashtag);
            getTweetPollDao().saveOrUpdate(tweetPoll);
            log.debug("Added previous hashtag done :"+hashtag.getHashTagId());
            return hashtag;
        }
    }
View Full Code Here


        createHashTagHit(hashTag, this.ipAddress);
        final Question question = createQuestion("Who I am?", "");
        createQuestionAnswer("yes", question, "12345");
        createQuestionAnswer("no", question, "12346");
        this.tweetPoll = createPublishedTweetPoll(secondary.getAccount(), question);
        final HashTag hashTag2 = createHashTag("programmer",80L);
        this.tweetPoll.getHashTags().add(hashTag);
        this.tweetPoll.getHashTags().add(hashTag2);
        getTweetPoll().saveOrUpdate(this.tweetPoll);
       
      request = new MockHttpServletRequest();
View Full Code Here

     * Test Get hash tags
     */
    @Test
    public void testGetHashTags(){

        /** Hash Tags **/
        final HashTag hashTag1 = createHashTag("software",50L);
        final HashTag hashTag2 = createHashTag("holidays",70L);
        final HashTag hashTag3 = createHashTag("futboll",80L);
        final HashTag hashTag4 = createHashTag("championsLeague",90L);
        final HashTag hashTag5 = createHashTag("copaAmerica",150L);

        /** Question 2 **/
        final Question question2 = createQuestion("Question 1", "");
        createQuestionAnswer("yes", question2, "12345");
        createQuestionAnswer("no", question2, "12346");
View Full Code Here

     */
    @Test
    public void testGetHashTagRanking() throws EnMeNoResultsFoundException {
        final Calendar myCalDate = Calendar.getInstance();
       
        final HashTag tag = createHashTag("America", 20L);
        final HashTag tag1 = createHashTag("Europa", 30L);
        final HashTag tag2 = createHashTag("Asia", 40L);
        final HashTag tag3 = createHashTag("Oceania", 20L);
        final HashTag tag4 = createHashTag("Africa", 60L);
        final HashTag tag5 = createHashTag("Australia", 55L);
        final HashTag tag6 = createHashTag("Tailandia", 12L);
        final HashTag tag7 = createHashTag("Caribe", 5L);
        final HashTag tag8 = createHashTag("Antartic", 10L);
        final HashTag tag9 = createHashTag("Mediterraneo", 70L);
        final HashTag tag10 = createHashTag("Balcanes", 80L);
        final HashTag tag11 = createHashTag("China", 42L);
       
        createHashTagRank(tag11, myCalDate.getTime(), (double) 97); // China -- 11
        createHashTagRank(tag3, myCalDate.getTime(), (double) 90); // Oceania -- 0
        createHashTagRank(tag4, myCalDate.getTime(), (double) 70); // Africa -- 1
        createHashTagRank(tag7, myCalDate.getTime(), (double) 58); // Caribe -- 7 
        createHashTagRank(tag1, myCalDate.getTime(), (double) 40); // Europa --4
        createHashTagRank(tag9, myCalDate.getTime(), (double) 38); // Mediterraneo -- 9
        createHashTagRank(tag2, myCalDate.getTime(), (double) 30); // Asia -- 2
        createHashTagRank(tag5, myCalDate.getTime(), (double) 25); // Australia -- 5 
        createHashTagRank(tag10, myCalDate.getTime(), (double) 16); // Balcanes -- 10
        createHashTagRank(tag, myCalDate.getTime(), (double) 14); // America -- 3  
        createHashTagRank(tag6, myCalDate.getTime(), (double) 12); // Tailandia -- 6
        createHashTagRank(tag8, myCalDate.getTime(), (double) 10); // Antartic -- 8
       
        myCalDate.add(Calendar.DATE, -1);
       
        createHashTagRank(tag8, myCalDate.getTime(), (double) 80); //Antartic -- 0
        createHashTagRank(tag11, myCalDate.getTime(), (double) 68); // China -- 1
        createHashTagRank(tag, myCalDate.getTime(), (double) 56); // America -- 2
        createHashTagRank(tag9, myCalDate.getTime(), (double) 55); // Mediterraneo -- 3
        createHashTagRank(tag7, myCalDate.getTime(), (double) 39); // Caribe -- 4 
        createHashTagRank(tag4, myCalDate.getTime(), (double) 34); // Africa --5
        createHashTagRank(tag10, myCalDate.getTime(), (double) 31); // Balcanes --6
        createHashTagRank(tag6, myCalDate.getTime(), (double) 28); // Tailandia -- 7
        createHashTagRank(tag3, myCalDate.getTime(), (double) 25); // Oceania -- 8
        createHashTagRank(tag1, myCalDate.getTime(), (double) 20); // Europa -- 9
        createHashTagRank(tag2, myCalDate.getTime(), (double) 12); // Asia -- 10
        createHashTagRank(tag5, myCalDate.getTime(), (double) 10); // Australia -- 11   
        final List<HashTagRankingBean> getFirstHashTag = getFrontEndService()
                .getHashTagRanking(tag11.getHashTag())
        Assert.assertEquals("Should be equals", 2, getFirstHashTag.size());

        final List<HashTagRankingBean> getMiddleHashTag = getFrontEndService()
                .getHashTagRanking(tag9.getHashTag());
        Assert.assertEquals("Should be equals", 3, getMiddleHashTag.size());
View Full Code Here

        .retrieveGenericStats(poll.getPollId().toString(),
            TypeSearchResult.POLL, this.request);
        Assert.assertNotNull(genericPollStats);

       
        final HashTag hashtag = createHashTag("continents", 350L);
      System.out.println(hashtag.getHashTag());       
    Assert.assertNotNull(hashtag);
    Assert.assertNotNull(hashtag.getHashTagId());
    Assert.assertNotNull(hashtag.getHashTag());
    @SuppressWarnings("unused")
    final GenericStatsBean genericHashTagStats = getFrontEndService().retrieveGenericStats(
        hashtag.getHashTag(), TypeSearchResult.HASHTAG, this.request);
     
        //final GenericStatsBean genericSurveyStats = getFrontEndService().retrieveGenericStats(survey.getSid(), TypeSearchResult.SURVEY);
        //Assert.assertNotNull(genericSurveyStats);
  }
View Full Code Here

                for (int i = 0; i < EnMePlaceHolderConfigurer
                        .getIntegerProperty("demo.hashtab.by.item"); i++) {
                    double htx = getRandomNumberRange(0, totalhashtagss) - 1;
                    final HashTagBean b = hashtags.get(Double.valueOf(htx).intValue());
                        log.debug("Adding Hashtag "+b.getHashTagName()+ " to tp "+tweetPollDomain.getTweetPollId());
                        final HashTag h = getTweetPollService().addHashtagToTweetPoll(tweetPollDomain, b);
                        h.setUpdatedDate(createRandomDate());
                        getTweetPollDao().saveOrUpdate(h);
                }

                List<QuestionAnswerBean> listOfAnswers = question.getListAnswers();
                log.debug("Ansswers in this questions  "+listOfAnswers.size());
View Full Code Here

            likeVotes = survey.getLikeVote();
            dislikeVotes = survey.getDislikeVote();
            likeDislikeRate = (likeVotes - dislikeVotes);
            genericBean = ConvertDomainBean.createGenericStatsBean(likeDislikeRate, totalHits, createdBy, average, createdAt);
        } else if (itemType.equals(TypeSearchResult.HASHTAG)) {
            final HashTag tag = getHashTagItem(itemId);
            totalHits = tag.getHits();
            createdAt = convertRelativeTimeToString(tag.getUpdatedDate(), request);
            likeDislikeRate = 0L;
            genericBean = ConvertDomainBean.createGenericStatsBean(likeDislikeRate, totalHits, null, average, createdAt);
        }
        return genericBean;
    }
View Full Code Here

     * @throws EnMeSearchException
     */
    @Test
    public void testGetTotalHashTagHitsbyDateRange() throws EnMeNoResultsFoundException, EnMeSearchException{
        final Question question = createQuestion("What is your favorite type of song?", "");
        final HashTag tag = createHashTag("romantic");
        final Calendar myDate = Calendar.getInstance();
        // TweetPoll
        final TweetPoll tpoll = createPublishedTweetPoll(5L, question,
                getSpringSecurityLoggedUserAccount());
        tpoll.getHashTags().add(tag);
        getTweetPoll().saveOrUpdate(tpoll);

        final TweetPoll tpoll2 = createPublishedTweetPoll(5L, question,
                getSpringSecurityLoggedUserAccount());
        tpoll2.getHashTags().add(tag);
        getTweetPoll().saveOrUpdate(tpoll2);
        myDate.add(Calendar.MONTH, -2);

        final TweetPoll tpoll3 = createPublishedTweetPoll(6L, question,
                getSpringSecurityLoggedUserAccount());
        tpoll3.getHashTags().add(tag);
        tpoll3.setCreateDate(myDate.getTime());
        getTweetPoll().saveOrUpdate(tpoll3);
        myDate.add(Calendar.MONTH, -4);

        final TweetPoll tpoll4 = createPublishedTweetPoll(6L, question,
                getSpringSecurityLoggedUserAccount());
        tpoll4.getHashTags().add(tag);
        tpoll4.setCreateDate(myDate.getTime());
        getTweetPoll().saveOrUpdate(tpoll4);

        // Polls

        final Poll poll1 = createPoll(myDate.getTime(), question,
                getSpringSecurityLoggedUserAccount(), Boolean.TRUE,
                Boolean.TRUE);
        poll1.getHashTags().add(tag);
        getPollDao().saveOrUpdate(poll1);

        final Poll poll2 = createPoll(new Date(), question,
                getSpringSecurityLoggedUserAccount(), Boolean.TRUE,
                Boolean.TRUE);
        poll2.getHashTags().add(tag);
        getPollDao().saveOrUpdate(poll2);
        myDate.add(Calendar.MONTH, -10);

        // Out of range
        final Poll poll3 = createPoll(myDate.getTime(), question,
                getSpringSecurityLoggedUserAccount(), Boolean.TRUE,
                Boolean.TRUE);
        poll3.getHashTags().add(tag);
        getPollDao().saveOrUpdate(poll3);


        // Surveys

        final Survey survey = createDefaultSurvey(getSpringSecurityLoggedUserAccount()
                .getAccount());
        survey.getHashTags().add(tag);
        survey.setCreateDate(new Date());
        getSurveyDaoImp().saveOrUpdate(survey);
        final Survey survey2 = createDefaultSurvey(getSpringSecurityLoggedUserAccount()
                .getAccount());
        survey2.getHashTags().add(tag);
        survey2.setCreateDate(new Date());
        getSurveyDaoImp().saveOrUpdate(survey2);

        final Survey survey3 = createDefaultSurvey(getSpringSecurityLoggedUserAccount()
                .getAccount());
        survey3.getHashTags().add(tag);
        survey3.setCreateDate(myDate.getTime());
        getSurveyDaoImp().saveOrUpdate(survey3);

        myDate.add(Calendar.MONTH, +6);
        final Survey survey4 = createDefaultSurvey(getSpringSecurityLoggedUserAccount()
                    .getAccount());
        survey4.getHashTags().add(tag);
        survey4.setCreateDate(myDate.getTime());
        getSurveyDaoImp().saveOrUpdate(survey4);

        final List<HashTagDetailStats> stats = getStatisticsService()
                .getTotalUsagebyHashTagAndDateRange(tag.getHashTag(), SearchPeriods.ONEYEAR, this.request);
        Assert.assertEquals("Should be equals", 4, stats.size());
    }
View Full Code Here

     *
     */
    @Test
    public void getTweetPollSocialNetworkLinksbyTagAndDateRange() {
        final Calendar calendarDate = Calendar.getInstance();
        final HashTag hashtag1 = createHashTag("romantic");
        final Question question = createQuestion(
                "What is your favorite hobbie?", "");
        // TweetPoll 1
        final TweetPoll tp = createPublishedTweetPoll(question, this.secondary);
        tp.getHashTags().add(hashtag1);
View Full Code Here

     * @throws EnMeNoResultsFoundException
     */
    @Test
    public void testGetTotalHitsUsagebyHashTagAndDateRange() throws EnMeNoResultsFoundException, EnMeSearchException{
        final Calendar myDate = Calendar.getInstance();
        final HashTag hashTag1 = createHashTag("software2");

        final Hit hit1 = createHashTagHit(hashTag1, "192.168.1.1");
        final Hit hit2 = createHashTagHit(hashTag1, "192.168.1.2");

        hit1.setHitDate(myDate.getTime());
        getTweetPoll().saveOrUpdate(hit1);

        myDate.add(Calendar.DATE, -4);
        hit2.setHitDate(myDate.getTime());
        getTweetPoll().saveOrUpdate(hit2);


        final List<HashTagDetailStats> tagHitsDetailList = getStatisticsService().getTotalHitsUsagebyHashTagAndDateRange(hashTag1.getHashTag(), SearchPeriods.SEVENDAYS, this.request);
        Assert.assertEquals("Should be equals", 2, tagHitsDetailList.size());

    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.HashTag

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.