Search in sources :

Example 31 with IndicacaoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method travaDeIndicacao.

@Override
@Transactional(readOnly = true)
public void travaDeIndicacao(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.travaDeIndicacao(_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 32 with IndicacaoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method createMatricula.

@Override
@Transactional
public Long createMatricula(MatriculaDTO matricula) {
    MatriculaDAO matriculaDAO = factory.getMatriculaDAO();
    IndicacaoDAO indicacaoDAO = factory.getIndicacaoDAO();
    TurmaDAO turmaDAO = factory.getTurmaDAO();
    Matricula _matricula = null;
    if (matricula != null) {
        if (matricula instanceof MatriculaAlunoDTO) {
            _matricula = new MatriculaAluno((MatriculaAlunoDTO) matricula);
        } else {
            _matricula = new MatriculaInstrutor((MatriculaInstrutorDTO) matricula);
        }
    }
    Long id = null;
    try {
        Indicacao _indicacao = _matricula.getIndicacao();
        TurmaEfetiva _turma = _matricula.getTurma();
        id = matriculaDAO.create(_matricula);
        _indicacao.setMatriculado(true);
        _turma.setAtivado(true);
        indicacaoDAO.update(_indicacao);
        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());
    }
    return id;
}
Also used : MatriculaInstrutor(com.tomasio.projects.trainning.model.MatriculaInstrutor) PreMatriculaInstrutor(com.tomasio.projects.trainning.model.PreMatriculaInstrutor) 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) PreMatriculaInstrutorDTO(com.tomasio.projects.trainning.dto.PreMatriculaInstrutorDTO) MatriculaInstrutorDTO(com.tomasio.projects.trainning.dto.MatriculaInstrutorDTO) 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) PreMatriculaAlunoDTO(com.tomasio.projects.trainning.dto.PreMatriculaAlunoDTO) MatriculaAlunoDTO(com.tomasio.projects.trainning.dto.MatriculaAlunoDTO) DAOException(com.tomasio.projects.trainning.exception.DAOException) PreMatriculaAluno(com.tomasio.projects.trainning.model.PreMatriculaAluno) MatriculaAluno(com.tomasio.projects.trainning.model.MatriculaAluno) 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 33 with IndicacaoDAO

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesInstrutoresSelecionados.

@Override
@Transactional(readOnly = true)
public IndicacaoInstrutorDTO[] findAllIndicacoesInstrutoresSelecionados(Long turmaId) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoInstrutorDTO[] indicacoesArray = null;
    try {
        List<IndicacaoInstrutor> indicacoes = dao.findAllInstrutoresSelecionados(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)

Example 34 with IndicacaoDAO

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

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

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