Package org.encuestame.utils.json

Examples of org.encuestame.utils.json.QuestionBean


            final  List<Question> questionsList = getQuestionDao()
                    .loadAllQuestions();
            if (questionsList.size() > 0) {

               for (Question questions : questionsList) {
                    final QuestionBean q = new QuestionBean();
                    q.setId(Long.valueOf(questions.getQid().toString()));
                    q.setQuestionName(questions.getQuestion());
                    listQuestionBean.add(q);
                }
            }
        } catch (HibernateException e) {
            throw new EnMeExpcetion(e);
View Full Code Here


     * @throws NoSuchAlgorithmException
     */
    public Question createTweetPollQuestion(
            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

            final  List<Question> questionsList = getQuestionDao()
                    .loadAllQuestions();
            if (questionsList.size() > 0) {

               for (Question questions : questionsList) {
                    final QuestionBean q = new QuestionBean();
                    q.setId(Long.valueOf(questions.getQid().toString()));
                    q.setQuestionName(questions.getQuestion());
                    listQuestionBean.add(q);
                }
            }
        } catch (HibernateException e) {
            throw new EnMeExpcetion(e);
View Full Code Here

    private List<QuestionBean> getPollQuestions() throws IOException {
        final List<QuestionBean> questions = new ArrayList<QuestionBean>();
        CSVReader reader2 = readCSVFile("poll-questions.csv");
        String[] nextLine;
        while ((nextLine = reader2.readNext()) != null) {
            final QuestionBean bean = new QuestionBean();
            bean.setQuestionName(nextLine[0]);
            bean.setHits(Double.valueOf(5 + (Math.random() * (3000 - 5)))
                    .longValue());
            bean.setSlugName(RestFullUtil.slugify(nextLine[0]));
            final List<QuestionAnswerBean> listA = new ArrayList<QuestionAnswerBean>();
            listA.add(createAnswer(nextLine[1]));
            listA.add(createAnswer(nextLine[2]));
            listA.add(createAnswer(nextLine[3]));
            listA.add(createAnswer(nextLine[4]));
            bean.setListAnswers(listA);
            questions.add(bean);
        }
        return questions;
    }
View Full Code Here

    private List<QuestionBean> getTpPollQuestions() throws IOException {
        final List<QuestionBean> questions = new ArrayList<QuestionBean>();
        CSVReader reader2 = readCSVFile("tp-questions.csv");
        String[] nextLine;
        while ((nextLine = reader2.readNext()) != null) {
            final QuestionBean bean = new QuestionBean();
            bean.setQuestionName(nextLine[0]);
            bean.setHits(Double.valueOf(5 + (Math.random() * (3000 - 5)))
                    .longValue());
            bean.setSlugName(RestFullUtil.slugify(nextLine[0]));
            final List<QuestionAnswerBean> listA = new ArrayList<QuestionAnswerBean>();
            listA.add(createAnswer(nextLine[1]));
            listA.add(createAnswer(nextLine[2]));
            bean.setListAnswers(listA);
            questions.add(bean);
        }
        return questions;
    }
View Full Code Here

     * Test createPoll.
     * @throws Exception exception
     */
    @Test
    public void testcreatePoll() throws Exception{
        final QuestionBean question = ConvertDomainBean.convertQuestionsToBean(this.question);
        final PollBean unitPoll = ConvertDomainBean.convertPollDomainToBean(this.poll);
        unitPoll.setQuestionBean(question);
        //"ssss", this.answers, "ALL", "APPROVE" ,Boolean.TRUE, this.tagBeanList
        final String[] answer = {"a", "b"};
        final String[] hashtag = {"hastag1", "hastag2"};
View Full Code Here

   * Test Remove HashTags from Poll.
   * @throws EnMeExpcetion
   */
  //@Test
  public void testRemoveHashTagsFromPoll() throws EnMeExpcetion {
    final QuestionBean question = ConvertDomainBean
        .convertQuestionsToBean(this.question);
    final PollBean unitPoll = ConvertDomainBean
        .convertPollDomainToBean(this.poll);
    unitPoll.setQuestionBean(question);
   
View Full Code Here

        "html");
    final DateTime dt = new DateTime();
    final TweetPoll tp = createTweetPollPublicated(true, true, dt.toDate(),
        this.userAccount, question1);

    final QuestionBean questionBean = createUnitQuestionBean(
        " Mi nueva pregunta", null, null, null);
    final TweetPollBean tpBeanToUpdate = createTweetPoll(Boolean.FALSE,
        Boolean.FALSE, Boolean.FALSE, new Date(), Boolean.FALSE,
        Boolean.FALSE, Boolean.FALSE, new Date(), " ",
        this.userAccount.getUid(), questionBean, "twitterAccoint",
View Full Code Here

     *            {@link Question}
     * @return {@link QuestionBean}
     */
    public static final QuestionBean convertQuestionsToBean(
            final Question questions) {
        final QuestionBean questionBean = new QuestionBean();
        questionBean.setId(questions.getQid());
        questionBean.setQuestionName(questions.getQuestion());
        questionBean.setSlugName(questions.getSlugQuestion());
        questionBean.setHits(questions.getHits());
        questionBean.setUserId(questions.getAccountQuestion() == null ? null
                : questions.getAccountQuestion().getUid());
        if (questions.getQuestionPattern() != null) {
            //log.debug("questions.getQuestionPattern()"
     //               + questions.getQuestionPattern().name());
            questionBean.setWidget(questions.getQuestionPattern().getWidget());
            questionBean.setPattern(questions.getQuestionPattern().name());
        }
        return questionBean;
    }
View Full Code Here

     * Convert {@link SurveyBean} to {@link QuestionBean}.
     * @param surveyBean2
     * @return
     */
    public static final QuestionBean convertSurveyToQuestionBean(final SurveyBean surveyBean2){
        final QuestionBean qbean = new QuestionBean();
        qbean.setQuestionName(surveyBean2.getName());
        qbean.setId(surveyBean2.getSid());
        qbean.setSlugName(surveyBean2.getSurveySlugName());
        return qbean;
    }
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.