From 71255cee7c997dfeeffbc19cde5f6b65d60dcccc Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Mon, 25 Mar 2024 16:12:44 +0100 Subject: [PATCH 01/28] feat: add full baseProfile system The full baseProfile system is now useable. Sending any message of any type to the new configuration will return a version of Profile.json, as an XML, which has the baseProfile values added to every profile. It does not overwrite existing values or break the structure. --- .../Translate/Common/xsl/AddBaseProfile2.xsl | 56 +++++++++++++++++++ .../Translate/Common/xsl/AddPathAttribute.xsl | 38 +++++++++++++ .../Common/xsl/ExtractBaseProfile.xsl | 8 +++ .../Common/xsl/RemovePathAttribute.xsl | 16 ++++++ .../Translate/Common/xsl/RemoveResultTags.xsl | 12 ++++ .../Translate/Configuration.xml | 2 + .../Configuration_ResolveProfileValues.xml | 55 ++++++++++++++++++ 7 files changed, 187 insertions(+) create mode 100644 src/main/configurations/Translate/Common/xsl/AddBaseProfile2.xsl create mode 100644 src/main/configurations/Translate/Common/xsl/AddPathAttribute.xsl create mode 100644 src/main/configurations/Translate/Common/xsl/ExtractBaseProfile.xsl create mode 100644 src/main/configurations/Translate/Common/xsl/RemovePathAttribute.xsl create mode 100644 src/main/configurations/Translate/Common/xsl/RemoveResultTags.xsl create mode 100644 src/main/configurations/Translate/Configuration_ResolveProfileValues.xml diff --git a/src/main/configurations/Translate/Common/xsl/AddBaseProfile2.xsl b/src/main/configurations/Translate/Common/xsl/AddBaseProfile2.xsl new file mode 100644 index 000000000..ff1aa8ce9 --- /dev/null +++ b/src/main/configurations/Translate/Common/xsl/AddBaseProfile2.xsl @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/configurations/Translate/Common/xsl/AddPathAttribute.xsl b/src/main/configurations/Translate/Common/xsl/AddPathAttribute.xsl new file mode 100644 index 000000000..4fc5896cb --- /dev/null +++ b/src/main/configurations/Translate/Common/xsl/AddPathAttribute.xsl @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/configurations/Translate/Common/xsl/ExtractBaseProfile.xsl b/src/main/configurations/Translate/Common/xsl/ExtractBaseProfile.xsl new file mode 100644 index 000000000..d1306612a --- /dev/null +++ b/src/main/configurations/Translate/Common/xsl/ExtractBaseProfile.xsl @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/main/configurations/Translate/Common/xsl/RemovePathAttribute.xsl b/src/main/configurations/Translate/Common/xsl/RemovePathAttribute.xsl new file mode 100644 index 000000000..09e6bb1fe --- /dev/null +++ b/src/main/configurations/Translate/Common/xsl/RemovePathAttribute.xsl @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/src/main/configurations/Translate/Common/xsl/RemoveResultTags.xsl b/src/main/configurations/Translate/Common/xsl/RemoveResultTags.xsl new file mode 100644 index 000000000..72fd69792 --- /dev/null +++ b/src/main/configurations/Translate/Common/xsl/RemoveResultTags.xsl @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/configurations/Translate/Configuration.xml b/src/main/configurations/Translate/Configuration.xml index c1d482baf..544e2d58c 100644 --- a/src/main/configurations/Translate/Configuration.xml +++ b/src/main/configurations/Translate/Configuration.xml @@ -54,6 +54,7 @@ + @@ -126,6 +127,7 @@ &PostZaak; &PostZgwLock; &PutZgwZaakDocument; + &ResolveProfileValues; &SetResultaatAndStatus; &SoapEndpointRouter_BeantwoordVraag; &SoapEndpointRouter_BeantwoordVraag_v2; diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml new file mode 100644 index 000000000..29c8d53ed --- /dev/null +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From eb66d8d0b70a82128ed3d724068cd9d1f809c652 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Tue, 26 Mar 2024 15:23:46 +0100 Subject: [PATCH 02/28] feat: add cache --- .../Translate/Configuration_ResolveProfileValues.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index 29c8d53ed..257079c17 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -13,7 +13,8 @@ - + + From d0ae3997261e1b01685586503b1c4df502a3eb81 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Tue, 26 Mar 2024 15:24:46 +0100 Subject: [PATCH 03/28] refactor: add baseProfile with example values Adds baseProfile with some example elements. Can be changed where necessary. --- src/main/configurations/Translate/Profiles.json | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/configurations/Translate/Profiles.json b/src/main/configurations/Translate/Profiles.json index 35b9093f5..536dbb25e 100644 --- a/src/main/configurations/Translate/Profiles.json +++ b/src/main/configurations/Translate/Profiles.json @@ -1,11 +1,14 @@ { "profile": [ { - "zaakTypeIdentificatie": "B9999", + "zaakTypeIdentificatie": "*", "endCaseEndDate": { - "coalesceResultaat":"Onbekend" - }, - + "coalesceResultaat":"TestDefaultValue", + "testval":"tval" + } + }, + { + "zaakTypeIdentificatie": "B9999", "endDateAndResultLastStatus": { "coalesceResultaat": "Onbekend" } From f5748e2c2dcac84b9b42d4297b344b3ea57bc802 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Tue, 26 Mar 2024 15:26:08 +0100 Subject: [PATCH 04/28] refactor: rename xslt file --- .../Common/xsl/{AddBaseProfile2.xsl => AddBaseProfile.xsl} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/configurations/Translate/Common/xsl/{AddBaseProfile2.xsl => AddBaseProfile.xsl} (100%) diff --git a/src/main/configurations/Translate/Common/xsl/AddBaseProfile2.xsl b/src/main/configurations/Translate/Common/xsl/AddBaseProfile.xsl similarity index 100% rename from src/main/configurations/Translate/Common/xsl/AddBaseProfile2.xsl rename to src/main/configurations/Translate/Common/xsl/AddBaseProfile.xsl From 0895f3374c6312db68cc42273956c813fc26963a Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Tue, 26 Mar 2024 15:26:22 +0100 Subject: [PATCH 05/28] refactor: add active property --- src/main/configurations/Translate/DeploymentSpecifics.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/configurations/Translate/DeploymentSpecifics.properties b/src/main/configurations/Translate/DeploymentSpecifics.properties index 2b6b2599b..5b796ce86 100644 --- a/src/main/configurations/Translate/DeploymentSpecifics.properties +++ b/src/main/configurations/Translate/DeploymentSpecifics.properties @@ -63,6 +63,7 @@ Zaken_PostZgwStatus.Active=true PostZaakAdapter.Active=true PostZgwLock.Active=true PutZgwZaakDocument.Active=true +ResolveProfileValues.Active=true SetResultaatAndStatus.Active=true SoapEndpointRouter_BeantwoordVraag.Active=true SoapEndpointRouter_BeantwoordVraag_v2.Active=false From de4e4b629ab9e4f2a458938f697c23f65e41f602 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Wed, 27 Mar 2024 12:10:01 +0100 Subject: [PATCH 06/28] fix: incorrect styleSheetName attribute --- .../Translate/Configuration_ResolveProfileValues.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index 257079c17..9f68540d5 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -43,7 +43,7 @@ - From 1e5df315d3651291e27f15d1954bd94b3baee919 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Wed, 27 Mar 2024 15:30:16 +0100 Subject: [PATCH 07/28] refactor: add baseProfile check --- .../Translate/Configuration_ResolveProfileValues.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index 9f68540d5..b74654e84 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -21,7 +21,7 @@ - + @@ -41,6 +41,12 @@ omitXmlDeclaration="true" storeResultInSessionKey="baseProfile" outputType="XML"> + + + + + + Date: Fri, 29 Mar 2024 15:13:44 +0100 Subject: [PATCH 08/28] refactor: add error handling --- .../Configuration_ResolveProfileValues.xml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index b74654e84..650f3439f 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -41,12 +41,24 @@ omitXmlDeclaration="true" storeResultInSessionKey="baseProfile" outputType="XML"> - - + + + + + + + + + + + + + + Date: Fri, 29 Mar 2024 15:14:03 +0100 Subject: [PATCH 09/28] refactor: remove unnecessary check --- .../Translate/Configuration_ResolveProfileValues.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index 650f3439f..5aba05ed0 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -17,14 +17,8 @@ - - - - - - Date: Fri, 29 Mar 2024 15:18:29 +0100 Subject: [PATCH 10/28] refactor: remove excess param --- .../Translate/Configuration_ResolveProfileValues.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index 5aba05ed0..06e0fd5ad 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -25,7 +25,6 @@ getInputFromSessionKey="profiles" targetElement="profile"> - From 88fc6ebc3eda64165883d379055f5e568b1c8a14 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Fri, 29 Mar 2024 15:18:45 +0100 Subject: [PATCH 11/28] style: formatting --- .../Configuration_ResolveProfileValues.xml | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index 06e0fd5ad..632430f85 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -13,13 +13,13 @@ - + - + @@ -28,7 +28,8 @@ - + @@ -36,7 +37,7 @@ - + @@ -45,10 +46,11 @@ - + - + @@ -59,9 +61,9 @@ - - - + + + \ No newline at end of file From 939a97cb084f9d6ed30ae658ea482e8399495c70 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Fri, 29 Mar 2024 15:21:29 +0100 Subject: [PATCH 12/28] refactor: redo profiles structure --- .../configurations/Translate/Profiles.json | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/main/configurations/Translate/Profiles.json b/src/main/configurations/Translate/Profiles.json index 5750053fd..62705fb86 100644 --- a/src/main/configurations/Translate/Profiles.json +++ b/src/main/configurations/Translate/Profiles.json @@ -1,23 +1,40 @@ { - "profile": [ - { - "zaakTypeIdentificatie": "*", - "endCaseEndDate": { - "coalesceResultaat": "Onbekend", - "testval": "testvalue" - } + "profileDefaults": { + "endCaseEndDate": { + "coalesceResultaat": "Onbekend", + "testval": "testvalue" }, + "valueOverrides": [ + { + "key": "zgw.zaken-api.zaken.zaak.toelichting", + "value": "toelichtingBase" + } + ] + }, + "profile": [ { "zaakTypeIdentificatie": "B9999", "endDateAndResultLastStatus": { "coalesceResultaat": "Onbekend" - } + }, + "valueOverrides": [ + { + "key": "zgw.zaken-api.zaken.zaak.communicatiekanaal", + "value": "http://example.com" + } + ] }, { "zaakTypeIdentificatie": "B1026", "endCaseEndDate": { "coalesceResultaat": "Toegekend" - } + }, + "valueOverrides": [ + { + "key": "zgw.zaken-api.zaken.zaak.toelichting", + "value": "toelichting" + } + ] } ] } \ No newline at end of file From 1003d711ffa6ae2e0b3ef3fa20463407b67942b8 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Tue, 2 Apr 2024 09:32:32 +0200 Subject: [PATCH 13/28] feat: add compatibility for new profiles structure --- .../Common/xsl/RenameProfileElement.xsl | 15 ++++++++++++ .../Common/xsl/ResetProfileElementName.xsl | 15 ++++++++++++ .../Configuration_ResolveProfileValues.xml | 23 +++++++++++-------- 3 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 src/main/configurations/Translate/Common/xsl/RenameProfileElement.xsl create mode 100644 src/main/configurations/Translate/Common/xsl/ResetProfileElementName.xsl diff --git a/src/main/configurations/Translate/Common/xsl/RenameProfileElement.xsl b/src/main/configurations/Translate/Common/xsl/RenameProfileElement.xsl new file mode 100644 index 000000000..e666eea8a --- /dev/null +++ b/src/main/configurations/Translate/Common/xsl/RenameProfileElement.xsl @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/main/configurations/Translate/Common/xsl/ResetProfileElementName.xsl b/src/main/configurations/Translate/Common/xsl/ResetProfileElementName.xsl new file mode 100644 index 000000000..8f9559a51 --- /dev/null +++ b/src/main/configurations/Translate/Common/xsl/ResetProfileElementName.xsl @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index 632430f85..d8fb95382 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -19,10 +19,12 @@ - + + + + getInputFromSessionKey="profiles"> @@ -31,12 +33,12 @@ - - - + + getInputFromSessionKey="profiles"> @@ -64,6 +66,7 @@ + \ No newline at end of file From a26f2245caca8ff30cf2ec29e2d32413e4184064 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Tue, 2 Apr 2024 11:47:19 +0200 Subject: [PATCH 14/28] style: align formatting with other configurations --- .../Configuration_ResolveProfileValues.xml | 52 +++++++++++++------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index d8fb95382..d1a790477 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -15,26 +15,43 @@ + - + - + - - + + - + - + - - + + - + \ No newline at end of file From 42ffd0391fa97c06c6f1d26f723a27cc26742fe7 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Tue, 2 Apr 2024 13:47:12 +0200 Subject: [PATCH 15/28] refactor: relocate XSL files --- .../{Common/xsl => BaseProfile}/AddBaseProfile.xsl | 0 .../xsl => BaseProfile}/AddPathAttribute.xsl | 0 .../xsl => BaseProfile}/RemovePathAttribute.xsl | 0 .../xsl => BaseProfile}/RemoveResultTags.xsl | 0 .../xsl => BaseProfile}/RenameProfileElement.xsl | 0 .../ResetProfileElementName.xsl | 0 .../Configuration_ResolveProfileValues.xml | 14 +++++++------- 7 files changed, 7 insertions(+), 7 deletions(-) rename src/main/configurations/Translate/{Common/xsl => BaseProfile}/AddBaseProfile.xsl (100%) rename src/main/configurations/Translate/{Common/xsl => BaseProfile}/AddPathAttribute.xsl (100%) rename src/main/configurations/Translate/{Common/xsl => BaseProfile}/RemovePathAttribute.xsl (100%) rename src/main/configurations/Translate/{Common/xsl => BaseProfile}/RemoveResultTags.xsl (100%) rename src/main/configurations/Translate/{Common/xsl => BaseProfile}/RenameProfileElement.xsl (100%) rename src/main/configurations/Translate/{Common/xsl => BaseProfile}/ResetProfileElementName.xsl (100%) diff --git a/src/main/configurations/Translate/Common/xsl/AddBaseProfile.xsl b/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl similarity index 100% rename from src/main/configurations/Translate/Common/xsl/AddBaseProfile.xsl rename to src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl diff --git a/src/main/configurations/Translate/Common/xsl/AddPathAttribute.xsl b/src/main/configurations/Translate/BaseProfile/AddPathAttribute.xsl similarity index 100% rename from src/main/configurations/Translate/Common/xsl/AddPathAttribute.xsl rename to src/main/configurations/Translate/BaseProfile/AddPathAttribute.xsl diff --git a/src/main/configurations/Translate/Common/xsl/RemovePathAttribute.xsl b/src/main/configurations/Translate/BaseProfile/RemovePathAttribute.xsl similarity index 100% rename from src/main/configurations/Translate/Common/xsl/RemovePathAttribute.xsl rename to src/main/configurations/Translate/BaseProfile/RemovePathAttribute.xsl diff --git a/src/main/configurations/Translate/Common/xsl/RemoveResultTags.xsl b/src/main/configurations/Translate/BaseProfile/RemoveResultTags.xsl similarity index 100% rename from src/main/configurations/Translate/Common/xsl/RemoveResultTags.xsl rename to src/main/configurations/Translate/BaseProfile/RemoveResultTags.xsl diff --git a/src/main/configurations/Translate/Common/xsl/RenameProfileElement.xsl b/src/main/configurations/Translate/BaseProfile/RenameProfileElement.xsl similarity index 100% rename from src/main/configurations/Translate/Common/xsl/RenameProfileElement.xsl rename to src/main/configurations/Translate/BaseProfile/RenameProfileElement.xsl diff --git a/src/main/configurations/Translate/Common/xsl/ResetProfileElementName.xsl b/src/main/configurations/Translate/BaseProfile/ResetProfileElementName.xsl similarity index 100% rename from src/main/configurations/Translate/Common/xsl/ResetProfileElementName.xsl rename to src/main/configurations/Translate/BaseProfile/ResetProfileElementName.xsl diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index d1a790477..4eff7606f 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -23,7 +23,7 @@ @@ -32,7 +32,7 @@ getInputFromSessionKey="profiles" > @@ -41,7 +41,7 @@ @@ -78,7 +78,7 @@ getInputFromSessionKey="profiles" > @@ -86,9 +86,9 @@ - - - + + + \ No newline at end of file From 646d399a5f26468b4c3b17307389eda6f75af910 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Tue, 2 Apr 2024 13:47:24 +0200 Subject: [PATCH 16/28] refactor: remove excess xsl --- .../Translate/Common/xsl/ExtractBaseProfile.xsl | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 src/main/configurations/Translate/Common/xsl/ExtractBaseProfile.xsl diff --git a/src/main/configurations/Translate/Common/xsl/ExtractBaseProfile.xsl b/src/main/configurations/Translate/Common/xsl/ExtractBaseProfile.xsl deleted file mode 100644 index d1306612a..000000000 --- a/src/main/configurations/Translate/Common/xsl/ExtractBaseProfile.xsl +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file From 7338c3fa830c3a993ce04d3024bf8ed6f0dc3624 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Tue, 2 Apr 2024 13:47:49 +0200 Subject: [PATCH 17/28] refactor: integrate baseProfile into Overrides configuration --- ...portValueOverridesFromTranslationProfile.xml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/configurations/Translate/Configuration_ImportValueOverridesFromTranslationProfile.xml b/src/main/configurations/Translate/Configuration_ImportValueOverridesFromTranslationProfile.xml index 7314971ae..75b55c794 100644 --- a/src/main/configurations/Translate/Configuration_ImportValueOverridesFromTranslationProfile.xml +++ b/src/main/configurations/Translate/Configuration_ImportValueOverridesFromTranslationProfile.xml @@ -14,26 +14,21 @@ - - - - + + + - - - - - - + + - + From d82ea542f2eddbb2b3012aaa5633a6d9432d859c Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Thu, 4 Apr 2024 13:14:40 +0200 Subject: [PATCH 18/28] feat: add overrides array compatibility --- .../Translate/BaseProfile/AddBaseProfile.xsl | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl b/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl index ff1aa8ce9..bbeaae41e 100644 --- a/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl +++ b/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl @@ -1,4 +1,4 @@ - + @@ -44,11 +44,22 @@ - - - - - + + + + + + + + + + + + + + + + From 5a5c8d778396665eca5f0707affef3de6b247a8d Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Thu, 4 Apr 2024 14:00:40 +0200 Subject: [PATCH 19/28] refactor: restore Profiles.json to original state --- .../configurations/Translate/Profiles.json | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/main/configurations/Translate/Profiles.json b/src/main/configurations/Translate/Profiles.json index 62705fb86..404771b16 100644 --- a/src/main/configurations/Translate/Profiles.json +++ b/src/main/configurations/Translate/Profiles.json @@ -1,40 +1,19 @@ { - "profileDefaults": { - "endCaseEndDate": { - "coalesceResultaat": "Onbekend", - "testval": "testvalue" - }, - "valueOverrides": [ - { - "key": "zgw.zaken-api.zaken.zaak.toelichting", - "value": "toelichtingBase" - } - ] - }, "profile": [ { "zaakTypeIdentificatie": "B9999", - "endDateAndResultLastStatus": { + "endCaseEndDate": { "coalesceResultaat": "Onbekend" }, - "valueOverrides": [ - { - "key": "zgw.zaken-api.zaken.zaak.communicatiekanaal", - "value": "http://example.com" - } - ] + "endDateAndResultLastStatus": { + "coalesceResultaat": "Onbekend" + } }, { "zaakTypeIdentificatie": "B1026", "endCaseEndDate": { "coalesceResultaat": "Toegekend" - }, - "valueOverrides": [ - { - "key": "zgw.zaken-api.zaken.zaak.toelichting", - "value": "toelichting" - } - ] + } } ] } \ No newline at end of file From 465f910ad4d1b11df6da65605e1ae82afe61ee12 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Thu, 4 Apr 2024 14:17:16 +0200 Subject: [PATCH 20/28] refactor: add required minimum profileDefault --- src/main/configurations/Translate/Profiles.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/configurations/Translate/Profiles.json b/src/main/configurations/Translate/Profiles.json index 404771b16..eafcc90eb 100644 --- a/src/main/configurations/Translate/Profiles.json +++ b/src/main/configurations/Translate/Profiles.json @@ -1,4 +1,6 @@ { + "profileDefaults": { + }, "profile": [ { "zaakTypeIdentificatie": "B9999", From 0dc6e4348d307d81de5232b252b28532210df9e6 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Thu, 4 Apr 2024 15:00:04 +0200 Subject: [PATCH 21/28] feat: add error handling --- .../Configuration_ResolveProfileValues.xml | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index 4eff7606f..f345d3c8d 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -54,25 +54,31 @@ > - + + + + + + + - - - - - - --> + + + Date: Thu, 4 Apr 2024 15:00:25 +0200 Subject: [PATCH 22/28] docs: add comments to main XSLT --- .../Translate/BaseProfile/AddBaseProfile.xsl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl b/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl index bbeaae41e..cb10bba7f 100644 --- a/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl +++ b/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl @@ -11,6 +11,15 @@ + + @@ -42,6 +51,11 @@ + + From 06bddbe07b8fd10b577915d04c2a9fc05485e643 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Thu, 4 Apr 2024 15:00:48 +0200 Subject: [PATCH 23/28] feat: add calls to defaults system --- .../Translate/Configuration_SetResultaatAndStatus.xml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/configurations/Translate/Configuration_SetResultaatAndStatus.xml b/src/main/configurations/Translate/Configuration_SetResultaatAndStatus.xml index 634d81659..0b00b5529 100644 --- a/src/main/configurations/Translate/Configuration_SetResultaatAndStatus.xml +++ b/src/main/configurations/Translate/Configuration_SetResultaatAndStatus.xml @@ -232,10 +232,9 @@ - @@ -297,10 +296,9 @@ - From 226017f131aa724cde85188cf326145f686d88d7 Mon Sep 17 00:00:00 2001 From: DelanoWAF Date: Thu, 4 Apr 2024 15:30:09 +0200 Subject: [PATCH 24/28] fix: add missing pipe --- .../Translate/Configuration_ResolveProfileValues.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index f345d3c8d..f8c724f11 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -72,6 +72,11 @@ + + + + + From ec47f7a77c45366c3d7d1a7a96f14d023a8d511a Mon Sep 17 00:00:00 2001 From: MLenterman Date: Wed, 17 Apr 2024 08:52:42 +0200 Subject: [PATCH 25/28] refactor to javascript solution --- .../Translate/BaseProfile/AddBaseProfile.xsl | 81 ------------- .../BaseProfile/AddPathAttribute.xsl | 38 ------ .../BaseProfile/RemovePathAttribute.xsl | 16 --- .../BaseProfile/RemoveResultTags.xsl | 12 -- .../BaseProfile/RenameProfileElement.xsl | 15 --- .../BaseProfile/ResetProfileElementName.xsl | 15 --- .../Translate/Configuration.xml | 4 +- ...ApplyTranslationProfileValueOverrides.xml} | 27 +++-- .../Configuration_CreeerZaak_LK01.xml | 2 +- .../Configuration_ResolveProfileValues.xml | 108 +++++------------- .../Configuration_SetResultaatAndStatus.xml | 16 +-- .../Translate/DeploymentSpecifics.properties | 2 +- .../configurations/Translate/Profiles.json | 3 +- .../MergeProfileDefaultsWithProfiles.js | 73 ++++++++++++ 14 files changed, 130 insertions(+), 282 deletions(-) delete mode 100644 src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl delete mode 100644 src/main/configurations/Translate/BaseProfile/AddPathAttribute.xsl delete mode 100644 src/main/configurations/Translate/BaseProfile/RemovePathAttribute.xsl delete mode 100644 src/main/configurations/Translate/BaseProfile/RemoveResultTags.xsl delete mode 100644 src/main/configurations/Translate/BaseProfile/RenameProfileElement.xsl delete mode 100644 src/main/configurations/Translate/BaseProfile/ResetProfileElementName.xsl rename src/main/configurations/Translate/{Configuration_ImportValueOverridesFromTranslationProfile.xml => Configuration_ApplyTranslationProfileValueOverrides.xml} (73%) create mode 100644 src/main/resources/MergeProfileDefaultsWithProfiles.js diff --git a/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl b/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl deleted file mode 100644 index cb10bba7f..000000000 --- a/src/main/configurations/Translate/BaseProfile/AddBaseProfile.xsl +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/configurations/Translate/BaseProfile/AddPathAttribute.xsl b/src/main/configurations/Translate/BaseProfile/AddPathAttribute.xsl deleted file mode 100644 index 4fc5896cb..000000000 --- a/src/main/configurations/Translate/BaseProfile/AddPathAttribute.xsl +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/configurations/Translate/BaseProfile/RemovePathAttribute.xsl b/src/main/configurations/Translate/BaseProfile/RemovePathAttribute.xsl deleted file mode 100644 index 09e6bb1fe..000000000 --- a/src/main/configurations/Translate/BaseProfile/RemovePathAttribute.xsl +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/src/main/configurations/Translate/BaseProfile/RemoveResultTags.xsl b/src/main/configurations/Translate/BaseProfile/RemoveResultTags.xsl deleted file mode 100644 index 72fd69792..000000000 --- a/src/main/configurations/Translate/BaseProfile/RemoveResultTags.xsl +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/configurations/Translate/BaseProfile/RenameProfileElement.xsl b/src/main/configurations/Translate/BaseProfile/RenameProfileElement.xsl deleted file mode 100644 index e666eea8a..000000000 --- a/src/main/configurations/Translate/BaseProfile/RenameProfileElement.xsl +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/main/configurations/Translate/BaseProfile/ResetProfileElementName.xsl b/src/main/configurations/Translate/BaseProfile/ResetProfileElementName.xsl deleted file mode 100644 index 8f9559a51..000000000 --- a/src/main/configurations/Translate/BaseProfile/ResetProfileElementName.xsl +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/main/configurations/Translate/Configuration.xml b/src/main/configurations/Translate/Configuration.xml index a0129634f..3fbbda256 100644 --- a/src/main/configurations/Translate/Configuration.xml +++ b/src/main/configurations/Translate/Configuration.xml @@ -43,7 +43,7 @@ - + @@ -117,7 +117,7 @@ &GetZgwZaakTypeByIdentificatie; &HandleZgwZaakInformatieObjecten; &ImportFromLocalFS; - &ImportValueOverridesFromTranslationProfile; + &ApplyTranslationProfileValueOverrides; &MapZdsDeelzakenFromZgwDeelzaken; &MapZdsHeeftFromZgwStatus; &MapZdsRelevanteAndereZaakFromZgwRelevanteAndereZaken; diff --git a/src/main/configurations/Translate/Configuration_ImportValueOverridesFromTranslationProfile.xml b/src/main/configurations/Translate/Configuration_ApplyTranslationProfileValueOverrides.xml similarity index 73% rename from src/main/configurations/Translate/Configuration_ImportValueOverridesFromTranslationProfile.xml rename to src/main/configurations/Translate/Configuration_ApplyTranslationProfileValueOverrides.xml index 75b55c794..cf1e2e6bd 100644 --- a/src/main/configurations/Translate/Configuration_ImportValueOverridesFromTranslationProfile.xml +++ b/src/main/configurations/Translate/Configuration_ApplyTranslationProfileValueOverrides.xml @@ -1,11 +1,11 @@ - - - + + @@ -14,21 +14,24 @@ - - - - - + + - - + + - + diff --git a/src/main/configurations/Translate/Configuration_CreeerZaak_LK01.xml b/src/main/configurations/Translate/Configuration_CreeerZaak_LK01.xml index cd53704af..3d81bcf9f 100644 --- a/src/main/configurations/Translate/Configuration_CreeerZaak_LK01.xml +++ b/src/main/configurations/Translate/Configuration_CreeerZaak_LK01.xml @@ -164,7 +164,7 @@ > diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index f8c724f11..3ca229e28 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -4,8 +4,13 @@ active="${ResolveProfileValues.Active}" description=""> - - + + @@ -16,90 +21,35 @@ - + + + - - - - - - - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + \ No newline at end of file diff --git a/src/main/configurations/Translate/Configuration_SetResultaatAndStatus.xml b/src/main/configurations/Translate/Configuration_SetResultaatAndStatus.xml index 0b00b5529..08df41221 100644 --- a/src/main/configurations/Translate/Configuration_SetResultaatAndStatus.xml +++ b/src/main/configurations/Translate/Configuration_SetResultaatAndStatus.xml @@ -226,14 +226,14 @@ - + @@ -289,15 +289,15 @@ - + diff --git a/src/main/configurations/Translate/DeploymentSpecifics.properties b/src/main/configurations/Translate/DeploymentSpecifics.properties index aa2e1bd44..d8f5fbe9f 100644 --- a/src/main/configurations/Translate/DeploymentSpecifics.properties +++ b/src/main/configurations/Translate/DeploymentSpecifics.properties @@ -52,7 +52,7 @@ GetZgwZaakInformatieObjectByEnkelvoudigInformatieObjectUrl.Active=true GetZgwZaakTypeByIdentificatie.Active=true HandleZgwZaakInformatieObjecten.Active=true ImportFromLocalFS.Active=true -ImportValueOverridesFromTranslationProfile.Active=true +ApplyTranslationProfileValueOverrides.Active=true MapZdsDeelzakenFromZgwDeelzaken.Active=true MapZdsHeeftFromZgwStatus.Active=true MapZdsRelevanteAndereZaakFromZgwRelevanteAndereZaken.Active=true diff --git a/src/main/configurations/Translate/Profiles.json b/src/main/configurations/Translate/Profiles.json index eafcc90eb..fbd66250d 100644 --- a/src/main/configurations/Translate/Profiles.json +++ b/src/main/configurations/Translate/Profiles.json @@ -1,6 +1,5 @@ { - "profileDefaults": { - }, + "profileDefaults": {}, "profile": [ { "zaakTypeIdentificatie": "B9999", diff --git a/src/main/resources/MergeProfileDefaultsWithProfiles.js b/src/main/resources/MergeProfileDefaultsWithProfiles.js new file mode 100644 index 000000000..193f00c01 --- /dev/null +++ b/src/main/resources/MergeProfileDefaultsWithProfiles.js @@ -0,0 +1,73 @@ +// function mergeProfileDefaultsWithProfiles(profilesFile){ +// const json = JSON.parse(profilesFile); +// const profileDefaults = {"profile": json["profileDefaults"]}; +// const profiles = { "profile": json["profile"] }; + +// let result = {}; +// result["profile"] = []; +// result["profileDefaults"] = json["profileDefaults"]; +// for(const pf of profiles.profile){ +// let pfres = {}; + +// Object.keys(profileDefaults.profile) +// .forEach(key => pfres[key] = profileDefaults.profile[key]); +// Object.keys(pf) +// .forEach(key => pfres[key] = pf[key]); + +// pfres["valueOverrides"] = pf.valueOverrides +// .concat(profileDefaults.profile.valueOverrides +// .filter((value) => pf.valueOverrides +// .find((value2) => value2.key != value.key))); + +// result.profile.push(pfres); +// } + +// return JSON.stringify(result, null, 4); +// } + +// Transpiled to ES5 +"use strict"; + +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } +function mergeProfileDefaultsWithProfiles(profilesFile) { + var json = JSON.parse(profilesFile); + var profileDefaults = { + "profile": json["profileDefaults"] + }; + var profiles = { + "profile": json["profile"] + }; + var result = {}; + result["profile"] = []; + result["profileDefaults"] = json["profileDefaults"]; + var _iterator = _createForOfIteratorHelper(profiles.profile), + _step; + try { + var _loop = function _loop() { + var pf = _step.value; + var pfres = {}; + Object.keys(profileDefaults.profile).forEach(function (key) { + return pfres[key] = profileDefaults.profile[key]; + }); + Object.keys(pf).forEach(function (key) { + return pfres[key] = pf[key]; + }); + pfres["valueOverrides"] = pf.valueOverrides.concat(profileDefaults.profile.valueOverrides.filter(function (value) { + return pf.valueOverrides.find(function (value2) { + return value2.key != value.key; + }); + })); + result.profile.push(pfres); + }; + for (_iterator.s(); !(_step = _iterator.n()).done;) { + _loop(); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + return JSON.stringify(result, null, 4); +} From 3fa10344220d57287803970f592ed715b09a908d Mon Sep 17 00:00:00 2001 From: MLenterman Date: Wed, 17 Apr 2024 09:28:10 +0200 Subject: [PATCH 26/28] readme profile defaults section --- README.md | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/README.md b/README.md index b0514583c..e2fb5cab0 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,98 @@ The syntax for variable substitution is as follows {[variable-name][:formatting- ## Translation Profiles +### Profile Defaults +Profile defaults can be used to configure common translation profile settings. The settings configured in the `profileDefaults` section are applied to **all** zaaktypen. When a regular translation profile for a specific zaaktype is also configured, the settings are merged together. The more specific per zaaktype translation profile will always override any overlapping settings from the `profileDefaults` section. Items in array's like `valuesOverrides` will be combined instead, unless there is an overlapping key. Here the more specific per zaaktype translation profile will also always override any overlapping keys from the ones in the `profileDefaults` section. + +For example, the following configuration: +```json +{ + "profileDefaults": { + "endCaseEndDate": { + "coalesceResultaat": "Onbekend", + }, + "valueOverrides": [ + { + "key": "zgw.zaken-api.zaken.zaak.toelichting", + "value": "toelichting from profileDefaults" + } + ] + }, + "profile": [ + { + "zaakTypeIdentificatie": "B9999", + "endDateAndResultLastStatus": { + "coalesceResultaat": "Onbekend" + }, + "valueOverrides": [ + { + "key": "zgw.zaken-api.zaken.zaak.communicatiekanaal", + "value": "http://example.com" + } + ] + }, + { + "zaakTypeIdentificatie": "B1026", + "endCaseEndDate": { + "coalesceResultaat": "Toegekend" + }, + "valueOverrides": [ + { + "key": "zgw.zaken-api.zaken.zaak.toelichting", + "value": "toelichting from specific translation profile" + } + ] + } + ] +} +``` + +Will result in: +```json +{ + "profile": [ + { + "zaakTypeIdentificatie": "B9999", + // highlight-start + "endCaseEndDate": { + "coalesceResultaat": "Onbekend", + }, + // highlight-end + "endDateAndResultLastStatus": { + "coalesceResultaat": "Onbekend" + }, + "valueOverrides": [ + // highlight-start + { + "key": "zgw.zaken-api.zaken.zaak.toelichting", + "value": "toelichting from profileDefaults" + }, + // // highlight-end + { + "key": "zgw.zaken-api.zaken.zaak.communicatiekanaal", + "value": "http://example.com" + } + ] + }, + { + "zaakTypeIdentificatie": "B1026", + "endCaseEndDate": { + // highlight-next-line + "coalesceResultaat": "Toegekend" + }, + "valueOverrides": [ + { + "key": "zgw.zaken-api.zaken.zaak.toelichting", + // highlight-next-line + "value": "toelichting from specific translation profile" + } + ] + } + ] +} +``` + + ### Value Overrides The translations from ZDS/StUF to ZGW are made to be as neutral as possible. With value overrides it is possible to diverge from the generic translation defaults or add static properties. From 0bcdeabb0a22e974281c350e4638c9ce7987a8b2 Mon Sep 17 00:00:00 2001 From: MLenterman Date: Wed, 17 Apr 2024 10:40:32 +0200 Subject: [PATCH 27/28] fix error when elements not present in profiles.json --- .../MergeProfileDefaultsWithProfiles-orig.js | 35 +++++++++++++++++ .../MergeProfileDefaultsWithProfiles.js | 38 +++++-------------- 2 files changed, 44 insertions(+), 29 deletions(-) create mode 100644 src/main/resources/MergeProfileDefaultsWithProfiles-orig.js diff --git a/src/main/resources/MergeProfileDefaultsWithProfiles-orig.js b/src/main/resources/MergeProfileDefaultsWithProfiles-orig.js new file mode 100644 index 000000000..31f5dc1b6 --- /dev/null +++ b/src/main/resources/MergeProfileDefaultsWithProfiles-orig.js @@ -0,0 +1,35 @@ +function mergeProfileDefaultsWithProfiles(profilesFile){ + const json = JSON.parse(profilesFile); + const profileDefaults = {"profile": json["profileDefaults"]}; + const profiles = { "profile": json["profile"] }; + + let result = {}; + result["profile"] = []; + result["profileDefaults"] = json["profileDefaults"]; + + if(json["profileDefaults"] == null || json["profile"] == null){ + return profilesFiles; + } + + for(const pf of profiles.profile){ + let pfres = {}; + Object.keys(profileDefaults.profile) + .forEach(key => pfres[key] = profileDefaults.profile[key]); + Object.keys(pf) + .forEach(key => pfres[key] = pf[key]); + + if(pf["valueOverrides"] == null){ + result.profile.push(pfres); + break; + } + + pfres["valueOverrides"] = pf.valueOverrides + .concat(profileDefaults.profile.valueOverrides + .filter((value) => pf.valueOverrides + .find((value2) => value2.key != value.key))); + + result.profile.push(pfres); + } + + return JSON.stringify(result, null, 4); +} \ No newline at end of file diff --git a/src/main/resources/MergeProfileDefaultsWithProfiles.js b/src/main/resources/MergeProfileDefaultsWithProfiles.js index 193f00c01..5601d2717 100644 --- a/src/main/resources/MergeProfileDefaultsWithProfiles.js +++ b/src/main/resources/MergeProfileDefaultsWithProfiles.js @@ -1,31 +1,3 @@ -// function mergeProfileDefaultsWithProfiles(profilesFile){ -// const json = JSON.parse(profilesFile); -// const profileDefaults = {"profile": json["profileDefaults"]}; -// const profiles = { "profile": json["profile"] }; - -// let result = {}; -// result["profile"] = []; -// result["profileDefaults"] = json["profileDefaults"]; -// for(const pf of profiles.profile){ -// let pfres = {}; - -// Object.keys(profileDefaults.profile) -// .forEach(key => pfres[key] = profileDefaults.profile[key]); -// Object.keys(pf) -// .forEach(key => pfres[key] = pf[key]); - -// pfres["valueOverrides"] = pf.valueOverrides -// .concat(profileDefaults.profile.valueOverrides -// .filter((value) => pf.valueOverrides -// .find((value2) => value2.key != value.key))); - -// result.profile.push(pfres); -// } - -// return JSON.stringify(result, null, 4); -// } - -// Transpiled to ES5 "use strict"; function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } @@ -42,6 +14,9 @@ function mergeProfileDefaultsWithProfiles(profilesFile) { var result = {}; result["profile"] = []; result["profileDefaults"] = json["profileDefaults"]; + if (json["profileDefaults"] == null || json["profile"] == null) { + return profilesFiles; + } var _iterator = _createForOfIteratorHelper(profiles.profile), _step; try { @@ -54,6 +29,10 @@ function mergeProfileDefaultsWithProfiles(profilesFile) { Object.keys(pf).forEach(function (key) { return pfres[key] = pf[key]; }); + if (pf["valueOverrides"] == null) { + result.profile.push(pfres); + return "break"; + } pfres["valueOverrides"] = pf.valueOverrides.concat(profileDefaults.profile.valueOverrides.filter(function (value) { return pf.valueOverrides.find(function (value2) { return value2.key != value.key; @@ -62,7 +41,8 @@ function mergeProfileDefaultsWithProfiles(profilesFile) { result.profile.push(pfres); }; for (_iterator.s(); !(_step = _iterator.n()).done;) { - _loop(); + var _ret = _loop(); + if (_ret === "break") break; } } catch (err) { _iterator.e(err); From 89e3e462f4b2d0a2183c62d1af3eafebd00de000 Mon Sep 17 00:00:00 2001 From: MLenterman Date: Wed, 17 Apr 2024 11:31:26 +0200 Subject: [PATCH 28/28] add error feedback for errors during merging --- .../Configuration_ResolveProfileValues.xml | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml index 3ca229e28..6f2fda36f 100644 --- a/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml +++ b/src/main/configurations/Translate/Configuration_ResolveProfileValues.xml @@ -27,11 +27,12 @@ > - + - + - + + + + + + + + + + + \ No newline at end of file