Search in sources :

Example 11 with IndicacaoAlunoDTO

use of com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO 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 12 with IndicacaoAlunoDTO

use of com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO 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 13 with IndicacaoAlunoDTO

use of com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO 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 14 with IndicacaoAlunoDTO

use of com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO 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)

Example 15 with IndicacaoAlunoDTO

use of com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO in project trainning by fernandotomasio.

the class AtividadesEnsinoServiceSimpleImpl method createIndicacao.

@Override
@Transactional
public Long createIndicacao(IndicacaoDTO indicacao) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    OrganizacaoDAO organizacaoDAO = factory.getOrganizacaoDAO();
    TurmaDAO turmaDAO = factory.getTurmaDAO();
    Indicacao _indicacao = null;
    if (indicacao != null) {
        if (indicacao instanceof IndicacaoAlunoDTO) {
            _indicacao = new IndicacaoAluno((IndicacaoAlunoDTO) indicacao);
        } else {
            _indicacao = new IndicacaoInstrutor((IndicacaoInstrutorDTO) indicacao);
        }
    }
    Long id = null;
    try {
        id = dao.create(_indicacao);
        updateWorkflowActors(_indicacao.getId());
    } catch (DAOException ex) {
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
    return id;
}
Also used : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) IndicacaoAlunoDTO(com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) OrganizacaoDAO(com.tomasio.projects.trainning.dao.OrganizacaoDAO) IndicacaoAluno(com.tomasio.projects.trainning.model.IndicacaoAluno) CoreException(com.tomasio.projects.trainning.exeption.CoreException) Indicacao(com.tomasio.projects.trainning.model.Indicacao) IndicacaoInstrutor(com.tomasio.projects.trainning.model.IndicacaoInstrutor) TurmaDAO(com.tomasio.projects.trainning.dao.TurmaDAO) IndicacaoInstrutorDTO(com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO) 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

IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)36 CoreException (com.tomasio.projects.trainning.exeption.CoreException)25 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)19 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)18 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)17 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)17 Date (java.util.Date)13 IndicacaoDAO (com.tomasio.projects.trainning.dao.IndicacaoDAO)12 DAOException (com.tomasio.projects.trainning.exception.DAOException)12 IndicacaoAluno (com.tomasio.projects.trainning.model.IndicacaoAluno)12 Transactional (org.springframework.transaction.annotation.Transactional)12 CustoDTO (com.tomasio.projects.trainning.dto.CustoDTO)11 ParseException (java.text.ParseException)11 ArrayList (java.util.ArrayList)9 HashMap (java.util.HashMap)8 IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)6 Map (java.util.Map)6 Indicacao (com.tomasio.projects.trainning.model.Indicacao)4 SimpleDateFormat (java.text.SimpleDateFormat)4 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)3