Package org.vosao.entity

Examples of org.vosao.entity.FormConfigEntity


    List<FormConfigEntity> list = select();
    if (list.size() > 0) {
      return list.get(0);
    }
    logger.error("Form config for site was not found!");
    return new FormConfigEntity();
  }
View Full Code Here


    return getDao().getFormConfigDao().getConfig();
  }

  @Override
  public ServiceResponse saveFormConfig(Map<String, String> vo) {
    FormConfigEntity config = getDao().getFormConfigDao().getConfig();
    config.setFormTemplate(vo.get("formTemplate"));
    config.setLetterTemplate(vo.get("letterTemplate"));
    getDao().getFormConfigDao().save(config);
    return ServiceResponse.createSuccessResponse(
        Messages.get("form.config_success_save"));
  }
View Full Code Here

        Messages.get("form.config_success_save"));
  }

  @Override
  public ServiceResponse restoreFormLetter() throws IOException {
    FormConfigEntity config = getDao().getFormConfigDao().getConfig();
    config.setLetterTemplate(StreamUtil.getTextResource(
      SetupBeanImpl.FORM_LETTER_FILE));
    getDao().getFormConfigDao().save(config);     
    return ServiceResponse.createSuccessResponse(
        Messages.get("form.letter_success_restore"));
  }
View Full Code Here

        Messages.get("form.letter_success_restore"));
  }

  @Override
  public ServiceResponse restoreFormTemplate() throws IOException {
    FormConfigEntity config = getDao().getFormConfigDao().getConfig();
    config.setFormTemplate(StreamUtil.getTextResource(
      SetupBeanImpl.FORM_TEMPLATE_FILE));
    getDao().getFormConfigDao().save(config);     
    return ServiceResponse.createSuccessResponse(
        Messages.get("form.template_success_restore"));
  }
View Full Code Here

      FormEntity form = getDao().getFormDao().getByName(formName);
      if (form == null) {
        return Messages.get("form.not_found", formName);
      }
      List<FieldEntity> fields = getDao().getFieldDao().getByForm(form);
      FormConfigEntity formConfig = getDao().getFormConfigDao().getConfig();
      VelocityContext context = getPageBusiness().createContext(
        getBusiness().getLanguage(), null);
      context.put("formConfig", formConfig);
      context.put("form", form);
      context.put("fields", fields);
      if (StringUtils.isEmpty(formConfig.getFormTemplate())) {
        return Messages.get("form.template_is_empty");
      }
      return getSystemService().render(formConfig.getFormTemplate(),
          context);
    }
    catch (Exception e) {
      e.printStackTrace();
      return e.getMessage();
View Full Code Here

    "org/vosao/resources/html/form-template.html";
  public static final String FORM_LETTER_FILE =
    "org/vosao/resources/html/form-letter.html";
 
  private void initForms() {
    FormConfigEntity config = getDao().getFormConfigDao().getConfig();
    if (config.getId() == null) {
      config.setFormTemplate(loadResource(
          FORM_TEMPLATE_FILE));
      config.setLetterTemplate(loadResource(
          FORM_LETTER_FILE));
      getDao().getFormConfigDao().save(config);     
    }
  }
View Full Code Here

    f = getDao().getFormDao().getByName("test");
    assertEquals("test", f.getName());
  }

  public void testGetConfig() {
    FormConfigEntity c = getDao().getFormConfigDao().getConfig();
    assertNotNull(c);
    c.setFormTemplate("template");
    getDao().getFormConfigDao().save(c);
    c = getDao().getFormConfigDao().getConfig();
    assertEquals("template", c.getFormTemplate());
    c.setFormTemplate("template2");
    getDao().getFormConfigDao().save(c);
    c = getDao().getFormConfigDao().getConfig();
    assertEquals("template2", c.getFormTemplate());
  }
View Full Code Here

      createFormXML(formsElement, form);
    }
  }
 
  private void createFormConfigXML(Element formsElement) {
    FormConfigEntity config = getDao().getFormConfigDao().getConfig();
    Element configElement = formsElement.addElement("form-config");
    Element formTemplateElement = configElement.addElement("formTemplate");
    formTemplateElement.setText(config.getFormTemplate());
    Element formLetterElement = configElement.addElement("letterTemplate");
    formLetterElement.setText(config.getLetterTemplate());
  }
View Full Code Here

            }
    }   
  }

  public void readFormConfig(Element configElement) throws DaoTaskException {
    FormConfigEntity config = getDao().getFormConfigDao().getConfig();
    for (Iterator<Element> i = configElement.elementIterator();
        i.hasNext(); ) {
            Element element = i.next();
            if (element.getName().equals("formTemplate")) {
              config.setFormTemplate(element.getText());
            }
            if (element.getName().equals("letterTemplate")) {
              config.setLetterTemplate(element.getText());
            }
    }
    getDaoTaskAdapter().formConfigSave(config);
  }
View Full Code Here

 
  @Override
  public void formConfigSave(FormConfigEntity entity) throws DaoTaskException {
    if (isSkip()) {
      if (entity.getId() == null) {
        FormConfigEntity found = getDao().getFormConfigDao().getConfig();
        if (found == null) {
          throw new DaoTaskException("Form config not found while "
            + "skipping save operation. ");
        }
        entity.setKey(found.getKey());
      }
    }
    else {
      getDao().getFormConfigDao().save(entity);
    }
View Full Code Here

TOP

Related Classes of org.vosao.entity.FormConfigEntity

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.