Search in sources :

Example 31 with IndicacaoAlunoDTO

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesAlunosSelecionadosForOrdemMatricula.

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

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesAlunosByOrganizacao.

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

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

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

the class TestMail method main.

public static void main(String[] args) throws FileNotFoundException, Exception {
    ApplicationContext context = new ClassPathXmlApplicationContext("service-context.xml");
    SimpleDateFormat df = new SimpleDateFormat("yyyy");
    AtividadesEnsinoService service = (AtividadesEnsinoService) context.getBean("atividadesEnsinoService");
    // service.updateWorkflowActors(821699L);
    System.out.println("recuperando todas as turmas do sistema");
    TurmaEfetivaDTO[] turmas = service.findAllTurmasEfetivas(df.parse("2015"), null, null, null, null, null);
    for (TurmaEfetivaDTO turma : turmas) {
        System.out.println("BUSCANDO INDICAÇÕES DA TURMA " + turma.getId());
        IndicacaoAlunoDTO[] indicacoes = service.findAllIndicacoesAlunos(turma.getId());
        for (IndicacaoAlunoDTO indicacao : indicacoes) {
            System.out.println("ATUALIZANDO INDICAÇÃO");
            service.updateWorkflowActors(indicacao.getId());
        }
    }
    System.out.println("Finalizado");
}
Also used : IndicacaoAlunoDTO(com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO) ApplicationContext(org.springframework.context.ApplicationContext) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) ClassPathXmlApplicationContext(org.springframework.context.support.ClassPathXmlApplicationContext) SimpleDateFormat(java.text.SimpleDateFormat) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Example 35 with IndicacaoAlunoDTO

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

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