Examples of TweetPoll


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

     */
  @Test
    public void testGetGenericStats() throws EnMeNoResultsFoundException{
        final Question question = createQuestion("What is your favorite type of song?", "");
        // TweetPoll
        final TweetPoll tpoll = createPublishedTweetPoll(5L, question, getSpringSecurityLoggedUserAccount());
        // Poll
        final Poll poll = createPoll(new Date(), question, "JCPM", getSpringSecurityLoggedUserAccount(), Boolean.TRUE, Boolean.TRUE);
        // Survey
        //final Survey survey = createDefaultSurvey(getSpringSecurityLoggedUserAccount().getAccount(), "Technology survey", new Date());

    final GenericStatsBean genericTweetPollStats = getFrontEndService()
        .retrieveGenericStats(tpoll.getTweetPollId().toString(),
            TypeSearchResult.TWEETPOLL, this.request);
        Assert.assertNotNull(genericTweetPollStats);

    final GenericStatsBean genericPollStats = getFrontEndService()
        .retrieveGenericStats(poll.getPollId().toString(),
View Full Code Here

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

//            }
            // no scheduled tp in the demo data
            tweetPollBean.setSchedule(Boolean.FALSE);
            try {
                //final Question qm = createQuestion(question, u, QuestionPattern.CUSTOMIZABLE_SELECTION);
                final TweetPoll tweetPollDomain = getTweetPollService().createTweetPoll(tweetPollBean, question.getQuestionName(), u, null);

                //force to be published
                tweetPollDomain.setPublishTweetPoll(true);
                getTweetPollDao().saveOrUpdate(tweetPollDomain);
               
                double hits = getRandomNumberRange(2, EnMePlaceHolderConfigurer
                        .getIntegerProperty("demo.max.tweetpoll.hits"));
                for (int i = 0; i < hits; i++) {
                    getFrontEndService().registerHit(tweetPollDomain, null, null, null, EnMeUtils.ipGenerator(), HitCategory.VISIT);
                }

                double votes = getRandomNumberRange(10, EnMePlaceHolderConfigurer
                        .getIntegerProperty("demo.max.tweetpoll.votes"));
                for (int i = 0; i < votes; i++) {
                    getFrontEndService().registerVote(tweetPollDomain.getTweetPollId(), TypeSearchResult.TWEETPOLL, EnMeUtils.ipGenerator());
                }

                //TODO: make sense?
                //tpx.setHits(Long.valueOf(getRandomNumberRange(6, 5000)));
                //tpx.setNumbervotes(Long.valueOf(getRandomNumberRange(40, 10000)));

                tweetPollDomain.setPublishTweetPoll(true);
                Date tweetPollRandomDate = createRandomDate();
                tweetPollDomain.setCreateDate(tweetPollRandomDate);
                tweetPollDomain.setUpdatedDate(tweetPollRandomDate);
                getTweetPollDao().saveOrUpdate(tweetPollDomain);

                for (int i = 0; i < EnMePlaceHolderConfigurer
                        .getIntegerProperty("demo.max.tweetpoll.folder"); i++) {
                    log.debug("Creating folder name ....");
                    getTweetPollService().createTweetPollFolder(this.DEFAULT_FOLDER_NAME+"_"+i+"_", u.getUsername());
                }
                log.debug("New tweetpoll "+tweetPollDomain.getTweetPollId());

                for (CommentBean commentBean2 : comments) {
                    log.debug("New COMMENT tweetpoll ");
                    final Comment comment = new Comment();
                    comment.setTweetPoll(tweetPollDomain);
                    comment.setCreatedAt(createRandomDate());
                    comment.setComment(commentBean2.getComment());
                    comment.setDislikeVote(Long.valueOf(getRandomNumberRange(EnMePlaceHolderConfigurer
                            .getIntegerProperty("demo.min.comments.unlikes"), EnMePlaceHolderConfigurer
                            .getIntegerProperty("demo.max.comments.unlikes"))));
                    comment.setLikeVote(Long.valueOf(getRandomNumberRange(EnMePlaceHolderConfigurer
                            .getIntegerProperty("demo.min.comments.likes"), EnMePlaceHolderConfigurer
                            .getIntegerProperty("demo.max.comments.likes"))));
                    comment.setUser(userAccount.get(Double.valueOf(getRandomNumberRange(0, totalUsers) - 1).intValue()));
                    getTweetPollDao().saveOrUpdate(comment);
                    log.debug("Saved COMMENT tweetpoll ");
                }

                log.debug("Add hashtag to tweetpoll ");
                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);
                }
View Full Code Here

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

        hit.setHitCategory(HitCategory.VOTE);
        hit.setIpAddress(ipAddress);
            try {
                //vote process
                if (searchResult.equals(TypeSearchResult.TWEETPOLL)) {
                    final TweetPoll tp = getTweetPollService().getTweetPollPublishedById(itemId);
                    final Long votes = tp.getNumbervotes() + INCREASE_VOTES;
                    tp.setNumbervotes(votes);
                    hit.setTweetPoll(tp);
                    getTweetPollDao().saveOrUpdate(tp);
                } else if (searchResult.equals(TypeSearchResult.POLL)) {
                    final Poll poll = getPollService().getPollById(itemId);
                    final Long votes = poll.getNumbervotes() + INCREASE_VOTES;
View Full Code Here

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

            throws EnMeExpcetion {
        AccessRate recordAccessRate = new AccessRate();
        if (ipAddress != null) {
            if (type.equals(TypeSearchResult.TWEETPOLL)) {
                // Find tweetPoll by itemId.
                final TweetPoll tweetPoll = this.getTweetPoll(itemId);
                Assert.assertNotNull(tweetPoll);
                // Check if exist a previous tweetpoll access record.
                recordAccessRate = this.checkExistTweetPollPreviousRecord(
                        tweetPoll, ipAddress, rate);
            }
View Full Code Here

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

        long likeVotes;
        long dislikeVotes;
        long id;
        if (itemType.equals(TypeSearchResult.TWEETPOLL)) {
            id = new Long(Long.parseLong(itemId));
            final TweetPoll tweetPoll = this.getTweetPoll(id);
            totalHits = tweetPoll.getHits() == null ? 0 : tweetPoll.getHits();
            createdBy = tweetPoll.getEditorOwner().getUsername() == null ? ""
                    : tweetPoll.getEditorOwner().getUsername();
            createdAt = convertRelativeTimeToString(tweetPoll.getCreateDate(), request);
            likeVotes = tweetPoll.getLikeVote() == null ? 0L : tweetPoll
                    .getLikeVote();
            dislikeVotes = tweetPoll.getDislikeVote() == null ? 0L : tweetPoll
                    .getDislikeVote();
            // Like/Dislike Rate = Total Like votes minus total dislike votes.
            likeDislikeRate = (likeVotes - dislikeVotes);
            genericBean = ConvertDomainBean.createGenericStatsBean(likeDislikeRate, totalHits, createdBy, average, createdAt);
        } else if (itemType.equals(TypeSearchResult.POLL)) {
View Full Code Here

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

    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,
View Full Code Here

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

        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);
        getTweetPoll().saveOrUpdate(tp);

        // TweetPoll 2
        final TweetPoll tp2 = createPublishedTweetPoll(question, this.secondary);
        tp2.getHashTags().add(hashtag1);
        getTweetPoll().saveOrUpdate(tp2);

        // /
        final SocialAccount socialAccount = createDefaultSettedSocialAccount(this.secondary);
        assertNotNull(socialAccount);
        final String tweetContent = "Tweet content text";

        final TweetPollSavedPublishedStatus tpSaved = createTweetPollSavedPublishedStatus(
                tp, " ", socialAccount, tweetContent);

        tpSaved.setApiType(SocialProvider.TWITTER);
        tpSaved.setPublicationDateTweet(calendarDate.getTime());
        getTweetPoll().saveOrUpdate(tpSaved);
        assertNotNull(tpSaved);

        calendarDate.add(Calendar.MONTH, -2);

        final TweetPollSavedPublishedStatus tpSaved2 = createTweetPollSavedPublishedStatus(
                tp, " ", socialAccount, tweetContent);
        tpSaved2.setApiType(SocialProvider.FACEBOOK);
        tpSaved2.setPublicationDateTweet(calendarDate.getTime());
        getTweetPoll().saveOrUpdate(tpSaved2);
        assertNotNull(tpSaved2);

        // TweetPoll 3
        // calendarDate.add(Calendar.MONTH, -1);
        final TweetPoll tp3 = createPublishedTweetPoll(question, this.secondary);
        tp3.getHashTags().add(hashtag1);
        tp3.setCreateDate(calendarDate.getTime());
        getTweetPoll().saveOrUpdate(tp3);

        calendarDate.add(Calendar.MONTH, -2);
        final TweetPollSavedPublishedStatus tpSaved3 = createTweetPollSavedPublishedStatus(
                tp3, " ", socialAccount, tweetContent);
        tpSaved3.setApiType(SocialProvider.FACEBOOK);
        tpSaved3.setPublicationDateTweet(calendarDate.getTime());
        getTweetPoll().saveOrUpdate(tpSaved3);
        assertNotNull(tpSaved3);

        // TweetPoll 4
        final TweetPoll tp4 = createPublishedTweetPoll(question, this.secondary);
        tp4.getHashTags().add(hashtag1);
        tp4.setCreateDate(calendarDate.getTime());
        getTweetPoll().saveOrUpdate(tp4);

        calendarDate.add(Calendar.MONTH, -1);
        final TweetPollSavedPublishedStatus tpSaved4 = createTweetPollSavedPublishedStatus(
                tp4, " ", socialAccount, tweetContent);
View Full Code Here

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

        final Question question2 = createQuestion("Who will win  the spain league 2012?", "");
        final QuestionAnswer answerMadrid = createQuestionAnswer("Real Madrid", question2, "98765");
        final QuestionAnswer answerBarsa = createQuestionAnswer("Barcelon", question2, "765432");

        final TweetPoll tweetpoll2 = createPublishedTweetPoll(5L, question2,
                getSpringSecurityLoggedUserAccount());
        tweetpoll2.getHashTags().add(this.initHashTag);
        getTweetPoll().saveOrUpdate(initTweetPoll);

        final TweetPollSwitch tpSwichtMadrid = createTweetPollSwitch(answerMadrid, tweetpoll2);
        final TweetPollSwitch tpSwichtBarsa = createTweetPollSwitch(answerBarsa, tweetpoll2);
View Full Code Here

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

        final HashTag hashtag1 = createHashTag("romantic");

        final Question question = createQuestion("What is your favorite type of movies?", "");
        final Date myDate = new Date();
        // TweetPoll
        final TweetPoll tp = createPublishedTweetPoll(question, this.secondary);
        tp.getHashTags().add(hashtag1);
        getTweetPoll().saveOrUpdate(tp);

        // Poll
        final Poll poll = createPoll(myDate, question, this.secondary,
                Boolean.TRUE, Boolean.TRUE);
View Full Code Here

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

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

        ///
        final SocialAccount socialAccount = createDefaultSettedSocialAccount(this.secondary);
        assertNotNull(socialAccount);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.