Package org.encuestame.persistence.domain.question

Examples of org.encuestame.persistence.domain.question.QuestionAnswer


     * @param answerId answer Id
     * @param nameUpdated new name for answer
     * @throws EnMeExpcetion exception
     */
    public void updateAnswerByAnswerId(final Long answerId, String nameUpdated) throws EnMeExpcetion{
            final QuestionAnswer answer = getQuestionDao().retrieveAnswerById(answerId);
            if (answer==null) {
                throw new EnMeExpcetion("answer not found");
            }
            answer.setAnswer(nameUpdated);
            getQuestionDao().saveOrUpdate(answer);
    }
View Full Code Here


            final TweetPoll tp,
            final HttpServletRequest request)
            throws EnMeNoResultsFoundException {
        final Question question = tp.getQuestion();
        //create answer
        final QuestionAnswer questionAnswer = createQuestionAnswer(answerBean,
                question);
        if (questionAnswer == null) {
            throw new EnMeNoResultsFoundException("answer is missing");
        } else {
            //create tweet poll switch with tp and new answer.
            log.debug("createTweetPollQuestionAnswer: short url provider:{ "+questionAnswer.getProvider());
            final TweetPollSwitch tpSwitch = this.createTweetPollSwitch(tp, questionAnswer, request);
            return tpSwitch;
        }
    }
View Full Code Here

            final List<TweetPollSwitch> tweetPollSwitchs = getTweetPollSwitch(tweetPollDomain);
            log.debug("generateTweetPollText tweetPollSwitchs:{ "+tweetPollSwitchs.size());
            final StringBuilder builder = new StringBuilder(tweetQuestionText);

            for (final TweetPollSwitch tpswitch : tweetPollSwitchs) {
                 final QuestionAnswer questionsAnswers = tpswitch.getAnswers();
                 log.debug("Answer ID: "+questionsAnswers.getQuestionAnswerId());
                 log.debug("Answer Question: "+questionsAnswers.getAnswer());
                 builder.append(" ");
                 builder.append(questionsAnswers.getAnswer());
                 builder.append(" ");
                 builder.append(tpswitch.getShortUrl());
            }

            // build Hash Tag.
View Full Code Here

     * @param answerId answer Id
     * @param nameUpdated new name for answer
     * @throws EnMeExpcetion exception
     */
    public void updateAnswerByAnswerId(final Long answerId, String nameUpdated) throws EnMeExpcetion{
            final QuestionAnswer answer = getQuestionDao().retrieveAnswerById(answerId);
            if(answer==null){
                throw new EnMeExpcetion("answer not found");
            }
            answer.setAnswer(nameUpdated);
            getQuestionDao().saveOrUpdate(answer);
    }
View Full Code Here

     * @param question question
     * @param hash hash
     * @return {@link QuestionAnswer}
     */
    public QuestionAnswer createQuestionAnswer(final String answer, final Question question, final String hash){
        final QuestionAnswer questionsAnswers = new QuestionAnswer();
        questionsAnswers.setAnswer(answer);
        questionsAnswers.setQuestions(question);
        questionsAnswers.setUniqueAnserHash(hash);
        questionsAnswers.setColor(PictureUtils.getRandomHexColor());
        questionsAnswers.setAnswerType(AnswerType.DEFAULT);
        getQuestionDaoImp().saveOrUpdate(questionsAnswers);
        //log.info("Q "+questionsAnswers.getQuestionAnswerId());
        return questionsAnswers;
    }
View Full Code Here

     * @param answer
     * @param question
     * @return
     */
    public QuestionAnswer createDefaultQuestionAnswer(final String answer, final Question question){
        final QuestionAnswer questionsAnswers = new QuestionAnswer();
        questionsAnswers.setAnswer(answer);
        questionsAnswers.setQuestions(question);
        questionsAnswers.setUniqueAnserHash(RandomStringUtils.randomAlphabetic(18));
        questionsAnswers.setColor(PictureUtils.getRandomHexColor());
        questionsAnswers.setAnswerType(AnswerType.DEFAULT);
        getQuestionDaoImp().saveOrUpdate(questionsAnswers);
        //log.info("Q "+questionsAnswers.getQuestionAnswerId());
        return questionsAnswers;
    }
View Full Code Here

     * @return tweet poll
     */
    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");
View Full Code Here

    @Before
    public void initData(){
        this.secondary = createUserAccount("paola", createAccount());
        this.initQuestion = createQuestion("Who will win  the champions league 2012?", "");
        this.initHashTag = createHashTag("futbol");
        final QuestionAnswer answerChelsea = createQuestionAnswer("Chelsea", initQuestion, "123457");
        final QuestionAnswer answerBayern = createQuestionAnswer("Bayern", initQuestion, "123469");

        this.initTweetPoll = createPublishedTweetPoll(5L, initQuestion,
                getSpringSecurityLoggedUserAccount());
        initTweetPoll.getHashTags().add(initHashTag);
        getTweetPoll().saveOrUpdate(initTweetPoll);
View Full Code Here

    public void testGetTotalVotesbyHashTagUsageAndDateRange() throws EnMeSearchException{

        DateTime updateDate = new DateTime();

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

        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");

        final QuestionAnswer questionsAnswers3 = createQuestionAnswer("yes", question2, "11121314");
        final QuestionAnswer questionsAnswers4 = createQuestionAnswer("no", question2, "11121315");

        final TweetPollSwitch tpollSwitch1 = createTweetPollSwitch(questionsAnswers1, tp);
        final TweetPollSwitch tpollSwitch2 = createTweetPollSwitch(questionsAnswers2, tp);

        final TweetPollSwitch tpollSwitch3 = createTweetPollSwitch(questionsAnswers3, tp2);
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.question.QuestionAnswer

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.