Пример #1
0
  @Override
  public String addForm(Form form) throws AddFormException {
    logger.info("------------> Adding a new Form 848");
    try {
      logger.info("Finding principal user");

      User user = null;
      try {
        user = userManager.findUserByName(sc.getCallerPrincipal().getName());
      } catch (Exception e1) {
        logger.error("Imposible to retrieve principal user.", e1);
        throw new AddFormException(e1.getClass() + " --> " + e1.getMessage());
      }

      Form848 form848 = new Form848(user);

      form848.fillForm(form);
      em.persist(form848);
      form848.setPrePrintedNumber(form848.getId().toString());

      return form848.getId().toString();

    } catch (FillFormException e) {
      logger.error(e);
      throw new AddFormException(e.getClass() + " --> " + e.getMessage());
    }
  }
Пример #2
0
  @Override
  public Form getForm(String id) throws FormNotFoundException {
    logger.info("get Form 848 whith pre pinted number " + id);

    try {
      Form848 form848;
      form848 = findByPrePrintedNumber(id);
      Form form = null;
      form = form848.loadForm(this);
      return form;
    } catch (Exception e) {
      throw new FormNotFoundException(e.getClass().getName() + " --> " + e.getMessage());
    }
  }
Пример #3
0
  @Override
  public void updateForm(Form form) throws UpdateFormException {
    try {
      Form848 form848 = findByPrePrintedNumber((String) form.getCell("prePrintedNumber").getData());

      form848.fillForm(form);
      em.persist(form848);

    } catch (FormNotFoundException e) {
      logger.error(e);
      throw new UpdateFormException(e.getClass() + " --> " + e.getMessage());
    } catch (FillFormException e) {
      logger.error(e);
      throw new UpdateFormException(e.getClass() + " --> " + e.getMessage());
    }
  }