Package org.encuestame.persistence.domain.tweetpoll

Examples of org.encuestame.persistence.domain.tweetpoll.TweetPoll


             Date creationDate,
             Boolean completed,
             Account tweetOwner,
             Question question,
             final UserAccount userAccount){
        final TweetPoll tweetPoll = new TweetPoll();
        tweetPoll.setCloseNotification(closeNotification);
        tweetPoll.setResultNotification(resultNotification);
        tweetPoll.setAllowLiveResults(allowLiveResults);
        tweetPoll.setCompleted(completed);
        tweetPoll.setPublishTweetPoll(publishTweetPoll);
        tweetPoll.setQuestion(question);
        tweetPoll.setScheduleDate(scheduleDate);
        tweetPoll.setScheduleTweetPoll(scheduleTweetPoll);
        // The create date always have to be the date of creation
        tweetPoll.setCreateDate(creationDate);
        tweetPoll.setFavourites(Boolean.TRUE);
        tweetPoll.setTweetOwner(tweetOwner);
        // The update date is the date when the tweetpoll has been updated, included the
        // publication date
        tweetPoll.setUpdatedDate(creationDate);
        tweetPoll.setEditorOwner(userAccount);
        tweetPoll.setRelevance(1L);
        getTweetPoll().saveOrUpdate(tweetPoll);
        return tweetPoll;
    }
