Search in sources :

Example 36 with IndicacaoDTO

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

the class EXC004CSV 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.newLine();
        } catch (IOException ex) {
            Logger.getLogger(EXC004CSV.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    try {
        bufferedWriter.flush();
        bufferedWriter.close();
    } catch (IOException ex) {
        Logger.getLogger(EXC004CSV.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)

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