Search in sources :

Example 1 with IndicacaoAluno

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesAlunosByOrganizacoesBeneficiadas.

@Override
@Transactional(readOnly = true)
@SuppressWarnings({ "BroadCatchBlock", "TooBroadCatch" })
public IndicacaoAlunoDTO[] findAllIndicacoesAlunosByOrganizacoesBeneficiadas(Date exercicio, Long[] organizacoesBeneficiadasIds, Long[] cursosIds, Long[] turmasIds) {
    if (organizacoesBeneficiadasIds == null || organizacoesBeneficiadasIds.length <= 0) {
        throw new IllegalArgumentException("É obrigatório informar a organização beneficiada");
    }
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoAlunoDTO[] indicacoesArray = null;
    List<Long> cursosIdsList = null;
    List<Long> turmasIdsList = null;
    if (cursosIds != null) {
        cursosIdsList = Arrays.asList(cursosIds);
    }
    if (turmasIds != null) {
        turmasIdsList = Arrays.asList(turmasIds);
    }
    try {
        List<IndicacaoAluno> indicacoes = dao.findAllAlunosByOrganizacoesBeneficiadas(exercicio, Arrays.asList(organizacoesBeneficiadasIds), cursosIdsList, turmasIdsList);
        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) {
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        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 2 with IndicacaoAluno

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesPendentes.

@Override
@Transactional(readOnly = true)
public IndicacaoAlunoDTO[] findAllIndicacoesPendentes(Date exercicio, Long organizacaoIndicadoraId) {
    Map<Long, TurmaEfetiva> mapTurmas = new HashMap<Long, TurmaEfetiva>();
    IndicacaoDAO indicacaoDAO = factory.getIndicacaoDAO();
    TurmaDAO turmaDAO = factory.getTurmaDAO();
    List<IndicacaoAlunoDTO> result = new ArrayList<IndicacaoAlunoDTO>();
    try {
        List<IndicacaoAluno> indicacoes = indicacaoDAO.findAllAlunosByOrganizacao(exercicio, organizacaoIndicadoraId);
        for (IndicacaoAluno indicacao : indicacoes) {
            TurmaEfetiva turma = mapTurmas.get(indicacao.getTurma().getId());
            if (turma == null) {
                turma = (TurmaEfetiva) turmaDAO.find(indicacao.getTurma().getId());
                mapTurmas.put(indicacao.getTurma().getId(), turma);
            }
            if (turma.getDataInicio().after(new Date())) {
                if (turma.isAtivado()) {
                    if (turma.getDataInicio() == null) {
                        result.add(indicacao.createDTO());
                    } else if (turma.getDataInicio().after(new Date())) {
                        result.add(indicacao.createDTO());
                    }
                } else {
                    result.add(indicacao.createDTO());
                }
            }
        }
    } catch (DAOException ex) {
        Logger.getLogger(AtividadesEnsinoServiceSimpleImpl.class.getName()).log(Level.SEVERE, null, ex);
    }
    IndicacaoAlunoDTO[] resultArray = new IndicacaoAlunoDTO[result.size()];
    result.toArray(resultArray);
    return resultArray;
}
Also used : StatusTurmaEfetiva(com.tomasio.projects.trainning.model.StatusTurmaEfetiva) TurmaEfetiva(com.tomasio.projects.trainning.model.TurmaEfetiva) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Date(java.util.Date) 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) TurmaDAO(com.tomasio.projects.trainning.dao.TurmaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with IndicacaoAluno

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesAlunos.

@Override
@Transactional(readOnly = true)
public IndicacaoAlunoDTO[] findAllIndicacoesAlunos(Long turmaId, Long organizacaoId, Long pessoaId, Date exercicio) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoAlunoDTO[] indicacoesArray = null;
    try {
        List<IndicacaoAluno> indicacoes = dao.findAllAlunos(turmaId, organizacaoId, pessoaId, exercicio);
        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 4 with IndicacaoAluno

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesAlunos.

@Override
@Transactional(readOnly = true)
public IndicacaoAlunoDTO[] findAllIndicacoesAlunos(Long turmaId) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoAlunoDTO[] indicacoesArray = null;
    try {
        List<IndicacaoAluno> indicacoes = dao.findAllAlunos(turmaId);
        indicacoes = arrangeIndicacoes(turmaId, indicacoes);
        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 5 with IndicacaoAluno

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesAlunosSelecionados.

@Override
@Transactional(readOnly = true)
public IndicacaoAlunoDTO[] findAllIndicacoesAlunosSelecionados(Long turmaId) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoAlunoDTO[] indicacoesArray = null;
    try {
        List<IndicacaoAluno> indicacoes = arrangeIndicacoes(turmaId, dao.findAllAlunosSelecionados(turmaId));
        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)

Aggregations

IndicacaoAluno (com.tomasio.projects.trainning.model.IndicacaoAluno)22 DAOException (com.tomasio.projects.trainning.exception.DAOException)20 IndicacaoDAO (com.tomasio.projects.trainning.dao.IndicacaoDAO)15 ParseException (java.text.ParseException)14 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)12 Transactional (org.springframework.transaction.annotation.Transactional)12 CoreException (com.tomasio.projects.trainning.exeption.CoreException)11 Session (org.hibernate.Session)6 Indicacao (com.tomasio.projects.trainning.model.Indicacao)5 IndicacaoInstrutor (com.tomasio.projects.trainning.model.IndicacaoInstrutor)4 HashMap (java.util.HashMap)4 HibernateException (org.hibernate.HibernateException)4 HibernateIndicacaoDAO (com.tomasio.projects.trainning.dao.HibernateIndicacaoDAO)3 TurmaEfetiva (com.tomasio.projects.trainning.model.TurmaEfetiva)3 SimpleDateFormat (java.text.SimpleDateFormat)3 Date (java.util.Date)3 List (java.util.List)3 HibernateMatriculaDAO (com.tomasio.projects.trainning.dao.HibernateMatriculaDAO)2 HibernatePreMatriculaDAO (com.tomasio.projects.trainning.dao.HibernatePreMatriculaDAO)2 MatriculaDAO (com.tomasio.projects.trainning.dao.MatriculaDAO)2