Package org.encuestame.persistence.domain.survey

Examples of org.encuestame.persistence.domain.survey.Poll


            // 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)) {
            id = new Long(Long.parseLong(itemId));
            final Poll poll = this.getPoll(id);
            totalHits = poll.getHits() == null ? 0 : poll.getHits();
            createdBy = poll.getEditorOwner().getUsername();
            createdAt = convertRelativeTimeToString(poll.getCreateDate(), request);
            likeVotes = poll.getLikeVote() == null ? 0L : poll.getLikeVote();
            dislikeVotes = poll.getDislikeVote() == null ? 0L : poll
                    .getDislikeVote();
            likeDislikeRate = (likeVotes - dislikeVotes);
            genericBean = ConvertDomainBean.createGenericStatsBean(likeDislikeRate, totalHits, createdBy, average, createdAt);
        } else if (itemType.equals(TypeSearchResult.SURVEY)) {
            id = new Long(Long.parseLong(itemId));
View Full Code Here


            final UserAccount userAccount,
            final Boolean pollCompleted,
            final Boolean pollPublish
            ){
        final String pollHash = RandomStringUtils.randomAlphabetic(18);
        final Poll poll = new Poll();
        poll.setCreateDate(createdAt);
        poll.setQuestion(question);
        poll.setPollHash(pollHash);         //should be unique
        poll.setEditorOwner(userAccount);
        poll.setOwner(userAccount.getAccount());
        poll.setPollCompleted(pollCompleted);
        poll.setPublish(pollPublish);
        poll.setShowComments(CommentOptions.APPROVE);
        poll.setRelevance(1L);
        getPollDao().saveOrUpdate(poll);
        return poll;

    }
View Full Code Here

     * @param dislikeVote
     * @return
     */
    public Poll createDefaultPoll(final Question question,
            final UserAccount userAccount, final Date createdAt, final Long likeVote, final Long dislikeVote) {
        final Poll poll = createPoll(createdAt, question, userAccount, Boolean.TRUE,
                Boolean.TRUE);
        poll.setLikeVote(likeVote);
        poll.setDislikeVote(dislikeVote);
        getPollDao().saveOrUpdate(poll);
        return poll;
    }
View Full Code Here

            final Question question,
            final String hash,
            final UserAccount userAccount,
            final Boolean pollCompleted,
            final Boolean published){
        final Poll poll = new Poll();
        poll.setCreateDate(createdDate);
        poll.setCloseAfterDate(true);
        poll.setAdditionalInfo("additional");
        poll.setClosedDate(new Date());
        poll.setClosedQuota(100);
        poll.setCustomFinalMessage(CustomFinalMessage.FINALMESSAGE);
        poll.setCustomMessage(true);
        poll.setDislikeVote(1L);
        poll.setLikeVote(1L);
        poll.setEndDate(new Date());
        poll.setFavourites(true);
        poll.setNumbervotes(600L);
        poll.setQuestion(question);
        poll.setPollHash(hash);
        poll.setEditorOwner(userAccount);
        poll.setOwner(userAccount.getAccount());
        poll.setPollCompleted(pollCompleted);
        poll.setPublish(published);
        poll.setShowComments(CommentOptions.APPROVE);
        getPollDao().saveOrUpdate(poll);
        return poll;

    }
View Full Code Here

     * @return
     * @throws EnMeNoResultsFoundException
     */
    public Poll addPollToFolder(final Long folderId, final UserAccount userAccount, final Long pollId) throws EnMeNoResultsFoundException{
        final PollFolder pfolder = getPollDao().getPollFolderById(folderId);
        final Poll poll = getPollDao().getPollById(pollId, userAccount);
        poll.setPollFolder(pfolder);
        getPollDao().saveOrUpdate(poll);
        return poll;
    }
View Full Code Here

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

        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);
        poll.getHashTags().add(hashtag1);
        getPollDao().saveOrUpdate(poll);

        // Poll 2
        final Question question2 = createQuestion("What is your favorite type of music?", "");
         final Poll poll2 = createPoll(myDate, question2, this.secondary,
                Boolean.TRUE, Boolean.TRUE);
        poll2.getHashTags().add(hashtag1);
        getPollDao().saveOrUpdate(poll2);

        // Survey
        final Survey mySurvey = createDefaultSurvey(account, "Survey test",
                myDate);
View Full Code Here

                tp, " ", socialAccount, tweetContent);
        tpSaved2.setApiType(SocialProvider.FACEBOOK);
        getTweetPoll().saveOrUpdate(tpSaved2);
        assertNotNull(tpSaved2);

        final Poll poll1 = createPoll(new Date(), question,
                "DPMU123", this.secondary, Boolean.TRUE, Boolean.TRUE);
        poll1.getHashTags().add(hashtag1);
        getPollDao().saveOrUpdate(poll1);

        final TweetPollSavedPublishedStatus pollSaved1 = createPollSavedPublishedStatus(
                poll1, " ", socialAccount, tweetContent);
        pollSaved1.setApiType(SocialProvider.TWITTER);
View Full Code Here

            throws NoSuchAlgorithmException, UnsupportedEncodingException {
        int j = 0;
        List<QuestionAnswer> qAnswersList = new ArrayList<QuestionAnswer>();

        final Question pollQuestion = this.createRandomQuestion();
        final Poll myPoll = createPoll(randomDate, pollQuestion,
                MD5Utils.md5(RandomStringUtils.randomAlphanumeric(4)),
                getSpringSecurityLoggedUserAccount(), Boolean.TRUE, Boolean.TRUE);
        myPoll.getHashTags().add(tag);
        getPollDao().saveOrUpdate(myPoll);
        for (j = 0; j < 2; j++) {
            // Creating answers...
            final QuestionAnswer qAnswers = this.createRandomQuestionAnswer(j,
                    pollQuestion, answers);
View Full Code Here

        tpoll3.setCreateDate(createdAt.toDate());
        getTweetPoll().saveOrUpdate(tpoll3);
        //myDate.add(Calendar.MONTH, -2);
        createdAt = this.creationDate.minusMonths(4);

         final Poll poll4 = createDefaultPoll(question,
                 getSpringSecurityLoggedUserAccount());
         poll4.getHashTags().add(mytag);
         poll4.setCreateDate(createdAt.toDate());
         getPollDao().saveOrUpdate(poll4);


         createdAt = this.creationDate.minusMonths(6);
         final Survey survey5 = createDefaultSurvey(
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.survey.Poll

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.