use of com.tomasio.projects.trainning.reports.DOC001PDF in project trainning by fernandotomasio.
the class CurriculosMinimosController method savePublicacao.
public void savePublicacao(PublicacaoCMForm form) {
CurriculoMinimoDTO curriculo = teachingDocumentsService.findCurriculoMinimo(form.getCurriculoMinimoId());
curriculo.setNumeroBCACM(form.getNumeroBCA());
Calendar dataBCA = Calendar.getInstance();
dataBCA.setTime(form.getDataBCA());
curriculo.setDataBCACM(dataBCA);
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()));
DOC001PDF report = new DOC001PDF(params, services);
DocumentDTO document = new DocumentDTO();
document.setContentStream(report.build());
document.setTitle("Currículo Mínimo do Curso " + curriculo.getCurso().getCodigo());
document.setName(curriculo.getCurso().getCodigo() + "-" + df.format(curriculo.getDataBCACM().getTime()) + ".pdf");
document.setMimeType("application/pdf");
String documentUID = ecmService.createDocumentWithUUIDParent(document, "cc325a72-77d9-4737-964d-e65e0eb0c32a");
if (documentUID != null) {
curriculo.setCurriculoMinimoDocumentUID(documentUID);
teachingDocumentsService.updateCurriculoMinimo(curriculo);
}
}
Aggregations