Package org.encuestame.persistence.domain.survey

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


     * (non-Javadoc)
     * @see org.encuestame.core.service.imp.IPollService#ipProtectionPoll(java.lang.Long, java.lang.String)
     */
    public void ipProtectionPoll(final Long pollId, final String username)
            throws EnMeNoResultsFoundException, EnmeFailOperation {
        final Poll poll = getPollById(pollId, username);
        if (poll != null) {
            poll.setIpRestriction(!(poll.getIpRestriction() == null ? false
                    : poll.getIpRestriction()));
            getPollDao().saveOrUpdate(poll);
        } else {
            throw new EnmeFailOperation("Fail Change Status Operation");
        }
    }
View Full Code Here


     * @see org.encuestame.core.service.imp.IPollService#ipEnableNotificationsPoll(java.lang.Long, java.lang.String)
     */
    public void enableNotificationsPoll(final Long pollId,
            final String username) throws EnMeNoResultsFoundException,
            EnmeFailOperation {
        final Poll poll = getPollById(pollId, username);
        if (poll != null) {
            poll.setNotifications(!(poll.getNotifications() == null ? false
                    : poll.getNotifications()));
            getPollDao().saveOrUpdate(poll);
        } else {
            throw new EnmeFailOperation("Fail Change Status Operation");
        }
    }
View Full Code Here

     * (non-Javadoc)
     * @see org.encuestame.core.service.imp.IPollService#setAdditionalInfoPoll(java.lang.Long, java.lang.String)
     */
    public void setAdditionalInfoPoll(final Long pollId, final String username)
            throws EnMeNoResultsFoundException, EnmeFailOperation {
        final Poll poll = getPollById(pollId, username);
        if (poll != null) {
            poll.setShowAdditionalInfo(!(poll.getShowAdditionalInfo() == null ? false
                    : poll.getShowAdditionalInfo()));
            getPollDao().saveOrUpdate(poll);
        } else {
            throw new EnmeFailOperation("Fail Change Status Operation");
        }
    }
View Full Code Here

     * @see org.encuestame.core.service.imp.IPollService#setPasswordRestrictionsPoll(java.lang.Long, java.lang.String)
     */
    public void setPasswordRestrictionsPoll(final Long pollId,
            final String username) throws EnMeNoResultsFoundException,
            EnmeFailOperation {
        final Poll poll = getPollById(pollId, username);
        if (poll != null) {
            poll.setPasswordRestrictions(!(poll.getPasswordRestrictions() == null ? false
                    : poll.getPasswordRestrictions()));
            getPollDao().saveOrUpdate(poll);
        } else {
            throw new EnmeFailOperation("Fail Change Status Operation");
        }
    }
View Full Code Here

     * (non-Javadoc)
     * @see org.encuestame.core.service.imp.IPollService#setShowResultsPoll(java.lang.Long, java.lang.String)
     */
    public void setShowResultsPoll(final Long pollId, final String username)
            throws EnMeNoResultsFoundException, EnmeFailOperation {
        final Poll poll = getPollById(pollId, username);
        if (poll != null) {
            poll.setShowResults(ShowResultsOptions.getShowResults("ALL"));
            getPollDao().saveOrUpdate(poll);
        } else {
            throw new EnmeFailOperation("Fail Change Status Operation");
        }
    }
View Full Code Here

     * (non-Javadoc)
     * @see org.encuestame.core.service.imp.IPollService#getPollDetailInfo(java.lang.Long)
     */
    public PollDetailBean getPollDetailInfo(final Long pollId) throws EnMeNoResultsFoundException{
        final PollDetailBean detail = new PollDetailBean();
        final Poll poll = getPoll(pollId);
        detail.setPollBean(ConvertDomainBean.convertPollDomainToBean(poll));
        detail.setResults(this.getResultVotes(poll));
        //FIXME: Next line is repeated, please review
        this.calculatePercents(detail.getResults());
        //set the list of answers
        detail.setListAnswers(ConvertDomainBean
                .convertAnswersToQuestionAnswerBean(getQuestionDao()
                        .getAnswersByQuestionId(poll.getQuestion().getQid())));
        //set the comments.
        detail.getPollBean().setTotalComments(this.getTotalCommentsbyType(detail.getPollBean().getId(), TypeSearchResult.POLL));
        return detail;
    }
View Full Code Here

    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(),
            TypeSearchResult.POLL, this.request);
        Assert.assertNotNull(genericPollStats);

       
        final HashTag hashtag = createHashTag("continents", 350L);
View Full Code Here

                createPollBean.setMultiple(Boolean.FALSE);
                createPollBean.setCloseDate(null);
                createPollBean.setLimitVote(null);
                createPollBean.setAllowAdd(Boolean.FALSE);
                createPollBean.setHashtags(arrayHashtag);
                final Poll poll = getPollService().createPoll(createPollBean);
                getTweetPollDao().saveOrUpdate(poll);
                double hits = getRandomNumberRange(EnMePlaceHolderConfigurer
                        .getIntegerProperty("demo.min.poll.hits"), EnMePlaceHolderConfigurer
                        .getIntegerProperty("demo.max.poll.hits"));

                for (int i = 0; i < hits; i++) {
                    getFrontEndService().registerHit(null, poll, null, null, EnMeUtils.ipGenerator(), HitCategory.VISIT);
                }

                double votes = getRandomNumberRange(EnMePlaceHolderConfigurer
                        .getIntegerProperty("demo.min.poll.votes"), EnMePlaceHolderConfigurer
                        .getIntegerProperty("demo.max.poll.votes"));

                for (int i = 0; i < votes; i++) {
                    getFrontEndService().registerVote(poll.getPollId(), TypeSearchResult.POLL, EnMeUtils.ipGenerator());
                }

                log.trace(" Polls ID ..."+poll.getPollId());
                    final List<QuestionAnswerBean> answer = getPollService().retrieveAnswerByQuestionId(poll.getQuestion().getQid());
                    for (QuestionAnswerBean questionAnswerBean : answer) {
                        double totalVotes = getRandomNumberRange(0, EnMePlaceHolderConfigurer.getIntegerProperty("demo.votes.by.poll")) - 1;
                        log.trace(totalVotes+":: Votes for this POLL switch id "+questionAnswerBean.getAnswers());
                        for (int i = 0; i < totalVotes; i++) {
                        getPollService().vote(poll,
                                poll.getQuestion().getSlugQuestion(),
                                EnMeUtils.ipGenerator(),questionAnswerBean.getAnswerId());
                        }
                    }
                    log.trace(" Polls ID ..."+poll.getCreateDate());
            } catch (EnMeExpcetion e) {
                e.printStackTrace();
            }
        }
        //retrive all hits
View Full Code Here

                    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;
                    poll.setNumbervotes(votes);
                    getPollDao().saveOrUpdate(poll);
                    hit.setPoll(poll);
                } else if (searchResult.equals(TypeSearchResult.SURVEY)) {
                    //TODO: Vote a Survey.
                }
View Full Code Here

                        tweetPoll, ipAddress, rate);
            }
            // Poll Acces rate item.
            if (type.equals(TypeSearchResult.POLL)) {
                // Find poll by itemId.
                final Poll poll = this.getPoll(itemId);
                Assert.assertNotNull(poll);
                // Check if exist a previous poll access record.
                recordAccessRate = this.checkExistPollPreviousRecord(poll,
                        ipAddress, rate);
            }
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.