Package org.vosao.entity

Examples of org.vosao.entity.FormEntity


    FieldEntity field3 = getDao().getFieldDao().getById(field.getId());
    assertEquals("update", field3.getTitle());
  }
 
  public void testGetByForm() {
    FormEntity form = formTool.addForm("form");
    fieldTool.addField("field1", FieldType.TEXT, "text1", form);
    fieldTool.addField("field2", FieldType.TEXT, "text2", form);
    fieldTool.addField("field3", FieldType.TEXT, "text3", form);
    FormEntity form2 = formTool.addForm("form");
    fieldTool.addField("field21", FieldType.TEXT, "text21", form2);
    fieldTool.addField("field22", FieldType.TEXT, "text22", form2);
    List<FieldEntity> fields = getDao().getFieldDao().getByForm(form);
    assertEquals(3, fields.size());
    fields = getDao().getFieldDao().getByForm(form2);
View Full Code Here


    fields = getDao().getFieldDao().getByForm(form2);
    assertEquals(2, fields.size());
  }
 
  public void testGetByName() {
    FormEntity form = formTool.addForm("form");
    fieldTool.addField("field1", FieldType.TEXT, "text1", form);
    fieldTool.addField("field2", FieldType.TEXT, "text2", form);
    fieldTool.addField("field3", FieldType.TEXT, "text3", form);
    FormEntity form2 = formTool.addForm("form");
    fieldTool.addField("field21", FieldType.TEXT, "text21", form2);
    fieldTool.addField("field22", FieldType.TEXT, "text22", form2);
    FieldEntity field = getDao().getFieldDao().getByName(form, "field3");
    assertNotNull(field);
    assertEquals("field3", field.getName());
View Full Code Here

  public FormTool(Dao aDao) {
    dao = aDao;
  }

  public FormEntity addForm(final String name) {
    FormEntity form = new FormEntity(name, name, name, name);
    dao.getFormDao().save(form);
    return form;
  }
View Full Code Here

 
  public void testGetByName() {
    formTool.addForm("john");
    formTool.addForm("test");
    formTool.addForm("jack");
    FormEntity f = getDao().getFormDao().getByName(null);
    assertNull(f);
    f = getDao().getFormDao().getByName("test");
    assertEquals("test", f.getName());
  }
View Full Code Here

            if (element.getName().equals("form")) {
              String name = element.attributeValue("name");
              String title = element.attributeValue("title");
              String email = element.attributeValue("email");
              String letterSubject = element.attributeValue("letterSubject");
              FormEntity form = new FormEntity(name, email, title,
                  letterSubject);
              form.setSendButtonTitle(element.attributeValue("sendButtonTitle"));
              form.setShowResetButton(XmlUtil.readBooleanAttr(element,
                  "showResetButton", false));
              form.setEnableCaptcha(XmlUtil.readBooleanAttr(element,
                  "enableCaptcha", false));
              form.setEnableSave(XmlUtil.readBooleanAttr(element,
                  "enableSave", false));
              form.setResetButtonTitle(element.attributeValue("resetButtonTitle"));
              getDaoTaskAdapter().formSave(form);
              readFields(element, form);
            }
            if (element.getName().equals("form-config")) {
              readFormConfig(element);
View Full Code Here

  @Override
  public void formSave(FormEntity entity) throws DaoTaskException {
    if (isSkip()) {
      if (entity.getId() == null) {
        FormEntity found = getDao().getFormDao().getByName(
            entity.getName());
        if (found == null) {
          throw new DaoTaskException("Form not found while "
            + "skipping save operation. " + entity.getName());
        }
        entity.setKey(found.getKey());
      }
    }
    else {
      getDao().getFormDao().save(entity);
    }
View Full Code Here

  @Override
  public void fieldSave(FieldEntity entity) throws DaoTaskException {
    if (isSkip()) {
      if (entity.getId() == null) {
        FormEntity form = getDao().getFormDao().getById(
            entity.getFormId());
        FieldEntity found = getDao().getFieldDao().getByName(form,
            entity.getName());
        if (found == null) {
          throw new DaoTaskException("Field not found while "
View Full Code Here

          .validateBeforeUpdate(field);
      if (validateErrors.isEmpty()) {
        boolean newField = field.getId() == null;
        getDao().getFieldDao().save(field);
        if (newField) {
          FormEntity form = getDao().getFormDao().getById(field.getFormId());
          getBusiness().getFieldBusiness().checkOrder(form);
        }
        return ServiceResponse.createSuccessResponse(
            Messages.get("form.field_success_update"));
      }
View Full Code Here

  }

  @Override
  public List<FieldVO> getByForm(Long formId) {
    List<FieldEntity> result = new ArrayList<FieldEntity>();
    FormEntity form = getDao().getFormDao().getById(formId);
    if (form != null) {
      result = getDao().getFieldDao().getByForm(form);
    }
    return FieldVO.create(result);
  }
View Full Code Here

  @Override
  public ServiceResponse remove(List<String> ids) {
    if (ids.size() > 0) {
      FieldEntity field = null;
      FormEntity form = null;
      for (String id : ids) {
        field = getDao().getFieldDao().getById(Long.valueOf(id));
        if (field != null) {
          form = getDao().getFormDao().getById(field.getFormId());
          break;
View Full Code Here

TOP

Related Classes of org.vosao.entity.FormEntity

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.