Search in sources :

Example 1 with IndicacaoDAO

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

the class IndicacoesLoggerAdvice method logRemoveIndicacao.

@Around("remove()")
public void logRemoveIndicacao(ProceedingJoinPoint joinPoint) throws Throwable {
    Long id = (Long) joinPoint.getArgs()[0];
    IndicacaoDAO indicacaoDAO = factory.getIndicacaoDAO();
    Indicacao indicacao = indicacaoDAO.find(id);
    joinPoint.proceed();
    LogDTO log = new LogDTO();
    log.setDataCriacao(new Date());
    log.setUser(getUser());
    log.setTexto("EXCLUSÃO DE INDICACAO " + getDetails(indicacao.createDTO()));
    logger.create(log);
}
Also used : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) LogDTO(com.tomasio.projects.trainning.dto.LogDTO) Indicacao(com.tomasio.projects.trainning.model.Indicacao) Date(java.util.Date) Around(org.aspectj.lang.annotation.Around)

Example 2 with IndicacaoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method countIndicacoesInstrutores.

@Override
@Transactional(readOnly = true)
public int countIndicacoesInstrutores(Date start, Date end) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    int count = 0;
    try {
        count = dao.countAllIndicacoesInstrutores(start, end);
    } catch (DAOException ex) {
        throw new CoreException(ex.getMessage());
    } catch (Exception ex) {
        throw new CoreException("Erro em tempo de execução: " + ex.getMessage());
    }
    return count;
}
Also used : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) 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 3 with IndicacaoDAO

use of com.tomasio.projects.trainning.dao.IndicacaoDAO 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 4 with IndicacaoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method updateWorkflowActors.

@Override
@Transactional
public void updateWorkflowActors(Long indicacaoId) throws Exception {
    IndicacaoDAO indicacaoDAO = factory.getIndicacaoDAO();
    TurmaDAO turmaDAO = factory.getTurmaDAO();
    ParecerDAO parecerDAO = factory.getParecerDAO();
    Indicacao indicacao = indicacaoDAO.find(indicacaoId);
    List<Parecer> pareceres = parecerDAO.findAll(indicacao.getId());
    TurmaEfetiva turma = (TurmaEfetiva) turmaDAO.find(indicacao.getTurma().getId());
    Organizacao nextActor;
    Organizacao lastActor = null;
    if (pareceres.size() > 0) {
        // pareceres são retornados pelo dao em ordem decrescente
        Parecer lastParecer = pareceres.get(0);
        lastActor = lastParecer.getOrganizacao();
        nextActor = getNextActor(lastParecer.getOrganizacao(), turma);
        if (lastParecer instanceof Reprovacao) {
            indicacao.setReprovado(true);
        } else {
            indicacao.setReprovado(false);
        }
    } else {
        // não havendo pareceres
        nextActor = getNextActor(indicacao.getOrganizacao(), turma);
        /*
            verifica se é uma indicação de grande comando para outro grande comando
            então o grande comando que indicou ainda precisa aprovar.
             */
        if ((indicacao.getOrganizacao() instanceof Comando) && (turma.getOrganizacaoGestoraId().equals(indicacao.getOrganizacao().getId()) == false)) {
            nextActor = indicacao.getOrganizacao();
        }
        indicacao.setReprovado(false);
    }
    indicacao.setNextWorkflowActor(nextActor);
    indicacao.setLastWorkflowActor(lastActor);
    indicacaoDAO.update(indicacao);
}
Also used : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) Comando(com.tomasio.projects.trainning.model.Comando) Parecer(com.tomasio.projects.trainning.model.Parecer) Organizacao(com.tomasio.projects.trainning.model.Organizacao) StatusTurmaEfetiva(com.tomasio.projects.trainning.model.StatusTurmaEfetiva) TurmaEfetiva(com.tomasio.projects.trainning.model.TurmaEfetiva) ParecerDAO(com.tomasio.projects.trainning.dao.ParecerDAO) Indicacao(com.tomasio.projects.trainning.model.Indicacao) Reprovacao(com.tomasio.projects.trainning.model.Reprovacao) TurmaDAO(com.tomasio.projects.trainning.dao.TurmaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with IndicacaoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesInstrutores.

@Override
@Transactional(readOnly = true)
public IndicacaoInstrutorDTO[] findAllIndicacoesInstrutores(Long turmaId) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoInstrutorDTO[] indicacoesArray = null;
    try {
        List<IndicacaoInstrutor> indicacoes = dao.findAllInstrutores(turmaId);
        if (indicacoes != null) {
            indicacoesArray = new IndicacaoInstrutorDTO[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) DAOException(com.tomasio.projects.trainning.exception.DAOException) CoreException(com.tomasio.projects.trainning.exeption.CoreException) IndicacaoInstrutor(com.tomasio.projects.trainning.model.IndicacaoInstrutor) 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

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