Package org.encuestame.utils.json

Examples of org.encuestame.utils.json.QuestionBean


        tweetPoll.setId(1L);
        tweetPoll.setAllowLiveResults(true);
        tweetPoll.setCloseNotification(true);
        tweetPoll.setPublishPoll(true);
        tweetPoll.setUserId(1L);
        tweetPoll.setQuestionBean(new QuestionBean());
        tweetPoll.setResultNotification(true);
        List<ResumeResultTweetPoll> results = new ArrayList<ResumeResultTweetPoll>();
        tweetPoll.setResults(results);
        tweetPoll.setSchedule(true);
        tweetPoll.setScheduleDate(myDate);
View Full Code Here


    public void testUnitPoll(){
        final PollBean poll = new PollBean();
        poll.setId(1L);
        poll.setCompletedPoll(true);
        poll.setCreateDate(DateUtil.DOJO_DATE_FORMAT.format(new Date()));
        poll.setQuestionBean(new QuestionBean());
        poll.setFinishDate(new Date());
        poll.setPublishPoll(true);
        poll.setCloseNotification(true);
        poll.setHashTags(new ArrayList<HashTagBean>());
        poll.setShowResultsPoll(true);
View Full Code Here

    /**
     * Test {@link QuestionBean}.
     */
    @Test
    public void testUnitQuestionBean(){
        final QuestionBean questionBean = new QuestionBean();
        questionBean.setId(1L);
        questionBean.setListAnswers(new ArrayList<QuestionAnswerBean>());
        questionBean.setQuestionName("Why sky is blue?");
        questionBean.setStateId(1L);
        questionBean.setUserId(1L);
        questionBean.setVersion("1.0");
        questionBean.setSlugName("Why-sky-is-blue-");
        questionBean.setHits(10L);
        assertNotNull(questionBean.getId());
        assertEquals(questionBean.getListAnswers().size(), 0);
        assertNotNull(questionBean.getQuestionName());
        assertNotNull(questionBean.getStateId());
        assertNotNull(questionBean.getUserId());
        assertNotNull(questionBean.getVersion());
    }
View Full Code Here

        final List<QuestionAnswerBean> qAnswerBean = new ArrayList<QuestionAnswerBean>();
        qAnswerBean.add(this.questionAnswer);
        qAnswerBean.add(qAnswer2);

        // QuestionBean
        QuestionBean qBean = createUnitQuestionBean(1L, "First question", "1",
                qAnswerBean);
        assertNotNull(qBean);

        // HashTagBeans
        HashTagBean tagBean1 = createUnitHashTag("Education", 1L);
View Full Code Here

     */
    @Test
    public void testUnitSurveySectionBean(){
        final UnitSurveySection surveySectionBean = new UnitSurveySection();
        final List<QuestionBean> questionBeanList = new ArrayList<QuestionBean>();
        questionBeanList.add(new QuestionBean("First Question"));
        questionBeanList.add(new QuestionBean("Second Question"));
        questionBeanList.add(new QuestionBean("Third Question"));
        surveySectionBean.setId(1);
        surveySectionBean.setName("main section");
        surveySectionBean.setShowPanel(Boolean.TRUE);
        surveySectionBean.setStateId(1);
        surveySectionBean.setListQuestions(questionBeanList);
View Full Code Here

        tweetPollBean.setLimitVotesEnabled(options.getLimitVotes());
        if (options.getLimitVotes()) {
            tweetPollBean.setLimitVotes(options.getMaxLimitVotes());
        }
        //question
        tweetPollBean.setQuestionBean(new QuestionBean(question));
        log.debug("fillTweetPoll: "+tweetPollBean);
        return tweetPollBean;
    }
View Full Code Here

     * @param user {@link UserAccount} owner.
     * @return {@link Question}
     * @throws EnMeExpcetion exception
     */
    public Question createQuestion(final String questionName, final String[] answers, final UserAccount user) throws EnMeExpcetion{
        final QuestionBean questionBean = new QuestionBean();
        questionBean.setQuestionName(questionName);
        questionBean.setUserId(user.getUid());
        // setting Answers.
        for (int row = 0; row < answers.length; row++) {
            final QuestionAnswerBean answer = new QuestionAnswerBean();
            answer.setAnswers(answers[row].trim());
            answer.setAnswerHash(RandomStringUtils.randomAscii(5));
            questionBean.getListAnswers().add(answer);
        }
        final Question questionDomain = getSurveyService().createQuestion(
                questionBean);
        return questionDomain;
    }
View Full Code Here

        final Long questionId,
        final String questionName,
        final String version,
        final List unitAnswer
    ){
        final QuestionBean unitQuestionBean = new QuestionBean();
        unitQuestionBean.setId(questionId);
        unitQuestionBean.setQuestionName(questionName);
        unitQuestionBean.setVersion(version);
        unitQuestionBean.setUserId(1L);
        unitQuestionBean.setStateId(1L);
        return unitQuestionBean;
    }
View Full Code Here

     */
    public Poll createPoll(final CreatePollBean createPollBean ) throws EnMeExpcetion {
        final UserAccount user = getUserAccount(getUserPrincipalUsername());
        final Poll pollDomain = new Poll();
        try {
            final QuestionBean questionBean = new QuestionBean();
            questionBean.setQuestionName(createPollBean.getQuestionName());
            final Question question = createQuestion(questionBean, user, QuestionPattern.CUSTOMIZABLE_SELECTION);
            if (question == null) {
                throw new EnMeNoResultsFoundException("Question not valid");
            } else if (createPollBean.getAnswers().length  == 0 ) {
                  throw new EnMeNoResultsFoundException("answers are required to create Poll");
View Full Code Here

     * @throws NoSuchAlgorithmException
     */
    public Question createQuestion(
            final String questionName,
            final UserAccount user) throws EnMeExpcetion, NoSuchAlgorithmException, UnsupportedEncodingException{
        final QuestionBean questionBean = new QuestionBean();
        questionBean.setQuestionName(questionName);
        questionBean.setUserId(user.getUid());
        final Question questionDomain = createQuestion(questionBean, user, QuestionPattern.LINKS);
        return questionDomain;
    }
View Full Code Here

TOP

Related Classes of org.encuestame.utils.json.QuestionBean

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.