Package com.agiletec.aps.util

Examples of com.agiletec.aps.util.ApsProperties


    question2.setPos(2);
    List<Question> questions = new ArrayList<Question>();
    questions.add(question);
    questions.add(question2);
    Date date = new Date();
    ApsProperties prop = new ApsProperties();
    prop.loadFromXml(xmlDescription);
    survey.setDescriptions(prop);
    survey.setGroupName("fake");
    survey.setStartDate(date);
    survey.setEndDate(null);
    survey.setActive(true);
    survey.setPublicPartialResult(false);
    survey.setPublicResult(true);
    survey.setQuestionnaire(false);
    survey.setGatherUserInfo(true);
    survey.setRestricted(true);
    prop = new ApsProperties();
    prop.loadFromXml(xmlTitle);
    survey.setTitles(prop);
    survey.setImageId("IMGXXX");
    prop = new ApsProperties();
    prop.loadFromXml(xmlDescription);
    survey.setImageDescriptions(prop);
    survey.setQuestions(questions);
    return survey;
  }
View Full Code Here


   * @throws Throwable
   */
  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);
View Full Code Here

  }
 
  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) {
View Full Code Here

      Date lastUpdate = new Date(res.getTimestamp("lastupdate").getTime());
      item.setLastUpdate(lastUpdate);
      item.setContentType(res.getString("contenttype"));
      String cat = res.getString("categories");
      if (null != cat && cat.trim().length() > 0) {
        ApsProperties categories = new ApsProperties();
        categories.loadFromXml(cat);
        item.setCategories(categories);
      }
    }
    return item;
  }
View Full Code Here

      item.setContentType(res.getString("contenttype"));
      Date lastUpdate = new Date(res.getTimestamp("lastupdate").getTime());
      item.setLastUpdate(lastUpdate);
      String cat = res.getString("categories");
      if (null != cat && cat.trim().length() > 0) {
        ApsProperties categories = new ApsProperties();
        categories.loadFromXml(cat);
        item.setCategories(categories);
      }
      items.add(item);
    }
    return items;
View Full Code Here

      if (id > 0) {
        question = new Question();
        question.setChoices(new ArrayList<Choice>());
        question.setId(id);
        question.setSurveyId(res.getInt(shift + 2));
        ApsProperties prop = new ApsProperties();
        prop.loadFromXml(res.getString(shift + 3));
        question.setQuestions(prop);
        question.setPos(res.getInt(shift + 4));
        question.setSingleChoice(res.getBoolean(shift + 5));
        question.setMinResponseNumber(res.getInt(shift + 6));
        question.setMaxResponseNumber(res.getInt(shift + 7));
View Full Code Here

      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) {
View Full Code Here

  public void testRemoveImage() throws Throwable {
    SurveyAction action = null;
    String result = null;
    Survey survey = this.prepareSurveyForTest(true, true);
    Survey verify = null;
    ApsProperties prop = null;
    try {
      this.setUserOnSession("admin");
      this.getSurveyManager().saveSurvey(survey);
      survey.setImageId("29975");
      this.getSurveyManager().updateSurvey(survey);
      this.initAction("/do/jpsurvey/Survey", "removeSurveyImage");
      this.addParameter("surveyId", survey.getId());
      this.addParameter("questionnaire", survey.isQuestionnaire());
      this.addParameter("checkCookie", survey.isCheckCookie());
      this.addParameter("imageId", survey.getImageId());
      this.addParameter("title-it", "Questa");
      this.addParameter("description-it", "è");
      this.addParameter("imageDescription-it", "Spartaaaa");
      this.addParameter("resourceTypeCode", "Image");
      this.addParameter("groupName", survey.getGroupName());
      this.addParameter("startDate", "10/06/2009");
      this.addParameter("strutsAction", ApsAdminSystemConstants.EDIT);
      this.addParameter("gatherUserInfo", survey.isGatherUserInfo());
      result = this.executeAction();
      assertNotNull(result);
      action = (SurveyAction) this.getAction();
      assertEquals(action.SUCCESS, result);
      verify = this.getSurveyManager().loadSurvey(survey.getId());
      assertNull(verify.getImageId());
      assertTrue(verify.getImageDescriptions().isEmpty());
      prop = verify.getTitles();
      assertEquals("Questa", prop.getProperty("it"));
      prop = verify.getDescriptions();
      assertEquals("è", prop.getProperty("it"));
      prop = verify.getImageDescriptions();
      assertNull(prop.getProperty("it"));
    } catch (Throwable t) {
      throw t;
    } finally {
      this.getSurveyManager().deleteSurvey(survey.getId());
    }
View Full Code Here

TOP

Related Classes of com.agiletec.aps.util.ApsProperties

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.