Package com.agiletec.plugins.jpsurvey.aps.system.services.survey.model

Examples of com.agiletec.plugins.jpsurvey.aps.system.services.survey.model.Choice


   */
  protected Question getFakeQuestion() throws Throwable {
    Question question = new Question();
    String xml="<?xml version=\"1.0\" encoding=\"UTF-8\"?><properties><property key=\"test\">me</property><property key=\"test2\">me too</property></properties>";
    ApsProperties prop = new ApsProperties();
    Choice choice1 = this.getFakeChoice();
    Choice choice2 = this.getFakeChoice();
    List<Choice> choiceList = new ArrayList<Choice>();
    try {
      choiceList.add(choice1);
      choiceList.add(choice2);
      prop.loadFromXml(xml);
      question.setQuestions(prop);
      question.setId(2); // this will be changed when saving...
      question.setMaxResponseNumber(2677);
      question.setMinResponseNumber(1977);
      question.setPos(0);
      question.setSingleChoice(false);
      question.setSurveyId(1);
      choice1.setId(2); // will be changed upon saving
      choice1.setPos(0);
      choice1.setQuestionId(question.getId());
      choice1.setId(2); // will be changed upon saving
      choice2.setPos(10); // this is set on purpose to test save in sorted position method
      choice2.setQuestionId(question.getId());
      question.setChoices(choiceList);
    } catch (Throwable t) {
      throw t;
    }
    return question;
View Full Code Here


    }
    return question;
  }
 
  protected Choice getFakeChoice() throws Throwable {
    Choice choice = new Choice();
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><properties><property key=\"test\">me</property><property key=\"test2\">me too</property></properties>";
    ApsProperties prop = new ApsProperties();
    try {
      prop.loadFromXml(xml);
      choice.setChoices(prop);
      choice.setFreeText(true);
      choice.setPos(96);
      choice.setQuestionId(2);
    } catch (Throwable t) {
      throw t;
    }
    return choice;
  }
View Full Code Here

   */
  protected Question getFakeQuestion() throws Throwable {
    Question question = new Question();
    String xml="<?xml version=\"1.0\" encoding=\"UTF-8\"?><properties><property key=\"test\">me</property><property key=\"test2\">me too</property></properties>";
    ApsProperties prop = new ApsProperties();
    Choice choice1 = this.getFakeChoice();
    Choice choice2 = this.getFakeChoice();
    List<Choice> choiceList = new ArrayList<Choice>();
    try {
      choiceList.add(choice1);
      choiceList.add(choice2);
      prop.loadFromXml(xml);
      question.setQuestions(prop);
      question.setId(2); // this will be changed when saving...
      question.setMaxResponseNumber(2677);
      question.setMinResponseNumber(1977);
      question.setPos(0);
      question.setSingleChoice(false);
      question.setSurveyId(1);
      choice1.setId(2); // will be changed upon saving
      choice1.setPos(0);
      choice1.setQuestionId(question.getId());
      choice1.setId(2); // will be changed upon saving
      choice2.setPos(10); // this is set on purpose to test save in sorted position method
      choice2.setQuestionId(question.getId());
      question.setChoices(choiceList);
    } catch (Throwable t) {
      throw t;
    }
    return question;
View Full Code Here

    }
    return question;
  }
 
  protected Choice getFakeChoice() throws Throwable {
    Choice choice = new Choice();
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><properties><property key=\"test\">me</property><property key=\"test2\">me too</property></properties>";
    ApsProperties prop = new ApsProperties();
    try {
      prop.loadFromXml(xml);
      choice.setChoices(prop);
      choice.setFreeText(true);
      choice.setPos(96);
      choice.setQuestionId(2);
    } catch (Throwable t) {
      throw t;
    }
    return choice;
  }
View Full Code Here

   * @param res The result set as returned from the database
   * @param shift The shift to the 'choice' object data in the result set
   * @return the 'choice' record requested
   */
  protected Choice buildChoiceRecordFromResultSet(ResultSet res, int shift) {
    Choice choice = null;
    if (null == res) return null;
    if (shift > 0) --shift;
    try {
      int id = res.getInt(shift + 1);
      if (id > 0) {
        choice = new Choice();
        choice.setId(id);
        choice.setQuestionId(res.getInt(shift + 2));
        ApsProperties prop = new ApsProperties();
        prop.loadFromXml(res.getString(shift + 3));
        choice.setChoices(prop);
        choice.setPos(res.getInt(shift + 4));
        choice.setFreeText(res.getBoolean(shift + 5));
      }
    } catch (Throwable t) {
      ApsSystemUtils.logThrowable(t, this, "buildChoiceRecordFromResultSet",
      "Error while building a 'choice' object from the result set");
    }
View Full Code Here

TOP

Related Classes of com.agiletec.plugins.jpsurvey.aps.system.services.survey.model.Choice

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.