Exemplo n.º 1
0
  @Override
  public void add(String path, byte[] file, MimeFilesDTO dto) throws BusinessException {
    MimeFiles dao = Convert.dto2dao(dto);
    TransactionFactory transactionFactory = new TransactionFactory();
    BusinessTransactionBo bt = transactionFactory.beginTx();
    try {
      MimeFilesDAOImpl mimeFilesDAO = new MimeFilesDAOImpl(bt);
      Long pk = mimeFilesDAO.add(dao);
      dto.setMimFilPk(pk);

      if (file != null) {
        FileUtils.carga(path, file);
      }
      bt.commitTx();
    } catch (DaoException e) {
      bt.rollbackTx();
      logger.error(e.getMessage());
      throw new BusinessException(e);
    } catch (IOException e) {
      bt.rollbackTx();
      logger.error(e.getMessage());
      throw new BusinessException(e);
    } finally {
      transactionFactory.endTx();
    }
  }
Exemplo n.º 2
0
 @Override
 public void delete(MimeFilesDTO dto) throws BusinessException {
   MimeFiles dao = Convert.dto2dao(dto);
   TransactionFactory transactionFactory = new TransactionFactory();
   BusinessTransactionBo bt = transactionFactory.beginTx();
   try {
     MimeFilesDAOImpl mimeFilesDAO = new MimeFilesDAOImpl(bt);
     mimeFilesDAO.delete(dao);
     bt.commitTx();
   } catch (DaoException e) {
     bt.rollbackTx();
     logger.error(e.getMessage());
     throw new BusinessException(e);
   } finally {
     transactionFactory.endTx();
   }
 }
Exemplo n.º 3
0
 @Override
 public void add(ParametrosDTO dto) throws BusinessException {
   Parametros dao = Convert.dto2dao(dto);
   TransactionFactory transactionFactory = new TransactionFactory();
   BusinessTransactionBo bt = transactionFactory.beginTx();
   try {
     ParametrosDAOImpl parametrosDAO = new ParametrosDAOImpl(bt);
     parametrosDAO.add(dao);
     bt.commitTx();
   } catch (DaoException e) {
     bt.rollbackTx();
     logger.error(e.getMessage());
     throw new BusinessException(e);
   } finally {
     transactionFactory.endTx();
   }
 }