use of de.symeda.sormas.api.docgeneneration.DocumentWorkflow in project SORMAS-Project by hzi-braunschweig.
the class QuarantineOrderFacadeEjbTest method testBulkContactDocumentCreation.
@Test
public void testBulkContactDocumentCreation() throws DocumentTemplateException, IOException {
ReferenceDto rootEntityReference = contactDto.toReference();
Properties properties = new Properties();
properties.setProperty("extraremark1", "the first remark");
properties.setProperty("extra.remark.no3", "the third remark");
DocumentWorkflow workflow = DocumentWorkflow.QUARANTINE_ORDER_CONTACT;
Map<ReferenceDto, byte[]> documentContents = quarantineOrderFacadeEjb.getGeneratedDocuments("Quarantine.docx", workflow, Collections.singletonList(rootEntityReference), properties, false);
verifyGeneratedDocument(rootEntityReference, workflow, "QuarantineContact.cmp", documentContents.get(rootEntityReference));
}
use of de.symeda.sormas.api.docgeneneration.DocumentWorkflow in project SORMAS-Project by hzi-braunschweig.
the class QuarantineOrderFacadeEjbTest method testBulkCaseDocumentCreation.
@Test
public void testBulkCaseDocumentCreation() throws DocumentTemplateException, IOException {
ReferenceDto rootEntityReference = caseDataDto.toReference();
Properties properties = new Properties();
properties.setProperty("extraremark1", "the first remark");
properties.setProperty("extra.remark.no3", "the third remark");
DocumentWorkflow workflow = DocumentWorkflow.QUARANTINE_ORDER_CASE;
Map<ReferenceDto, byte[]> documentContents = quarantineOrderFacadeEjb.getGeneratedDocuments("Quarantine.docx", workflow, Collections.singletonList(rootEntityReference), properties, false);
verifyGeneratedDocument(rootEntityReference, workflow, "QuarantineCase.cmp", documentContents.get(rootEntityReference));
}
use of de.symeda.sormas.api.docgeneneration.DocumentWorkflow in project SORMAS-Project by hzi-braunschweig.
the class DocumentTemplateFacadeEjb method getDocumentVariables.
@Override
public DocumentVariables getDocumentVariables(DocumentWorkflow documentWorkflow, String templateName) throws DocumentTemplateException {
File templateFile = getTemplateFile(documentWorkflow, templateName);
DocumentVariables documentVariables = documentWorkflow.isDocx() ? getTemplateVariablesDocx(templateFile) : getTemplateVariablesTxt(templateFile);
Set<String> propertyKeys = documentVariables.getVariables();
documentVariables.setAdditionalVariables(propertyKeys.stream().filter(e -> !isEntityVariable(documentWorkflow, e)).sorted(String::compareTo).collect(Collectors.toList()));
propertyKeys.stream().filter(e -> isEntityVariable(documentWorkflow, e)).forEach(e -> documentVariables.addUsedEntity(getVariableBaseName(e)));
return documentVariables;
}
use of de.symeda.sormas.api.docgeneneration.DocumentWorkflow in project SORMAS-Project by hzi-braunschweig.
the class QuarantineOrderFacadeEjbTest method testBulkEventParticipantDocumentCreation.
@Test
public void testBulkEventParticipantDocumentCreation() throws DocumentTemplateException, IOException {
EventParticipantReferenceDto rootEntityReference = eventParticipantDto.toReference();
Properties properties = new Properties();
properties.setProperty("extraremark1", "the first remark");
properties.setProperty("extra.remark.no3", "the third remark");
DocumentWorkflow workflow = DocumentWorkflow.QUARANTINE_ORDER_EVENT_PARTICIPANT;
Map<ReferenceDto, byte[]> documentContents = quarantineOrderFacadeEjb.getGeneratedDocumentsForEventParticipants("Quarantine.docx", Collections.singletonList(rootEntityReference), eventDto.getDisease(), properties, false);
verifyGeneratedDocument(rootEntityReference, workflow, "QuarantineEvent.cmp", documentContents.get(rootEntityReference));
}
Aggregations