Search in sources :

Example 21 with IndicacaoDAO

use of com.tomasio.projects.trainning.dao.IndicacaoDAO in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method removePreMatricula.

@Override
@Transactional
public void removePreMatricula(Long preMatriculaId) {
    PreMatriculaDAO preMatriculaDAO = factory.getPreMatriculaDAO();
    IndicacaoDAO indicacaoDAO = factory.getIndicacaoDAO();
    TurmaDAO turmaDAO = factory.getTurmaDAO();
    try {
        PreMatricula preMatricula = preMatriculaDAO.find(preMatriculaId);
        Indicacao indicacao = preMatricula.getIndicacao();
        TurmaEfetiva turma = preMatricula.getTurma();
        preMatriculaDAO.remove(preMatriculaId);
        indicacao.setPreMatriculado(false);
        indicacaoDAO.update(indicacao);
        if (hasPreMatriculas(turma.getId())) {
            turma.setPreAtivado(true);
        } else {
            turma.setPreAtivado(false);
        }
        turmaDAO.update(turma);
    } 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 : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) 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) PreMatricula(com.tomasio.projects.trainning.model.PreMatricula) Indicacao(com.tomasio.projects.trainning.model.Indicacao) TurmaDAO(com.tomasio.projects.trainning.dao.TurmaDAO) 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 22 with IndicacaoDAO

use of com.tomasio.projects.trainning.dao.IndicacaoDAO in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method alertaDeIndicacao.

@Override
@Transactional(readOnly = true)
public void alertaDeIndicacao(IndicacaoDTO indicacao, String chamada) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    Indicacao _indicacao = null;
    if (indicacao != null) {
        // if (indicacao instanceof IndicacaoAlunoDTO) {
        _indicacao = new IndicacaoAluno((IndicacaoAlunoDTO) indicacao);
    // } else {
    // _indicacao = new IndicacaoInstrutor((IndicacaoInstrutorDTO) indicacao);
    // }
    }
    try {
        dao.alertaDeIndicacao(_indicacao, chamada);
    } catch (DAOException ex) {
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
}
Also used : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) IndicacaoAlunoDTO(com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) IndicacaoAluno(com.tomasio.projects.trainning.model.IndicacaoAluno) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Indicacao(com.tomasio.projects.trainning.model.Indicacao) 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 23 with IndicacaoDAO

use of com.tomasio.projects.trainning.dao.IndicacaoDAO in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesAlunos.

