From 8611e8521a711ea3b70e2ff5f7a7ec94c1f41461 Mon Sep 17 00:00:00 2001 From: Giuseppe Baittiner Date: Thu, 14 Sep 2023 15:46:51 +0200 Subject: [PATCH] feat(strategy): add new props support --- .../scheduler/executors/base/ExecutorEDS.java | 4 ++-- .../ms/gtw/rulesmanager/service/IConfigSRV.java | 4 ++++ .../gtw/rulesmanager/service/impl/ConfigSRV.java | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/scheduler/executors/base/ExecutorEDS.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/scheduler/executors/base/ExecutorEDS.java index 8da7f68..dd4caef 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/scheduler/executors/base/ExecutorEDS.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/scheduler/executors/base/ExecutorEDS.java @@ -137,14 +137,14 @@ protected ActionRes startup(String[] steps) { // === LISTENERS === protected OnStepListener onStepFailure(Date timestamp) { return (name, status) -> { - if (bridge.getConfig().isNoFhirEds() && status == ActionRes.KO) { + if (bridge.getConfig().areLogsEnabled() && status == ActionRes.KO) { bridge.getLogger().error(LOG_TYPE_CONTROL, "Error while updating GTW configuration items", config.getTitle() + " - " + name, ResultLogEnum.KO, timestamp); } }; } protected OnPlanListener onPlanSuccess(Date timestamp) { return (status) -> { - if (bridge.getConfig().isNoFhirEds() && status == ActionRes.OK) { + if (bridge.getConfig().areLogsEnabled() && status == ActionRes.OK) { bridge.getLogger().info(LOG_TYPE_CONTROL, "Successfully updated configuration items", "Update" + " - " + config.getTitle(), ResultLogEnum.OK, timestamp); } }; diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/IConfigSRV.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/IConfigSRV.java index cf4062e..1d48bcd 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/IConfigSRV.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/IConfigSRV.java @@ -7,4 +7,8 @@ public interface IConfigSRV { boolean isNoEds(); boolean isNoFhirEds(); + + boolean isNoEdsWithLogs(); + + boolean areLogsEnabled(); } diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/impl/ConfigSRV.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/impl/ConfigSRV.java index 08c5264..5ea0b01 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/impl/ConfigSRV.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/rulesmanager/service/impl/ConfigSRV.java @@ -57,10 +57,25 @@ public boolean isNoFhirEds() { return StringUtils.isNotBlank(out) && EdsStrategyEnum.NO_FHIR_EDS.name().equalsIgnoreCase(out); } + @Override + public boolean isNoEdsWithLogs() { + // Trigger refresh if necessary + String out = getEdsStrategy(); + // Evaluate + return StringUtils.isNotBlank(out) && EdsStrategyEnum.NO_EDS_WITH_LOG.name().equalsIgnoreCase(out); + } + + @Override + public boolean areLogsEnabled() { + return isNoEdsWithLogs() || isNoFhirEds(); + } + //Se la strategy รจ null si setta come default no_eds (quindi non verranno emesse loggate) @Override public boolean isNoEds() { + // Trigger refresh if necessary String out = getEdsStrategy(); + // Evaluate return StringUtils.isBlank(out) || EdsStrategyEnum.NO_EDS.name().equalsIgnoreCase(out); } }