use of com.tomasio.projects.trainning.reports.DOC002PDF in project trainning by fernandotomasio.
the class PudsController method savePublicacao.
public void savePublicacao(PublicacaoPUDForm form) {
CurriculoMinimoDTO curriculo = teachingDocumentsService.findCurriculoMinimo(form.getCurriculoMinimoId());
curriculo.setNumeroBoletimPUD(form.getNumeroBoletim());
Calendar dataBoletim = Calendar.getInstance();
curriculo.setDataBoletimPUD(dataBoletim);
SimpleDateFormat df = new SimpleDateFormat("ddMMyy");
Map services = new HashMap<>();
services.put("teachingDocumentsService", teachingDocumentsService);
services.put("ecmService", ecmService);
Map params = new HashMap<>();
params.put("curriculoMinimoId", String.valueOf(curriculo.getId()));
DOC002PDF report = new DOC002PDF(params, services);
DocumentDTO document = new DocumentDTO();
document.setContentStream(report.build());
document.setTitle("PUD do Curso " + curriculo.getCurso().getCodigo());
document.setName(curriculo.getCurso().getCodigo() + "-" + df.format(curriculo.getDataBoletimPUD().getTime()) + ".pdf");
document.setMimeType("application/pdf");
String documentUID = ecmService.createDocumentWithUUIDParent(document, "045c40a2-f22e-4c96-9a30-0de7909ef736");
if (documentUID != null) {
curriculo.setPudDocumentUID(documentUID);
teachingDocumentsService.updateCurriculoMinimo(curriculo);
}
}
Aggregations