Examples of QuestionAnswer


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

                log.debug("survey section id is missing");
            } else {

                final Survey survey = getSurveyService()
                        .getSurveyById(surveyId);
                final QuestionAnswer qAnswer = getSurveyService()
                        .getQuestionAnswerById(qanswer);
                final Question question = getSurveyService().getQuestionById(
                        questionId);
                final SurveyResult surveyResult = getSurveyService()
                        .saveSurveyResult(qAnswer, survey, question,
View Full Code Here

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

  @Test
  public void testSaveSurveyResponses() throws ServletException, IOException {
    Assert.assertNotNull(survey);
    createDefaultSection("SurveySection 2", this.survey);
    final Question myQuestion = createDefaultQuestion("Who is the best football player");
    final QuestionAnswer qAnswer1 = createQuestionAnswer("D.Beckam",
        myQuestion, "");
    createQuestionAnswer("L.Messi", myQuestion, "");

    // Search All surveys.
    initService("/api/survey/save.json", MethodJson.GET);
    setParameter("sid", this.survey.getSid().toString());
    setParameter("question", myQuestion.getQid().toString());
    setParameter("answer", qAnswer1.getQuestionAnswerId().toString());
    setParameter("txtResponse", "50");

    final JSONObject response = callJsonService();
    final JSONObject sucess = getSucess(response);
View Full Code Here

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

    /**
     * Test QuestionAnswer.
     **/
    @Test
    public void testQuestionAnswer(){
        final QuestionAnswer qanswer = new QuestionAnswer();
        qanswer.setAnswer("Yes");
        qanswer.setProvider(ShortUrlProvider.GOOGL);
        qanswer.setQuestions(createQuestion("Are you single?", "yesNo",createAccount()));
        qanswer.setUniqueAnserHash("AKDL12_"+RandomStringUtils.randomAlphabetic(4));
        qanswer.setAnswerType(AnswerType.DEFAULT);
        qanswer.setUrlAnswer("url");
        //getQuestionDaoImp().saveOrUpdate(qanswer);
        //assertNotNull(qanswer);
    }
View Full Code Here

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

                    TypeSearchResult.HASHTAG, null);
        Assert.assertEquals("Should be equals ", totalHitsbyTag.intValue(), 5);

        // 4- Get total Usage by tweetpoll voted.

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

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

        createTweetPollResult(tpollSwitch1, "192.168.0.1");
View Full Code Here

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

    public void init() throws EnMeNoResultsFoundException{
      //question
        final Question question = createQuestion("Real Madrid or Barcelona?", getSpringSecurityLoggedUserAccount().getAccount());
        //tweetpoll
        this.tweetPoll = createTweetPollPublicated(Boolean.TRUE, Boolean.TRUE, new Date(), getSpringSecurityLoggedUserAccount(), question);
        final QuestionAnswer questionsAnswers1 = createQuestionAnswer("Yes", question, "hash1");
        final QuestionAnswer questionsAnswers2 = createQuestionAnswer("No", question, "hash2");
         //answers
        this.answer1 = createTweetPollSwitch(questionsAnswers1, tweetPoll);
        this.answer2 = createTweetPollSwitch(questionsAnswers2, tweetPoll);
        //votes
        getTweetPollService().tweetPollVote(answer1, "80.23.43.23", Calendar.getInstance().getTime());
        getTweetPollService().tweetPollVote(answer2, "80.33.13.23", Calendar.getInstance().getTime());
        getTweetPollService().tweetPollVote(answer2, "80.13.13.43", Calendar.getInstance().getTime());
        getTweetPollService().tweetPollVote(answer2, "30.33.13.23", Calendar.getInstance().getTime());
        getTweetPollService().tweetPollVote(answer1, "80.33.13.13", Calendar.getInstance().getTime());
        //poll
        this.poll = createPoll(new Date(), question,  getSpringSecurityLoggedUserAccount(), true, true);
        getPollService().vote(poll, question.getSlugQuestion(), "80.33.13.23", questionsAnswers1.getQuestionAnswerId());
        getPollService().vote(poll, question.getSlugQuestion(), "80.33.13.25", questionsAnswers2.getQuestionAnswerId());
    }
View Full Code Here

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

        public void initMVc() {
            final UserAccount userAccount = createUserAccount("jota", createAccount());
            createFakesTweetPoll(userAccount);
            final TweetPoll tp1 = (TweetPoll) getHibernateTemplate().find("from TweetPoll").get(0);
            final Question q1 = tp1.getQuestion();
            final QuestionAnswer a1 = createQuestionAnswer("yes", q1, "12345");
            final QuestionAnswer a2 = createQuestionAnswer("no", q1, "12346");
            this.tpswitch = createTweetPollSwitch(a1, tp1);
            final TweetPollSwitch tps2 = createTweetPollSwitch(a2, tp1);
        }
View Full Code Here

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

     * org.encuestame.persistence.domain.security.UserAccount)
     */
    public Poll getPollByAnswerId(final Long pollId, final Long answerId,
            final UserAccount account) throws EnMeNoResultsFoundException {
        final Poll poll = this.getPollById(pollId);
        QuestionAnswer qA = getQuestionDao().retrieveAnswersByQuestionId(
                poll.getQuestion(), answerId);
        if (qA == null) {
            throw new EnMeNoResultsFoundException("Answer not found");
        }
        return poll;
View Full Code Here

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

     */
    public QuestionAnswer createQuestionAnswer(
            final QuestionAnswerBean answerBean,
            final Question question){
        log.debug("action createQuestionAnswer "+ answerBean.toString());
        final QuestionAnswer answer = new QuestionAnswer();
        answer.setQuestions(question);
        answer.setAnswer(answerBean.getAnswers());
        answer.setProvider(answerBean.getShortUrlType());
        answer.setColor(PictureUtils.getRandomHexColor());
        answer.setUniqueAnserHash(answerBean.getAnswerHash());
        this.getQuestionDao().saveOrUpdate(answer);
        answerBean.setAnswerId(answer.getQuestionAnswerId());
        log.debug("QuestionAnswer created:{"+answerBean.toString());
        return answer;
    }
View Full Code Here

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

     *
     * @param question
     * @return
     */
    public QuestionAnswer createAnswers(final Question question, final String answerText){
         final QuestionAnswer answer = new QuestionAnswer();
          answer.setQuestions(question);
          answer.setAnswer(answerText);
          answer.setColor(PictureUtils.getRandomHexColor());
          this.getQuestionDao().saveOrUpdate(answer);
          log.debug("createAnswers =>" + answer.getQuestionAnswerId());
        return answer;
    }
View Full Code Here

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

     * @param id
     * @return
     * @throws EnMeNoResultsFoundException
     */
    public QuestionAnswer getQuestionAnswerById(final Long id) throws EnMeNoResultsFoundException{
        final QuestionAnswer answer = getQuestionDao().retrieveAnswerById(id);
        if (answer == null) {
            throw new EnMeNoResultsFoundException("answer not found");
        }
        return  answer;
    }
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.