Search in sources :

Example 11 with IndicacaoDTO

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

the class AtividadesDeEnsinoService method findAllIndicacoesInstrutorByPessoaId.

@WebMethod(operationName = "findAllIndicacoesInstrutorByPessoaId")
public IndicacaoDTO[] findAllIndicacoesInstrutorByPessoaId(@WebParam(name = "exercicio") int exercicio, @WebParam(name = "pessoaId") Long pessoaId) {
    SimpleDateFormat df = new SimpleDateFormat("yyyy");
    Date exercicioDate = null;
    try {
        exercicioDate = df.parse(String.valueOf(exercicio));
    } catch (ParseException ex) {
        Logger.getLogger(AtividadesDeEnsinoService.class.getName()).log(Level.SEVERE, null, ex);
    }
    IndicacaoDTO[] indicacoes = atividadesEnsinoService.findAllIndicacoesInstrutorByPessoaId(exercicioDate, pessoaId);
    return indicacoes;
}
Also used : ParseException(java.text.ParseException) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) WebMethod(javax.jws.WebMethod)

Example 12 with IndicacaoDTO

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

the class AtividadesEnsinoServiceSimpleImpl method findAllIndicacoesInstrutorByPessoaId.

@Override
@Transactional(readOnly = true)
public IndicacaoDTO[] findAllIndicacoesInstrutorByPessoaId(Date exercicio, Long pessoaId) {
    IndicacaoDAO dao = factory.getIndicacaoDAO();
    IndicacaoDTO[] indicacoesArray = null;
    try {
        List<Indicacao> indicacoes = dao.findAllIndicacoesInstrutorByPessoaId(pessoaId, exercicio);
        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) 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 13 with IndicacaoDTO

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

the class EXC001ODF method makeReport.

@Override
public void makeReport() {
    try {
        odt = OdfTextDocument.newTextDocument();
        AtividadesEnsinoService service = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
        OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
        Long turmaId = (Long) params.get("turmaId");
        TurmaDTO turma = service.findTurmaEfetiva(turmaId);
        IndicacaoDTO[] indicacoes = service.findAllIndicacoesAlunos(turmaId);
        odt.newParagraph("CURSO: " + turma.getCurso().getCodigo() + " - " + turma.getCurso().getDescricao());
        odt.newParagraph("TURMA: " + turma.getNumeroTurma());
        odt.newParagraph("INICIO: " + turma.getDataInicioFormatted());
        odt.newParagraph("TERMINO: " + turma.getDataTerminoFormatted());
        OdfTable indicacoesTable = OdfTable.newTable(odt, indicacoes.length + 1, 5);
        OdfTableCell postoHeader = indicacoesTable.getCellByPosition(0, 0);
        postoHeader.setStringValue("Posto/Graduacao");
        postoHeader.setHorizontalAlignment("center");
        OdfTableCell especialidadeHeader = indicacoesTable.getCellByPosition(1, 0);
        especialidadeHeader.setStringValue("Especialidade");
        especialidadeHeader.setHorizontalAlignment("center");
        OdfTableCell nomeHeader = indicacoesTable.getCellByPosition(2, 0);
        nomeHeader.setStringValue("Nome");
        nomeHeader.setHorizontalAlignment("center");
        OdfTableCell saramHeader = indicacoesTable.getCellByPosition(3, 0);
        saramHeader.setStringValue("SARAM");
        saramHeader.setHorizontalAlignment("center");
        OdfTableCell cpfHeader = indicacoesTable.getCellByPosition(4, 0);
        cpfHeader.setStringValue("CPF");
        cpfHeader.setHorizontalAlignment("center");
        OdfTableCell organizacaoHeader = indicacoesTable.getCellByPosition(5, 0);
        organizacaoHeader.setStringValue("Organizacao");
        organizacaoHeader.setHorizontalAlignment("center");
        for (int i = 0; i < indicacoes.length; i++) {
            PessoaDTO pessoa = organizationalService.findPessoa(indicacoes[i].getPessoa().getId());
            String posto = pessoa.getPosto();
            String especialidade = pessoa.getEspecialidade();
            String nome = pessoa.getNome();
            String saram = pessoa.getSaram();
            String cpf = pessoa.getCpf();
            OrganizacaoDTO organizacao = organizationalService.findOrganizacao(indicacoes[i].getOrganizacao().getId());
            String siglaOrganizacao = organizacao.getSigla();
            OdfTableCell postoCell = indicacoesTable.getCellByPosition(0, i + 1);
            postoCell.setStringValue(posto);
            OdfTableCell especialidadeCell = indicacoesTable.getCellByPosition(1, i + 1);
            especialidadeCell.setStringValue(especialidade);
            OdfTableCell nomeCell = indicacoesTable.getCellByPosition(2, i + 1);
            nomeCell.setStringValue(nome);
            OdfTableCell saramCell = indicacoesTable.getCellByPosition(3, i + 1);
            saramCell.setStringValue(saram);
            OdfTableCell cpfCell = indicacoesTable.getCellByPosition(4, i + 1);
            cpfCell.setStringValue(cpf);
            OdfTableCell organizacaoCell = indicacoesTable.getCellByPosition(5, i + 1);
            organizacaoCell.setStringValue(siglaOrganizacao);
        }
        odt.save(os);
    } catch (Exception ex) {
        Logger.getLogger(EXC001ODF.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) OdfTableCell(org.odftoolkit.odfdom.doc.table.OdfTableCell) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) OdfTable(org.odftoolkit.odfdom.doc.table.OdfTable) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Example 14 with IndicacaoDTO

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

the class EXC005CSV method makeReport.

@Override
public void makeReport() {
    AtividadesEnsinoService service = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
    OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
    Writer writter = new OutputStreamWriter(os);
    BufferedWriter bufferedWriter = new BufferedWriter(writter);
    Long turmaId = (Long) params.get("turmaId");
    IndicacaoDTO[] indicacoes = service.findAllIndicacoesAlunos(turmaId);
    for (IndicacaoDTO indicacao : indicacoes) {
        try {
            PessoaDTO pessoa = organizationalService.findPessoa(indicacao.getPessoa().getId());
            if (pessoa.getPosto() != null) {
                bufferedWriter.write(pessoa.getPosto());
            }
            bufferedWriter.write(",");
            if (pessoa.getQuadro() != null) {
                bufferedWriter.write(pessoa.getQuadro());
            }
            bufferedWriter.write(",");
            if (pessoa.getEspecialidade() != null) {
                bufferedWriter.write(pessoa.getEspecialidade());
            }
            bufferedWriter.write(",");
            if (pessoa.getNome() != null) {
                bufferedWriter.write(pessoa.getNome());
            }
            bufferedWriter.write(",");
            if (pessoa.getNomeGuerra() != null) {
                bufferedWriter.write(pessoa.getNomeGuerra());
            }
            bufferedWriter.write(",");
            if (pessoa.getOrganizacao() != null && pessoa.getOrganizacao().getSigla() != null) {
                bufferedWriter.write(pessoa.getOrganizacao().getSigla());
            }
            bufferedWriter.write(",");
            if (indicacao.getEmail() != null) {
                bufferedWriter.write(indicacao.getEmail());
            }
            bufferedWriter.write(",");
            if (indicacao.getTelefone() != null) {
                bufferedWriter.write(indicacao.getTelefone());
            }
            bufferedWriter.write(",");
            if (pessoa.getSaram() != null) {
                bufferedWriter.write(pessoa.getSaram());
            }
            bufferedWriter.write(",");
            if (indicacao.getStatus() != null) {
                bufferedWriter.write(indicacao.getStatus());
            }
            bufferedWriter.newLine();
        } catch (IOException ex) {
            Logger.getLogger(EXC005CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    try {
        bufferedWriter.flush();
        bufferedWriter.close();
    } catch (IOException ex) {
        Logger.getLogger(EXC005CSV.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) OutputStreamWriter(java.io.OutputStreamWriter) IOException(java.io.IOException) BufferedWriter(java.io.BufferedWriter) Writer(java.io.Writer) OutputStreamWriter(java.io.OutputStreamWriter) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService) BufferedWriter(java.io.BufferedWriter) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO)

Example 15 with IndicacaoDTO

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

the class EXC006CSV method makeReport.

@Override
public void makeReport() {
    AtividadesEnsinoService service = (AtividadesEnsinoService) services.get("atividadesEnsinoService");
    OrganizationalService organizationalService = (OrganizationalService) services.get("organizationalService");
    Writer writter = new OutputStreamWriter(os);
    BufferedWriter bufferedWriter = new BufferedWriter(writter);
    Map<Long, TurmaEfetivaDTO> mapTurmas = new HashMap<Long, TurmaEfetivaDTO>();
    TurmaEfetivaDTO[] turmas = service.findAllTurmasEfetivas(null, null, null, null, null, null);
    for (TurmaEfetivaDTO turma : turmas) {
        if (!mapTurmas.containsKey(turma.getId())) {
            mapTurmas.put(turma.getId(), turma);
        }
    }
    List<IndicacaoDTO> indicacoes = new ArrayList<IndicacaoDTO>();
    IndicacaoDTO[] indicacoesInstrutores = service.findAllIndicacoesInstrutores();
    indicacoes.addAll(Arrays.asList(indicacoesInstrutores));
    IndicacaoDTO[] indicacoesAlunos = service.findAllIndicacoesAlunos();
    indicacoes.addAll(Arrays.asList(indicacoesAlunos));
    for (IndicacaoDTO indicacao : indicacoes) {
        TurmaDTO turma = mapTurmas.get(indicacao.getTurma().getId());
        try {
            PessoaDTO pessoa = organizationalService.findPessoa(indicacao.getPessoa().getId());
            if (indicacao instanceof IndicacaoAlunoDTO) {
                bufferedWriter.write("ALUNO");
            } else {
                bufferedWriter.write("INSTRUTOR");
            }
            bufferedWriter.write(",");
            if (turma != null) {
                bufferedWriter.write(turma.getCurso().getCodigo() + "-" + turma.getNumeroTurma());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (pessoa.getPosto() != null) {
                bufferedWriter.write(pessoa.getPosto());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (pessoa.getQuadro() != null) {
                bufferedWriter.write(pessoa.getQuadro());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (pessoa.getEspecialidade() != null) {
                bufferedWriter.write(pessoa.getEspecialidade());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (pessoa.getNome() != null) {
                bufferedWriter.write(pessoa.getNome());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (pessoa.getNomeGuerra() != null) {
                bufferedWriter.write(pessoa.getNomeGuerra());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (pessoa.getOrganizacao() != null && pessoa.getOrganizacao().getSigla() != null) {
                bufferedWriter.write(pessoa.getOrganizacao().getSigla());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (indicacao.getEmail() != null) {
                bufferedWriter.write(indicacao.getEmail());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (indicacao.getTelefone() != null) {
                bufferedWriter.write(indicacao.getTelefone());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (pessoa.getSaram() != null) {
                bufferedWriter.write(pessoa.getSaram());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (pessoa.getCpf() != null) {
                bufferedWriter.write(pessoa.getCpf());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (((TurmaEfetivaDTO) turma).getOrganizacaoGestoraId() != null) {
                OrganizacaoDTO organizacaoGestora = organizationalService.findOrganizacao(((TurmaEfetivaDTO) turma).getOrganizacaoGestoraId());
                bufferedWriter.write(organizacaoGestora.getSigla());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.write(",");
            if (indicacao.getStatus() != null) {
                bufferedWriter.write(indicacao.getStatus());
            } else {
                bufferedWriter.write("");
            }
            bufferedWriter.newLine();
        } catch (IOException ex) {
            Logger.getLogger(EXC006CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    try {
        bufferedWriter.flush();
        bufferedWriter.close();
    } catch (IOException ex) {
        Logger.getLogger(EXC006CSV.class.getName()).log(Level.SEVERE, null, ex);
    }
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) TurmaDTO(com.tomasio.projects.trainning.dto.TurmaDTO) IOException(java.io.IOException) BufferedWriter(java.io.BufferedWriter) IndicacaoDTO(com.tomasio.projects.trainning.dto.IndicacaoDTO) IndicacaoAlunoDTO(com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO) TurmaEfetivaDTO(com.tomasio.projects.trainning.dto.TurmaEfetivaDTO) PessoaDTO(com.tomasio.projects.trainning.dto.PessoaDTO) OrganizationalService(com.tomasio.projects.trainning.interfaces.OrganizationalService) OutputStreamWriter(java.io.OutputStreamWriter) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) BufferedWriter(java.io.BufferedWriter) Writer(java.io.Writer) OutputStreamWriter(java.io.OutputStreamWriter) AtividadesEnsinoService(com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)

Aggregations

IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)36 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)19 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)15 ArrayList (java.util.ArrayList)13 OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)12 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)11 AtividadesEnsinoService (com.tomasio.projects.trainning.interfaces.AtividadesEnsinoService)11 OrganizationalService (com.tomasio.projects.trainning.interfaces.OrganizationalService)11 SimpleDateFormat (java.text.SimpleDateFormat)10 TurmaDTO (com.tomasio.projects.trainning.dto.TurmaDTO)8 Date (java.util.Date)7 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)6 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)6 IndicacaoInstrutorDTO (com.tomasio.projects.trainning.dto.IndicacaoInstrutorDTO)6 BufferedWriter (java.io.BufferedWriter)5 IOException (java.io.IOException)5 OutputStreamWriter (java.io.OutputStreamWriter)5 Writer (java.io.Writer)5 ParseException (java.text.ParseException)5 HashMap (java.util.HashMap)5