Search in sources :

Example 6 with PreMatricula

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

the class HibernatePreMatriculaDAO method remove.

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

Example 7 with PreMatricula

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

the class AtividadesEnsinoServiceSimpleImpl method updatePreMatricula.

@Override
@Transactional
public void updatePreMatricula(PreMatriculaDTO preMatricula) {
    PreMatriculaDAO dao = factory.getPreMatriculaDAO();
    PreMatricula _preMatricula = null;
    if (preMatricula instanceof PreMatriculaAlunoDTO) {
        _preMatricula = new PreMatriculaAluno((PreMatriculaAlunoDTO) preMatricula);
    } else {
        _preMatricula = new PreMatriculaInstrutor((PreMatriculaInstrutorDTO) preMatricula);
    }
    try {
        dao.update(_preMatricula);
    } catch (DAOException ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        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) PreMatricula(com.tomasio.projects.trainning.model.PreMatricula) PreMatriculaInstrutor(com.tomasio.projects.trainning.model.PreMatriculaInstrutor) PreMatriculaAluno(com.tomasio.projects.trainning.model.PreMatriculaAluno) PreMatriculaInstrutorDTO(com.tomasio.projects.trainning.dto.PreMatriculaInstrutorDTO) PreMatriculaAlunoDTO(com.tomasio.projects.trainning.dto.PreMatriculaAlunoDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PreMatriculaDAO(com.tomasio.projects.trainning.dao.PreMatriculaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with PreMatricula

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

the class AtividadesEnsinoServiceSimpleImpl method findAllPreMatriculas.

@Override
@Transactional(readOnly = true)
public PreMatriculaDTO[] findAllPreMatriculas() {
    PreMatriculaDAO dao = factory.getPreMatriculaDAO();
    PreMatriculaDTO[] preMatriculasArray = null;
    try {
        List<PreMatricula> preMatriculas = dao.findAll();
        if (preMatriculas != null) {
            preMatriculasArray = new PreMatriculaDTO[preMatriculas.size()];
            for (int i = 0; i < preMatriculas.size(); i++) {
                preMatriculasArray[i] = preMatriculas.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
    return preMatriculasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PreMatricula(com.tomasio.projects.trainning.model.PreMatricula) PreMatriculaDTO(com.tomasio.projects.trainning.dto.PreMatriculaDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PreMatriculaDAO(com.tomasio.projects.trainning.dao.PreMatriculaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 9 with PreMatricula

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

the class AtividadesEnsinoServiceSimpleImpl method hasPreMatriculas.

private boolean hasPreMatriculas(Long id) throws DAOException {
    PreMatriculaDAO dao = factory.getPreMatriculaDAO();
    List<PreMatricula> alunos = dao.findAllAlunos(id);
    if (alunos.size() > 0) {
        return true;
    }
    List<PreMatricula> instrutores = dao.findAllInstrutores(id);
    if (instrutores.size() > 0) {
        return true;
    }
    return false;
}
Also used : PreMatricula(com.tomasio.projects.trainning.model.PreMatricula) PreMatriculaDAO(com.tomasio.projects.trainning.dao.PreMatriculaDAO)

Example 10 with PreMatricula

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

the class AtividadesEnsinoServiceSimpleImpl method findAllPreMatriculasInstrutores.

@Override
@Transactional(readOnly = true)
public PreMatriculaDTO[] findAllPreMatriculasInstrutores(Long turmaId) {
    PreMatriculaDAO dao = factory.getPreMatriculaDAO();
    PreMatriculaDTO[] preMatriculasArray = null;
    try {
        List<PreMatricula> preMatriculas = dao.findAllInstrutores(turmaId);
        if (preMatriculas != null) {
            preMatriculasArray = new PreMatriculaDTO[preMatriculas.size()];
            for (int i = 0; i < preMatriculas.size(); i++) {
                preMatriculasArray[i] = preMatriculas.get(i).createDTOWithoutDependencies();
            }
        }
    } catch (DAOException ex) {
        ex.printStackTrace();
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
    return preMatriculasArray;
}
Also used : DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PreMatricula(com.tomasio.projects.trainning.model.PreMatricula) PreMatriculaDTO(com.tomasio.projects.trainning.dto.PreMatriculaDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) ParseException(java.text.ParseException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) PreMatriculaDAO(com.tomasio.projects.trainning.dao.PreMatriculaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

PreMatricula (com.tomasio.projects.trainning.model.PreMatricula)11 PreMatriculaDAO (com.tomasio.projects.trainning.dao.PreMatriculaDAO)10 DAOException (com.tomasio.projects.trainning.exception.DAOException)10 CoreException (com.tomasio.projects.trainning.exeption.CoreException)8 ParseException (java.text.ParseException)8 Transactional (org.springframework.transaction.annotation.Transactional)8 IndicacaoDAO (com.tomasio.projects.trainning.dao.IndicacaoDAO)4 PreMatriculaDTO (com.tomasio.projects.trainning.dto.PreMatriculaDTO)4 PreMatriculaAluno (com.tomasio.projects.trainning.model.PreMatriculaAluno)4 PreMatriculaAlunoDTO (com.tomasio.projects.trainning.dto.PreMatriculaAlunoDTO)3 PreMatriculaInstrutorDTO (com.tomasio.projects.trainning.dto.PreMatriculaInstrutorDTO)3 Indicacao (com.tomasio.projects.trainning.model.Indicacao)3 PreMatriculaInstrutor (com.tomasio.projects.trainning.model.PreMatriculaInstrutor)3 TurmaDAO (com.tomasio.projects.trainning.dao.TurmaDAO)2 StatusTurmaEfetiva (com.tomasio.projects.trainning.model.StatusTurmaEfetiva)2 TurmaEfetiva (com.tomasio.projects.trainning.model.TurmaEfetiva)2 HibernateIndicacaoDAO (com.tomasio.projects.trainning.dao.HibernateIndicacaoDAO)1 HibernatePreMatriculaDAO (com.tomasio.projects.trainning.dao.HibernatePreMatriculaDAO)1 IndicacaoAluno (com.tomasio.projects.trainning.model.IndicacaoAluno)1 IndicacaoInstrutor (com.tomasio.projects.trainning.model.IndicacaoInstrutor)1