Search in sources :

Example 21 with Indicacao

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesAlunoByPessoaId.

@Override
@Transactional(readOnly = true)
public IndicacaoDTO[] findAllIndicacoesAlunoByPessoaId(Date exercicio, Long pessoaId) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoDTO[] indicacoesArray = null;
    try {
        List<Indicacao> indicacoes = dao.findAllIndicacoesAlunoByPessoaId(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) DAOException(com.tomasio.projects.trainning.exception.DAOException) 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) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 22 with Indicacao

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

the class AtividadesEnsinoServiceSimpleImpl method findIndicacao.

@Override
@Transactional(readOnly = true)
public IndicacaoDTO findIndicacao(Long indicacaoId) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    Indicacao indicacao = null;
    try {
        indicacao = dao.find(indicacaoId);
    } 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());
    }
    if (indicacao != null) {
        return indicacao.createDTO();
    } else {
        return null;
    }
}
Also used : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) 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 Indicacao

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

the class AtividadesEnsinoServiceSimpleImpl method createCancelamentoMatricula.

@Override
@Transactional
public Long createCancelamentoMatricula(CancelamentoMatriculaDTO cancelamentoMatricula) {
    CancelamentoMatriculaDAO cancelamentoMatriculaDAO = factory.getCancelamentoMatriculaDAO();
    IndicacaoDAO indicacaoDAO = factory.getIndicacaoDAO();
    MatriculaDAO matriculaDAO = factory.getMatriculaDAO();
    TurmaDAO turmaDAO = factory.getTurmaDAO();
    Long id = null;
    CancelamentoMatricula _cancelamentoMatricula = null;
    // cria um registro na tabela CancelamentoMatricula
    if (cancelamentoMatricula != null) {
        _cancelamentoMatricula = new CancelamentoMatricula(cancelamentoMatricula);
    }
    try {
        // verificar se já existe uma apresentação realizada desta matricula
        ApresentacaoDAO daoApre = factory.getApresentacaoDAO();
        boolean apresentacao = daoApre.hasApresentacaoComparecimento(cancelamentoMatricula.getMatricula().getId());
        if (apresentacao) {
            throw new CoreException("N&atilde;o &eacute; poss&iacute;vel cancelar a matricula pois o aluno j&aacute; se apresentou para o in&iacute;cio do curso");
        }
        Matricula matricula = matriculaDAO.find(_cancelamentoMatricula.getMatricula().getId());
        Indicacao indicacao = matricula.getIndicacao();
        TurmaEfetiva turma = matricula.getTurma();
        id = cancelamentoMatriculaDAO.create(_cancelamentoMatricula);
        indicacao.setMatriculado(false);
        indicacaoDAO.update(indicacao);
        if (hasMatriculas(turma.getId())) {
            turma.setAtivado(true);
        } else {
            turma.setAtivado(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());
        throw new CoreException(ex.getMessage());
    }
    return id;
}
Also used : CancelamentoMatricula(com.tomasio.projects.trainning.model.CancelamentoMatricula) ApresentacaoDAO(com.tomasio.projects.trainning.dao.ApresentacaoDAO) StatusTurmaEfetiva(com.tomasio.projects.trainning.model.StatusTurmaEfetiva) TurmaEfetiva(com.tomasio.projects.trainning.model.TurmaEfetiva) CancelamentoMatricula(com.tomasio.projects.trainning.model.CancelamentoMatricula) Matricula(com.tomasio.projects.trainning.model.Matricula) NotificacaoMatricula(com.tomasio.projects.trainning.model.NotificacaoMatricula) PreMatricula(com.tomasio.projects.trainning.model.PreMatricula) 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) IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) CancelamentoMatriculaDAO(com.tomasio.projects.trainning.dao.CancelamentoMatriculaDAO) CoreException(com.tomasio.projects.trainning.exeption.CoreException) CancelamentoMatriculaDAO(com.tomasio.projects.trainning.dao.CancelamentoMatriculaDAO) MatriculaDAO(com.tomasio.projects.trainning.dao.MatriculaDAO) NotificacaoMatriculaDAO(com.tomasio.projects.trainning.dao.NotificacaoMatriculaDAO) PreMatriculaDAO(com.tomasio.projects.trainning.dao.PreMatriculaDAO) TurmaDAO(com.tomasio.projects.trainning.dao.TurmaDAO) Transactional(org.springframework.transaction.annotation.Transactional)

