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);
}
}
Aggregations