Skip to content

Commit 301c6f3

Browse files
reverting general workflow
1 parent 9d5a09f commit 301c6f3

File tree

3 files changed

+5
-47
lines changed

3 files changed

+5
-47
lines changed

sormas-api/src/main/java/de/symeda/sormas/api/docgeneneration/DocumentWorkflow.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import static de.symeda.sormas.api.docgeneneration.RootEntityType.ROOT_EVENT_ACTIONS;
2222
import static de.symeda.sormas.api.docgeneneration.RootEntityType.ROOT_EVENT_PARTICIPANT;
2323
import static de.symeda.sormas.api.docgeneneration.RootEntityType.ROOT_EVENT_PARTICIPANTS;
24-
import static de.symeda.sormas.api.docgeneneration.RootEntityType.ROOT_GENERAL;
2524
import static de.symeda.sormas.api.docgeneneration.RootEntityType.ROOT_PATHOGEN_TEST;
2625
import static de.symeda.sormas.api.docgeneneration.RootEntityType.ROOT_PERSON;
2726
import static de.symeda.sormas.api.docgeneneration.RootEntityType.ROOT_SAMPLE;
@@ -55,8 +54,7 @@ public enum DocumentWorkflow {
5554
ROOT_USER,
5655
ROOT_SAMPLE,
5756
ROOT_PATHOGEN_TEST,
58-
ROOT_VACCINATION,
59-
ROOT_GENERAL),
57+
ROOT_VACCINATION),
6058
QUARANTINE_ORDER_CONTACT(DocumentWorkflowType.DOCUMENT,
6159
"quarantineContact",
6260
DOCX,
@@ -66,8 +64,7 @@ public enum DocumentWorkflow {
6664
ROOT_USER,
6765
ROOT_SAMPLE,
6866
ROOT_PATHOGEN_TEST,
69-
ROOT_VACCINATION,
70-
ROOT_GENERAL),
67+
ROOT_VACCINATION),
7168
QUARANTINE_ORDER_EVENT_PARTICIPANT(DocumentWorkflowType.DOCUMENT,
7269
"quarantineEventParticipant",
7370
DOCX,
@@ -77,16 +74,14 @@ public enum DocumentWorkflow {
7774
ROOT_USER,
7875
ROOT_SAMPLE,
7976
ROOT_PATHOGEN_TEST,
80-
ROOT_VACCINATION,
81-
ROOT_GENERAL),
77+
ROOT_VACCINATION),
8278
QUARANTINE_ORDER_TRAVEL_ENTRY(DocumentWorkflowType.DOCUMENT,
8379
"quarantineTravelEntry",
8480
DOCX,
8581
UserRight.DOCUMENT_TEMPLATE_MANAGEMENT,
8682
ROOT_TRAVEL_ENTRY,
8783
ROOT_PERSON,
88-
ROOT_USER,
89-
ROOT_GENERAL),
84+
ROOT_USER),
9085
EVENT_HANDOUT(DocumentWorkflowType.DOCUMENT,
9186
"eventHandout",
9287
HTML,

sormas-api/src/main/java/de/symeda/sormas/api/docgeneneration/RootEntityType.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ public enum RootEntityType {
2828
ROOT_EVENT_ACTIONS("eventActions"),
2929
ROOT_EVENT_PARTICIPANTS("eventParticipants"),
3030
ROOT_TRAVEL_ENTRY("travelEntry"),
31-
ROOT_VACCINATION("vaccination"),
32-
ROOT_GENERAL("general");
31+
ROOT_VACCINATION("vaccination");
3332

3433
private final String entityName;
3534

sormas-backend/src/main/java/de/symeda/sormas/backend/docgeneration/DocumentTemplateFacadeEjb.java

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
import java.io.File;
2020
import java.io.IOException;
2121
import java.nio.charset.StandardCharsets;
22-
import java.time.LocalDate;
23-
import java.time.format.DateTimeFormatter;
24-
import java.time.format.FormatStyle;
2522
import java.util.List;
26-
import java.util.Optional;
2723
import java.util.Properties;
2824
import java.util.Set;
2925
import java.util.regex.Matcher;
@@ -233,11 +229,6 @@ private Properties prepareProperties(
233229
continue;
234230
}
235231

236-
// check if the entity is from a general.
237-
if (rootEntityType == RootEntityType.ROOT_GENERAL) {
238-
fillGeneralValues(documentVariables, properties, propertyKey);
239-
}
240-
241232
Object entity = entities.getEntity(rootEntityType);
242233
if (entity instanceof HasUuid) {
243234
if (documentWorkflow.isDocx() || propertyKey.contains(propertySeparator)) {
@@ -293,33 +284,6 @@ private Properties prepareProperties(
293284
return properties;
294285
}
295286

296-
private void fillGeneralValues(DocumentVariables documentVariables, Properties properties, String propertyKey) {
297-
// finding the general property key. Based on the type, formatStyle is deciding.
298-
// general properties are allowed only doc-formatted files.
299-
Optional<String> generalPropertyOpt = documentVariables.getVariables()
300-
.stream()
301-
.filter(e -> e.startsWith(RootEntityType.ROOT_GENERAL.getEntityName() + "."))
302-
.filter(e -> e.equals(propertyKey))
303-
.findAny();
304-
305-
if (generalPropertyOpt.isPresent()) {
306-
String generalProperty = generalPropertyOpt.get();
307-
String dateType = generalProperty.substring(generalProperty.lastIndexOf('.') + 1);
308-
FormatStyle formatStyle;
309-
switch (dateType) {
310-
case "medium":
311-
formatStyle = FormatStyle.MEDIUM;
312-
break;
313-
case "short":
314-
default:
315-
formatStyle = FormatStyle.SHORT;
316-
}
317-
String propertyValue =
318-
LocalDate.now().format(DateTimeFormatter.ofLocalizedDate(formatStyle).withLocale(I18nProperties.getUserLanguage().getLocale()));
319-
properties.setProperty(generalProperty, propertyValue);
320-
}
321-
}
322-
323287
private byte[] generateDocumentDocx(File templateFile, Properties properties) throws DocumentTemplateException {
324288
return templateEngine.generateDocumentDocx(properties, templateFile);
325289
}

0 commit comments

Comments
 (0)