From 41560d09f3b7dc6c9814699a626da7bade973538 Mon Sep 17 00:00:00 2001 From: Giuseppe Baittiner Date: Thu, 16 Mar 2023 12:30:17 +0100 Subject: [PATCH] feat(ts): Add system support --- .../ms/gtw/rulesmanager/dto/eds/data/SchematronDTO.java | 2 ++ .../gtw/rulesmanager/repository/entity/SchematronETY.java | 5 ++++- .../scheduler/entity/impl/SchematronQuery.java | 8 +++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/dto/eds/data/SchematronDTO.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/dto/eds/data/SchematronDTO.java index 72f7d39..7b786d7 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/dto/eds/data/SchematronDTO.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/dto/eds/data/SchematronDTO.java @@ -34,6 +34,8 @@ public static class Schematron { @JsonProperty private String version; @JsonProperty + private String system; + @JsonProperty private String templateIdRoot; @JsonProperty private Date lastUpdateDate; diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/repository/entity/SchematronETY.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/repository/entity/SchematronETY.java index 55c66c6..243accd 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/repository/entity/SchematronETY.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/repository/entity/SchematronETY.java @@ -24,7 +24,8 @@ public class SchematronETY { public static final String FIELD_FILENAME = "name_schematron"; public static final String FIELD_CONTENT = "content_schematron"; public static final String FIELD_VERSION = "version"; - public static final String FIELD_ROOT = "template_id_root"; + public static final String FIELD_SYSTEM = "system"; + public static final String FIELD_ROOT = "template_id_root"; public static final String FIELD_LAST_UPDATE = "last_update_date"; public static final String FIELD_LAST_SYNC = "last_sync"; public static final String FIELD_DELETED = "deleted"; @@ -39,6 +40,8 @@ public class SchematronETY { private String templateIdRoot; @Field(name = FIELD_VERSION) private String version; + @Field(name = FIELD_SYSTEM) + private String system; @Field(name = FIELD_LAST_UPDATE) private Date lastUpdateDate; @Field(name = FIELD_LAST_SYNC) diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/scheduler/entity/impl/SchematronQuery.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/scheduler/entity/impl/SchematronQuery.java index c2f3ac3..c8bac0c 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/scheduler/entity/impl/SchematronQuery.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/scheduler/entity/impl/SchematronQuery.java @@ -26,14 +26,19 @@ public Document getUpsertQuery(SchematronDTO dto) { // Get data SchematronDTO.Schematron schematron = dto.getDocument(); // Create - return new org.bson.Document() + Document doc = new Document() .append(FIELD_ID, new ObjectId(schematron.getId())) .append(FIELD_FILENAME, schematron.getName()) .append(FIELD_CONTENT, new Binary(StringUtility.decodeBase64(schematron.getContent()))) .append(FIELD_VERSION, schematron.getVersion()) + .append(FIELD_SYSTEM, schematron.getSystem()) .append(FIELD_ROOT, schematron.getTemplateIdRoot()) .append(FIELD_LAST_UPDATE, schematron.getLastUpdateDate()) .append(FIELD_DELETED, false); + + if(schematron.getSystem() == null) doc.remove(FIELD_SYSTEM); + + return doc; } /** @@ -72,6 +77,7 @@ public Document getComparatorQuery(Document doc) { .append(FIELD_CONTENT, doc.get(FIELD_CONTENT, Binary.class)) .append(FIELD_VERSION, doc.getString(FIELD_VERSION)) .append(FIELD_ROOT, doc.getString(FIELD_ROOT)) + .append(FIELD_SYSTEM, doc.getString(FIELD_SYSTEM)) .append(FIELD_LAST_UPDATE, doc.getDate(FIELD_LAST_UPDATE)) .append(FIELD_LAST_SYNC, doc.getDate(FIELD_LAST_SYNC)) .append(FIELD_DELETED, doc.getBoolean(FIELD_DELETED));