@Override
@Transactional(readOnly = true)
public IndicacaoAlunoDTO[] findAllIndicacoesAlunos() {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoAlunoDTO[] indicacoesArray = null;
    try {
        List<IndicacaoAluno> indicacoes = dao.findAllAlunos();
        if (indicacoes != null) {
            indicacoesArray = new IndicacaoAlunoDTO[indicacoes.size()];
            for (int i = 0; i < indicacoes.size(); i++) {
                indicacoesArray[i] = indicacoes.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 indicacoesArray;
}
Also used : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) IndicacaoAlunoDTO(com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) IndicacaoAluno(com.tomasio.projects.trainning.model.IndicacaoAluno) CoreException(com.tomasio.projects.trainning.exeption.CoreException) 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 24 with IndicacaoDAO

use of com.tomasio.projects.trainning.dao.IndicacaoDAO in project trainning by fernandotomasio.

the class ImportTurmasImplEfetivasFromTabelao method periodosInstrutor.

private List<Periodo> periodosInstrutor(String codInstrutor, Connection conn) {
    List<Periodo> periodos = new ArrayList<Periodo>();
    try {
        IndicacaoDAO indicacaoDAO = new HibernateIndicacaoDAO();
        OrganizacaoDAO organizacaoDAO = new HibernateOrganizacaoDAO();
        PessoaDAO pessoaDAO = new HibernatePessoaDAO();
        MatriculaDAO matriculaDAO = new HibernateMatriculaDAO();
        Statement stm = conn.createStatement();
        ResultSet rs = stm.executeQuery("select * from periodoinstrutores where codInstrutores=" + codInstrutor);
        while (rs.next()) {
            Date inicio = rs.getDate("inicio");
            Date termino = rs.getDate("termino");
            Periodo periodo = new Periodo();
            periodo.setDataInicio(inicio);
            periodo.setDataTermino(termino);
            periodos.add(periodo);
        }
    } catch (SQLException ex) {
        Logger.getLogger(ImportTurmasImplEfetivasFromTabelao.class.getName()).log(Level.SEVERE, null, ex);
    }
    return periodos;
}
Also used : HibernatePessoaDAO(com.tomasio.projects.trainning.dao.HibernatePessoaDAO) PessoaDAO(com.tomasio.projects.trainning.dao.PessoaDAO) ArrayList(java.util.ArrayList) HibernateOrganizacaoDAO(com.tomasio.projects.trainning.dao.HibernateOrganizacaoDAO) Periodo(com.tomasio.projects.trainning.model.Periodo) Date(java.util.Date) IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) HibernateIndicacaoDAO(com.tomasio.projects.trainning.dao.HibernateIndicacaoDAO) OrganizacaoDAO(com.tomasio.projects.trainning.dao.OrganizacaoDAO) HibernateOrganizacaoDAO(com.tomasio.projects.trainning.dao.HibernateOrganizacaoDAO) HibernateMatriculaDAO(com.tomasio.projects.trainning.dao.HibernateMatriculaDAO) HibernateMatriculaDAO(com.tomasio.projects.trainning.dao.HibernateMatriculaDAO) MatriculaDAO(com.tomasio.projects.trainning.dao.MatriculaDAO) HibernateIndicacaoDAO(com.tomasio.projects.trainning.dao.HibernateIndicacaoDAO) HibernatePessoaDAO(com.tomasio.projects.trainning.dao.HibernatePessoaDAO)

Example 25 with IndicacaoDAO

use of com.tomasio.projects.trainning.dao.IndicacaoDAO in project trainning by fernandotomasio.

the class ImportTurmasImplEfetivasFromTabelao method recuperarAnotacoesPagina.

private void recuperarAnotacoesPagina(int codTabelao, TurmaEfetiva turmaCriada, Connection conn) {
    try {
        IndicacaoDAO indicacaoDAO = new HibernateIndicacaoDAO();
        OrganizacaoDAO organizacaoDAO = new HibernateOrganizacaoDAO();
        PessoaDAO pessoaDAO = new HibernatePessoaDAO();
        AnotacaoDAO anotacaoDAO = new HibernateAnotacaoDAO();
        Statement stm = conn.createStatement();
        ResultSet rs = stm.executeQuery("select * from tabelao where codTabelao=" + codTabelao);
        while (rs.next()) {
            String observacoes = rs.getString("avisos");
            AnotacaoDTO anotacao = new AnotacaoDTO();
            anotacao.setDataCriacao(new Date());
            anotacao.setObjectId(turmaCriada.getObjectId());
            anotacao.setTexto(observacoes);
            anotacao.setUser("IMPORTAÇÃO");
            anotacao.setVisibleInWebpage(true);
            anotacaoDAO.create(anotacao);
        }
    } catch (SQLException ex) {
        Logger.getLogger(ImportTurmasImplEfetivasFromTabelao.class.getName()).log(Level.SEVERE, null, ex);
    } catch (Exception ex) {
        Logger.getLogger(ImportTurmasImplEfetivasFromTabelao.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : HibernatePessoaDAO(com.tomasio.projects.trainning.dao.HibernatePessoaDAO) PessoaDAO(com.tomasio.projects.trainning.dao.PessoaDAO) HibernateOrganizacaoDAO(com.tomasio.projects.trainning.dao.HibernateOrganizacaoDAO) Date(java.util.Date) ParseException(java.text.ParseException) RemoteException(java.rmi.RemoteException) DAOException(com.tomasio.projects.trainning.exception.DAOException) IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) HibernateIndicacaoDAO(com.tomasio.projects.trainning.dao.HibernateIndicacaoDAO) OrganizacaoDAO(com.tomasio.projects.trainning.dao.OrganizacaoDAO) HibernateOrganizacaoDAO(com.tomasio.projects.trainning.dao.HibernateOrganizacaoDAO) HibernateIndicacaoDAO(com.tomasio.projects.trainning.dao.HibernateIndicacaoDAO) AnotacaoDTO(com.tomasio.projects.trainning.dto.AnotacaoDTO) HibernateAnotacaoDAO(com.tomasio.projects.trainning.dao.HibernateAnotacaoDAO) HibernatePessoaDAO(com.tomasio.projects.trainning.dao.HibernatePessoaDAO) AnotacaoDAO(com.tomasio.projects.trainning.dao.AnotacaoDAO) HibernateAnotacaoDAO(com.tomasio.projects.trainning.dao.HibernateAnotacaoDAO)

Aggregations

IndicacaoDAO (com.tomasio.projects.trainning.dao.IndicacaoDAO)42 DAOException (com.tomasio.projects.trainning.exception.DAOException)39 Transactional (org.springframework.transaction.annotation.Transactional)33 ParseException (java.text.ParseException)32 CoreException (com.tomasio.projects.trainning.exeption.CoreException)30 Indicacao (com.tomasio.projects.trainning.model.Indicacao)20 IndicacaoAluno (com.tomasio.projects.trainning.model.IndicacaoAluno)15 TurmaDAO (com.tomasio.projects.trainning.dao.TurmaDAO)13 MatriculaDAO (com.tomasio.projects.trainning.dao.MatriculaDAO)12 PreMatriculaDAO (com.tomasio.projects.trainning.dao.PreMatriculaDAO)12 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)12 StatusTurmaEfetiva (com.tomasio.projects.trainning.model.StatusTurmaEfetiva)12 TurmaEfetiva (com.tomasio.projects.trainning.model.TurmaEfetiva)12 PreMatricula (com.tomasio.projects.trainning.model.PreMatricula)11 Matricula (com.tomasio.projects.trainning.model.Matricula)9 HibernateIndicacaoDAO (com.tomasio.projects.trainning.dao.HibernateIndicacaoDAO)8 OrganizacaoDAO (com.tomasio.projects.trainning.dao.OrganizacaoDAO)8 IndicacaoInstrutor (com.tomasio.projects.trainning.model.IndicacaoInstrutor)8 CancelamentoMatriculaDAO (com.tomasio.projects.trainning.dao.CancelamentoMatriculaDAO)7 NotificacaoMatriculaDAO (com.tomasio.projects.trainning.dao.NotificacaoMatriculaDAO)7