Package org.encuestame.persistence.domain.question

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


        final HashTag hashTag2 = createHashTag("holidays",70L);
        final HashTag hashTag3 = createHashTag("futboll",80L);
        final HashTag hashTag4 = createHashTag("championsLeague",90L);
        final HashTag hashTag5 = createHashTag("copaAmerica",150L);

        /** Question 2 **/
        final Question question2 = createQuestion("Question 1", "");
        createQuestionAnswer("yes", question2, "12345");
        createQuestionAnswer("no", question2, "12346");
        this.tweetPoll = createPublishedTweetPoll(secondary.getAccount(), question2);

        this.tweetPoll.getHashTags().add(hashTag1);
        this.tweetPoll.getHashTags().add(hashTag2);
        getTweetPoll().saveOrUpdate(this.tweetPoll);

        /** Question 3 **/
        final Question question3 = createQuestion("Question 2", "");
        createQuestionAnswer("yes", question3, "12345");
        createQuestionAnswer("no", question3, "12346");
        this.tweetPoll = createPublishedTweetPoll(secondary.getAccount(), question3);

        this.tweetPoll.getHashTags().add(hashTag1);
        this.tweetPoll.getHashTags().add(hashTag2);
        this.tweetPoll.getHashTags().add(hashTag3);
        getTweetPoll().saveOrUpdate(this.tweetPoll);

        /** Question 4 **/
        final Question question4 = createQuestion("Question 3", "");
        createQuestionAnswer("yes", question4, "12345");
        createQuestionAnswer("no", question4, "12346");
        this.tweetPoll = createPublishedTweetPoll(secondary.getAccount(), question4);

        this.tweetPoll.getHashTags().add(hashTag1);
        this.tweetPoll.getHashTags().add(hashTag4);
        this.tweetPoll.getHashTags().add(hashTag5);
        getTweetPoll().saveOrUpdate(this.tweetPoll);

        /** Question 5 **/
        final Question question5 = createQuestion("Question 4", "");
        createQuestionAnswer("yes", question5, "12345");
        createQuestionAnswer("no", question5, "12346");
        this.tweetPoll = createPublishedTweetPoll(secondary.getAccount(), question5);

        this.tweetPoll.getHashTags().add(hashTag4);
        this.tweetPoll.getHashTags().add(hashTag5);
        this.tweetPoll.getHashTags().add(hashTag3);
        getTweetPoll().saveOrUpdate(this.tweetPoll);

        final Question question6 = createQuestion("Question 5", "");
        createQuestionAnswer("yes", question6, "12345");
        createQuestionAnswer("no", question6, "12346");
        this.tweetPoll = createPublishedTweetPoll(secondary.getAccount(), question6);

        this.tweetPoll.getHashTags().add(hashTag3);
View Full Code Here


     * @throws EnMeNoResultsFoundException
     * @throws EnMeExpcetion
     */
    @Test
    public void testRegisterAccessRateVotedLike() throws EnMeNoResultsFoundException, EnMeExpcetion{
         final Question question = createQuestion("Who are you?", "");
         final TweetPoll tp = createPublishedTweetPoll(getSpringSecurityLoggedUserAccount().getAccount(), question);
         final String ipAddress = "192.168.1.81";
         flushIndexes();
         // I like it vote.
         final AccessRate rate = getFrontEndService().registerAccessRate(
View Full Code Here

     * Test get user rated top.
     * @throws EnMeNoResultsFoundException
     */
  @Test
  public void testGetUsersRatedTop() throws EnMeNoResultsFoundException {
    final Question question = createQuestion("Who are you ?", "");
    final Question question2 = createQuestion(
        "What is your favorite month of the year", "");
    final Question question3 = createQuestion(
        "What is your favorite quote", "");
    final Question question4 = createQuestion(
        "What is your marital status?", "");
    final Date myDate = new Date();
    createPublishedTweetPoll(question, this.secondary);
    createPublishedTweetPoll(question2, this.secondary);
    createPoll(myDate, question3, this.secondary, Boolean.TRUE,
View Full Code Here

     * Test Generic data stats.
     * @throws EnMeNoResultsFoundException
     */
  @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
View Full Code Here

     * @throws EnMeExpcetion exception
     * @deprecated use the parent method.
     */
    @Deprecated
    public Question createQuestion(final QuestionBean questionBean) throws EnMeExpcetion{
            final Question question = new Question();
            try{
                question.setQuestion(questionBean.getQuestionName());
                question.setAccountQuestion(getAccountDao().getUserById(questionBean.getUserId()));
                question.setQidKey(MD5Utils.md5(RandomStringUtils.randomAlphanumeric(SurveyService.RANDOM_QUESTION_KEY)));
                question.setSlugQuestion(RestFullUtil.slugify(questionBean.getQuestionName()));
                //question.setQidKey("xxxxxxxxxxxxxx");
                question.setSharedQuestion(Boolean.TRUE);
                question.setHits(0L);
                question.setCreateDate(new Date());
                //save question
                getQuestionDao().saveOrUpdate(question);
                questionBean.setId(question.getQid());
                //save answers.
                for (final QuestionAnswerBean answerBean : questionBean.getListAnswers()) {
                    this.createQuestionAnswer(answerBean, question);
                }
            }
View Full Code Here

  public Question addQuestionToSurveySection(final String questionName,
      final UserAccount user, final SurveySection section,
      final QuestionPattern questionPattern, final String[] answers)
      throws EnMeExpcetion, NoSuchAlgorithmException,
      UnsupportedEncodingException {
      Question question = new Question();
      if ((questionName == null) || (questionName.isEmpty())) {
        log.error("Question is required");
      } else {
        // Create question
        question = createQuestion(questionName, user);
        // Add section to question
        question.setSection(section);
        // Add answers to question
        question.setQuestionPattern(questionPattern);
        this.getQuestionDao().saveOrUpdate(question);
        //
      /* if(answers.length == 0) {
        throw new EnMeNoResultsFoundException(
        "answers are required");
View Full Code Here

     * @return {@link Question}
     */
    public Question createQuestion(
            final String question,
            final String pattern){
        final Question questions = new Question();
        questions.setQidKey("1");
        questions.setQuestion(question);
        questions.setSlugQuestion(question.replace(" ", "-"));
        questions.setSharedQuestion(Boolean.TRUE);
        questions.setAccountQuestion(this.createAccount());
        getQuestionDaoImp().saveOrUpdate(questions);
        return questions;
    }
View Full Code Here

    public Question addQuestionSection(
            final String question,
            final SurveySection section,
            final Account account){
        final Question questions = new Question();
        questions.setQidKey("1");
        questions.setQuestion(question);
        questions.setSlugQuestion(question.replace(" ", "-"));
        questions.setSharedQuestion(Boolean.TRUE);
        questions.setAccountQuestion(account);
        questions.setSection(section);
        getQuestionDaoImp().saveOrUpdate(questions);
        return questions;
    }
View Full Code Here

     * @param questionName
     * @param user
     * @return
     */
    public Question createQuestion(final String questionName, final Account user){
        final Question question =  this.createQuestion(questionName, "pattern");
        question.setAccountQuestion(user);
        getQuestionDaoImp().saveOrUpdate(question);
        return question;
    }
View Full Code Here

    public Question createQuestion(
            final String questionName,
            final Account user,
            final Date createDate,
            final Long hits){
        final Question question =  this.createQuestion(questionName, "pattern");
        question.setAccountQuestion(user);
        question.setCreateDate(createDate);
        question.setHits(hits);
        getQuestionDaoImp().saveOrUpdate(question);
        return question;
    }
View Full Code Here

TOP

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

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.