Example 24 with Indicacao

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

the class AtividadesEnsinoServiceSimpleImpl method updateIndicacao.

@Override
@Transactional
public void updateIndicacao(IndicacaoDTO indicacao) {
    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.update(_indicacao);
    } 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) 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) 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)

Example 25 with Indicacao

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

the class AtividadesEnsinoServiceSimpleImpl method createParecer.

@Override
@Transactional
public Long createParecer(ParecerDTO parecer) {
    ParecerDAO dao = factory.getParecerDAO();
    IndicacaoDAO indicacaoDAO = factory.getIndicacaoDAO();
    Parecer _parecer = null;
    if (parecer instanceof AprovacaoDTO) {
        _parecer = new Aprovacao((AprovacaoDTO) parecer);
    } else {
        _parecer = new Reprovacao((ReprovacaoDTO) parecer);
    }
    Long id = null;
    try {
        id = dao.create(_parecer);
        Indicacao indicacao = indicacaoDAO.find(_parecer.getIndicacao().getId());
        updateWorkflowActors(indicacao.getId());
    } 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 id;
}
Also used : IndicacaoDAO(com.tomasio.projects.trainning.dao.IndicacaoDAO) DAOException(com.tomasio.projects.trainning.exception.DAOException) Parecer(com.tomasio.projects.trainning.model.Parecer) CoreException(com.tomasio.projects.trainning.exeption.CoreException) ParecerDAO(com.tomasio.projects.trainning.dao.ParecerDAO) Indicacao(com.tomasio.projects.trainning.model.Indicacao) Aprovacao(com.tomasio.projects.trainning.model.Aprovacao) Reprovacao(com.tomasio.projects.trainning.model.Reprovacao) ReprovacaoDTO(com.tomasio.projects.trainning.dto.ReprovacaoDTO) AprovacaoDTO(com.tomasio.projects.trainning.dto.AprovacaoDTO) 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

Indicacao (com.tomasio.projects.trainning.model.Indicacao)25 DAOException (com.tomasio.projects.trainning.exception.DAOException)23 ParseException (java.text.ParseException)21 IndicacaoDAO (com.tomasio.projects.trainning.dao.IndicacaoDAO)20 Transactional (org.springframework.transaction.annotation.Transactional)19 CoreException (com.tomasio.projects.trainning.exeption.CoreException)18 TurmaDAO (com.tomasio.projects.trainning.dao.TurmaDAO)11 PreMatriculaDAO (com.tomasio.projects.trainning.dao.PreMatriculaDAO)10 PreMatricula (com.tomasio.projects.trainning.model.PreMatricula)10 StatusTurmaEfetiva (com.tomasio.projects.trainning.model.StatusTurmaEfetiva)10 TurmaEfetiva (com.tomasio.projects.trainning.model.TurmaEfetiva)10 CancelamentoMatriculaDAO (com.tomasio.projects.trainning.dao.CancelamentoMatriculaDAO)7 MatriculaDAO (com.tomasio.projects.trainning.dao.MatriculaDAO)7 NotificacaoMatriculaDAO (com.tomasio.projects.trainning.dao.NotificacaoMatriculaDAO)7 CancelamentoMatricula (com.tomasio.projects.trainning.model.CancelamentoMatricula)7 Matricula (com.tomasio.projects.trainning.model.Matricula)7 NotificacaoMatricula (com.tomasio.projects.trainning.model.NotificacaoMatricula)7 IndicacaoAluno (com.tomasio.projects.trainning.model.IndicacaoAluno)5 HibernateException (org.hibernate.HibernateException)5 Session (org.hibernate.Session)5