Search in sources :

Example 1 with DOC001PDF

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);
    }
}
Also used : HashMap(java.util.HashMap) Calendar(java.util.Calendar) DocumentDTO(com.tomasio.projects.trainning.dto.DocumentDTO) DOC001PDF(com.tomasio.projects.trainning.reports.DOC001PDF) CurriculoMinimoDTO(com.tomasio.projects.trainning.dto.CurriculoMinimoDTO) SimpleDateFormat(java.text.SimpleDateFormat) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

CurriculoMinimoDTO (com.tomasio.projects.trainning.dto.CurriculoMinimoDTO)1 DocumentDTO (com.tomasio.projects.trainning.dto.DocumentDTO)1 DOC001PDF (com.tomasio.projects.trainning.reports.DOC001PDF)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Calendar (java.util.Calendar)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1