Search in sources :

Example 1 with ConfirmacaoConviteInstrutor

use of com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method updateConfirmacaoConviteInstrutor.

@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public void updateConfirmacaoConviteInstrutor(ConfirmacaoConviteInstrutorDTO confirmacao) {
    ConfirmacaoConviteInstrutorDAO dao = factory.getConfirmacaoConviteInstrutorDAO();
    ConfirmacaoConviteInstrutor model = new ConfirmacaoConviteInstrutor(confirmacao);
    try {
        dao.update(model);
    } catch (DAOException ex) {
        Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ConfirmacaoConviteInstrutorDAO(com.tomasio.projects.trainning.dao.ConfirmacaoConviteInstrutorDAO) ConfirmacaoConviteInstrutor(com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with ConfirmacaoConviteInstrutor

use of com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor in project trainning by fernandotomasio.

the class HibernateConfirmacaoConviteInstrutorDAO method remove.

@Override
public void remove(Long id) throws DAOException {
    Session session = sessionFactory.getCurrentSession();
    try {
        ConfirmacaoConviteInstrutor confirmacao = (ConfirmacaoConviteInstrutor) session.get(ConfirmacaoConviteInstrutor.class, id);
        session.delete(confirmacao);
    } catch (HibernateException e) {
        Logger.getLogger(HibernateConfirmacaoConviteInstrutorDAO.class.getName()).log(Level.SEVERE, null, e);
        throw new DAOException(MessageHelper.getMessage("consultas.remove.error"));
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) ConfirmacaoConviteInstrutor(com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor)

Example 3 with ConfirmacaoConviteInstrutor

use of com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method findConfirmacaoConviteInstrutor.

@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional(readOnly = true)
public ConfirmacaoConviteInstrutorDTO findConfirmacaoConviteInstrutor(Long confirmacaoId) {
    ConfirmacaoConviteInstrutorDAO dao = factory.getConfirmacaoConviteInstrutorDAO();
    ConfirmacaoConviteInstrutor confirmacao = null;
    try {
        confirmacao = dao.find(confirmacaoId);
    } catch (DAOException ex) {
        Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
    if (confirmacao != null) {
        return confirmacao.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ConfirmacaoConviteInstrutorDAO(com.tomasio.projects.trainning.dao.ConfirmacaoConviteInstrutorDAO) ConfirmacaoConviteInstrutor(com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with ConfirmacaoConviteInstrutor

use of com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method createConfirmacaoConviteInstrutor.

@Override
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
@Transactional
public Long createConfirmacaoConviteInstrutor(ConfirmacaoConviteInstrutorDTO confirmacao) {
    ConfirmacaoConviteInstrutorDAO dao = factory.getConfirmacaoConviteInstrutorDAO();
    ConfirmacaoConviteInstrutor model = new ConfirmacaoConviteInstrutor(confirmacao);
    try {
        Long id = dao.create(model);
        return id;
    } catch (DAOException ex) {
        Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ConfirmacaoConviteInstrutorDAO(com.tomasio.projects.trainning.dao.ConfirmacaoConviteInstrutorDAO) ConfirmacaoConviteInstrutor(com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with ConfirmacaoConviteInstrutor

use of com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method findAllConfirmacoesConvitesInstrutoresByTurmaId.

@Override
@Transactional(readOnly = true)
public ConfirmacaoConviteInstrutorDTO[] findAllConfirmacoesConvitesInstrutoresByTurmaId(Long turmaId) {
    ConfirmacaoConviteInstrutorDAO dao = factory.getConfirmacaoConviteInstrutorDAO();
    ConfirmacaoConviteInstrutorDTO[] confirmacoesArray;
    try {
        List<ConfirmacaoConviteInstrutor> itens = dao.findAllByTurmaId(turmaId);
        confirmacoesArray = new ConfirmacaoConviteInstrutorDTO[itens.size()];
        for (int i = 0; i < confirmacoesArray.length; i++) {
            confirmacoesArray[i] = itens.get(i).createDTO();
        }
        return confirmacoesArray;
    } catch (DAOException ex) {
        Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
        throw new CoreException(ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) ConfirmacaoConviteInstrutorDTO(com.tomasio.projects.trainning.dto.ConfirmacaoConviteInstrutorDTO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ConfirmacaoConviteInstrutorDAO(com.tomasio.projects.trainning.dao.ConfirmacaoConviteInstrutorDAO) ConfirmacaoConviteInstrutor(com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

DAOException (com.tomasio.projects.trainning.exception.DAOException)7 ConfirmacaoConviteInstrutor (com.tomasio.projects.trainning.model.ConfirmacaoConviteInstrutor)7 ConfirmacaoConviteInstrutorDAO (com.tomasio.projects.trainning.dao.ConfirmacaoConviteInstrutorDAO)6 CoreException (com.tomasio.projects.trainning.exeption.CoreException)6 Transactional (org.springframework.transaction.annotation.Transactional)6 ConfirmacaoConviteInstrutorDTO (com.tomasio.projects.trainning.dto.ConfirmacaoConviteInstrutorDTO)3 ParseException (java.text.ParseException)3