View Full Code Here


     */
    @Test
    public void testGetHashTagUsedOnItemsVoted(){
        final HashTag hashtag1 = createHashTag("season");
        final Question question = createQuestion("What is your favorite season?", "");
        final TweetPoll tp = createPublishedTweetPoll(question, this.secondary);
        tp.getHashTags().add(hashtag1);
        getTweetPoll().saveOrUpdate(tp);

        // Item 2
        final Question question2 = createQuestion("What is your favorite holidays?", "");
        final TweetPoll tp2 = createPublishedTweetPoll(question2, this.secondary);
        tp2.getHashTags().add(hashtag1);
        getTweetPoll().saveOrUpdate(tp2);

        final QuestionAnswer questionsAnswers1 = createQuestionAnswer("yes", question, "7891011");
        final QuestionAnswer questionsAnswers2 = createQuestionAnswer("no", question, "7891012");

View Full Code Here

        // Creating question ...
        final Question question =  this.createRandomQuestion();

        // Creating tweetpoll...

        final TweetPoll myTweet = createPublishedTweetPoll(question,
                getSpringSecurityLoggedUserAccount());
        myTweet.getHashTags().add(tag);
        myTweet.setCreateDate(randomDate);
        getTweetPoll().saveOrUpdate(myTweet);

        // Add 2 answers by question
        for (j = 0; j < 2; j++) {
            // Creating answers... - Select answers = "yes", "no", "maybe", "impossible", "never"
View Full Code Here

        final Question question = createQuestion("What is your favorite type of song?", "");
        final HashTag mytag = createHashTag("romantic");
        DateTime createdAt = new DateTime();

        // TweetPoll
        final TweetPoll tpoll = createPublishedTweetPoll(5L, question,
                getSpringSecurityLoggedUserAccount());
        tpoll.getHashTags().add(mytag);
        tpoll.setCreateDate(createdAt.toDate());
        getTweetPoll().saveOrUpdate(tpoll);

        // Tweetpoll 2
        final TweetPoll tpoll2 = createPublishedTweetPoll(5L, question,
                getSpringSecurityLoggedUserAccount());
        tpoll2.getHashTags().add(mytag);
        tpoll.setCreateDate(createdAt.toDate());
        getTweetPoll().saveOrUpdate(tpoll2);
        createdAt = this.creationDate.minusMonths(2);

        // Tweetpoll 3
        final TweetPoll tpoll3 = createPublishedTweetPoll(6L, question,
                getSpringSecurityLoggedUserAccount());
        tpoll3.getHashTags().add(mytag);
        tpoll3.setCreateDate(createdAt.toDate());
        getTweetPoll().saveOrUpdate(tpoll3);
        //myDate.add(Calendar.MONTH, -2);
        createdAt = this.creationDate.minusMonths(4);

         final Poll poll4 = createDefaultPoll(question,
View Full Code Here

        final Question myFirstQuestion = createQuestion(
                "What is your favorite kind of movie?", secondary.getAccount());
        final Question mySecondQuestion = createQuestion(
                "What is your favorite kind of song?", secondary.getAccount());
        // TP 1
        final TweetPoll tp1 = createPublishedTweetPoll(
                this.secondary.getAccount(), myFirstQuestion,
                releaseDate.getTime());
        tp1.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tp1);
        assertNotNull(tp1);

        // TP 2
        releaseDate.add(Calendar.HOUR, -1);
        final TweetPoll tp2 = createPublishedTweetPoll(
                this.secondary.getAccount(), myFirstQuestion,
                releaseDate.getTime());
        tp2.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tp2);
        assertNotNull(tp2);

        // TP 3
        releaseDate.add(Calendar.HOUR, -3);
        final TweetPoll tp3 = createPublishedTweetPoll(
                this.secondary.getAccount(), myFirstQuestion,
                releaseDate.getTime());
        tp3.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tp3);
        assertNotNull(tp3);

        // TP 4
        releaseDate.add(Calendar.DATE, -1);
        releaseDate.add(Calendar.HOUR, -5);
        final TweetPoll tp4 = createPublishedTweetPoll(
                this.secondary.getAccount(), myFirstQuestion,
                releaseDate.getTime());
        tp4.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tp4);
        assertNotNull(tp4);

        // TP 5
        releaseDate.add(Calendar.DATE, -1);
        final TweetPoll tp5 = createPublishedTweetPoll(
                this.secondary.getAccount(), myFirstQuestion,
                releaseDate.getTime());
        tp5.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tp5);
        assertNotNull(tp5);

        // TP 6
        releaseDate.add(Calendar.DATE, -1);
        releaseDate.add(Calendar.HOUR, -2);
        final TweetPoll tp6 = createPublishedTweetPoll(
                this.secondary.getAccount(), myFirstQuestion,
                releaseDate.getTime());
        tp6.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tp6);
        assertNotNull(tp6);

        // TP 7
        releaseDate.add(Calendar.YEAR, -1);
        final TweetPoll tp7 = createPublishedTweetPoll(
                this.secondary.getAccount(), myFirstQuestion,
                releaseDate.getTime());
        tp7.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tp7);
        assertNotNull(tp7);

        // TP 8
        releaseDate.add(Calendar.MONTH, -1);
        final TweetPoll tp8 = createPublishedTweetPoll(
                this.secondary.getAccount(), myFirstQuestion,
                releaseDate.getTime());
        tp8.getHashTags().add(myHashTag);
        getTweetPoll().saveOrUpdate(tp8);
        assertNotNull(tp8);

        final List<ItemStatDetail> itemStatDetail = new ArrayList<ItemStatDetail>();
        final ItemStatDetail isd1 = this.createItemStatDetail(tp1.getTweetPollId(),
                tp1.getCreateDate());
        final ItemStatDetail isd2 = this.createItemStatDetail(tp2.getTweetPollId(),
                tp2.getCreateDate());
        final ItemStatDetail isd3 = this.createItemStatDetail(tp3.getTweetPollId(),
                tp3.getCreateDate());
        final ItemStatDetail isd4 = this.createItemStatDetail(tp4.getTweetPollId(),
                tp4.getCreateDate());
        final ItemStatDetail isd5 = this.createItemStatDetail(tp5.getTweetPollId(),
                tp5.getCreateDate());
        final ItemStatDetail isd6 = this.createItemStatDetail(tp6.getTweetPollId(),
                tp6.getCreateDate());
        final ItemStatDetail isd7 = this.createItemStatDetail(tp7.getTweetPollId(),
                tp7.getCreateDate());
        final ItemStatDetail isd8 = this.createItemStatDetail(tp7.getTweetPollId(),
                tp8.getCreateDate());

        itemStatDetail.add(isd1);
        itemStatDetail.add(isd2);
        itemStatDetail.add(isd3);
        itemStatDetail.add(isd4);
