Search in sources :

Example 6 with ConsultaInstrutor

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

the class InstructorsServiceSimpleImpl method findAllConsultaInstrutorByPessoaId.

@Override
@Transactional(readOnly = true)
public ConsultaInstrutorDTO[] findAllConsultaInstrutorByPessoaId(Long pessoaId, boolean finalizado) {
    ConsultaInstrutorDAO dao = factory.getConsultaInstrutorDAO();
    ConsultaInstrutorDTO[] consultasArray = null;
    try {
        List<ConsultaInstrutor> consultas = dao.findAllByPessoaId(pessoaId, finalizado);
        if (consultas != null) {
            consultasArray = new ConsultaInstrutorDTO[consultas.size()];
            for (int i = 0; i < consultas.size(); i++) {
                consultasArray[i] = consultas.get(i).createDTO();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return consultasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ConsultaInstrutorDTO(com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO) ConsultaInstrutor(com.tomasio.projects.trainning.model.ConsultaInstrutor) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ConsultaInstrutor (com.tomasio.projects.trainning.model.ConsultaInstrutor)6 Transactional (org.springframework.transaction.annotation.Transactional)6 ConsultaInstrutorDTO (com.tomasio.projects.trainning.dto.ConsultaInstrutorDTO)3 DAOException (com.tomasio.projects.trainning.exception.DAOException)3 CoreException (com.tomasio.projects.trainning.exeption.CoreException)3