Package org.vosao.entity

Examples of org.vosao.entity.FormEntity


    return ServiceResponse.createSuccessResponse(Messages.get("success"));
  }

  @Override
  public void moveDown(Long formId, Long fieldId) {
    FormEntity form = getDao().getFormDao().getById(formId);
    if (form == null) {
      return;
    }
    List<FieldEntity> fields = getBusiness().getFieldBusiness().checkOrder(form);
    int index = indexOf(fields, fieldId);
View Full Code Here


    return -1;
  }

  @Override
  public void moveUp(Long formId, Long fieldId) {
    FormEntity form = getDao().getFormDao().getById(formId);
    if (form == null) {
      return;
    }
    List<FieldEntity> fields = getBusiness().getFieldBusiness().checkOrder(form);
    int index = indexOf(fields, fieldId);
View Full Code Here

public class FormServiceImpl extends AbstractServiceImpl
    implements FormService {

  @Override
  public ServiceResponse send(final String name, Map<String, String> params) {
    FormEntity form = getDao().getFormDao().getByName(name);
    if (form == null) {
      return new ServiceResponse("error", Messages.get("form_not_found",
          name));
    }
    String msgBody = createLetter(params);
    String subject = form.getLetterSubject();
    ConfigEntity config = getBusiness().getConfigBusiness().getConfig();
    String fromAddress = config.getSiteEmail();
    String fromText = config.getSiteDomain() + " admin";
    String toAddress = form.getEmail();
    String error = EmailUtil.sendEmail(msgBody, subject, fromAddress, fromText,
          toAddress);
    if (error == null) {
      return new ServiceResponse("success", Messages.get(
          "form.success_send", form.getEmail()));
    }
    else {
      return new ServiceResponse("error", error);
    }
  }
View Full Code Here

 
  @Override
  public List<String> validateBeforeUpdate(final FormEntity entity) {
    List<String> errors = new ArrayList<String>();
    if (entity.getId() == null) {
      FormEntity myForm = getFormDao().getByName(entity.getName());
      if (myForm != null) {
        errors.add(Messages.get("form.already_exists"));
      }
    }
    if (StringUtils.isEmpty(entity.getName())) {
View Full Code Here

    }
    return result;
  }
 
  public String getFilePath(FormDataEntity formData) {
    FormEntity form = getFormDao().getById(formData.getFormId());
    return "/form/" + form.getName() + "/" + formData.getUuid();
  }
View Full Code Here

    return getBusiness().getFileBusiness();
  }

  @Override
  public String sendEmail(FormDataEntity formData) {
    FormEntity form = getFormDao().getById(formData.getFormId());
    ConfigEntity config = VosaoContext.getInstance().getConfig();
    FormConfigEntity formConfig = getDao().getFormConfigDao().getConfig();
    VelocityContext context = new VelocityContext();
    List<FieldEntity> fields = getDao().getFieldDao().getByForm(form);
    context.put("form", form);
    context.put("fields", fields);
    context.put("values", formData.getValues());
    context.put("config", config);
    String letter = getSystemService().render(
        formConfig.getLetterTemplate(), context);
    List<String> emails = StrUtil.fromCSV(form.getEmail());
    for (String email : emails) {
      String error = EmailUtil.sendEmail(
          letter,
          form.getLetterSubject(),
          config.getSiteEmail(),
          "Site admin",
          StringUtils.strip(email),
          getFileItems(formData));
      if (error != null) {
View Full Code Here

    return null;
  }
 
  private List<FileItem> getFileItems(FormDataEntity formData) {
    List<FileItem> result = new ArrayList<FileItem>();
    FormEntity form = getFormDao().getById(formData.getFormId());
    List<FieldEntity> fields = getDao().getFieldDao().getByForm(form);
    Map<String, String> values = formData.getValues();
    for (FieldEntity field : fields) {
      if (field.getFieldType().equals(FieldType.FILE)
        && values.containsKey(field.getName())
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.