View Full Code Here

    public TweetPoll createFastTweetPollVotes(){
        final UserAccount secondary = createUserAccount("jhon-"+RandomStringUtils.randomAscii(4), createAccount());
        final Question question = createQuestion("who I am?", "");
        final QuestionAnswer questionsAnswers1 = createQuestionAnswer("yes", question, "12345");
        final QuestionAnswer questionsAnswers2 = createQuestionAnswer("no", question, "12346");
        final TweetPoll tweetPoll = createPublishedTweetPoll(secondary.getAccount(), question);
        final TweetPollSwitch pollSwitch1 = createTweetPollSwitch(questionsAnswers1, tweetPoll);
        final TweetPollSwitch pollSwitch2 = createTweetPollSwitch(questionsAnswers2, tweetPoll);
        createTweetPollResult(pollSwitch1, "192.168.0.1");
        createTweetPollResult(pollSwitch1, "192.168.0.2");
        createTweetPollResult(pollSwitch2, "192.168.0.3");
View Full Code Here

     * @return
     * @throws EnMeNoResultsFoundException
     */
    public TweetPoll addTweetPollToFolder(final Long folderId, final Long userId, final Long tweetPollId) throws EnMeNoResultsFoundException{
        final TweetPollFolder tpfolder = getTweetPoll().getTweetPollFolderById(folderId);
        final TweetPoll tpoll = getTweetPoll().getTweetPollByIdandUserId(tweetPollId, userId);
        tpoll.setTweetPollFolder(tpfolder);
        getTweetPoll().saveOrUpdate(tpoll);
        return tpoll;
    }
View Full Code Here

              final Boolean publishTweetPoll,
              final Boolean completed,
              final Date scheduleDate,
              final UserAccount tweetOwner,
              final Question question){
         final TweetPoll tweetPoll = new TweetPoll();
         tweetPoll.setPublishTweetPoll(publishTweetPoll);
         tweetPoll.setCompleted(completed);
         tweetPoll.setScheduleDate(scheduleDate);
         tweetPoll.setCreateDate(new Date());
         tweetPoll.setFavourites(false);
         tweetPoll.setQuestion(question);
         tweetPoll.setTweetOwner(tweetOwner.getAccount());
         tweetPoll.setEditorOwner(tweetOwner);
         getTweetPoll().saveOrUpdate(tweetPoll);
         return tweetPoll;
     }
View Full Code Here

        final Calendar currentDate = Calendar.getInstance();
        final List<HashTagListGraphData> list = getStatisticsService().getTotalUsagebyHashtagAndDateRangeListGraph( this.initHashTag.getHashTag(),
                    SearchPeriods.ONEYEAR, request);
        Assert.assertEquals("Should be equals", 1, list.size());
        final Question question = createQuestion("What is your favorite season?", "");
        final TweetPoll tp = createPublishedTweetPoll(question, this.secondary);
        tp.getHashTags().add(this.initHashTag);
        getTweetPoll().saveOrUpdate(tp);
        // Item 2
        final Question question2 = createQuestion("What is your favorite holidays?", "");
        final TweetPoll tp2 = createPublishedTweetPoll(question2, this.secondary);
        tp2.getHashTags().add(this.initHashTag);
        getTweetPoll().saveOrUpdate(tp2);
        final List<HashTagListGraphData> list2 = getStatisticsService().getTotalUsagebyHashtagAndDateRangeListGraph( this.initHashTag.getHashTag(),
                SearchPeriods.ONEYEAR, request);
        Assert.assertEquals("Should be equals", 1, list2.size());
        Assert.assertEquals("Should be equals", Long.valueOf(3), list2.get(0).getValue());
View Full Code Here

             final Boolean completed,
             final Boolean favourites,
             final UserAccount tweetOwner,
             final Question question,
             final Date creationDate ){
        final TweetPoll tweetPoll = new TweetPoll();
        tweetPoll.setPublishTweetPoll(publishTweetPoll);
        tweetPoll.setCompleted(completed);
        tweetPoll.setCreateDate(creationDate);
        tweetPoll.setFavourites(favourites);
        tweetPoll.setQuestion(question);
        tweetPoll.setTweetOwner(tweetOwner.getAccount());
        tweetPoll.setEditorOwner(tweetOwner);
        getTweetPoll().saveOrUpdate(tweetPoll);
        return tweetPoll;
    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.tweetpoll.TweetPoll

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.