Search in sources :

Example 41 with DAOException

use of com.tomasio.projects.trainning.exception.DAOException in project trainning by fernandotomasio.

the class InstructorsServiceSimpleImpl method findHabilitacaoInstrutor.

@Override
@Transactional(readOnly = true)
public HabilitacaoInstrutorDTO findHabilitacaoInstrutor(Long id) {
    HabilitacaoInstrutorDAO dao = factory.getHabilitacaoInstrutorDAO();
    HabilitacaoInstrutor instrutor = null;
    try {
        instrutor = dao.find(id);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    if (instrutor != null) {
        return instrutor.createDTO();
    } else {
        return null;
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) HabilitacaoInstrutor(com.tomasio.projects.trainning.model.HabilitacaoInstrutor) Transactional(org.springframework.transaction.annotation.Transactional)

Example 42 with DAOException

use of com.tomasio.projects.trainning.exception.DAOException in project trainning by fernandotomasio.

the class InstructorsServiceSimpleImpl method findAllConsultaInstrutorByRemetenteId.

@Override
@Transactional(readOnly = true)
public ConsultaInstrutorDTO[] findAllConsultaInstrutorByRemetenteId(Long remetenteId, boolean finalizado) {
    ConsultaInstrutorDAO dao = factory.getConsultaInstrutorDAO();
    ConsultaInstrutorDTO[] consultasArray = null;
    try {
        List<ConsultaInstrutor> consultas = dao.findAllByRemetenteId(remetenteId, 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)

Example 43 with DAOException

use of com.tomasio.projects.trainning.exception.DAOException in project trainning by fernandotomasio.

the class InstructorsServiceSimpleImpl method findAllHabilitacoesInstrutoresPropostas.

@Override
@Transactional(readOnly = true)
public HabilitacaoInstrutorPropostaDTO[] findAllHabilitacoesInstrutoresPropostas(Long cursoId, Long organizacaoId, Long pessoaId) {
    HabilitacaoInstrutorDAO dao = factory.getHabilitacaoInstrutorDAO();
    HabilitacaoInstrutorPropostaDTO[] instrutorsArray = null;
    try {
        List<HabilitacaoInstrutorProposta> instrutores = dao.findAllHabilitacoesPropostas(cursoId, organizacaoId, pessoaId);
        if (instrutores != null) {
            instrutorsArray = new HabilitacaoInstrutorPropostaDTO[instrutores.size()];
            for (int i = 0; i < instrutores.size(); i++) {
                instrutorsArray[i] = instrutores.get(i).createDTO();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return instrutorsArray;
}
Also used : HabilitacaoInstrutorPropostaDTO(com.tomasio.projects.trainning.dto.HabilitacaoInstrutorPropostaDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) HabilitacaoInstrutorProposta(com.tomasio.projects.trainning.model.HabilitacaoInstrutorProposta) Transactional(org.springframework.transaction.annotation.Transactional)

Example 44 with DAOException

use of com.tomasio.projects.trainning.exception.DAOException in project trainning by fernandotomasio.

the class OrganizationalServiceSimpleImpl method findAllOrganizacoesExternasByEstadoId.

@Override
@Transactional(readOnly = true)
public OrganizacaoDTO[] findAllOrganizacoesExternasByEstadoId(Long estadoId) {
    OrganizacaoDAO dao = factory.getOrganizacaoDAO();
    OrganizacaoDTO[] organizacoesArray = null;
    try {
        List<Organizacao> organizacoes = dao.findAllExternoByEstadoId(estadoId);
        if (organizacoes != null) {
            organizacoesArray = convertToArray(organizacoes);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return organizacoesArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Organizacao(com.tomasio.projects.trainning.model.Organizacao) CoreException(com.tomasio.projects.trainning.exeption.CoreException) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 45 with DAOException

use of com.tomasio.projects.trainning.exception.DAOException in project trainning by fernandotomasio.

the class OrganizationalServiceSimpleImpl method findPosto.

@Override
@Transactional(readOnly = true)
public PostoDTO findPosto(Long id) {
    PostoDAO dao = factory.getPostoDAO();
    Posto posto;
    try {
        posto = dao.find(id);
        if (posto != null) {
            return posto.createDTO();
        } else {
            return null;
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) Posto(com.tomasio.projects.trainning.model.Posto) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

DAOException (com.tomasio.projects.trainning.exception.DAOException)643 CoreException (com.tomasio.projects.trainning.exeption.CoreException)388 Transactional (org.springframework.transaction.annotation.Transactional)385 HibernateException (org.hibernate.HibernateException)186 Session (org.hibernate.Session)186 ParseException (java.text.ParseException)112 Organizacao (com.tomasio.projects.trainning.model.Organizacao)77 ArrayList (java.util.ArrayList)57 Criteria (org.hibernate.Criteria)51 Pessoa (com.tomasio.projects.trainning.model.Pessoa)46 IndicacaoDAO (com.tomasio.projects.trainning.dao.IndicacaoDAO)37 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)37 TurmaEfetiva (com.tomasio.projects.trainning.model.TurmaEfetiva)33 PreMatriculaDAO (com.tomasio.projects.trainning.dao.PreMatriculaDAO)32 PreMatricula (com.tomasio.projects.trainning.model.PreMatricula)30 StatusTurmaEfetiva (com.tomasio.projects.trainning.model.StatusTurmaEfetiva)30 Matricula (com.tomasio.projects.trainning.model.Matricula)29 SimpleDateFormat (java.text.SimpleDateFormat)28 MatriculaDAO (com.tomasio.projects.trainning.dao.MatriculaDAO)26 TurmaDAO (com.tomasio.projects.trainning.dao.TurmaDAO)26