Search in sources :

Example 96 with DAOException

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

the class PlanningServiceSimpleImpl method findDistribuicao.

@Override
@Transactional(readOnly = true)
public DistribuicaoDTO findDistribuicao(Long turmaId, Long organizacaoId) {
    DistribuicaoDAO dao = factory.getDistribuicaoDAO();
    Distribuicao distribuicao = null;
    try {
        distribuicao = dao.find(turmaId, organizacaoId);
        if (distribuicao != null) {
            return distribuicao.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) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Distribuicao(com.tomasio.projects.trainning.model.Distribuicao) Transactional(org.springframework.transaction.annotation.Transactional)

Example 97 with DAOException

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

the class PlanningServiceSimpleImpl method searchTurmasPlanejadas.

@Override
@Transactional(readOnly = true)
public TurmaPlanejadaDTO[] searchTurmasPlanejadas(Long planejamentoId, Long planoId, Long cursoId, Long responsavelId, String term) {
    TurmaDAO dao = factory.getTurmaDAO();
    TurmaPlanejadaDTO[] turmasArray = null;
    try {
        List<TurmaPlanejadaDTO> turmas = dao.searchTurmasPlanejadas(planejamentoId, planoId, cursoId, responsavelId, term);
        if (turmas != null) {
            turmasArray = new TurmaPlanejadaDTO[turmas.size()];
            turmas.toArray(turmasArray);
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return turmasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 98 with DAOException

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

the class PlanningServiceSimpleImpl method createPlanejamento.

@Override
@Transactional
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public Long createPlanejamento(PlanejamentoDTO planejamento) {
    PlanejamentoDAO dao = factory.getPlanejamentoDAO();
    Planejamento _planejamento = new Planejamento(planejamento);
    Long id = null;
    try {
        dao.create(_planejamento);
    } catch (DAOException ex) {
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        throw new CoreException(ex.getMessage());
    }
    return id;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Planejamento(com.tomasio.projects.trainning.model.Planejamento) 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 99 with DAOException

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

the class PlanningServiceSimpleImpl method createTurma.

@Override
@Transactional
public Long createTurma(TurmaDTO turma) {
    TurmaDAO dao = factory.getTurmaDAO();
    Turma _turma = new TurmaPlanejada((TurmaPlanejadaDTO) turma);
    Long id = null;
    try {
        id = dao.create(_turma);
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return id;
}
Also used : TurmaPlanejada(com.tomasio.projects.trainning.model.TurmaPlanejada) DAOException(com.tomasio.projects.trainning.exception.DAOException) Turma(com.tomasio.projects.trainning.model.Turma) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 100 with DAOException

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

the class PlanningServiceSimpleImpl method searchTurmasEfetivas.

@Override
@Transactional(readOnly = true)
public TurmaEfetivaDTO[] searchTurmasEfetivas(Date exercicio, Long planoId, Long cursoId, Long responsavelId, Long organizacaoGestoraId, String term) {
    TurmaDAO dao = factory.getTurmaDAO();
    TurmaEfetivaDTO[] turmasArray = null;
    try {
        List<TurmaEfetiva> turmas = dao.searchTurmasEfetivas(exercicio, planoId, cursoId, responsavelId, organizacaoGestoraId, term);
        if (turmas != null) {
            turmasArray = new TurmaEfetivaDTO[turmas.size()];
            for (int i = 0; i < turmas.size(); i++) {
                turmasArray[i] = turmas.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        throw new CoreException("Erro de de acesso ao banco de dados: " + ex.getMessage());
    }
    return turmasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) StatusTurmaEfetiva(com.tomasio.projects.trainning.model.StatusTurmaEfetiva) TurmaEfetiva(com.tomasio.projects.trainning.model.TurmaEfetiva) 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