From 3efabbe932e8610af5523be8f07f5d82bb14da0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 12:34:44 +0100 Subject: [PATCH 001/382] Trying out if collaboration diagrams can be run --- src/main/resources/bpe/ping-collab.bpmn | 1075 +++++++++++++++++++++++ src/main/resources/bpe/ping.bpmn | 266 ------ src/main/resources/bpe/pong.bpmn | 98 --- 3 files changed, 1075 insertions(+), 364 deletions(-) create mode 100644 src/main/resources/bpe/ping-collab.bpmn delete mode 100644 src/main/resources/bpe/ping.bpmn delete mode 100644 src/main/resources/bpe/pong.bpmn diff --git a/src/main/resources/bpe/ping-collab.bpmn b/src/main/resources/bpe/ping-collab.bpmn new file mode 100644 index 00000000..71b6abb5 --- /dev/null +++ b/src/main/resources/bpe/ping-collab.bpmn @@ -0,0 +1,1075 @@ + + + + + + + + + + + + + Flow_00lor5a + + + + Flow_1ufourf + Flow_0iuuyo1 + Flow_152nb9r + + + Flow_00lor5a + Flow_1ufourf + + + Flow_152nb9r + Flow_1qz7z39 + + + Flow_1qz7z39 + Flow_12a5546 + + + Flow_1c15ef2 + Flow_0j92st0 + + + Flow_12a5546 + Flow_0m0hq4h + + + Flow_0iuuyo1 + Flow_0m0hq4h + Flow_1c15ef2 + + + Flow_1du5wys + + + Flow_0gubpgz + Flow_1du5wys + + + Flow_1bfs68o + Flow_0gubpgz + + + Flow_0j92st0 + Flow_1bfs68o + + + R3/PT5S + + + + Flow_10epxa2 + + + Flow_0y9usku + Flow_1fjeq2h + + PT20S + + + + Flow_1lghrxh + Flow_03hkxbe + + + + + + + Flow_1j54c2s + Flow_0y9usku + Flow_1lghrxh + + + Flow_1fjeq2h + Flow_136htek + + + Flow_08vgmf6 + Flow_1j54c2s + Flow_101sqed + + + Flow_101sqed + Flow_16ssf4a + + + Flow_136htek + Flow_16ssf4a + Flow_1ho1hys + + + + R3/PT5S + + Flow_1ho1hys + + + + + + + + + ${execution.hasVariable('statusCode') && (statusCode == 'not-allowed' || statusCode == 'not-reachable')} + + + + + + + http://dsf.dev/bpe/Process/pong|#{version} + + + ping + + + http://dsf.dev/fhir/StructureDefinition/task-ping|#{version} + + + Flow_10epxa2 + Flow_08vgmf6 + + + + + Flow_03hkxbe + Flow_1yt9547 + Flow_13u1nzy + + + + Flow_1yt9547 + Flow_02vykzd + + + Flow_10h6pqh + + + + Flow_1t8wvoj + Flow_0pj6d62 + + + + Flow_10h6pqh + Flow_0w8n7ok + + + Flow_02vykzd + Flow_0w8n7ok + Flow_1t8wvoj + + + Flow_13u1nzy + Flow_0pj6d62 + Flow_03nx6rk + + + ${downloadResourceSize < 0} + + + Flow_03nx6rk + Flow_0v6axlv + + + Flow_0v6axlv + + + + + + + + + Information in message: +- dowloadResourceSize: long +- downloadResourceReference: Reference + + + + Information in message: +- downloadDurationMillis: long +- bytesDownloaded: long +- hash validation result (both ways) + + + + downloads up to maxDownloadSizeBytes + + + + + + + ${downloadResourceSize < 0} + + + + + + + + + + + + Cleanup steps: +- delete generated resource + + + - downloadResourceSize read from Input Paramater (default tbd) +- maxDownloadSizeBytes read from environment variable (default tbd) +- maxUpdloadSizeBytes read from environment variables (default tbd) + + + generates up to maxUploadSizeBystes + + + + + + Includes download speeds and errors of all pongs + + + + + + SequenceFlow_07w11cw + + + + Flow_0gfjp39 + Flow_10z0d4x + Flow_08gidyv + + + SequenceFlow_07w11cw + Flow_0gfjp39 + + + Flow_10z0d4x + Flow_0zphif7 + + + Flow_0zphif7 + Flow_0gohf1b + + + Flow_061qpt4 + Flow_1eass2g + + + Flow_08gidyv + Flow_0gvrnxd + Flow_1o3n9u6 + + + Flow_1o3n9u6 + Flow_061qpt4 + + + + + http://dsf.dev/bpe/Process/ping|#{version} + + + pong + + + http://dsf.dev/fhir/StructureDefinition/task-pong|#{version} + + + Flow_1eass2g + Flow_0fzmjzb + + + Flow_0fzmjzb + Flow_0h8flp6 + Flow_1bzjspe + Flow_00t1ck1 + + + Flow_0h8flp6 + Flow_05ucfds + + + Flow_1bzjspe + Flow_0rj915n + Flow_17x98wg + + + Flow_0rj915n + Flow_0cl2bet + + + + Flow_17x98wg + Flow_0wy02qe + + ${cleanupTimerDuration} + + + + Flow_05ucfds + Flow_00t1ck1 + Flow_1qzb40k + + + Flow_1qzb40k + Flow_1qg0rto + + + Flow_0gohf1b + Flow_1jehvly + Flow_0x7t1ii + + + Flow_0uj7rm3 + Flow_1jehvly + + + Flow_0yr2pmf + + + Flow_0wy02qe + Flow_165e73u + Flow_1qg0rto + + + Flow_0cl2bet + Flow_165e73u + + + Flow_0yr2pmf + + + + Flow_0uj7rm3 + + + + + + + ${downloadResourceSize < 0} + + + + + + + + + + ${execution.hasVariable('statusCode') && statusCode == 'not-reachable'} + + + ${bidirectionalResourceDownload == true} + + + + + + + + + + + + + + + + + + + Flow_03hviat + Flow_0gvrnxd + + + Flow_0h9y3hl + Flow_03hviat + + + Flow_1w09zt7 + Flow_0h9y3hl + + + Flow_0x7t1ii + Flow_1w09zt7 + + + - downloadResourceSize read from Input Paramater (no default, value from message expected) +- maxDownloadSizeBytes read from environment variable (default tbd) +- maxUpdloadSizeBytes read from environment variables (default tbd) + + + downloads up to maxDownloadSizeBytes + + + Information in message: +- downloadedResourceHash: String +- downloadedBytes: long +- downloadDurationMillis: long +- downloadResourceReference: Reference +- downloadResourceHash: String +- errors: List + + + Cleanup steps: +- delete generated resource + + + Estimation based on download duration e.g. 10x or 20x download duration + + + generates up to maxUploadSizeBystes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn deleted file mode 100644 index 5d1ba29e..00000000 --- a/src/main/resources/bpe/ping.bpmn +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - SequenceFlow_0k1j79c - Flow_0j92st0 - - - - Flow_0j92st0 - Flow_099pk09 - - - R3/PT5S - - - - Flow_0v2ascf - - - - - - - Flow_0y9usku - Flow_1fjeq2h - - PT20S - - - - - Flow_1lghrxh - Flow_03hkxbe - - - - - - - Flow_1j54c2s - Flow_1lghrxh - Flow_0y9usku - - - - Flow_1fjeq2h - Flow_136htek - - - - Flow_03hkxbe - Flow_0wmpprs - - - Flow_1ipvu5v - Flow_1j54c2s - Flow_101sqed - - - - Flow_101sqed - Flow_16ssf4a - - - ${execution.hasVariable('statusCode') && (statusCode == 'not-allowed' || statusCode == 'not-reachable')} - - - - Flow_0v2ascf - Flow_1ipvu5v - - - - http://dsf.dev/bpe/Process/pong|#{version} - - - http://dsf.dev/fhir/StructureDefinition/task-ping|#{version} - - - ping - - - - - - - - - Flow_0wmpprs - Flow_136htek - Flow_16ssf4a - Flow_1ho1hys - - - - - - - R3/PT5S - - Flow_1ho1hys - - - - - Flow_1du5wys - - - SequenceFlow_0k1j79c - - - - - - - - Flow_099pk09 - Flow_1du5wys - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn deleted file mode 100644 index 39fdb0be..00000000 --- a/src/main/resources/bpe/pong.bpmn +++ /dev/null @@ -1,98 +0,0 @@ - - - - - SequenceFlow_07w11cw - - - - - - SequenceFlow_1ism9wt - - - - http://dsf.dev/fhir/StructureDefinition/task-pong|#{version} - - - pong - - - http://dsf.dev/bpe/Process/ping|#{version} - - - - - - - SequenceFlow_07w11cw - SequenceFlow_09i9zb8 - - - SequenceFlow_09i9zb8 - SequenceFlow_1ism9wt - - - - Flow_0yr2pmf - - - Flow_0yr2pmf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 8991421cd5e02b7d361fe615984b324deed1ec2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 12:34:51 +0100 Subject: [PATCH 002/382] Fixed typo --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 85c02919..1f769d41 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -30,11 +30,11 @@ public class PingConfig @Autowired private ProcessPluginApi api; - @ProcessDocumentation(description = "To enable a mail being send if the ping process fails, set to 'true'. This requires the SMPT mail service client to be configured in the DSF", processNames = "dsfdev_ping") + @ProcessDocumentation(description = "To enable a mail being sent if the ping process fails, set to 'true'. This requires the SMPT mail service client to be configured in the DSF", processNames = "dsfdev_ping") @Value("${dev.dsf.dsf.bpe.ping.mail.onPingProcessFailed:false}") private boolean sendPingProcessFailedMail; - @ProcessDocumentation(description = "To enable a mail being send if the pong process fails, set to 'true'. This requires the SMPT mail service client to be configured in the DSF", processNames = "dsfdev_pong") + @ProcessDocumentation(description = "To enable a mail being sent if the pong process fails, set to 'true'. This requires the SMPT mail service client to be configured in the DSF", processNames = "dsfdev_pong") @Value("${dev.dsf.dsf.bpe.ping.mail.onPongProcessFailed:false}") private boolean sendPongProcessFailedMail; From ebd9c9390a8786262b1e52bddba7271e744cc4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 12:42:56 +0100 Subject: [PATCH 003/382] Added download and upload size limits --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 1f769d41..cbf81506 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -38,6 +38,14 @@ public class PingConfig @Value("${dev.dsf.dsf.bpe.ping.mail.onPongProcessFailed:false}") private boolean sendPongProcessFailedMail; + @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.") + @Value("{dev.dsf.bpe.ping.maxDownloadSize:10000000}") + private long maxDownloadSizeBytes; + + @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.") + @Value("{dev.dsf.bpe.ping.maxUploadSize:10000000}") + private long maxUploadSizeBytes; + @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SetTargetAndConfigureTimer setTargetAndConfigureTimer() From a2a3bea3416682e10056b5675521dc48354b7a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 14:12:41 +0100 Subject: [PATCH 004/382] Removed empty xml bodies --- src/main/resources/fhir/Task/dsf-task-start-ping.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping.xml b/src/main/resources/fhir/Task/dsf-task-start-ping.xml index d8ef908b..dac3816c 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping.xml @@ -38,10 +38,10 @@ - - + + - + From 140b81f539660f5a447992a96848d22514c59cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 14:17:51 +0100 Subject: [PATCH 005/382] Added download-resource-size-bytes as input parameter --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + .../resources/fhir/CodeSystem/dsf-ping.xml | 5 ++ .../StructureDefinition/dsf-task-ping.xml | 49 ++++++++++++------- .../fhir/Task/dsf-task-start-ping.xml | 9 ++++ 4 files changed, 46 insertions(+), 18 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 0f8c12f1..f8566ef2 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -38,6 +38,7 @@ public interface ConstantsPing String CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER = "endpoint-identifier"; String CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS = "target-endpoints"; String CODESYSTEM_DSF_PING_VALUE_TIMER_INTERVAL = "timer-interval"; + String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES = "download-resource-size-bytes"; String CODESYSTEM_DSF_PING_STATUS = "http://dsf.dev/fhir/CodeSystem/ping-status"; String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED = "not-allowed"; diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping.xml b/src/main/resources/fhir/CodeSystem/dsf-ping.xml index a79fc556..ff37adc2 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping.xml @@ -46,4 +46,9 @@ + + + + + \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index 89346167..2dd0bab7 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -60,13 +60,13 @@ - + - + - + @@ -86,7 +86,7 @@ - + @@ -95,27 +95,40 @@ - - - - - - + + + + - - - + + + + + + + + + + - - + + - + - - + + + + + + + + + + diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping.xml b/src/main/resources/fhir/Task/dsf-task-start-ping.xml index dac3816c..215db8dd 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping.xml @@ -35,6 +35,15 @@ + + + + + + + + + From a091f91bea8d65c520338c90a4a8a0e930f09a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 14:23:23 +0100 Subject: [PATCH 006/382] Removed unnecessary config reading step --- src/main/resources/bpe/ping-collab.bpmn | 92 ++++++++----------------- 1 file changed, 29 insertions(+), 63 deletions(-) diff --git a/src/main/resources/bpe/ping-collab.bpmn b/src/main/resources/bpe/ping-collab.bpmn index 71b6abb5..57ffcdbf 100644 --- a/src/main/resources/bpe/ping-collab.bpmn +++ b/src/main/resources/bpe/ping-collab.bpmn @@ -10,18 +10,14 @@ - Flow_00lor5a + Flow_0fpikty - Flow_1ufourf + Flow_0fpikty Flow_0iuuyo1 Flow_152nb9r - - Flow_00lor5a - Flow_1ufourf - Flow_152nb9r Flow_1qz7z39 @@ -204,8 +200,6 @@ - - ${downloadResourceSize < 0} @@ -218,12 +212,14 @@ + Cleanup steps: - delete generated resource - - downloadResourceSize read from Input Paramater (default tbd) + Process Parameters +- downloadResourceSize read from Input Paramater (default tbd) - maxDownloadSizeBytes read from environment variable (default tbd) - maxUpdloadSizeBytes read from environment variables (default tbd) @@ -231,7 +227,6 @@ generates up to maxUploadSizeBystes - Includes download speeds and errors of all pongs @@ -240,18 +235,14 @@ - SequenceFlow_07w11cw + Flow_0huy3o3 - Flow_0gfjp39 + Flow_0huy3o3 Flow_10z0d4x Flow_08gidyv - - SequenceFlow_07w11cw - Flow_0gfjp39 - Flow_10z0d4x Flow_0zphif7 @@ -353,8 +344,6 @@ Flow_0uj7rm3 - - ${downloadResourceSize < 0} @@ -404,11 +393,7 @@ Flow_0x7t1ii Flow_1w09zt7 - - - downloadResourceSize read from Input Paramater (no default, value from message expected) -- maxDownloadSizeBytes read from environment variable (default tbd) -- maxUpdloadSizeBytes read from environment variables (default tbd) - + downloads up to maxDownloadSizeBytes @@ -416,7 +401,7 @@ Information in message: - downloadedResourceHash: String - downloadedBytes: long -- downloadDurationMillis: long +- downloadedDurationMillis: long - downloadResourceReference: Reference - downloadResourceHash: String - errors: List @@ -431,12 +416,17 @@ generates up to maxUploadSizeBystes - + + Process Parameters +- downloadResourceSize read from Input Paramater (no default, value from message expected) +- maxDownloadSizeBytes read from environment variable (default tbd) +- maxUpdloadSizeBytes read from environment variables (default tbd) + @@ -461,10 +451,6 @@ - - - - @@ -690,7 +676,7 @@ - + @@ -701,14 +687,6 @@ - - - - - - - - @@ -755,10 +733,6 @@ - - - - @@ -767,10 +741,18 @@ + + + + + + + + @@ -780,10 +762,6 @@ - - - - @@ -863,16 +841,12 @@ - - - - - + @@ -899,14 +873,6 @@ - - - - - - - - @@ -1024,10 +990,6 @@ - - - - @@ -1048,6 +1010,10 @@ + + + + From 5b4326d07bb8ce382b6672c98b2301d836dfa8de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 14:47:02 +0100 Subject: [PATCH 007/382] Added new service task implementations --- .../java/dev/dsf/bpe/service/Cleanup.java | 26 ++++++++++++++++++ .../dev/dsf/bpe/service/CompareHashes.java | 26 ++++++++++++++++++ .../DownloadResourceAndMeasureSpeed.java | 26 ++++++++++++++++++ .../service/EstimateCleanupTimerDuration.java | 25 +++++++++++++++++ .../dev/dsf/bpe/service/GenerateResource.java | 26 ++++++++++++++++++ .../dev/dsf/bpe/service/HashResource.java | 27 +++++++++++++++++++ .../bpe/service/LogAndSaveAndStoreError.java | 26 ++++++++++++++++++ .../dev/dsf/bpe/service/LogAndSaveError.java | 26 ++++++++++++++++++ .../dsf/bpe/service/LogAndSaveNoResponse.java | 26 ++++++++++++++++++ .../dsf/bpe/service/LogAndSaveSendError.java | 26 ++++++++++++++++++ .../dsf/bpe/service/LogAndStoreSendError.java | 26 ++++++++++++++++++ .../dsf/bpe/service/SaveDownloadSpeeds.java | 26 ++++++++++++++++++ .../dsf/bpe/service/StoreDownloadSpeeds.java | 26 ++++++++++++++++++ .../dev/dsf/bpe/service/StoreResource.java | 26 ++++++++++++++++++ 14 files changed, 364 insertions(+) create mode 100644 src/main/java/dev/dsf/bpe/service/Cleanup.java create mode 100644 src/main/java/dev/dsf/bpe/service/CompareHashes.java create mode 100644 src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java create mode 100644 src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java create mode 100644 src/main/java/dev/dsf/bpe/service/GenerateResource.java create mode 100644 src/main/java/dev/dsf/bpe/service/HashResource.java create mode 100644 src/main/java/dev/dsf/bpe/service/LogAndSaveAndStoreError.java create mode 100644 src/main/java/dev/dsf/bpe/service/LogAndSaveError.java create mode 100644 src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java create mode 100644 src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java create mode 100644 src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java create mode 100644 src/main/java/dev/dsf/bpe/service/SaveDownloadSpeeds.java create mode 100644 src/main/java/dev/dsf/bpe/service/StoreDownloadSpeeds.java create mode 100644 src/main/java/dev/dsf/bpe/service/StoreResource.java diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java new file mode 100644 index 00000000..335c71d0 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class Cleanup extends AbstractServiceDelegate +{ + private final static Logger logger = LoggerFactory.getLogger(Cleanup.class.getName()); + + public Cleanup(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Cleaning up"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/CompareHashes.java b/src/main/java/dev/dsf/bpe/service/CompareHashes.java new file mode 100644 index 00000000..7bad29af --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/CompareHashes.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class CompareHashes extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(CompareHashes.class); + + public CompareHashes(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Compared hashes"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java new file mode 100644 index 00000000..d6291ec3 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate +{ + public static final Logger logger = LoggerFactory.getLogger(DownloadResourceAndMeasureSpeed.class); + + public DownloadResourceAndMeasureSpeed(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Downloading resource and measuring speed"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java new file mode 100644 index 00000000..9c03f129 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java @@ -0,0 +1,25 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class EstimateCleanupTimerDuration extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(EstimateCleanupTimerDuration.class); + public EstimateCleanupTimerDuration(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Estimated cleanup timer duration"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/GenerateResource.java b/src/main/java/dev/dsf/bpe/service/GenerateResource.java new file mode 100644 index 00000000..90e46ee3 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/GenerateResource.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class GenerateResource extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(GenerateResource.class); + + public GenerateResource(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Generating resource"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/HashResource.java b/src/main/java/dev/dsf/bpe/service/HashResource.java new file mode 100644 index 00000000..97f280db --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/HashResource.java @@ -0,0 +1,27 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class HashResource extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(HashResource.class); + + public HashResource(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Hashing resource"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/LogAndSaveAndStoreError.java new file mode 100644 index 00000000..71bd39ae --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/LogAndSaveAndStoreError.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class LogAndSaveAndStoreError extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(LogAndSaveAndStoreError.class); + + public LogAndSaveAndStoreError(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Logging and saving and storing error"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/LogAndSaveError.java new file mode 100644 index 00000000..5df5bb70 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/LogAndSaveError.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class LogAndSaveError extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(LogAndSaveError.class); + + public LogAndSaveError(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Logging and saving error"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java b/src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java new file mode 100644 index 00000000..ed951948 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class LogAndSaveNoResponse extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(LogAndSaveNoResponse.class); + + public LogAndSaveNoResponse(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Logging and saving missing response"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java new file mode 100644 index 00000000..cf95679d --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class LogAndSaveSendError extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(LogAndSaveSendError.class); + + public LogAndSaveSendError(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Logging and saving error during sending"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java b/src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java new file mode 100644 index 00000000..e66d27ac --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class LogAndStoreSendError extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(LogAndStoreSendError.class); + + public LogAndStoreSendError(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + + } +} diff --git a/src/main/java/dev/dsf/bpe/service/SaveDownloadSpeeds.java b/src/main/java/dev/dsf/bpe/service/SaveDownloadSpeeds.java new file mode 100644 index 00000000..5c3844f1 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/SaveDownloadSpeeds.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class SaveDownloadSpeeds extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(SaveDownloadSpeeds.class); + + public SaveDownloadSpeeds(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Saving download speeds as execution variable"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/StoreDownloadSpeeds.java b/src/main/java/dev/dsf/bpe/service/StoreDownloadSpeeds.java new file mode 100644 index 00000000..7df02204 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/StoreDownloadSpeeds.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class StoreDownloadSpeeds extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(StoreDownloadSpeeds.class); + + public StoreDownloadSpeeds(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Storing download speeds as input parameter"); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/StoreResource.java b/src/main/java/dev/dsf/bpe/service/StoreResource.java new file mode 100644 index 00000000..08f2a521 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/StoreResource.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class StoreResource extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(StoreResource.class); + + public StoreResource(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + logger.info("Storing resource"); + } +} From 70a899d6bc13b78ae7e1d7b0f27d89719da47ab9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 14:47:19 +0100 Subject: [PATCH 008/382] Fatping will be ping pong version 2.0 --- src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index 12e505f4..be492b3c 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -10,7 +10,7 @@ public class PingProcessPluginDefinition implements ProcessPluginDefinition { - public static final String VERSION = "1.0.1.0"; + public static final String VERSION = "2.0.0.0"; public static final LocalDate RELEASE_DATE = LocalDate.of(2023, 9, 12); @Override From ad0bd04941c398b896b9271b66b06487aa25e06b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 14:47:44 +0100 Subject: [PATCH 009/382] SaveResults is now StoreResults --- .../dsf/bpe/service/{SaveResults.java => StoreResults.java} | 4 ++-- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) rename src/main/java/dev/dsf/bpe/service/{SaveResults.java => StoreResults.java} (92%) diff --git a/src/main/java/dev/dsf/bpe/service/SaveResults.java b/src/main/java/dev/dsf/bpe/service/StoreResults.java similarity index 92% rename from src/main/java/dev/dsf/bpe/service/SaveResults.java rename to src/main/java/dev/dsf/bpe/service/StoreResults.java index 1edc5575..b22c8f85 100644 --- a/src/main/java/dev/dsf/bpe/service/SaveResults.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResults.java @@ -17,12 +17,12 @@ import dev.dsf.bpe.v1.variables.Targets; import dev.dsf.bpe.v1.variables.Variables; -public class SaveResults extends AbstractServiceDelegate implements InitializingBean +public class StoreResults extends AbstractServiceDelegate implements InitializingBean { private final PingStatusGenerator statusGenerator; private final ErrorMailService errorMailService; - public SaveResults(ProcessPluginApi api, PingStatusGenerator statusGenerator, ErrorMailService errorMailService) + public StoreResults(ProcessPluginApi api, PingStatusGenerator statusGenerator, ErrorMailService errorMailService) { super(api); diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index cbf81506..5dd88938 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -16,7 +16,7 @@ import dev.dsf.bpe.service.LogPing; import dev.dsf.bpe.service.LogPong; import dev.dsf.bpe.service.LogSendError; -import dev.dsf.bpe.service.SaveResults; +import dev.dsf.bpe.service.StoreResults; import dev.dsf.bpe.service.SelectPingTargets; import dev.dsf.bpe.service.SelectPongTarget; import dev.dsf.bpe.service.SetTargetAndConfigureTimer; @@ -117,9 +117,9 @@ public LogSendError logSendError() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public SaveResults savePingResults() + public StoreResults savePingResults() { - return new SaveResults(api, responseGenerator(), errorLogger()); + return new StoreResults(api, responseGenerator(), errorLogger()); } @Bean From 6eeff188c75f9c49818d07049ffba7431aa4e870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 15:03:22 +0100 Subject: [PATCH 010/382] Added java implementations --- src/main/resources/bpe/ping-collab.bpmn | 126 ++++++++++++------------ 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/src/main/resources/bpe/ping-collab.bpmn b/src/main/resources/bpe/ping-collab.bpmn index 57ffcdbf..beeb275a 100644 --- a/src/main/resources/bpe/ping-collab.bpmn +++ b/src/main/resources/bpe/ping-collab.bpmn @@ -18,22 +18,10 @@ Flow_0iuuyo1 Flow_152nb9r - - Flow_152nb9r - Flow_1qz7z39 - - - Flow_1qz7z39 - Flow_12a5546 - Flow_1c15ef2 Flow_0j92st0 - - Flow_12a5546 - Flow_0m0hq4h - Flow_0iuuyo1 Flow_0m0hq4h @@ -42,11 +30,11 @@ Flow_1du5wys - + Flow_0gubpgz Flow_1du5wys - + Flow_1bfs68o Flow_0gubpgz @@ -81,7 +69,7 @@ Flow_0y9usku Flow_1lghrxh - + Flow_1fjeq2h Flow_136htek @@ -90,7 +78,7 @@ Flow_1j54c2s Flow_101sqed - + Flow_101sqed Flow_16ssf4a @@ -139,7 +127,7 @@ Flow_13u1nzy - + Flow_1yt9547 Flow_02vykzd @@ -152,15 +140,10 @@ Flow_0pj6d62 - + Flow_10h6pqh Flow_0w8n7ok - - Flow_02vykzd - Flow_0w8n7ok - Flow_1t8wvoj - Flow_13u1nzy Flow_0pj6d62 @@ -169,7 +152,7 @@ ${downloadResourceSize < 0} - + Flow_03nx6rk Flow_0v6axlv @@ -177,11 +160,16 @@ Flow_0v6axlv - - - + + Flow_0w8n7ok + Flow_02vykzd + Flow_1t8wvoj + + + + Information in message: - dowloadResourceSize: long @@ -205,7 +193,6 @@ - @@ -213,6 +200,19 @@ + + Flow_152nb9r + Flow_1qz7z39 + + + Flow_12a5546 + Flow_0m0hq4h + + + Flow_1qz7z39 + Flow_12a5546 + + Cleanup steps: - delete generated resource @@ -227,11 +227,11 @@ generates up to maxUploadSizeBystes - Includes download speeds and errors of all pongs + @@ -243,14 +243,10 @@ Flow_10z0d4x Flow_08gidyv - + Flow_10z0d4x Flow_0zphif7 - - Flow_0zphif7 - Flow_0gohf1b - Flow_061qpt4 Flow_1eass2g @@ -264,7 +260,7 @@ Flow_1o3n9u6 Flow_061qpt4 - + http://dsf.dev/bpe/Process/ping|#{version} @@ -285,7 +281,7 @@ Flow_1bzjspe Flow_00t1ck1 - + Flow_0h8flp6 Flow_05ucfds @@ -316,23 +312,23 @@ Flow_1qg0rto - Flow_0gohf1b Flow_1jehvly + Flow_0gohf1b Flow_0x7t1ii - + Flow_0uj7rm3 Flow_1jehvly Flow_0yr2pmf - + Flow_0wy02qe Flow_165e73u Flow_1qg0rto - + Flow_0cl2bet Flow_165e73u @@ -349,7 +345,6 @@ ${downloadResourceSize < 0} - @@ -372,28 +367,33 @@ - - + + Flow_03hviat Flow_0gvrnxd - + Flow_0h9y3hl Flow_03hviat - + + Flow_0x7t1ii + Flow_1w09zt7 + + Flow_1w09zt7 Flow_0h9y3hl - - Flow_0x7t1ii - Flow_1w09zt7 + + + Flow_0zphif7 + Flow_0gohf1b - + downloads up to maxDownloadSizeBytes @@ -419,14 +419,14 @@ - - Process Parameters - downloadResourceSize read from Input Paramater (no default, value from message expected) - maxDownloadSizeBytes read from environment variable (default tbd) - maxUpdloadSizeBytes read from environment variables (default tbd) + + @@ -729,6 +729,10 @@ + + + + @@ -741,18 +745,10 @@ - - - - - - - - @@ -861,6 +857,10 @@ + + + + @@ -990,6 +990,10 @@ + + + + @@ -1010,10 +1014,6 @@ - - - - From 62069a002749e2d42352088e7e693da4d2002888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 15:06:19 +0100 Subject: [PATCH 011/382] Removed hashing because there is no benefit beyond what TLS already provides and hashes cannot always be calculated correctly because this requires a full resource download which might not be the case depending on the value of download/upload limits set in the plugin configuration --- .../dev/dsf/bpe/service/CompareHashes.java | 26 --- .../dev/dsf/bpe/service/HashResource.java | 27 --- src/main/resources/bpe/ping-collab.bpmn | 182 +++++++----------- 3 files changed, 65 insertions(+), 170 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/service/CompareHashes.java delete mode 100644 src/main/java/dev/dsf/bpe/service/HashResource.java diff --git a/src/main/java/dev/dsf/bpe/service/CompareHashes.java b/src/main/java/dev/dsf/bpe/service/CompareHashes.java deleted file mode 100644 index 7bad29af..00000000 --- a/src/main/java/dev/dsf/bpe/service/CompareHashes.java +++ /dev/null @@ -1,26 +0,0 @@ -package dev.dsf.bpe.service; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Variables; - -public class CompareHashes extends AbstractServiceDelegate -{ - private static final Logger logger = LoggerFactory.getLogger(CompareHashes.class); - - public CompareHashes(ProcessPluginApi api) - { - super(api); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception - { - logger.info("Compared hashes"); - } -} diff --git a/src/main/java/dev/dsf/bpe/service/HashResource.java b/src/main/java/dev/dsf/bpe/service/HashResource.java deleted file mode 100644 index 97f280db..00000000 --- a/src/main/java/dev/dsf/bpe/service/HashResource.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.dsf.bpe.service; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Variables; - -public class HashResource extends AbstractServiceDelegate -{ - - private static final Logger logger = LoggerFactory.getLogger(HashResource.class); - - public HashResource(ProcessPluginApi api) - { - super(api); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception - { - logger.info("Hashing resource"); - } -} diff --git a/src/main/resources/bpe/ping-collab.bpmn b/src/main/resources/bpe/ping-collab.bpmn index beeb275a..275c5dc5 100644 --- a/src/main/resources/bpe/ping-collab.bpmn +++ b/src/main/resources/bpe/ping-collab.bpmn @@ -129,20 +129,21 @@ Flow_1yt9547 - Flow_02vykzd + Flow_1v37fff Flow_10h6pqh - Flow_1t8wvoj + Flow_1v37fff + Flow_0jcfur3 Flow_0pj6d62 Flow_10h6pqh - Flow_0w8n7ok + Flow_0jcfur3 Flow_13u1nzy @@ -162,14 +163,8 @@ - - Flow_0w8n7ok - Flow_02vykzd - Flow_1t8wvoj - - - - + + Information in message: - dowloadResourceSize: long @@ -192,7 +187,7 @@ ${downloadResourceSize < 0} - + @@ -205,14 +200,9 @@ Flow_1qz7z39 - Flow_12a5546 - Flow_0m0hq4h - - Flow_1qz7z39 - Flow_12a5546 + Flow_0m0hq4h - Cleanup steps: - delete generated resource @@ -313,7 +303,7 @@ Flow_1jehvly - Flow_0gohf1b + Flow_0zphif7 Flow_0x7t1ii @@ -344,7 +334,7 @@ ${downloadResourceSize < 0} - + @@ -368,32 +358,22 @@ - + - - Flow_03hviat - Flow_0gvrnxd - - Flow_0h9y3hl + Flow_1w09zt7 Flow_03hviat Flow_0x7t1ii Flow_1w09zt7 - - Flow_1w09zt7 - Flow_0h9y3hl - - - - Flow_0zphif7 - Flow_0gohf1b + + Flow_03hviat + Flow_0gvrnxd - downloads up to maxDownloadSizeBytes @@ -425,8 +405,8 @@ - maxDownloadSizeBytes read from environment variable (default tbd) - maxUpdloadSizeBytes read from environment variables (default tbd) - + @@ -451,21 +431,10 @@ - - - - - - - - - - - @@ -479,6 +448,13 @@ + + + + + + + @@ -536,10 +512,6 @@ - - - - @@ -636,20 +608,6 @@ - - - - - - - - - - - - - - @@ -671,6 +629,16 @@ + + + + + + + + + + @@ -687,6 +655,10 @@ + + + + @@ -694,15 +666,11 @@ - + - - - - - - + + @@ -713,7 +681,7 @@ - + @@ -737,10 +705,6 @@ - - - - @@ -762,10 +726,6 @@ - - - - @@ -823,20 +783,6 @@ - - - - - - - - - - - - - - @@ -861,6 +807,24 @@ + + + + + + + + + + + + + + + + + + @@ -884,10 +848,6 @@ - - - - @@ -903,7 +863,7 @@ - + @@ -963,24 +923,20 @@ - + - - - - - - + + - - + + @@ -1006,14 +962,6 @@ - - - - - - - - From 8041b29f40c6a8b54decf73c3bc9f87a65999af1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= Date: Fri, 7 Feb 2025 15:53:57 +0100 Subject: [PATCH 012/382] Added download and upload speeds to ping status extension with option for different unit displays --- .../fhir/CodeSystem/dsf-ping-units.xml | 44 +++++++++++++ .../dsf-extension-ping-status.xml | 64 +++++++++++++++++++ .../fhir/ValueSet/dsf-ping-units.xml | 28 ++++++++ 3 files changed, 136 insertions(+) create mode 100644 src/main/resources/fhir/CodeSystem/dsf-ping-units.xml create mode 100644 src/main/resources/fhir/ValueSet/dsf-ping-units.xml diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml new file mode 100644 index 00000000..fdc3601e --- /dev/null +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="CodeSystem with ping/pong download speed units" /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> + <concept> + <code value="bits-per-second"/> + <display value="bps"/> + <definition value="Download speed unit in bits per second" /> + </concept> + <concept> + <code value="bytes-per-second"/> + <display value="Bps"/> + <definition value="Download speed unit in bytes per second" /> + </concept> + <concept> + <code value="megabits-per-second"/> + <display value="mbps"/> + <definition value="Download speed unit in megabits per second" /> + </concept> + <concept> + <code value="megabits-per-second"/> + <display value="mbps"/> + <definition value="Download speed unit in megabits per second" /> + </concept> +</CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 83251d5a..c2a3b8af 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -122,6 +122,70 @@ <code value="string"/> </type> </element> + <element id="Extension.extension:download-speed"> + <path value="Extension.extension"/> + <sliceName value="download-speed"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Extension.extension:download-speed.unit"> + <path value="Extension.extension.unit"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Extension.extension:download-speed.unit.system"> + <path value="Extension.extension.coding.system"/> + <min value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> + </element> + <element id="Extension.extension:download-speed.unit.code"> + <path value="Extension.extension.coding.code"/> + <min value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> + </binding> + </element> + <element id="Extension.extension:download-speed.value[x]"> + <path value="Extension.extension.value[x]"/> + <type> + <code value="Decimal"/> + </type> + </element> + + <element id="Extension.extension:upload-speed"> + <path value="Extension.extension"/> + <sliceName value="upload-speed"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Extension.extension:upload-speed.unit"> + <path value="Extension.extension.unit"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Extension.extension:upload-speed.unit.system"> + <path value="Extension.extension.coding.system"/> + <min value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> + </element> + <element id="Extension.extension:upload-speed.unit.code"> + <path value="Extension.extension.coding.code"/> + <min value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> + </binding> + </element> + <element id="Extension.extension:upload-speed.value[x]"> + <path value="Extension.extension.value[x]"/> + <type> + <code value="Decimal"/> + </type> + </element> + <element id="Extension.url"> <path value="Extension.url"/> <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml b/src/main/resources/fhir/ValueSet/dsf-ping-units.xml new file mode 100644 index 00000000..d5020dc1 --- /dev/null +++ b/src/main/resources/fhir/ValueSet/dsf-ping-units.xml @@ -0,0 +1,28 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system + value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/ValueSet/ping-units" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="DSF_Ping_Units" /> + <title value="DSF Ping Units" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="ValueSet with ping download speed units" /> + <immutable value="true" /> + <compose> + <include> + <system value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units" /> + <version value="#{version}" /> + </include> + </compose> +</ValueSet> \ No newline at end of file From b23a268d1e11b780e79d021db6e547c3634ec303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 7 Feb 2025 15:58:20 +0100 Subject: [PATCH 013/382] Added download resource size as start task input parameter --- .../StructureDefinition/dsf-task-start-ping.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index cf4363e7..e3e4da38 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -92,6 +92,19 @@ <code value="string" /> </type> </element> + <element id="Task.input:download-resource-size-bytes"> + <path value="Task.input" /> + <sliceName value="download-resource-size-bytes" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:download-resource-size-bytes.type"> + <path value="Task.input.type" /> + <binding> + <strength value="required" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> + </binding> + </element> <element id="Task.output:ping-status"> <path value="Task.output"/> <sliceName value="ping-status"/> From 7c8809f0cc0bcf7087e8e106486a65c816e7d99d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Feb 2025 10:32:22 +0100 Subject: [PATCH 014/382] Split collaboration diagram into 2 separate diagrams because dsf expects only one process per diagram --- src/main/resources/bpe/ping-collab.bpmn | 989 ------------------------ src/main/resources/bpe/ping.bpmn | 521 +++++++++++++ src/main/resources/bpe/pong.bpmn | 454 +++++++++++ 3 files changed, 975 insertions(+), 989 deletions(-) delete mode 100644 src/main/resources/bpe/ping-collab.bpmn create mode 100644 src/main/resources/bpe/ping.bpmn create mode 100644 src/main/resources/bpe/pong.bpmn diff --git a/src/main/resources/bpe/ping-collab.bpmn b/src/main/resources/bpe/ping-collab.bpmn deleted file mode 100644 index 275c5dc5..00000000 --- a/src/main/resources/bpe/ping-collab.bpmn +++ /dev/null @@ -1,989 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0mkowna" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.17.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.20.0"> - <bpmn:collaboration id="Collaboration_03vipzx"> - <bpmn:participant id="Participant_0vkpj55" name="Ping" processRef="dsfdev_ping" /> - <bpmn:participant id="Participant_0eb6dp7" name="Pong" processRef="dsfdev_pong" /> - <bpmn:participant id="Participant_16l0acs" name="Log = logger Save = save as execution variable Store = store on DSF FHIR server either as separate resource or output parameter" /> - <bpmn:messageFlow id="Flow_1tu7djj" sourceRef="Activity_0ri6fnv" targetRef="PingMessageStartEvent" /> - <bpmn:messageFlow id="Flow_1eqeb94" sourceRef="Activity_005ywv2" targetRef="PongCatchEvent" /> - <bpmn:messageFlow id="Flow_12wvay9" sourceRef="Activity_0vw65a2" targetRef="Event_1xvd4tr" /> - </bpmn:collaboration> - <bpmn:process id="dsfdev_ping" isExecutable="true" camunda:versionTag="#{version}" camunda:historyTimeToLive="180"> - <bpmn:startEvent id="StartPingMessageStartEvent" name="startPing"> - <bpmn:outgoing>Flow_0fpikty</bpmn:outgoing> - <bpmn:messageEventDefinition id="MessageEventDefinition_06brz1s" messageRef="Message_1pklz6t" /> - </bpmn:startEvent> - <bpmn:exclusiveGateway id="Gateway_0xw5i5v" default="Flow_152nb9r"> - <bpmn:incoming>Flow_0fpikty</bpmn:incoming> - <bpmn:outgoing>Flow_0iuuyo1</bpmn:outgoing> - <bpmn:outgoing>Flow_152nb9r</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:serviceTask id="SelectPingTargets" name="Select Targets" camunda:class="dev.dsf.bpe.service.SelectPingTargets"> - <bpmn:incoming>Flow_1c15ef2</bpmn:incoming> - <bpmn:outgoing>Flow_0j92st0</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:exclusiveGateway id="Gateway_0bifi5h"> - <bpmn:incoming>Flow_0iuuyo1</bpmn:incoming> - <bpmn:incoming>Flow_0m0hq4h</bpmn:incoming> - <bpmn:outgoing>Flow_1c15ef2</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:endEvent id="EndEvent"> - <bpmn:incoming>Flow_1du5wys</bpmn:incoming> - </bpmn:endEvent> - <bpmn:serviceTask id="SaveResults" name="Store Results" camunda:class="dev.dsf.bpe.service.StoreResults"> - <bpmn:incoming>Flow_0gubpgz</bpmn:incoming> - <bpmn:outgoing>Flow_1du5wys</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0802w0b" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> - <bpmn:incoming>Flow_1bfs68o</bpmn:incoming> - <bpmn:outgoing>Flow_0gubpgz</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:subProcess id="SubProcess"> - <bpmn:incoming>Flow_0j92st0</bpmn:incoming> - <bpmn:outgoing>Flow_1bfs68o</bpmn:outgoing> - <bpmn:multiInstanceLoopCharacteristics camunda:asyncBefore="true" camunda:exclusive="false" camunda:collection="${targets.entries}" camunda:elementVariable="target"> - <bpmn:extensionElements> - <camunda:failedJobRetryTimeCycle>R3/PT5S</camunda:failedJobRetryTimeCycle> - </bpmn:extensionElements> - </bpmn:multiInstanceLoopCharacteristics> - <bpmn:startEvent id="SubProcessStartEvent"> - <bpmn:outgoing>Flow_10epxa2</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:intermediateCatchEvent id="PongTimer" name="PT20S"> - <bpmn:incoming>Flow_0y9usku</bpmn:incoming> - <bpmn:outgoing>Flow_1fjeq2h</bpmn:outgoing> - <bpmn:timerEventDefinition id="TimerEventDefinition_1n8et61"> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT20S</bpmn:timeDuration> - </bpmn:timerEventDefinition> - </bpmn:intermediateCatchEvent> - <bpmn:intermediateCatchEvent id="PongCatchEvent" name="Pong"> - <bpmn:incoming>Flow_1lghrxh</bpmn:incoming> - <bpmn:outgoing>Flow_03hkxbe</bpmn:outgoing> - <bpmn:messageEventDefinition id="MessageEventDefinition_02hoxbe" messageRef="Message_10o3b8y" /> - </bpmn:intermediateCatchEvent> - <bpmn:eventBasedGateway id="EventBasedGateway"> - <bpmn:extensionElements> - <camunda:executionListener class="dev.dsf.bpe.listener.SetCorrelationKeyListener" event="start" /> - </bpmn:extensionElements> - <bpmn:incoming>Flow_1j54c2s</bpmn:incoming> - <bpmn:outgoing>Flow_0y9usku</bpmn:outgoing> - <bpmn:outgoing>Flow_1lghrxh</bpmn:outgoing> - </bpmn:eventBasedGateway> - <bpmn:serviceTask id="LogNoResponse" name="Log and Save No Response" camunda:class="dev.dsf.bpe.service.LogAndSaveNoResponse"> - <bpmn:incoming>Flow_1fjeq2h</bpmn:incoming> - <bpmn:outgoing>Flow_136htek</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:exclusiveGateway id="Gateway_0z5gz96" default="Flow_1j54c2s"> - <bpmn:incoming>Flow_08vgmf6</bpmn:incoming> - <bpmn:outgoing>Flow_1j54c2s</bpmn:outgoing> - <bpmn:outgoing>Flow_101sqed</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:serviceTask id="LogSendError" name="Log and Save Send Error" camunda:class="dev.dsf.bpe.service.LogAndSaveSendError"> - <bpmn:incoming>Flow_101sqed</bpmn:incoming> - <bpmn:outgoing>Flow_16ssf4a</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:exclusiveGateway id="Gateway_09z7b0z"> - <bpmn:incoming>Flow_136htek</bpmn:incoming> - <bpmn:incoming>Flow_16ssf4a</bpmn:incoming> - <bpmn:outgoing>Flow_1ho1hys</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:endEvent id="SubProcessEndEvent" camunda:asyncAfter="true"> - <bpmn:extensionElements> - <camunda:failedJobRetryTimeCycle>R3/PT5S</camunda:failedJobRetryTimeCycle> - </bpmn:extensionElements> - <bpmn:incoming>Flow_1ho1hys</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="Flow_0y9usku" sourceRef="EventBasedGateway" targetRef="PongTimer" /> - <bpmn:sequenceFlow id="Flow_1fjeq2h" sourceRef="PongTimer" targetRef="LogNoResponse" /> - <bpmn:sequenceFlow id="Flow_1lghrxh" sourceRef="EventBasedGateway" targetRef="PongCatchEvent" /> - <bpmn:sequenceFlow id="Flow_03hkxbe" sourceRef="PongCatchEvent" targetRef="Gateway_0p0be0a" /> - <bpmn:sequenceFlow id="Flow_1j54c2s" sourceRef="Gateway_0z5gz96" targetRef="EventBasedGateway" /> - <bpmn:sequenceFlow id="Flow_136htek" sourceRef="LogNoResponse" targetRef="Gateway_09z7b0z" /> - <bpmn:sequenceFlow id="Flow_101sqed" name="not-allowed or not-reachable" sourceRef="Gateway_0z5gz96" targetRef="LogSendError"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && (statusCode == 'not-allowed' || statusCode == 'not-reachable')}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_16ssf4a" sourceRef="LogSendError" targetRef="Gateway_09z7b0z" /> - <bpmn:sequenceFlow id="Flow_1ho1hys" sourceRef="Gateway_09z7b0z" targetRef="SubProcessEndEvent" /> - <bpmn:sendTask id="Activity_0ri6fnv" name="Ping" camunda:class="dev.dsf.bpe.message.SendPing"> - <bpmn:extensionElements> - <camunda:field name="instantiatesCanonical"> - <camunda:string>http://dsf.dev/bpe/Process/pong|#{version}</camunda:string> - </camunda:field> - <camunda:field name="messageName"> - <camunda:string>ping</camunda:string> - </camunda:field> - <camunda:field name="profile"> - <camunda:string>http://dsf.dev/fhir/StructureDefinition/task-ping|#{version}</camunda:string> - </camunda:field> - </bpmn:extensionElements> - <bpmn:incoming>Flow_10epxa2</bpmn:incoming> - <bpmn:outgoing>Flow_08vgmf6</bpmn:outgoing> - </bpmn:sendTask> - <bpmn:sequenceFlow id="Flow_10epxa2" sourceRef="SubProcessStartEvent" targetRef="Activity_0ri6fnv" /> - <bpmn:sequenceFlow id="Flow_08vgmf6" sourceRef="Activity_0ri6fnv" targetRef="Gateway_0z5gz96" /> - <bpmn:exclusiveGateway id="Gateway_0p0be0a" default="Flow_1yt9547"> - <bpmn:incoming>Flow_03hkxbe</bpmn:incoming> - <bpmn:outgoing>Flow_1yt9547</bpmn:outgoing> - <bpmn:outgoing>Flow_13u1nzy</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="Flow_1yt9547" sourceRef="Gateway_0p0be0a" targetRef="Activity_0h9o9u7" /> - <bpmn:serviceTask id="Activity_0h9o9u7" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.DownloadResourceAndMeasureSpeed"> - <bpmn:incoming>Flow_1yt9547</bpmn:incoming> - <bpmn:outgoing>Flow_1v37fff</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:boundaryEvent id="Event_0i4slcz" name="Invalid Resource Reference" attachedToRef="Activity_0h9o9u7"> - <bpmn:outgoing>Flow_10h6pqh</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0g1qm09" errorRef="Error_1jmenbm" /> - </bpmn:boundaryEvent> - <bpmn:sendTask id="Activity_0vw65a2" name="Cleanup Pong" camunda:class="dev.dsf.bpe.message.CleanupPong"> - <bpmn:incoming>Flow_1v37fff</bpmn:incoming> - <bpmn:incoming>Flow_0jcfur3</bpmn:incoming> - <bpmn:outgoing>Flow_0pj6d62</bpmn:outgoing> - </bpmn:sendTask> - <bpmn:sequenceFlow id="Flow_10h6pqh" sourceRef="Event_0i4slcz" targetRef="Activity_0akr23c" /> - <bpmn:serviceTask id="Activity_0akr23c" name="Log and Save Error" camunda:class="dev.dsf.bpe.service.LogAndSaveError"> - <bpmn:incoming>Flow_10h6pqh</bpmn:incoming> - <bpmn:outgoing>Flow_0jcfur3</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:exclusiveGateway id="Gateway_02orad4"> - <bpmn:incoming>Flow_13u1nzy</bpmn:incoming> - <bpmn:incoming>Flow_0pj6d62</bpmn:incoming> - <bpmn:outgoing>Flow_03nx6rk</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="Flow_13u1nzy" sourceRef="Gateway_0p0be0a" targetRef="Gateway_02orad4"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSize < 0}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:serviceTask id="Activity_0i9uqk0" name="Save Download Speeds" camunda:class="dev.dsf.bpe.service.SaveDownloadSpeeds"> - <bpmn:incoming>Flow_03nx6rk</bpmn:incoming> - <bpmn:outgoing>Flow_0v6axlv</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:endEvent id="Event_1foycg9"> - <bpmn:incoming>Flow_0v6axlv</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="Flow_0v6axlv" sourceRef="Activity_0i9uqk0" targetRef="Event_1foycg9" /> - <bpmn:sequenceFlow id="Flow_0pj6d62" sourceRef="Activity_0vw65a2" targetRef="Gateway_02orad4" /> - <bpmn:sequenceFlow id="Flow_03nx6rk" sourceRef="Gateway_02orad4" targetRef="Activity_0i9uqk0" /> - <bpmn:sequenceFlow id="Flow_1v37fff" sourceRef="Activity_0h9o9u7" targetRef="Activity_0vw65a2" /> - <bpmn:sequenceFlow id="Flow_0jcfur3" sourceRef="Activity_0akr23c" targetRef="Activity_0vw65a2" /> - <bpmn:textAnnotation id="TextAnnotation_0uc8utt"> - <bpmn:text>Information in message: -- dowloadResourceSize: long -- downloadResourceReference: Reference</bpmn:text> - </bpmn:textAnnotation> - <bpmn:association id="Association_1c7vgba" sourceRef="Activity_0ri6fnv" targetRef="TextAnnotation_0uc8utt" /> - <bpmn:textAnnotation id="TextAnnotation_0smygq5"> - <bpmn:text>Information in message: -- downloadDurationMillis: long -- bytesDownloaded: long -- hash validation result (both ways)</bpmn:text> - </bpmn:textAnnotation> - <bpmn:association id="Association_14iteoh" sourceRef="Activity_0vw65a2" targetRef="TextAnnotation_0smygq5" /> - <bpmn:textAnnotation id="TextAnnotation_08ic0l2"> - <bpmn:text>downloads up to maxDownloadSizeBytes</bpmn:text> - </bpmn:textAnnotation> - <bpmn:association id="Association_0l3n1oc" sourceRef="TextAnnotation_08ic0l2" targetRef="Activity_0h9o9u7" /> - </bpmn:subProcess> - <bpmn:sequenceFlow id="Flow_0iuuyo1" sourceRef="Gateway_0xw5i5v" targetRef="Gateway_0bifi5h"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSize < 0}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_152nb9r" sourceRef="Gateway_0xw5i5v" targetRef="Activity_0nwtf8o" /> - <bpmn:sequenceFlow id="Flow_1qz7z39" sourceRef="Activity_0nwtf8o" targetRef="Activity_16rb6hc" /> - <bpmn:sequenceFlow id="Flow_1c15ef2" sourceRef="Gateway_0bifi5h" targetRef="SelectPingTargets" /> - <bpmn:sequenceFlow id="Flow_0j92st0" sourceRef="SelectPingTargets" targetRef="SubProcess" /> - <bpmn:sequenceFlow id="Flow_0m0hq4h" sourceRef="Activity_16rb6hc" targetRef="Gateway_0bifi5h" /> - <bpmn:sequenceFlow id="Flow_1du5wys" sourceRef="SaveResults" targetRef="EndEvent" /> - <bpmn:sequenceFlow id="Flow_0gubpgz" sourceRef="Activity_0802w0b" targetRef="SaveResults" /> - <bpmn:sequenceFlow id="Flow_1bfs68o" sourceRef="SubProcess" targetRef="Activity_0802w0b" /> - <bpmn:sequenceFlow id="Flow_0fpikty" sourceRef="StartPingMessageStartEvent" targetRef="Gateway_0xw5i5v" /> - <bpmn:serviceTask id="Activity_0nwtf8o" name="Generate Resource" camunda:class="dev.dsf.bpe.service.GenerateResource"> - <bpmn:incoming>Flow_152nb9r</bpmn:incoming> - <bpmn:outgoing>Flow_1qz7z39</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_16rb6hc" name="Store Resource" camunda:class="dev.dsf.bpe.service.StoreResource"> - <bpmn:incoming>Flow_1qz7z39</bpmn:incoming> - <bpmn:outgoing>Flow_0m0hq4h</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:textAnnotation id="TextAnnotation_1plclrb"> - <bpmn:text>Cleanup steps: -- delete generated resource</bpmn:text> - </bpmn:textAnnotation> - <bpmn:textAnnotation id="TextAnnotation_0dhecha"> - <bpmn:text>Process Parameters -- downloadResourceSize read from Input Paramater (default tbd) -- maxDownloadSizeBytes read from environment variable (default tbd) -- maxUpdloadSizeBytes read from environment variables (default tbd)</bpmn:text> - </bpmn:textAnnotation> - <bpmn:textAnnotation id="TextAnnotation_1j1ytqy"> - <bpmn:text>generates up to maxUploadSizeBystes</bpmn:text> - </bpmn:textAnnotation> - <bpmn:association id="Association_1f86scd" sourceRef="TextAnnotation_1plclrb" targetRef="Activity_0802w0b" /> - <bpmn:textAnnotation id="TextAnnotation_1ig0151"> - <bpmn:text>Includes download speeds and errors of all pongs</bpmn:text> - </bpmn:textAnnotation> - <bpmn:association id="Association_02mkojs" sourceRef="SaveResults" targetRef="TextAnnotation_1ig0151" /> - <bpmn:association id="Association_0xonsp5" sourceRef="Activity_0nwtf8o" targetRef="TextAnnotation_1j1ytqy" /> - </bpmn:process> - <bpmn:process id="dsfdev_pong" isExecutable="false" camunda:versionTag="#{version}"> - <bpmn:startEvent id="PingMessageStartEvent" name="ping"> - <bpmn:outgoing>Flow_0huy3o3</bpmn:outgoing> - <bpmn:messageEventDefinition id="MessageEventDefinition_128t2ek" messageRef="Message_0u91abp" /> - </bpmn:startEvent> - <bpmn:exclusiveGateway id="Gateway_1jwjxzn" default="Flow_10z0d4x"> - <bpmn:incoming>Flow_0huy3o3</bpmn:incoming> - <bpmn:outgoing>Flow_10z0d4x</bpmn:outgoing> - <bpmn:outgoing>Flow_08gidyv</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:serviceTask id="Activity_095j2gg" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.DownloadResourceAndMeasureSpeed"> - <bpmn:incoming>Flow_10z0d4x</bpmn:incoming> - <bpmn:outgoing>Flow_0zphif7</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:serviceTask id="SelectPongTarget" name="Select Pong Target" camunda:class="dev.dsf.bpe.service.SelectPongTarget"> - <bpmn:incoming>Flow_061qpt4</bpmn:incoming> - <bpmn:outgoing>Flow_1eass2g</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:exclusiveGateway id="Gateway_1ggdr8l"> - <bpmn:incoming>Flow_08gidyv</bpmn:incoming> - <bpmn:incoming>Flow_0gvrnxd</bpmn:incoming> - <bpmn:outgoing>Flow_1o3n9u6</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:serviceTask id="LogPing" name="Log Ping" camunda:class="dev.dsf.bpe.service.LogPing"> - <bpmn:incoming>Flow_1o3n9u6</bpmn:incoming> - <bpmn:outgoing>Flow_061qpt4</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:sendTask id="Activity_005ywv2" name="Pong" camunda:class="dev.dsf.bpe.message.SendPong"> - <bpmn:extensionElements> - <camunda:field name="instantiatesCanonical"> - <camunda:string>http://dsf.dev/bpe/Process/ping|#{version}</camunda:string> - </camunda:field> - <camunda:field name="messageName"> - <camunda:string>pong</camunda:string> - </camunda:field> - <camunda:field name="profile"> - <camunda:string>http://dsf.dev/fhir/StructureDefinition/task-pong|#{version}</camunda:string> - </camunda:field> - </bpmn:extensionElements> - <bpmn:incoming>Flow_1eass2g</bpmn:incoming> - <bpmn:outgoing>Flow_0fzmjzb</bpmn:outgoing> - </bpmn:sendTask> - <bpmn:exclusiveGateway id="Gateway_0eiy9fm" default="Flow_00t1ck1"> - <bpmn:incoming>Flow_0fzmjzb</bpmn:incoming> - <bpmn:outgoing>Flow_0h8flp6</bpmn:outgoing> - <bpmn:outgoing>Flow_1bzjspe</bpmn:outgoing> - <bpmn:outgoing>Flow_00t1ck1</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:serviceTask id="Activity_0t0ex36" name="Log And Store Send Error" camunda:class="dev.dsf.bpe.service.LogAndStoreSendError"> - <bpmn:incoming>Flow_0h8flp6</bpmn:incoming> - <bpmn:outgoing>Flow_05ucfds</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:eventBasedGateway id="Gateway_1l5dkpz"> - <bpmn:incoming>Flow_1bzjspe</bpmn:incoming> - <bpmn:outgoing>Flow_0rj915n</bpmn:outgoing> - <bpmn:outgoing>Flow_17x98wg</bpmn:outgoing> - </bpmn:eventBasedGateway> - <bpmn:intermediateCatchEvent id="Event_1xvd4tr" name="Cleanup"> - <bpmn:incoming>Flow_0rj915n</bpmn:incoming> - <bpmn:outgoing>Flow_0cl2bet</bpmn:outgoing> - <bpmn:messageEventDefinition id="MessageEventDefinition_1o3wlnx" messageRef="Message_2m36ftq" /> - </bpmn:intermediateCatchEvent> - <bpmn:intermediateCatchEvent id="Event_0o4l2t4"> - <bpmn:incoming>Flow_17x98wg</bpmn:incoming> - <bpmn:outgoing>Flow_0wy02qe</bpmn:outgoing> - <bpmn:timerEventDefinition id="TimerEventDefinition_0a3j29a"> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">${cleanupTimerDuration}</bpmn:timeDuration> - </bpmn:timerEventDefinition> - </bpmn:intermediateCatchEvent> - <bpmn:exclusiveGateway id="Gateway_1uvkqh3"> - <bpmn:incoming>Flow_05ucfds</bpmn:incoming> - <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> - <bpmn:outgoing>Flow_1qzb40k</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:endEvent id="Event_0i1din5"> - <bpmn:incoming>Flow_1qzb40k</bpmn:incoming> - <bpmn:incoming>Flow_1qg0rto</bpmn:incoming> - </bpmn:endEvent> - <bpmn:exclusiveGateway id="Gateway_0fvmtve"> - <bpmn:incoming>Flow_1jehvly</bpmn:incoming> - <bpmn:incoming>Flow_0zphif7</bpmn:incoming> - <bpmn:outgoing>Flow_0x7t1ii</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:serviceTask id="Activity_1umihbr" name="Log and Save And Store Error" camunda:class="dev.dsf.bpe.service.LogAndSaveAndStoreError"> - <bpmn:incoming>Flow_0uj7rm3</bpmn:incoming> - <bpmn:outgoing>Flow_1jehvly</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:endEvent id="Event_1qh25on"> - <bpmn:incoming>Flow_0yr2pmf</bpmn:incoming> - </bpmn:endEvent> - <bpmn:serviceTask id="Activity_0otptjn" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> - <bpmn:incoming>Flow_0wy02qe</bpmn:incoming> - <bpmn:incoming>Flow_165e73u</bpmn:incoming> - <bpmn:outgoing>Flow_1qg0rto</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0mwyelp" name="Store Download Speeds" camunda:class="dev.dsf.bpe.service.StoreDownloadSpeeds"> - <bpmn:incoming>Flow_0cl2bet</bpmn:incoming> - <bpmn:outgoing>Flow_165e73u</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:boundaryEvent id="SelectPongTargetErrorBoundaryEvent" name="target not allowed" attachedToRef="SelectPongTarget"> - <bpmn:outgoing>Flow_0yr2pmf</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0ty7e1r" errorRef="Error_1j0t9ud" /> - </bpmn:boundaryEvent> - <bpmn:boundaryEvent id="Event_0olr5yw" name="Invalid Resource Reference" attachedToRef="Activity_095j2gg"> - <bpmn:outgoing>Flow_0uj7rm3</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0h8zmzk" errorRef="Error_1jmenbm" /> - </bpmn:boundaryEvent> - <bpmn:sequenceFlow id="Flow_10z0d4x" sourceRef="Gateway_1jwjxzn" targetRef="Activity_095j2gg" /> - <bpmn:sequenceFlow id="Flow_08gidyv" sourceRef="Gateway_1jwjxzn" targetRef="Gateway_1ggdr8l"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSize < 0}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_0zphif7" sourceRef="Activity_095j2gg" targetRef="Gateway_0fvmtve" /> - <bpmn:sequenceFlow id="Flow_061qpt4" sourceRef="LogPing" targetRef="SelectPongTarget" /> - <bpmn:sequenceFlow id="Flow_1eass2g" sourceRef="SelectPongTarget" targetRef="Activity_005ywv2" /> - <bpmn:sequenceFlow id="Flow_1o3n9u6" sourceRef="Gateway_1ggdr8l" targetRef="LogPing" /> - <bpmn:sequenceFlow id="Flow_0gvrnxd" sourceRef="Activity_0xcqxjs" targetRef="Gateway_1ggdr8l" /> - <bpmn:sequenceFlow id="Flow_0fzmjzb" sourceRef="Activity_005ywv2" targetRef="Gateway_0eiy9fm" /> - <bpmn:sequenceFlow id="Flow_0h8flp6" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0t0ex36"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'not-reachable'}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_1bzjspe" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1l5dkpz"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${bidirectionalResourceDownload == true}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_00t1ck1" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1uvkqh3" /> - <bpmn:sequenceFlow id="Flow_05ucfds" sourceRef="Activity_0t0ex36" targetRef="Gateway_1uvkqh3" /> - <bpmn:sequenceFlow id="Flow_0rj915n" sourceRef="Gateway_1l5dkpz" targetRef="Event_1xvd4tr" /> - <bpmn:sequenceFlow id="Flow_17x98wg" sourceRef="Gateway_1l5dkpz" targetRef="Event_0o4l2t4" /> - <bpmn:sequenceFlow id="Flow_0cl2bet" sourceRef="Event_1xvd4tr" targetRef="Activity_0mwyelp" /> - <bpmn:sequenceFlow id="Flow_0wy02qe" sourceRef="Event_0o4l2t4" targetRef="Activity_0otptjn" /> - <bpmn:sequenceFlow id="Flow_1qzb40k" sourceRef="Gateway_1uvkqh3" targetRef="Event_0i1din5" /> - <bpmn:sequenceFlow id="Flow_1qg0rto" sourceRef="Activity_0otptjn" targetRef="Event_0i1din5" /> - <bpmn:sequenceFlow id="Flow_1jehvly" sourceRef="Activity_1umihbr" targetRef="Gateway_0fvmtve" /> - <bpmn:sequenceFlow id="Flow_0x7t1ii" sourceRef="Gateway_0fvmtve" targetRef="Activity_1m4wavi" /> - <bpmn:sequenceFlow id="Flow_0uj7rm3" sourceRef="Event_0olr5yw" targetRef="Activity_1umihbr" /> - <bpmn:sequenceFlow id="Flow_03hviat" sourceRef="Activity_04mv5cn" targetRef="Activity_0xcqxjs" /> - <bpmn:sequenceFlow id="Flow_1w09zt7" sourceRef="Activity_1m4wavi" targetRef="Activity_04mv5cn" /> - <bpmn:sequenceFlow id="Flow_0yr2pmf" sourceRef="SelectPongTargetErrorBoundaryEvent" targetRef="Event_1qh25on" /> - <bpmn:sequenceFlow id="Flow_165e73u" sourceRef="Activity_0mwyelp" targetRef="Activity_0otptjn" /> - <bpmn:sequenceFlow id="Flow_0huy3o3" sourceRef="PingMessageStartEvent" targetRef="Gateway_1jwjxzn" /> - <bpmn:serviceTask id="Activity_04mv5cn" name="Store Resource" camunda:class="dev.dsf.bpe.service.StoreResource"> - <bpmn:incoming>Flow_1w09zt7</bpmn:incoming> - <bpmn:outgoing>Flow_03hviat</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_1m4wavi" name="Generate Resource" camunda:class="dev.dsf.bpe.service.GenerateResource"> - <bpmn:incoming>Flow_0x7t1ii</bpmn:incoming> - <bpmn:outgoing>Flow_1w09zt7</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0xcqxjs" name="Estimate Cleanup Timer Duration" camunda:class="dev.dsf.bpe.service.EstimateCleanupTimerDuration"> - <bpmn:incoming>Flow_03hviat</bpmn:incoming> - <bpmn:outgoing>Flow_0gvrnxd</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:textAnnotation id="TextAnnotation_1cled7l"> - <bpmn:text>downloads up to maxDownloadSizeBytes</bpmn:text> - </bpmn:textAnnotation> - <bpmn:textAnnotation id="TextAnnotation_1o7v81w"> - <bpmn:text>Information in message: -- downloadedResourceHash: String -- downloadedBytes: long -- downloadedDurationMillis: long -- downloadResourceReference: Reference -- downloadResourceHash: String -- errors: List</bpmn:text> - </bpmn:textAnnotation> - <bpmn:textAnnotation id="TextAnnotation_17fzn7d"> - <bpmn:text>Cleanup steps: -- delete generated resource</bpmn:text> - </bpmn:textAnnotation> - <bpmn:textAnnotation id="TextAnnotation_1bv3jri"> - <bpmn:text>Estimation based on download duration e.g. 10x or 20x download duration</bpmn:text> - </bpmn:textAnnotation> - <bpmn:textAnnotation id="TextAnnotation_1mo7foe"> - <bpmn:text>generates up to maxUploadSizeBystes</bpmn:text> - </bpmn:textAnnotation> - <bpmn:association id="Association_18psz8j" sourceRef="Activity_095j2gg" targetRef="TextAnnotation_1cled7l" /> - <bpmn:association id="Association_1py3u4x" sourceRef="Activity_005ywv2" targetRef="TextAnnotation_1o7v81w" /> - <bpmn:association id="Association_05fync1" sourceRef="Activity_0otptjn" targetRef="TextAnnotation_17fzn7d" /> - <bpmn:textAnnotation id="TextAnnotation_14ea4yc"> - <bpmn:text>Process Parameters -- downloadResourceSize read from Input Paramater (no default, value from message expected) -- maxDownloadSizeBytes read from environment variable (default tbd) -- maxUpdloadSizeBytes read from environment variables (default tbd)</bpmn:text> - </bpmn:textAnnotation> - <bpmn:association id="Association_1thj094" sourceRef="TextAnnotation_1mo7foe" targetRef="Activity_1m4wavi" /> - <bpmn:association id="Association_0wskzb7" sourceRef="Activity_0xcqxjs" targetRef="TextAnnotation_1bv3jri" /> - </bpmn:process> - <bpmn:message id="Message_1pklz6t" name="startPing" /> - <bpmn:message id="Message_10o3b8y" name="pong" /> - <bpmn:message id="Message_0u91abp" name="ping" /> - <bpmn:message id="Message_1h0kvyq" name="pong" /> - <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> - <bpmn:error id="Error_1jmenbm" name="invalid_resource_refernece" errorCode="invalid_resource_refernece" /> - <bpmn:message id="Message_2m36ftq" name="cleanupPong" /> - <bpmn:error id="Error_0tcstii" name="faulty_configuration" errorCode="faulty_configuration" /> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_03vipzx"> - <bpmndi:BPMNShape id="Participant_0vkpj55_di" bpmnElement="Participant_0vkpj55" isHorizontal="true"> - <dc:Bounds x="160" y="260" width="3180" height="680" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_1dlqln5_di" bpmnElement="StartPingMessageStartEvent"> - <dc:Bounds x="212" y="482" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="211" y="525" width="44" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0xw5i5v_di" bpmnElement="Gateway_0xw5i5v" isMarkerVisible="true"> - <dc:Bounds x="415" y="475" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1cxtndb_di" bpmnElement="SelectPingTargets"> - <dc:Bounds x="880" y="460" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0bifi5h_di" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> - <dc:Bounds x="795" y="475" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1rdxonv_di" bpmnElement="EndEvent"> - <dc:Bounds x="3262" y="492" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0911i44_di" bpmnElement="SaveResults"> - <dc:Bounds x="3140" y="470" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1od3gkp_di" bpmnElement="Activity_0802w0b"> - <dc:Bounds x="3010" y="470" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1r4mggo_di" bpmnElement="Activity_0nwtf8o"> - <dc:Bounds x="510" y="600" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0hnexfq_di" bpmnElement="Activity_16rb6hc"> - <dc:Bounds x="670" y="600" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="SubProcess_0szmntn_di" bpmnElement="SubProcess" isExpanded="true"> - <dc:Bounds x="1020" y="320" width="1930" height="560" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_18et3pb_di" bpmnElement="SubProcessStartEvent"> - <dc:Bounds x="1042" y="482" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0aaw2ua_di" bpmnElement="PongTimer"> - <dc:Bounds x="1492" y="572" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1493" y="615" width="34" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_06513nm_di" bpmnElement="PongCatchEvent"> - <dc:Bounds x="1692" y="482" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1697" y="458" width="26" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0bytr1u_di" bpmnElement="EventBasedGateway"> - <dc:Bounds x="1395" y="475" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0byox2n_di" bpmnElement="LogNoResponse"> - <dc:Bounds x="1580" y="550" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0z5gz96_di" bpmnElement="Gateway_0z5gz96" isMarkerVisible="true"> - <dc:Bounds x="1295" y="475" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0fsyyez" bpmnElement="LogSendError"> - <dc:Bounds x="1580" y="640" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_09z7b0z_di" bpmnElement="Gateway_09z7b0z" isMarkerVisible="true"> - <dc:Bounds x="1735" y="565" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1hv2lel_di" bpmnElement="SubProcessEndEvent"> - <dc:Bounds x="1842" y="572" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1h2feef_di" bpmnElement="Activity_0ri6fnv"> - <dc:Bounds x="1150" y="460" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0p0be0a_di" bpmnElement="Gateway_0p0be0a" isMarkerVisible="true"> - <dc:Bounds x="1945" y="475" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_08msjg0_di" bpmnElement="Activity_0h9o9u7"> - <dc:Bounds x="2050" y="620" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0wpjcyj_di" bpmnElement="Activity_0vw65a2"> - <dc:Bounds x="2490" y="620" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_01ca7r3_di" bpmnElement="Activity_0akr23c"> - <dc:Bounds x="2190" y="740" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_02orad4_di" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> - <dc:Bounds x="2615" y="475" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0s0p7on_di" bpmnElement="Activity_0i9uqk0"> - <dc:Bounds x="2730" y="460" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1foycg9_di" bpmnElement="Event_1foycg9"> - <dc:Bounds x="2892" y="482" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_0uc8utt_di" bpmnElement="TextAnnotation_0uc8utt"> - <dc:Bounds x="1250" y="360" width="250" height="70" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_0smygq5_di" bpmnElement="TextAnnotation_0smygq5"> - <dc:Bounds x="2640" y="752" width="239.99152587125295" height="68.9655172413793" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1toldj9" bpmnElement="TextAnnotation_08ic0l2"> - <dc:Bounds x="1960" y="762" width="170" height="37" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0i4slcz_di" bpmnElement="Event_0i4slcz"> - <dc:Bounds x="2132" y="682" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2178" y="686" width="83" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Flow_0y9usku_di" bpmnElement="Flow_0y9usku"> - <di:waypoint x="1420" y="525" /> - <di:waypoint x="1420" y="590" /> - <di:waypoint x="1492" y="590" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1fjeq2h_di" bpmnElement="Flow_1fjeq2h"> - <di:waypoint x="1528" y="590" /> - <di:waypoint x="1580" y="590" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1lghrxh_di" bpmnElement="Flow_1lghrxh"> - <di:waypoint x="1445" y="500" /> - <di:waypoint x="1692" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_03hkxbe_di" bpmnElement="Flow_03hkxbe"> - <di:waypoint x="1728" y="500" /> - <di:waypoint x="1945" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1j54c2s_di" bpmnElement="Flow_1j54c2s"> - <di:waypoint x="1345" y="500" /> - <di:waypoint x="1395" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_136htek_di" bpmnElement="Flow_136htek"> - <di:waypoint x="1680" y="590" /> - <di:waypoint x="1735" y="590" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_101sqed_di" bpmnElement="Flow_101sqed"> - <di:waypoint x="1320" y="525" /> - <di:waypoint x="1320" y="680" /> - <di:waypoint x="1580" y="680" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1245" y="646" width="70" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_16ssf4a_di" bpmnElement="Flow_16ssf4a"> - <di:waypoint x="1680" y="680" /> - <di:waypoint x="1760" y="680" /> - <di:waypoint x="1760" y="615" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1ho1hys_di" bpmnElement="Flow_1ho1hys"> - <di:waypoint x="1785" y="590" /> - <di:waypoint x="1842" y="590" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_10epxa2_di" bpmnElement="Flow_10epxa2"> - <di:waypoint x="1078" y="500" /> - <di:waypoint x="1150" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_08vgmf6_di" bpmnElement="Flow_08vgmf6"> - <di:waypoint x="1250" y="500" /> - <di:waypoint x="1295" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1yt9547_di" bpmnElement="Flow_1yt9547"> - <di:waypoint x="1970" y="525" /> - <di:waypoint x="1970" y="660" /> - <di:waypoint x="2050" y="660" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_10h6pqh_di" bpmnElement="Flow_10h6pqh"> - <di:waypoint x="2150" y="718" /> - <di:waypoint x="2150" y="780" /> - <di:waypoint x="2190" y="780" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_13u1nzy_di" bpmnElement="Flow_13u1nzy"> - <di:waypoint x="1995" y="500" /> - <di:waypoint x="2615" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0v6axlv_di" bpmnElement="Flow_0v6axlv"> - <di:waypoint x="2830" y="500" /> - <di:waypoint x="2892" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0pj6d62_di" bpmnElement="Flow_0pj6d62"> - <di:waypoint x="2590" y="660" /> - <di:waypoint x="2640" y="660" /> - <di:waypoint x="2640" y="525" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_03nx6rk_di" bpmnElement="Flow_03nx6rk"> - <di:waypoint x="2665" y="500" /> - <di:waypoint x="2730" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1c7vgba_di" bpmnElement="Association_1c7vgba"> - <di:waypoint x="1232" y="460" /> - <di:waypoint x="1256" y="430" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_14iteoh_di" bpmnElement="Association_14iteoh"> - <di:waypoint x="2590" y="690" /> - <di:waypoint x="2696" y="752" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_0l3n1oc_di" bpmnElement="Association_0l3n1oc"> - <di:waypoint x="2054" y="762" /> - <di:waypoint x="2082" y="700" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1v37fff_di" bpmnElement="Flow_1v37fff"> - <di:waypoint x="2150" y="660" /> - <di:waypoint x="2490" y="660" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0jcfur3_di" bpmnElement="Flow_0jcfur3"> - <di:waypoint x="2290" y="780" /> - <di:waypoint x="2390" y="780" /> - <di:waypoint x="2390" y="660" /> - <di:waypoint x="2490" y="660" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="BPMNShape_1rycpp0" bpmnElement="TextAnnotation_1plclrb"> - <dc:Bounds x="3010" y="630" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_0dhecha_di" bpmnElement="TextAnnotation_0dhecha"> - <dc:Bounds x="380" y="360" width="419.9974036141997" height="68.9655172413793" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1j1ytqy_di" bpmnElement="TextAnnotation_1j1ytqy"> - <dc:Bounds x="410" y="720" width="170" height="40" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1ig0151_di" bpmnElement="TextAnnotation_1ig0151"> - <dc:Bounds x="3080" y="379" width="160" height="49" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Association_0xonsp5_di" bpmnElement="Association_0xonsp5"> - <di:waypoint x="519" y="680" /> - <di:waypoint x="478" y="720" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0iuuyo1_di" bpmnElement="Flow_0iuuyo1"> - <di:waypoint x="465" y="500" /> - <di:waypoint x="795" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_152nb9r_di" bpmnElement="Flow_152nb9r"> - <di:waypoint x="440" y="525" /> - <di:waypoint x="440" y="640" /> - <di:waypoint x="510" y="640" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1qz7z39_di" bpmnElement="Flow_1qz7z39"> - <di:waypoint x="610" y="640" /> - <di:waypoint x="670" y="640" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1c15ef2_di" bpmnElement="Flow_1c15ef2"> - <di:waypoint x="845" y="500" /> - <di:waypoint x="880" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0j92st0_di" bpmnElement="Flow_0j92st0"> - <di:waypoint x="980" y="500" /> - <di:waypoint x="1020" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0m0hq4h_di" bpmnElement="Flow_0m0hq4h"> - <di:waypoint x="770" y="640" /> - <di:waypoint x="820" y="640" /> - <di:waypoint x="820" y="525" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1du5wys_di" bpmnElement="Flow_1du5wys"> - <di:waypoint x="3240" y="510" /> - <di:waypoint x="3262" y="510" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0gubpgz_di" bpmnElement="Flow_0gubpgz"> - <di:waypoint x="3110" y="510" /> - <di:waypoint x="3140" y="510" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1bfs68o_di" bpmnElement="Flow_1bfs68o"> - <di:waypoint x="2950" y="510" /> - <di:waypoint x="3010" y="510" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0fpikty_di" bpmnElement="Flow_0fpikty"> - <di:waypoint x="248" y="500" /> - <di:waypoint x="415" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1f86scd_di" bpmnElement="Association_1f86scd"> - <di:waypoint x="3103" y="630" /> - <di:waypoint x="3074" y="550" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_02mkojs_di" bpmnElement="Association_02mkojs"> - <di:waypoint x="3169" y="470" /> - <di:waypoint x="3148" y="428" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="Participant_0eb6dp7_di" bpmnElement="Participant_0eb6dp7" isHorizontal="true"> - <dc:Bounds x="160" y="1020" width="2710" height="517" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> - <dc:Bounds x="222" y="1149" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="230" y="1192" width="21" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_1jwjxzn_di" bpmnElement="Gateway_1jwjxzn" isMarkerVisible="true"> - <dc:Bounds x="505" y="1142" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_095j2gg_di" bpmnElement="Activity_095j2gg"> - <dc:Bounds x="580" y="1277" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0ko681m_di" bpmnElement="SelectPongTarget"> - <dc:Bounds x="1710" y="1127" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1r1hob1" bpmnElement="Gateway_1ggdr8l" isMarkerVisible="true"> - <dc:Bounds x="1495" y="1142" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1lhkmjw" bpmnElement="LogPing"> - <dc:Bounds x="1590" y="1127" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1h1lrei_di" bpmnElement="Activity_005ywv2"> - <dc:Bounds x="1890" y="1127" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0eiy9fm_di" bpmnElement="Gateway_0eiy9fm" isMarkerVisible="true"> - <dc:Bounds x="2075" y="1142" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_02b3m47_di" bpmnElement="Activity_0t0ex36"> - <dc:Bounds x="2190" y="1127" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_12p2jrx_di" bpmnElement="Gateway_1l5dkpz"> - <dc:Bounds x="2075" y="1242" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1xvd4tr_di" bpmnElement="Event_1xvd4tr"> - <dc:Bounds x="2322" y="1249" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2321" y="1295" width="42" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0o4l2t4_di" bpmnElement="Event_0o4l2t4"> - <dc:Bounds x="2322" y="1339" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_1uvkqh3_di" bpmnElement="Gateway_1uvkqh3" isMarkerVisible="true"> - <dc:Bounds x="2385" y="1142" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> - <dc:Bounds x="2682" y="1149" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> - <dc:Bounds x="885" y="1292" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1imd3tw_di" bpmnElement="Activity_1umihbr"> - <dc:Bounds x="770" y="1397" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_05zzvx3_di" bpmnElement="Event_1qh25on"> - <dc:Bounds x="1792" y="1452" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> - <dc:Bounds x="2570" y="1227" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1xbj20p_di" bpmnElement="Activity_0mwyelp"> - <dc:Bounds x="2410" y="1227" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1cled7l_di" bpmnElement="TextAnnotation_1cled7l"> - <dc:Bounds x="630" y="1210" width="170" height="37" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> - <dc:Bounds x="1840" y="1296" width="250" height="112.9996081504702" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> - <dc:Bounds x="2610" y="1390" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> - <dc:Bounds x="1350" y="1400" width="275" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> - <dc:Bounds x="970" y="1401" width="170" height="40" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1bdbmbf" bpmnElement="TextAnnotation_14ea4yc"> - <dc:Bounds x="330" y="1040" width="584.9987257236971" height="68.9655172413793" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1ouj7x3_di" bpmnElement="Activity_04mv5cn"> - <dc:Bounds x="1180" y="1277" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1m4wavi_di" bpmnElement="Activity_1m4wavi"> - <dc:Bounds x="1020" y="1277" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_06klx97_di" bpmnElement="Activity_0xcqxjs"> - <dc:Bounds x="1340" y="1277" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> - <di:waypoint x="1058" y="1401" /> - <di:waypoint x="1064" y="1357" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> - <di:waypoint x="1394" y="1357" /> - <di:waypoint x="1399" y="1400" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="BPMNShape_14ee8kb" bpmnElement="Event_0olr5yw"> - <dc:Bounds x="662" y="1339" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="699" y="1373" width="83" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> - <dc:Bounds x="1792" y="1189" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1829" y="1220" width="87" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> - <di:waypoint x="530" y="1192" /> - <di:waypoint x="530" y="1317" /> - <di:waypoint x="580" y="1317" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_08gidyv_di" bpmnElement="Flow_08gidyv"> - <di:waypoint x="555" y="1167" /> - <di:waypoint x="1495" y="1167" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0zphif7_di" bpmnElement="Flow_0zphif7"> - <di:waypoint x="680" y="1317" /> - <di:waypoint x="885" y="1317" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_061qpt4_di" bpmnElement="Flow_061qpt4"> - <di:waypoint x="1690" y="1167" /> - <di:waypoint x="1710" y="1167" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1eass2g_di" bpmnElement="Flow_1eass2g"> - <di:waypoint x="1810" y="1167" /> - <di:waypoint x="1890" y="1167" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1o3n9u6_di" bpmnElement="Flow_1o3n9u6"> - <di:waypoint x="1545" y="1167" /> - <di:waypoint x="1590" y="1167" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0gvrnxd_di" bpmnElement="Flow_0gvrnxd"> - <di:waypoint x="1440" y="1317" /> - <di:waypoint x="1520" y="1317" /> - <di:waypoint x="1520" y="1192" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0fzmjzb_di" bpmnElement="Flow_0fzmjzb"> - <di:waypoint x="1990" y="1167" /> - <di:waypoint x="2075" y="1167" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0h8flp6_di" bpmnElement="Flow_0h8flp6"> - <di:waypoint x="2125" y="1167" /> - <di:waypoint x="2190" y="1167" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1bzjspe_di" bpmnElement="Flow_1bzjspe"> - <di:waypoint x="2100" y="1192" /> - <di:waypoint x="2100" y="1242" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_00t1ck1_di" bpmnElement="Flow_00t1ck1"> - <di:waypoint x="2100" y="1142" /> - <di:waypoint x="2100" y="1107" /> - <di:waypoint x="2410" y="1107" /> - <di:waypoint x="2410" y="1142" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_05ucfds_di" bpmnElement="Flow_05ucfds"> - <di:waypoint x="2290" y="1167" /> - <di:waypoint x="2385" y="1167" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0rj915n_di" bpmnElement="Flow_0rj915n"> - <di:waypoint x="2125" y="1267" /> - <di:waypoint x="2322" y="1267" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_17x98wg_di" bpmnElement="Flow_17x98wg"> - <di:waypoint x="2100" y="1292" /> - <di:waypoint x="2100" y="1357" /> - <di:waypoint x="2322" y="1357" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0cl2bet_di" bpmnElement="Flow_0cl2bet"> - <di:waypoint x="2358" y="1267" /> - <di:waypoint x="2410" y="1267" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0wy02qe_di" bpmnElement="Flow_0wy02qe"> - <di:waypoint x="2358" y="1357" /> - <di:waypoint x="2620" y="1357" /> - <di:waypoint x="2620" y="1307" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1qzb40k_di" bpmnElement="Flow_1qzb40k"> - <di:waypoint x="2435" y="1167" /> - <di:waypoint x="2682" y="1167" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1qg0rto_di" bpmnElement="Flow_1qg0rto"> - <di:waypoint x="2670" y="1267" /> - <di:waypoint x="2700" y="1267" /> - <di:waypoint x="2700" y="1185" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> - <di:waypoint x="870" y="1437" /> - <di:waypoint x="910" y="1437" /> - <di:waypoint x="910" y="1342" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0x7t1ii_di" bpmnElement="Flow_0x7t1ii"> - <di:waypoint x="935" y="1317" /> - <di:waypoint x="1020" y="1317" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0uj7rm3_di" bpmnElement="Flow_0uj7rm3"> - <di:waypoint x="680" y="1375" /> - <di:waypoint x="680" y="1437" /> - <di:waypoint x="770" y="1437" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_03hviat_di" bpmnElement="Flow_03hviat"> - <di:waypoint x="1280" y="1317" /> - <di:waypoint x="1340" y="1317" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> - <di:waypoint x="1120" y="1317" /> - <di:waypoint x="1180" y="1317" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0yr2pmf_di" bpmnElement="Flow_0yr2pmf"> - <di:waypoint x="1810" y="1225" /> - <di:waypoint x="1810" y="1452" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_165e73u_di" bpmnElement="Flow_165e73u"> - <di:waypoint x="2510" y="1267" /> - <di:waypoint x="2570" y="1267" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0huy3o3_di" bpmnElement="Flow_0huy3o3"> - <di:waypoint x="258" y="1167" /> - <di:waypoint x="505" y="1167" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> - <di:waypoint x="652" y="1277" /> - <di:waypoint x="668" y="1247" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> - <di:waypoint x="1926" y="1207" /> - <di:waypoint x="1895" y="1296" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2632" y="1307" /> - <di:waypoint x="2656" y="1390" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="Participant_16l0acs_di" bpmnElement="Participant_16l0acs" isHorizontal="true" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> - <dc:Bounds x="160" y="80" width="540" height="160" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Flow_1tu7djj_di" bpmnElement="Flow_1tu7djj"> - <di:waypoint x="1200" y="540" /> - <di:waypoint x="1200" y="980" /> - <di:waypoint x="240" y="980" /> - <di:waypoint x="240" y="1149" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1eqeb94_di" bpmnElement="Flow_1eqeb94"> - <di:waypoint x="1940" y="1127" /> - <di:waypoint x="1940" y="980" /> - <di:waypoint x="1710" y="980" /> - <di:waypoint x="1710" y="518" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_12wvay9_di" bpmnElement="Flow_12wvay9"> - <di:waypoint x="2540" y="700" /> - <di:waypoint x="2540" y="980" /> - <di:waypoint x="2340" y="980" /> - <di:waypoint x="2340" y="1249" /> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn new file mode 100644 index 00000000..a361ab31 --- /dev/null +++ b/src/main/resources/bpe/ping.bpmn @@ -0,0 +1,521 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0abzurc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.17.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.20.0"> + <bpmn:message id="Message_1pklz6t" name="startPing" /> + <bpmn:message id="Message_10o3b8y" name="pong" /> + <bpmn:error id="Error_1jmenbm" name="invalid_resource_refernece" errorCode="invalid_resource_refernece" /> + <bpmn:process id="dsfdev_ping" isExecutable="true" camunda:versionTag="#{version}" camunda:historyTimeToLive="180"> + <bpmn:subProcess id="SubProcess"> + <bpmn:incoming>Flow_0j92st0</bpmn:incoming> + <bpmn:outgoing>Flow_1bfs68o</bpmn:outgoing> + <bpmn:multiInstanceLoopCharacteristics camunda:asyncBefore="true" camunda:exclusive="false" camunda:collection="${targets.entries}" camunda:elementVariable="target"> + <bpmn:extensionElements> + <camunda:failedJobRetryTimeCycle>R3/PT5S</camunda:failedJobRetryTimeCycle> + </bpmn:extensionElements> + </bpmn:multiInstanceLoopCharacteristics> + <bpmn:startEvent id="SubProcessStartEvent"> + <bpmn:outgoing>Flow_10epxa2</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:intermediateCatchEvent id="PongTimer" name="PT20S"> + <bpmn:incoming>Flow_0y9usku</bpmn:incoming> + <bpmn:outgoing>Flow_1fjeq2h</bpmn:outgoing> + <bpmn:timerEventDefinition id="TimerEventDefinition_1mgy0vi"> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT20S</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:intermediateCatchEvent> + <bpmn:intermediateCatchEvent id="PongCatchEvent" name="Pong"> + <bpmn:incoming>Flow_1lghrxh</bpmn:incoming> + <bpmn:outgoing>Flow_03hkxbe</bpmn:outgoing> + <bpmn:messageEventDefinition id="MessageEventDefinition_0ismjkr" messageRef="Message_10o3b8y" /> + </bpmn:intermediateCatchEvent> + <bpmn:eventBasedGateway id="EventBasedGateway"> + <bpmn:extensionElements> + <camunda:executionListener class="dev.dsf.bpe.listener.SetCorrelationKeyListener" event="start" /> + </bpmn:extensionElements> + <bpmn:incoming>Flow_1j54c2s</bpmn:incoming> + <bpmn:outgoing>Flow_0y9usku</bpmn:outgoing> + <bpmn:outgoing>Flow_1lghrxh</bpmn:outgoing> + </bpmn:eventBasedGateway> + <bpmn:serviceTask id="LogNoResponse" name="Log and Save No Response" camunda:class="dev.dsf.bpe.service.LogAndSaveNoResponse"> + <bpmn:incoming>Flow_1fjeq2h</bpmn:incoming> + <bpmn:outgoing>Flow_136htek</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:exclusiveGateway id="Gateway_0z5gz96" default="Flow_1j54c2s"> + <bpmn:incoming>Flow_08vgmf6</bpmn:incoming> + <bpmn:outgoing>Flow_1j54c2s</bpmn:outgoing> + <bpmn:outgoing>Flow_101sqed</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:serviceTask id="LogSendError" name="Log and Save Send Error" camunda:class="dev.dsf.bpe.service.LogAndSaveSendError"> + <bpmn:incoming>Flow_101sqed</bpmn:incoming> + <bpmn:outgoing>Flow_16ssf4a</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:exclusiveGateway id="Gateway_09z7b0z"> + <bpmn:incoming>Flow_136htek</bpmn:incoming> + <bpmn:incoming>Flow_16ssf4a</bpmn:incoming> + <bpmn:outgoing>Flow_1ho1hys</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="SubProcessEndEvent" camunda:asyncAfter="true"> + <bpmn:extensionElements> + <camunda:failedJobRetryTimeCycle>R3/PT5S</camunda:failedJobRetryTimeCycle> + </bpmn:extensionElements> + <bpmn:incoming>Flow_1ho1hys</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sendTask id="Activity_0ri6fnv" name="Ping" camunda:class="dev.dsf.bpe.message.SendPing"> + <bpmn:extensionElements> + <camunda:field name="instantiatesCanonical"> + <camunda:string>http://dsf.dev/bpe/Process/pong|#{version}</camunda:string> + </camunda:field> + <camunda:field name="messageName"> + <camunda:string>ping</camunda:string> + </camunda:field> + <camunda:field name="profile"> + <camunda:string>http://dsf.dev/fhir/StructureDefinition/task-ping|#{version}</camunda:string> + </camunda:field> + </bpmn:extensionElements> + <bpmn:incoming>Flow_10epxa2</bpmn:incoming> + <bpmn:outgoing>Flow_08vgmf6</bpmn:outgoing> + </bpmn:sendTask> + <bpmn:exclusiveGateway id="Gateway_0p0be0a" default="Flow_1yt9547"> + <bpmn:incoming>Flow_03hkxbe</bpmn:incoming> + <bpmn:outgoing>Flow_13u1nzy</bpmn:outgoing> + <bpmn:outgoing>Flow_1yt9547</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:serviceTask id="Activity_0h9o9u7" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.DownloadResourceAndMeasureSpeed"> + <bpmn:incoming>Flow_1yt9547</bpmn:incoming> + <bpmn:outgoing>Flow_1v37fff</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sendTask id="Activity_0vw65a2" name="Cleanup Pong" camunda:class="dev.dsf.bpe.message.CleanupPong"> + <bpmn:incoming>Flow_1v37fff</bpmn:incoming> + <bpmn:incoming>Flow_0jcfur3</bpmn:incoming> + <bpmn:outgoing>Flow_0pj6d62</bpmn:outgoing> + </bpmn:sendTask> + <bpmn:serviceTask id="Activity_0akr23c" name="Log and Save Error" camunda:class="dev.dsf.bpe.service.LogAndSaveError"> + <bpmn:incoming>Flow_10h6pqh</bpmn:incoming> + <bpmn:outgoing>Flow_0jcfur3</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:exclusiveGateway id="Gateway_02orad4"> + <bpmn:incoming>Flow_13u1nzy</bpmn:incoming> + <bpmn:incoming>Flow_0pj6d62</bpmn:incoming> + <bpmn:outgoing>Flow_03nx6rk</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:serviceTask id="Activity_0i9uqk0" name="Save Download Speeds" camunda:class="dev.dsf.bpe.service.SaveDownloadSpeeds"> + <bpmn:incoming>Flow_03nx6rk</bpmn:incoming> + <bpmn:outgoing>Flow_0v6axlv</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="Event_1foycg9"> + <bpmn:incoming>Flow_0v6axlv</bpmn:incoming> + </bpmn:endEvent> + <bpmn:boundaryEvent id="Event_0i4slcz" name="Invalid Resource Reference" attachedToRef="Activity_0h9o9u7"> + <bpmn:outgoing>Flow_10h6pqh</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0f1pn8k" errorRef="Error_1jmenbm" /> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="Flow_10epxa2" sourceRef="SubProcessStartEvent" targetRef="Activity_0ri6fnv" /> + <bpmn:sequenceFlow id="Flow_0y9usku" sourceRef="EventBasedGateway" targetRef="PongTimer" /> + <bpmn:sequenceFlow id="Flow_1fjeq2h" sourceRef="PongTimer" targetRef="LogNoResponse" /> + <bpmn:sequenceFlow id="Flow_1lghrxh" sourceRef="EventBasedGateway" targetRef="PongCatchEvent" /> + <bpmn:sequenceFlow id="Flow_03hkxbe" sourceRef="PongCatchEvent" targetRef="Gateway_0p0be0a" /> + <bpmn:sequenceFlow id="Flow_1j54c2s" sourceRef="Gateway_0z5gz96" targetRef="EventBasedGateway" /> + <bpmn:sequenceFlow id="Flow_136htek" sourceRef="LogNoResponse" targetRef="Gateway_09z7b0z" /> + <bpmn:sequenceFlow id="Flow_08vgmf6" sourceRef="Activity_0ri6fnv" targetRef="Gateway_0z5gz96" /> + <bpmn:sequenceFlow id="Flow_101sqed" name="not-allowed or not-reachable" sourceRef="Gateway_0z5gz96" targetRef="LogSendError"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && (statusCode == 'not-allowed' || statusCode == 'not-reachable')}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_16ssf4a" sourceRef="LogSendError" targetRef="Gateway_09z7b0z" /> + <bpmn:sequenceFlow id="Flow_1ho1hys" sourceRef="Gateway_09z7b0z" targetRef="SubProcessEndEvent" /> + <bpmn:sequenceFlow id="Flow_13u1nzy" sourceRef="Gateway_0p0be0a" targetRef="Gateway_02orad4"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSize < 0}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_1yt9547" sourceRef="Gateway_0p0be0a" targetRef="Activity_0h9o9u7" /> + <bpmn:sequenceFlow id="Flow_1v37fff" sourceRef="Activity_0h9o9u7" targetRef="Activity_0vw65a2" /> + <bpmn:sequenceFlow id="Flow_0jcfur3" sourceRef="Activity_0akr23c" targetRef="Activity_0vw65a2" /> + <bpmn:sequenceFlow id="Flow_0pj6d62" sourceRef="Activity_0vw65a2" targetRef="Gateway_02orad4" /> + <bpmn:sequenceFlow id="Flow_10h6pqh" sourceRef="Event_0i4slcz" targetRef="Activity_0akr23c" /> + <bpmn:sequenceFlow id="Flow_03nx6rk" sourceRef="Gateway_02orad4" targetRef="Activity_0i9uqk0" /> + <bpmn:sequenceFlow id="Flow_0v6axlv" sourceRef="Activity_0i9uqk0" targetRef="Event_1foycg9" /> + <bpmn:textAnnotation id="TextAnnotation_0uc8utt"> + <bpmn:text>Information in message: +- dowloadResourceSize: long +- downloadResourceReference: Reference</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_0smygq5"> + <bpmn:text>Information in message: +- downloadDurationMillis: long +- bytesDownloaded: long +- hash validation result (both ways)</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_08ic0l2"> + <bpmn:text>downloads up to maxDownloadSizeBytes</bpmn:text> + </bpmn:textAnnotation> + <bpmn:association id="Association_1c7vgba" sourceRef="Activity_0ri6fnv" targetRef="TextAnnotation_0uc8utt" /> + <bpmn:association id="Association_14iteoh" sourceRef="Activity_0vw65a2" targetRef="TextAnnotation_0smygq5" /> + <bpmn:association id="Association_0l3n1oc" sourceRef="TextAnnotation_08ic0l2" targetRef="Activity_0h9o9u7" /> + </bpmn:subProcess> + <bpmn:serviceTask id="Activity_16rb6hc" name="Store Resource" camunda:class="dev.dsf.bpe.service.StoreResource"> + <bpmn:incoming>Flow_1qz7z39</bpmn:incoming> + <bpmn:outgoing>Flow_0m0hq4h</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Activity_0nwtf8o" name="Generate Resource" camunda:class="dev.dsf.bpe.service.GenerateResource"> + <bpmn:incoming>Flow_152nb9r</bpmn:incoming> + <bpmn:outgoing>Flow_1qz7z39</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Activity_0802w0b" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> + <bpmn:incoming>Flow_1bfs68o</bpmn:incoming> + <bpmn:outgoing>Flow_0gubpgz</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="SaveResults" name="Store Results" camunda:class="dev.dsf.bpe.service.StoreResults"> + <bpmn:incoming>Flow_0gubpgz</bpmn:incoming> + <bpmn:outgoing>Flow_1du5wys</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="EndEvent"> + <bpmn:incoming>Flow_1du5wys</bpmn:incoming> + </bpmn:endEvent> + <bpmn:exclusiveGateway id="Gateway_0bifi5h"> + <bpmn:incoming>Flow_0m0hq4h</bpmn:incoming> + <bpmn:incoming>Flow_0iuuyo1</bpmn:incoming> + <bpmn:outgoing>Flow_1c15ef2</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:serviceTask id="SelectPingTargets" name="Select Targets" camunda:class="dev.dsf.bpe.service.SelectPingTargets"> + <bpmn:incoming>Flow_1c15ef2</bpmn:incoming> + <bpmn:outgoing>Flow_0j92st0</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:exclusiveGateway id="Gateway_0xw5i5v" default="Flow_152nb9r"> + <bpmn:incoming>Flow_0fpikty</bpmn:incoming> + <bpmn:outgoing>Flow_152nb9r</bpmn:outgoing> + <bpmn:outgoing>Flow_0iuuyo1</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:startEvent id="StartPingMessageStartEvent" name="startPing"> + <bpmn:outgoing>Flow_0fpikty</bpmn:outgoing> + <bpmn:messageEventDefinition id="MessageEventDefinition_1t2j917" messageRef="Message_1pklz6t" /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="Flow_0j92st0" sourceRef="SelectPingTargets" targetRef="SubProcess" /> + <bpmn:sequenceFlow id="Flow_1bfs68o" sourceRef="SubProcess" targetRef="Activity_0802w0b" /> + <bpmn:sequenceFlow id="Flow_1qz7z39" sourceRef="Activity_0nwtf8o" targetRef="Activity_16rb6hc" /> + <bpmn:sequenceFlow id="Flow_0m0hq4h" sourceRef="Activity_16rb6hc" targetRef="Gateway_0bifi5h" /> + <bpmn:sequenceFlow id="Flow_152nb9r" sourceRef="Gateway_0xw5i5v" targetRef="Activity_0nwtf8o" /> + <bpmn:sequenceFlow id="Flow_0gubpgz" sourceRef="Activity_0802w0b" targetRef="SaveResults" /> + <bpmn:sequenceFlow id="Flow_1du5wys" sourceRef="SaveResults" targetRef="EndEvent" /> + <bpmn:sequenceFlow id="Flow_0iuuyo1" sourceRef="Gateway_0xw5i5v" targetRef="Gateway_0bifi5h"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSize < 0}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_1c15ef2" sourceRef="Gateway_0bifi5h" targetRef="SelectPingTargets" /> + <bpmn:sequenceFlow id="Flow_0fpikty" sourceRef="StartPingMessageStartEvent" targetRef="Gateway_0xw5i5v" /> + <bpmn:textAnnotation id="TextAnnotation_1ig0151"> + <bpmn:text>Includes download speeds and errors of all pongs</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_1j1ytqy"> + <bpmn:text>generates up to maxUploadSizeBystes</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_0dhecha"> + <bpmn:text>Process Parameters +- downloadResourceSize read from Input Paramater (default tbd) +- maxDownloadSizeBytes read from environment variable (default tbd) +- maxUpdloadSizeBytes read from environment variables (default tbd)</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_1plclrb"> + <bpmn:text>Cleanup steps: +- delete generated resource</bpmn:text> + </bpmn:textAnnotation> + <bpmn:association id="Association_0xonsp5" sourceRef="Activity_0nwtf8o" targetRef="TextAnnotation_1j1ytqy" /> + <bpmn:association id="Association_1f86scd" sourceRef="TextAnnotation_1plclrb" targetRef="Activity_0802w0b" /> + <bpmn:association id="Association_02mkojs" sourceRef="SaveResults" targetRef="TextAnnotation_1ig0151" /> + <bpmn:textAnnotation id="TextAnnotation_02e4h2c"> + <bpmn:text>Log = logger +Save = save as execution variable +Store = store on DSF FHIR server either as separate resource or output parameter</bpmn:text> + </bpmn:textAnnotation> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> + <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> + <dc:Bounds x="3030" y="239" width="160" height="49" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0o5toqz" bpmnElement="TextAnnotation_1j1ytqy"> + <dc:Bounds x="360" y="580" width="170" height="40" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ne04k7" bpmnElement="TextAnnotation_0dhecha"> + <dc:Bounds x="330" y="220" width="420" height="69" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> + <dc:Bounds x="2960" y="490" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> + <dc:Bounds x="160" y="80" width="420" height="70" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_06i4ly8" bpmnElement="Activity_16rb6hc"> + <dc:Bounds x="620" y="460" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0fhb8wi" bpmnElement="Activity_0nwtf8o"> + <dc:Bounds x="460" y="460" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> + <dc:Bounds x="2960" y="330" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> + <dc:Bounds x="3090" y="330" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> + <dc:Bounds x="3212" y="352" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ob9la3" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> + <dc:Bounds x="745" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0wi2en6" bpmnElement="SelectPingTargets"> + <dc:Bounds x="830" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1v2z49g" bpmnElement="Gateway_0xw5i5v" isMarkerVisible="true"> + <dc:Bounds x="365" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ydgq5s" bpmnElement="StartPingMessageStartEvent"> + <dc:Bounds x="162" y="342" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="161" y="385" width="44" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> + <dc:Bounds x="970" y="180" width="1930" height="560" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> + <dc:Bounds x="1200" y="220" width="250" height="70" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> + <dc:Bounds x="2590" y="612" width="240" height="69" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> + <dc:Bounds x="1910" y="622" width="170" height="37" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0qz7nye" bpmnElement="SubProcessStartEvent"> + <dc:Bounds x="992" y="342" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_13ugi24" bpmnElement="PongTimer"> + <dc:Bounds x="1442" y="432" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1443" y="475" width="34" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1xv73wh" bpmnElement="PongCatchEvent"> + <dc:Bounds x="1642" y="342" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1647" y="318" width="26" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_01k7kv3" bpmnElement="EventBasedGateway"> + <dc:Bounds x="1345" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0icju6y" bpmnElement="LogNoResponse"> + <dc:Bounds x="1530" y="410" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1ipvtcp" bpmnElement="Gateway_0z5gz96" isMarkerVisible="true"> + <dc:Bounds x="1245" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_06ufst4" bpmnElement="LogSendError"> + <dc:Bounds x="1530" y="500" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0zk1xt7" bpmnElement="Gateway_09z7b0z" isMarkerVisible="true"> + <dc:Bounds x="1685" y="425" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19as0g5" bpmnElement="SubProcessEndEvent"> + <dc:Bounds x="1792" y="432" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_004x7xw" bpmnElement="Activity_0ri6fnv"> + <dc:Bounds x="1100" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0gumkp5" bpmnElement="Gateway_0p0be0a" isMarkerVisible="true"> + <dc:Bounds x="1895" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_14o9c36" bpmnElement="Activity_0h9o9u7"> + <dc:Bounds x="2000" y="480" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1uxa2sw" bpmnElement="Activity_0vw65a2"> + <dc:Bounds x="2440" y="480" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0djpma6" bpmnElement="Activity_0akr23c"> + <dc:Bounds x="2140" y="600" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> + <dc:Bounds x="2565" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1ivv0nj" bpmnElement="Activity_0i9uqk0"> + <dc:Bounds x="2680" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> + <dc:Bounds x="2842" y="342" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> + <di:waypoint x="1182" y="320" /> + <di:waypoint x="1206" y="290" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> + <di:waypoint x="2540" y="550" /> + <di:waypoint x="2646" y="612" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> + <di:waypoint x="2004" y="622" /> + <di:waypoint x="2032" y="560" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="BPMNShape_0968qvb" bpmnElement="Event_0i4slcz"> + <dc:Bounds x="2082" y="542" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2128" y="546" width="83" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_1hlvqjb" bpmnElement="Flow_10epxa2"> + <di:waypoint x="1028" y="360" /> + <di:waypoint x="1100" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0gkyk6o" bpmnElement="Flow_0y9usku"> + <di:waypoint x="1370" y="385" /> + <di:waypoint x="1370" y="450" /> + <di:waypoint x="1442" y="450" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0gf051n" bpmnElement="Flow_1fjeq2h"> + <di:waypoint x="1478" y="450" /> + <di:waypoint x="1530" y="450" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_132kwps" bpmnElement="Flow_1lghrxh"> + <di:waypoint x="1395" y="360" /> + <di:waypoint x="1642" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_12u1pw1" bpmnElement="Flow_03hkxbe"> + <di:waypoint x="1678" y="360" /> + <di:waypoint x="1895" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1lwj0ih" bpmnElement="Flow_1j54c2s"> + <di:waypoint x="1295" y="360" /> + <di:waypoint x="1345" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1k895i8" bpmnElement="Flow_136htek"> + <di:waypoint x="1630" y="450" /> + <di:waypoint x="1685" y="450" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0z1aurb" bpmnElement="Flow_08vgmf6"> + <di:waypoint x="1200" y="360" /> + <di:waypoint x="1245" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0ffsn0i" bpmnElement="Flow_101sqed"> + <di:waypoint x="1270" y="385" /> + <di:waypoint x="1270" y="540" /> + <di:waypoint x="1530" y="540" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1195" y="506" width="70" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1va7dmx" bpmnElement="Flow_16ssf4a"> + <di:waypoint x="1630" y="540" /> + <di:waypoint x="1710" y="540" /> + <di:waypoint x="1710" y="475" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1ce9w6g" bpmnElement="Flow_1ho1hys"> + <di:waypoint x="1735" y="450" /> + <di:waypoint x="1792" y="450" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1iq5cwe" bpmnElement="Flow_13u1nzy"> + <di:waypoint x="1945" y="360" /> + <di:waypoint x="2565" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1skpxus" bpmnElement="Flow_1yt9547"> + <di:waypoint x="1920" y="385" /> + <di:waypoint x="1920" y="520" /> + <di:waypoint x="2000" y="520" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1omiu15" bpmnElement="Flow_1v37fff"> + <di:waypoint x="2100" y="520" /> + <di:waypoint x="2440" y="520" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1lmv30e" bpmnElement="Flow_0jcfur3"> + <di:waypoint x="2240" y="640" /> + <di:waypoint x="2340" y="640" /> + <di:waypoint x="2340" y="520" /> + <di:waypoint x="2440" y="520" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0dd7vlu" bpmnElement="Flow_0pj6d62"> + <di:waypoint x="2540" y="520" /> + <di:waypoint x="2590" y="520" /> + <di:waypoint x="2590" y="385" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1figpr1" bpmnElement="Flow_10h6pqh"> + <di:waypoint x="2100" y="578" /> + <di:waypoint x="2100" y="640" /> + <di:waypoint x="2140" y="640" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0v8dcpi" bpmnElement="Flow_03nx6rk"> + <di:waypoint x="2615" y="360" /> + <di:waypoint x="2680" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0ghffjh" bpmnElement="Flow_0v6axlv"> + <di:waypoint x="2780" y="360" /> + <di:waypoint x="2842" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> + <di:waypoint x="3119" y="330" /> + <di:waypoint x="3098" y="288" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> + <di:waypoint x="469" y="540" /> + <di:waypoint x="428" y="580" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> + <di:waypoint x="3053" y="490" /> + <di:waypoint x="3024" y="410" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1ttfs4u" bpmnElement="Flow_1qz7z39"> + <di:waypoint x="560" y="500" /> + <di:waypoint x="620" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_172mwqu" bpmnElement="Flow_0m0hq4h"> + <di:waypoint x="720" y="500" /> + <di:waypoint x="770" y="500" /> + <di:waypoint x="770" y="385" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0u9gpv1" bpmnElement="Flow_152nb9r"> + <di:waypoint x="390" y="385" /> + <di:waypoint x="390" y="500" /> + <di:waypoint x="460" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_036wiw0" bpmnElement="Flow_1bfs68o"> + <di:waypoint x="2900" y="370" /> + <di:waypoint x="2960" y="370" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1fbz0br" bpmnElement="Flow_0gubpgz"> + <di:waypoint x="3060" y="370" /> + <di:waypoint x="3090" y="370" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_00ieeud" bpmnElement="Flow_1du5wys"> + <di:waypoint x="3190" y="370" /> + <di:waypoint x="3212" y="370" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0t4fqb7" bpmnElement="Flow_0iuuyo1"> + <di:waypoint x="415" y="360" /> + <di:waypoint x="745" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1e1kjcl" bpmnElement="Flow_1c15ef2"> + <di:waypoint x="795" y="360" /> + <di:waypoint x="830" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_09zmq8d" bpmnElement="Flow_0j92st0"> + <di:waypoint x="930" y="360" /> + <di:waypoint x="970" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_11qkk0c" bpmnElement="Flow_0fpikty"> + <di:waypoint x="198" y="360" /> + <di:waypoint x="365" y="360" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn new file mode 100644 index 00000000..ba8924ea --- /dev/null +++ b/src/main/resources/bpe/pong.bpmn @@ -0,0 +1,454 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_127i10h" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.17.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.20.0"> + <bpmn:process id="dsfdev_pong" isExecutable="true" camunda:versionTag="#{version}" camunda:historyTimeToLive="180"> + <bpmn:startEvent id="PingMessageStartEvent" name="ping"> + <bpmn:outgoing>Flow_0huy3o3</bpmn:outgoing> + <bpmn:messageEventDefinition id="MessageEventDefinition_128t2ek" messageRef="Message_0u91abp" /> + </bpmn:startEvent> + <bpmn:exclusiveGateway id="Gateway_1jwjxzn" default="Flow_10z0d4x"> + <bpmn:incoming>Flow_0huy3o3</bpmn:incoming> + <bpmn:outgoing>Flow_10z0d4x</bpmn:outgoing> + <bpmn:outgoing>Flow_08gidyv</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:serviceTask id="Activity_095j2gg" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.DownloadResourceAndMeasureSpeed"> + <bpmn:incoming>Flow_10z0d4x</bpmn:incoming> + <bpmn:outgoing>Flow_0zphif7</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="SelectPongTarget" name="Select Pong Target" camunda:class="dev.dsf.bpe.service.SelectPongTarget"> + <bpmn:incoming>Flow_061qpt4</bpmn:incoming> + <bpmn:outgoing>Flow_1eass2g</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:exclusiveGateway id="Gateway_1ggdr8l"> + <bpmn:incoming>Flow_08gidyv</bpmn:incoming> + <bpmn:incoming>Flow_0gvrnxd</bpmn:incoming> + <bpmn:outgoing>Flow_1o3n9u6</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:serviceTask id="LogPing" name="Log Ping" camunda:class="dev.dsf.bpe.service.LogPing"> + <bpmn:incoming>Flow_1o3n9u6</bpmn:incoming> + <bpmn:outgoing>Flow_061qpt4</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sendTask id="Activity_005ywv2" name="Pong" camunda:class="dev.dsf.bpe.message.SendPong"> + <bpmn:extensionElements> + <camunda:field name="instantiatesCanonical"> + <camunda:string>http://dsf.dev/bpe/Process/ping|#{version}</camunda:string> + </camunda:field> + <camunda:field name="messageName"> + <camunda:string>pong</camunda:string> + </camunda:field> + <camunda:field name="profile"> + <camunda:string>http://dsf.dev/fhir/StructureDefinition/task-pong|#{version}</camunda:string> + </camunda:field> + </bpmn:extensionElements> + <bpmn:incoming>Flow_1eass2g</bpmn:incoming> + <bpmn:outgoing>Flow_0fzmjzb</bpmn:outgoing> + </bpmn:sendTask> + <bpmn:exclusiveGateway id="Gateway_0eiy9fm" default="Flow_00t1ck1"> + <bpmn:incoming>Flow_0fzmjzb</bpmn:incoming> + <bpmn:outgoing>Flow_0h8flp6</bpmn:outgoing> + <bpmn:outgoing>Flow_1bzjspe</bpmn:outgoing> + <bpmn:outgoing>Flow_00t1ck1</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:serviceTask id="Activity_0t0ex36" name="Log And Store Send Error" camunda:class="dev.dsf.bpe.service.LogAndStoreSendError"> + <bpmn:incoming>Flow_0h8flp6</bpmn:incoming> + <bpmn:outgoing>Flow_05ucfds</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:eventBasedGateway id="Gateway_1l5dkpz"> + <bpmn:incoming>Flow_1bzjspe</bpmn:incoming> + <bpmn:outgoing>Flow_0rj915n</bpmn:outgoing> + <bpmn:outgoing>Flow_17x98wg</bpmn:outgoing> + </bpmn:eventBasedGateway> + <bpmn:intermediateCatchEvent id="Event_1xvd4tr" name="Cleanup"> + <bpmn:incoming>Flow_0rj915n</bpmn:incoming> + <bpmn:outgoing>Flow_0cl2bet</bpmn:outgoing> + <bpmn:messageEventDefinition id="MessageEventDefinition_1o3wlnx" messageRef="Message_2m36ftq" /> + </bpmn:intermediateCatchEvent> + <bpmn:intermediateCatchEvent id="Event_0o4l2t4"> + <bpmn:incoming>Flow_17x98wg</bpmn:incoming> + <bpmn:outgoing>Flow_0wy02qe</bpmn:outgoing> + <bpmn:timerEventDefinition id="TimerEventDefinition_0a3j29a"> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">${cleanupTimerDuration}</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:intermediateCatchEvent> + <bpmn:exclusiveGateway id="Gateway_1uvkqh3"> + <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> + <bpmn:incoming>Flow_05ucfds</bpmn:incoming> + <bpmn:outgoing>Flow_1qzb40k</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="Event_0i1din5"> + <bpmn:incoming>Flow_1qzb40k</bpmn:incoming> + <bpmn:incoming>Flow_1qg0rto</bpmn:incoming> + </bpmn:endEvent> + <bpmn:exclusiveGateway id="Gateway_0fvmtve"> + <bpmn:incoming>Flow_0zphif7</bpmn:incoming> + <bpmn:incoming>Flow_1jehvly</bpmn:incoming> + <bpmn:outgoing>Flow_0x7t1ii</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:serviceTask id="Activity_1umihbr" name="Log and Save And Store Error" camunda:class="dev.dsf.bpe.service.LogAndSaveAndStoreError"> + <bpmn:incoming>Flow_0uj7rm3</bpmn:incoming> + <bpmn:outgoing>Flow_1jehvly</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="Event_1qh25on"> + <bpmn:incoming>Flow_0yr2pmf</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="Activity_0otptjn" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> + <bpmn:incoming>Flow_0wy02qe</bpmn:incoming> + <bpmn:incoming>Flow_165e73u</bpmn:incoming> + <bpmn:outgoing>Flow_1qg0rto</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Activity_0mwyelp" name="Store Download Speeds" camunda:class="dev.dsf.bpe.service.StoreDownloadSpeeds"> + <bpmn:incoming>Flow_0cl2bet</bpmn:incoming> + <bpmn:outgoing>Flow_165e73u</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Activity_04mv5cn" name="Store Resource" camunda:class="dev.dsf.bpe.service.StoreResource"> + <bpmn:incoming>Flow_1w09zt7</bpmn:incoming> + <bpmn:outgoing>Flow_03hviat</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Activity_1m4wavi" name="Generate Resource" camunda:class="dev.dsf.bpe.service.GenerateResource"> + <bpmn:incoming>Flow_0x7t1ii</bpmn:incoming> + <bpmn:outgoing>Flow_1w09zt7</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Activity_0xcqxjs" name="Estimate Cleanup Timer Duration" camunda:class="dev.dsf.bpe.service.EstimateCleanupTimerDuration"> + <bpmn:incoming>Flow_03hviat</bpmn:incoming> + <bpmn:outgoing>Flow_0gvrnxd</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:boundaryEvent id="Event_0olr5yw" name="Invalid Resource Reference" attachedToRef="Activity_095j2gg"> + <bpmn:outgoing>Flow_0uj7rm3</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0h8zmzk" errorRef="Error_1jmenbm" /> + </bpmn:boundaryEvent> + <bpmn:boundaryEvent id="SelectPongTargetErrorBoundaryEvent" name="target not allowed" attachedToRef="SelectPongTarget"> + <bpmn:outgoing>Flow_0yr2pmf</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0ty7e1r" errorRef="Error_1j0t9ud" /> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="Flow_0huy3o3" sourceRef="PingMessageStartEvent" targetRef="Gateway_1jwjxzn" /> + <bpmn:sequenceFlow id="Flow_10z0d4x" sourceRef="Gateway_1jwjxzn" targetRef="Activity_095j2gg" /> + <bpmn:sequenceFlow id="Flow_08gidyv" sourceRef="Gateway_1jwjxzn" targetRef="Gateway_1ggdr8l"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSize < 0}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_0zphif7" sourceRef="Activity_095j2gg" targetRef="Gateway_0fvmtve" /> + <bpmn:sequenceFlow id="Flow_061qpt4" sourceRef="LogPing" targetRef="SelectPongTarget" /> + <bpmn:sequenceFlow id="Flow_1eass2g" sourceRef="SelectPongTarget" targetRef="Activity_005ywv2" /> + <bpmn:sequenceFlow id="Flow_0gvrnxd" sourceRef="Activity_0xcqxjs" targetRef="Gateway_1ggdr8l" /> + <bpmn:sequenceFlow id="Flow_1o3n9u6" sourceRef="Gateway_1ggdr8l" targetRef="LogPing" /> + <bpmn:sequenceFlow id="Flow_0fzmjzb" sourceRef="Activity_005ywv2" targetRef="Gateway_0eiy9fm" /> + <bpmn:sequenceFlow id="Flow_0h8flp6" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0t0ex36"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'not-reachable'}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_1bzjspe" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1l5dkpz"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${bidirectionalResourceDownload == true}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_00t1ck1" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1uvkqh3" /> + <bpmn:sequenceFlow id="Flow_05ucfds" sourceRef="Activity_0t0ex36" targetRef="Gateway_1uvkqh3" /> + <bpmn:sequenceFlow id="Flow_0rj915n" sourceRef="Gateway_1l5dkpz" targetRef="Event_1xvd4tr" /> + <bpmn:sequenceFlow id="Flow_17x98wg" sourceRef="Gateway_1l5dkpz" targetRef="Event_0o4l2t4" /> + <bpmn:sequenceFlow id="Flow_0cl2bet" sourceRef="Event_1xvd4tr" targetRef="Activity_0mwyelp" /> + <bpmn:sequenceFlow id="Flow_0wy02qe" sourceRef="Event_0o4l2t4" targetRef="Activity_0otptjn" /> + <bpmn:sequenceFlow id="Flow_1qzb40k" sourceRef="Gateway_1uvkqh3" targetRef="Event_0i1din5" /> + <bpmn:sequenceFlow id="Flow_1qg0rto" sourceRef="Activity_0otptjn" targetRef="Event_0i1din5" /> + <bpmn:sequenceFlow id="Flow_1jehvly" sourceRef="Activity_1umihbr" targetRef="Gateway_0fvmtve" /> + <bpmn:sequenceFlow id="Flow_0x7t1ii" sourceRef="Gateway_0fvmtve" targetRef="Activity_1m4wavi" /> + <bpmn:sequenceFlow id="Flow_0uj7rm3" sourceRef="Event_0olr5yw" targetRef="Activity_1umihbr" /> + <bpmn:sequenceFlow id="Flow_0yr2pmf" sourceRef="SelectPongTargetErrorBoundaryEvent" targetRef="Event_1qh25on" /> + <bpmn:sequenceFlow id="Flow_165e73u" sourceRef="Activity_0mwyelp" targetRef="Activity_0otptjn" /> + <bpmn:sequenceFlow id="Flow_1w09zt7" sourceRef="Activity_1m4wavi" targetRef="Activity_04mv5cn" /> + <bpmn:sequenceFlow id="Flow_03hviat" sourceRef="Activity_04mv5cn" targetRef="Activity_0xcqxjs" /> + <bpmn:textAnnotation id="TextAnnotation_02e4h2c"> + <bpmn:text>Log = logger +Save = save as execution variable +Store = store on DSF FHIR server either as separate resource or output parameter</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_1cled7l"> + <bpmn:text>downloads up to maxDownloadSizeBytes</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_1o7v81w"> + <bpmn:text>Information in message: +- downloadedResourceHash: String +- downloadedBytes: long +- downloadedDurationMillis: long +- downloadResourceReference: Reference +- downloadResourceHash: String +- errors: List</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_17fzn7d"> + <bpmn:text>Cleanup steps: +- delete generated resource</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_1bv3jri"> + <bpmn:text>Estimation based on download duration e.g. 10x or 20x download duration</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_1mo7foe"> + <bpmn:text>generates up to maxUploadSizeBystes</bpmn:text> + </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_14ea4yc"> + <bpmn:text>Process Parameters +- downloadResourceSize read from Input Paramater (no default, value from message expected) +- maxDownloadSizeBytes read from environment variable (default tbd) +- maxUpdloadSizeBytes read from environment variables (default tbd)</bpmn:text> + </bpmn:textAnnotation> + <bpmn:association id="Association_18psz8j" sourceRef="Activity_095j2gg" targetRef="TextAnnotation_1cled7l" /> + <bpmn:association id="Association_1py3u4x" sourceRef="Activity_005ywv2" targetRef="TextAnnotation_1o7v81w" /> + <bpmn:association id="Association_05fync1" sourceRef="Activity_0otptjn" targetRef="TextAnnotation_17fzn7d" /> + <bpmn:association id="Association_1thj094" sourceRef="TextAnnotation_1mo7foe" targetRef="Activity_1m4wavi" /> + <bpmn:association id="Association_0wskzb7" sourceRef="Activity_0xcqxjs" targetRef="TextAnnotation_1bv3jri" /> + </bpmn:process> + <bpmn:message id="Message_0u91abp" name="ping" /> + <bpmn:message id="Message_2m36ftq" name="cleanupPong" /> + <bpmn:error id="Error_1jmenbm" name="invalid_resource_refernece" errorCode="invalid_resource_refernece" /> + <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> + <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> + <dc:Bounds x="160" y="80" width="420" height="70" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_1cled7l_di" bpmnElement="TextAnnotation_1cled7l"> + <dc:Bounds x="580" y="353" width="170" height="37" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> + <dc:Bounds x="1790" y="439" width="250" height="113" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> + <dc:Bounds x="2560" y="533" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> + <dc:Bounds x="1300" y="543" width="275" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> + <dc:Bounds x="920" y="544" width="170" height="40" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1bdbmbf" bpmnElement="TextAnnotation_14ea4yc"> + <dc:Bounds x="280" y="183" width="585" height="69" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> + <dc:Bounds x="172" y="292" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="180" y="335" width="21" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1jwjxzn_di" bpmnElement="Gateway_1jwjxzn" isMarkerVisible="true"> + <dc:Bounds x="455" y="285" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_095j2gg_di" bpmnElement="Activity_095j2gg"> + <dc:Bounds x="530" y="420" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0ko681m_di" bpmnElement="SelectPongTarget"> + <dc:Bounds x="1660" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1r1hob1" bpmnElement="Gateway_1ggdr8l" isMarkerVisible="true"> + <dc:Bounds x="1445" y="285" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1lhkmjw" bpmnElement="LogPing"> + <dc:Bounds x="1540" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1h1lrei_di" bpmnElement="Activity_005ywv2"> + <dc:Bounds x="1840" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0eiy9fm_di" bpmnElement="Gateway_0eiy9fm" isMarkerVisible="true"> + <dc:Bounds x="2025" y="285" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_02b3m47_di" bpmnElement="Activity_0t0ex36"> + <dc:Bounds x="2140" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_12p2jrx_di" bpmnElement="Gateway_1l5dkpz"> + <dc:Bounds x="2025" y="385" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1xvd4tr_di" bpmnElement="Event_1xvd4tr"> + <dc:Bounds x="2272" y="392" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2271" y="438" width="42" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0o4l2t4_di" bpmnElement="Event_0o4l2t4"> + <dc:Bounds x="2272" y="482" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1uvkqh3_di" bpmnElement="Gateway_1uvkqh3" isMarkerVisible="true"> + <dc:Bounds x="2335" y="285" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> + <dc:Bounds x="2632" y="292" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> + <dc:Bounds x="835" y="435" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1imd3tw_di" bpmnElement="Activity_1umihbr"> + <dc:Bounds x="720" y="540" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_05zzvx3_di" bpmnElement="Event_1qh25on"> + <dc:Bounds x="1742" y="595" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> + <dc:Bounds x="2520" y="370" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1xbj20p_di" bpmnElement="Activity_0mwyelp"> + <dc:Bounds x="2360" y="370" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1ouj7x3_di" bpmnElement="Activity_04mv5cn"> + <dc:Bounds x="1130" y="420" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1m4wavi_di" bpmnElement="Activity_1m4wavi"> + <dc:Bounds x="970" y="420" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_06klx97_di" bpmnElement="Activity_0xcqxjs"> + <dc:Bounds x="1290" y="420" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> + <di:waypoint x="602" y="420" /> + <di:waypoint x="618" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> + <di:waypoint x="1876" y="350" /> + <di:waypoint x="1845" y="439" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> + <di:waypoint x="2582" y="450" /> + <di:waypoint x="2606" y="533" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> + <di:waypoint x="1008" y="544" /> + <di:waypoint x="1014" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> + <di:waypoint x="1344" y="500" /> + <di:waypoint x="1349" y="543" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="BPMNShape_14ee8kb" bpmnElement="Event_0olr5yw"> + <dc:Bounds x="612" y="482" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="649" y="516" width="83" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> + <dc:Bounds x="1742" y="332" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1779" y="363" width="87" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_0huy3o3_di" bpmnElement="Flow_0huy3o3"> + <di:waypoint x="208" y="310" /> + <di:waypoint x="455" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> + <di:waypoint x="480" y="335" /> + <di:waypoint x="480" y="460" /> + <di:waypoint x="530" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_08gidyv_di" bpmnElement="Flow_08gidyv"> + <di:waypoint x="505" y="310" /> + <di:waypoint x="1445" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0zphif7_di" bpmnElement="Flow_0zphif7"> + <di:waypoint x="630" y="460" /> + <di:waypoint x="835" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_061qpt4_di" bpmnElement="Flow_061qpt4"> + <di:waypoint x="1640" y="310" /> + <di:waypoint x="1660" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1eass2g_di" bpmnElement="Flow_1eass2g"> + <di:waypoint x="1760" y="310" /> + <di:waypoint x="1840" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0gvrnxd_di" bpmnElement="Flow_0gvrnxd"> + <di:waypoint x="1390" y="460" /> + <di:waypoint x="1470" y="460" /> + <di:waypoint x="1470" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1o3n9u6_di" bpmnElement="Flow_1o3n9u6"> + <di:waypoint x="1495" y="310" /> + <di:waypoint x="1540" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0fzmjzb_di" bpmnElement="Flow_0fzmjzb"> + <di:waypoint x="1940" y="310" /> + <di:waypoint x="2025" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0h8flp6_di" bpmnElement="Flow_0h8flp6"> + <di:waypoint x="2075" y="310" /> + <di:waypoint x="2140" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1bzjspe_di" bpmnElement="Flow_1bzjspe"> + <di:waypoint x="2050" y="335" /> + <di:waypoint x="2050" y="385" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_00t1ck1_di" bpmnElement="Flow_00t1ck1"> + <di:waypoint x="2050" y="285" /> + <di:waypoint x="2050" y="250" /> + <di:waypoint x="2360" y="250" /> + <di:waypoint x="2360" y="285" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_05ucfds_di" bpmnElement="Flow_05ucfds"> + <di:waypoint x="2240" y="310" /> + <di:waypoint x="2335" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0rj915n_di" bpmnElement="Flow_0rj915n"> + <di:waypoint x="2075" y="410" /> + <di:waypoint x="2272" y="410" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_17x98wg_di" bpmnElement="Flow_17x98wg"> + <di:waypoint x="2050" y="435" /> + <di:waypoint x="2050" y="500" /> + <di:waypoint x="2272" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0cl2bet_di" bpmnElement="Flow_0cl2bet"> + <di:waypoint x="2308" y="410" /> + <di:waypoint x="2360" y="410" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0wy02qe_di" bpmnElement="Flow_0wy02qe"> + <di:waypoint x="2308" y="500" /> + <di:waypoint x="2570" y="500" /> + <di:waypoint x="2570" y="450" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1qzb40k_di" bpmnElement="Flow_1qzb40k"> + <di:waypoint x="2385" y="310" /> + <di:waypoint x="2632" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1qg0rto_di" bpmnElement="Flow_1qg0rto"> + <di:waypoint x="2620" y="410" /> + <di:waypoint x="2650" y="410" /> + <di:waypoint x="2650" y="328" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> + <di:waypoint x="820" y="580" /> + <di:waypoint x="860" y="580" /> + <di:waypoint x="860" y="485" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0x7t1ii_di" bpmnElement="Flow_0x7t1ii"> + <di:waypoint x="885" y="460" /> + <di:waypoint x="970" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0uj7rm3_di" bpmnElement="Flow_0uj7rm3"> + <di:waypoint x="630" y="518" /> + <di:waypoint x="630" y="580" /> + <di:waypoint x="720" y="580" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0yr2pmf_di" bpmnElement="Flow_0yr2pmf"> + <di:waypoint x="1760" y="368" /> + <di:waypoint x="1760" y="595" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_165e73u_di" bpmnElement="Flow_165e73u"> + <di:waypoint x="2460" y="410" /> + <di:waypoint x="2520" y="410" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> + <di:waypoint x="1070" y="460" /> + <di:waypoint x="1130" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_03hviat_di" bpmnElement="Flow_03hviat"> + <di:waypoint x="1230" y="460" /> + <di:waypoint x="1290" y="460" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> From 0b1bf05ba8204161995ce5f850898d9fba72ec3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Feb 2025 10:35:05 +0100 Subject: [PATCH 015/382] Removed LogPong because it isn't used in the new diagrams --- .../java/dev/dsf/bpe/service/LogPong.java | 36 ------------------- .../dev/dsf/bpe/spring/config/PingConfig.java | 8 ----- 2 files changed, 44 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/service/LogPong.java diff --git a/src/main/java/dev/dsf/bpe/service/LogPong.java b/src/main/java/dev/dsf/bpe/service/LogPong.java deleted file mode 100644 index 72fa6168..00000000 --- a/src/main/java/dev/dsf/bpe/service/LogPong.java +++ /dev/null @@ -1,36 +0,0 @@ -package dev.dsf.bpe.service; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; -import dev.dsf.bpe.v1.variables.Variables; - -public class LogPong extends AbstractServiceDelegate -{ - private static final Logger logger = LoggerFactory.getLogger(LogPong.class); - - public LogPong(ProcessPluginApi api) - { - super(api); - - } - - @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception - { - Target target = variables.getTarget(); - - logger.info("PONG from {} (endpoint: {})", target.getOrganizationIdentifierValue(), - target.getEndpointIdentifierValue()); - - execution.removeVariable("statusCode"); - variables.setString("statusCode_" + target.getCorrelationKey(), - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED); - } -} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 5dd88938..b2802fac 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -14,7 +14,6 @@ import dev.dsf.bpe.message.SendStartPing; import dev.dsf.bpe.service.LogNoResponse; import dev.dsf.bpe.service.LogPing; -import dev.dsf.bpe.service.LogPong; import dev.dsf.bpe.service.LogSendError; import dev.dsf.bpe.service.StoreResults; import dev.dsf.bpe.service.SelectPingTargets; @@ -94,13 +93,6 @@ public SetCorrelationKeyListener setCorrelationKeyListener() return new SetCorrelationKeyListener(api); } - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public LogPong logPong() - { - return new LogPong(api); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public LogNoResponse logNoResponse() From 8b80b876bee8ea934576f19e2104d6d81bc62178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Feb 2025 10:38:15 +0100 Subject: [PATCH 016/382] Applied patch by Hauke Hund --- .../java/dev/dsf/bpe/message/SendStartPing.java | 14 ++++++++++++++ .../dsf-extension-ping-status.xml | 1 - 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendStartPing.java b/src/main/java/dev/dsf/bpe/message/SendStartPing.java index 196d828b..b38590fd 100644 --- a/src/main/java/dev/dsf/bpe/message/SendStartPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendStartPing.java @@ -1,5 +1,6 @@ package dev.dsf.bpe.message; +import java.util.UUID; import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -9,6 +10,7 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class SendStartPing extends AbstractTaskMessageSend @@ -26,4 +28,16 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut .anyMatch(c -> ConstantsPing.CODESYSTEM_DSF_PING.equals(c.getSystem()) && ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS.equals(c.getCode()))); } + + @Override + protected void sendTask(DelegateExecution execution, Variables variables, Target target, + String instantiatesCanonical, String messageName, String businessKey, String profile, + Stream<ParameterComponent> additionalInputParameters) + { + // different business-key for every start-ping execution + businessKey = UUID.randomUUID().toString(); + + super.sendTask(execution, variables, target, instantiatesCanonical, messageName, businessKey, profile, + additionalInputParameters); + } } diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index c2a3b8af..bd7dd4e7 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -34,7 +34,6 @@ </discriminator> <rules value="open"/> </slicing> - <min value="3"/> </element> <element id="Extension.extension:correlation-key"> <path value="Extension.extension"/> From 2e72d7a5d3b20eecd13e2a129bc57aa126256567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Feb 2025 12:14:34 +0100 Subject: [PATCH 017/382] Added download-resource-size-bytes properly --- .../StructureDefinition/dsf-task-ping.xml | 83 ++++++++++++------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index 2dd0bab7..8b92f1d1 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -60,13 +60,13 @@ <sliceName value="correlation-key" /> <min value="1" /> </element> - <element id="Task.input:download-resource-size-bytes"> + <element id="Task.input:endpoint-identifier"> <path value="Task.input" /> - <sliceName value="download-resource-size-bytes" /> + <sliceName value="endpoint-identifier" /> <min value="1" /> <max value="1" /> </element> - <element id="Task.input:download-resource-size-bytes.type"> + <element id="Task.input:endpoint-identifier.type"> <path value="Task.input.type" /> <binding> <strength value="required" /> @@ -86,7 +86,7 @@ <element id="Task.input:endpoint-identifier.type.coding.code"> <path value="Task.input.type.coding.code" /> <min value="1" /> - <fixedCode value="download-resource-size-bytes" /> + <fixedCode value="endpoint-identifier" /> </element> <element id="Task.input:endpoint-identifier.value[x]"> <path value="Task.input.value[x]" /> @@ -95,39 +95,66 @@ <targetProfile value="http://dsf.dev/fhir/StructureDefinition/endpoint" /> </type> </element> - <element id="Task.input:endpoint-identifier"> - <path value="Task.input" /> - <sliceName value="endpoint-identifier" /> - <min value="1" /> - <max value="1" /> + <element id="Task.input:endpoint-identifier.value[x].reference"> + <path value="Task.input.value[x].reference" /> + <min value="0" /> </element> - <element id="Task.input:endpoint-identifier.type"> - <path value="Task.input.type" /> - <binding> - <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> - </binding> + <element id="Task.input:endpoint-identifier.value[x].type"> + <path value="Task.input.value[x].type" /> + <max value="1" /> + <fixedUri value="Endpoint" /> </element> - <element id="Task.input:endpoint-identifier.type.coding"> - <path value="Task.input.type.coding" /> - <min value="1" /> + <element id="Task.input:endpoint-identifier.value[x].identifier"> + <path value="Task.input.value[x].identifier" /> <max value="1" /> </element> - <element id="Task.input:endpoint-identifier.type.coding.system"> - <path value="Task.input.type.coding.system" /> + <element id="Task.input:endpoint-identifier.value[x].identifier.system"> + <path value="Task.input.value[x].identifier.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/sid/endpoint-identifier" /> </element> - <element id="Task.input:endpoint-identifier.type.coding.code"> - <path value="Task.input.type.coding.code" /> + <element id="Task.input:endpoint-identifier.value[x].identifier.value"> + <path value="Task.input.value[x].identifier.value" /> <min value="1" /> - <fixedCode value="endpoint-identifier" /> </element> - <element id="Task.input:endpoint-identifier.value[x]"> - <path value="Task.input.value[x]" /> + <element id="Task.input:download-resource-size-bytes"> + <path value="Task.input"/> + <sliceName value="download-resource-size-bytes"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:download-resource-size-bytes.type"> + <path value="Task.input.type"/> + <min value="1"/> + <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> + </binding> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding"> + <path value="Task.input.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding.system"> + <path value="Task.input.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding.code"> + <path value="Task.input.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="download-resource-size-bytes"/> + </element> + <element id="Task.input:download-resource-size-bytes.value[x]"> + <path value="Task.input.value[x]"/> + <min value="1"/> + <max value="1"/> <type> - <code value="Integer" /> - <targetProfile value="http://dsf.dev/fhir/StructureDefinition/endpoint" /> + <code value="Integer"/> </type> </element> <element id="Task.output:pong-status"> From 5e5c66de5f2d9267c90d4daa010a9a891db38fcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Feb 2025 13:39:59 +0100 Subject: [PATCH 018/382] fixed typo --- src/main/resources/fhir/ValueSet/dsf-pong-status.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml index 09860584..c755a284 100644 --- a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml +++ b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml @@ -31,8 +31,8 @@ <display value="Not reachable" /> </concept> <concept> - <code value="pong-send" /> - <display value="Pong send" /> + <code value="pong-sent" /> + <display value="Pong sent" /> </concept> </include> </compose> From baf8f8ee614c0c65f6f1f34bdc95b18defac6255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Feb 2025 16:05:49 +0100 Subject: [PATCH 019/382] Removed information on hashing as hashing was removed --- src/main/resources/bpe/ping.bpmn | 191 +++++++++++++++---------------- src/main/resources/bpe/pong.bpmn | 12 +- 2 files changed, 100 insertions(+), 103 deletions(-) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index a361ab31..9143c207 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -139,8 +139,7 @@ <bpmn:textAnnotation id="TextAnnotation_0smygq5"> <bpmn:text>Information in message: - downloadDurationMillis: long -- bytesDownloaded: long -- hash validation result (both ways)</bpmn:text> +- bytesDownloaded: long</bpmn:text> </bpmn:textAnnotation> <bpmn:textAnnotation id="TextAnnotation_08ic0l2"> <bpmn:text>downloads up to maxDownloadSizeBytes</bpmn:text> @@ -225,74 +224,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> - <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> - <dc:Bounds x="3030" y="239" width="160" height="49" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0o5toqz" bpmnElement="TextAnnotation_1j1ytqy"> - <dc:Bounds x="360" y="580" width="170" height="40" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0ne04k7" bpmnElement="TextAnnotation_0dhecha"> - <dc:Bounds x="330" y="220" width="420" height="69" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> - <dc:Bounds x="2960" y="490" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> - <dc:Bounds x="160" y="80" width="420" height="70" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_06i4ly8" bpmnElement="Activity_16rb6hc"> - <dc:Bounds x="620" y="460" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0fhb8wi" bpmnElement="Activity_0nwtf8o"> - <dc:Bounds x="460" y="460" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> - <dc:Bounds x="2960" y="330" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> - <dc:Bounds x="3090" y="330" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> - <dc:Bounds x="3212" y="352" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0ob9la3" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> - <dc:Bounds x="745" y="335" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0wi2en6" bpmnElement="SelectPingTargets"> - <dc:Bounds x="830" y="320" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1v2z49g" bpmnElement="Gateway_0xw5i5v" isMarkerVisible="true"> - <dc:Bounds x="365" y="335" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0ydgq5s" bpmnElement="StartPingMessageStartEvent"> - <dc:Bounds x="162" y="342" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="161" y="385" width="44" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> <dc:Bounds x="970" y="180" width="1930" height="560" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> - <dc:Bounds x="1200" y="220" width="250" height="70" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> - <dc:Bounds x="2590" y="612" width="240" height="69" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> - <dc:Bounds x="1910" y="622" width="170" height="37" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0qz7nye" bpmnElement="SubProcessStartEvent"> <dc:Bounds x="992" y="342" width="36" height="36" /> </bpmndi:BPMNShape> @@ -357,18 +291,18 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> <dc:Bounds x="2842" y="342" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> - <di:waypoint x="1182" y="320" /> - <di:waypoint x="1206" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> - <di:waypoint x="2540" y="550" /> - <di:waypoint x="2646" y="612" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> - <di:waypoint x="2004" y="622" /> - <di:waypoint x="2032" y="560" /> - </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> + <dc:Bounds x="1200" y="220" width="250" height="70" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> + <dc:Bounds x="2590" y="612" width="239.99152587125295" height="54.858934169278996" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> + <dc:Bounds x="1910" y="622" width="170" height="37" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0968qvb" bpmnElement="Event_0i4slcz"> <dc:Bounds x="2082" y="542" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -462,17 +396,78 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2780" y="360" /> <di:waypoint x="2842" y="360" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> - <di:waypoint x="3119" y="330" /> - <di:waypoint x="3098" y="288" /> + <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> + <di:waypoint x="1182" y="320" /> + <di:waypoint x="1206" y="290" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> - <di:waypoint x="469" y="540" /> - <di:waypoint x="428" y="580" /> + <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> + <di:waypoint x="2540" y="550" /> + <di:waypoint x="2646" y="612" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> - <di:waypoint x="3053" y="490" /> - <di:waypoint x="3024" y="410" /> + <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> + <di:waypoint x="2004" y="622" /> + <di:waypoint x="2032" y="560" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="BPMNShape_06i4ly8" bpmnElement="Activity_16rb6hc"> + <dc:Bounds x="620" y="460" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0fhb8wi" bpmnElement="Activity_0nwtf8o"> + <dc:Bounds x="460" y="460" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> + <dc:Bounds x="2960" y="330" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> + <dc:Bounds x="3090" y="330" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> + <dc:Bounds x="3212" y="352" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ob9la3" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> + <dc:Bounds x="745" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0wi2en6" bpmnElement="SelectPingTargets"> + <dc:Bounds x="830" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1v2z49g" bpmnElement="Gateway_0xw5i5v" isMarkerVisible="true"> + <dc:Bounds x="365" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ydgq5s" bpmnElement="StartPingMessageStartEvent"> + <dc:Bounds x="162" y="342" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="161" y="385" width="44" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> + <dc:Bounds x="3030" y="239" width="160" height="49" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0o5toqz" bpmnElement="TextAnnotation_1j1ytqy"> + <dc:Bounds x="360" y="580" width="170" height="40" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ne04k7" bpmnElement="TextAnnotation_0dhecha"> + <dc:Bounds x="330" y="220" width="420" height="69" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> + <dc:Bounds x="2960" y="490" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> + <dc:Bounds x="160" y="80" width="420" height="70" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_09zmq8d" bpmnElement="Flow_0j92st0"> + <di:waypoint x="930" y="360" /> + <di:waypoint x="970" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_036wiw0" bpmnElement="Flow_1bfs68o"> + <di:waypoint x="2900" y="370" /> + <di:waypoint x="2960" y="370" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1ttfs4u" bpmnElement="Flow_1qz7z39"> <di:waypoint x="560" y="500" /> @@ -488,10 +483,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="390" y="500" /> <di:waypoint x="460" y="500" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_036wiw0" bpmnElement="Flow_1bfs68o"> - <di:waypoint x="2900" y="370" /> - <di:waypoint x="2960" y="370" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1fbz0br" bpmnElement="Flow_0gubpgz"> <di:waypoint x="3060" y="370" /> <di:waypoint x="3090" y="370" /> @@ -508,14 +499,22 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="795" y="360" /> <di:waypoint x="830" y="360" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_09zmq8d" bpmnElement="Flow_0j92st0"> - <di:waypoint x="930" y="360" /> - <di:waypoint x="970" y="360" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_11qkk0c" bpmnElement="Flow_0fpikty"> <di:waypoint x="198" y="360" /> <di:waypoint x="365" y="360" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> + <di:waypoint x="469" y="540" /> + <di:waypoint x="428" y="580" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> + <di:waypoint x="3053" y="490" /> + <di:waypoint x="3024" y="410" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> + <di:waypoint x="3119" y="330" /> + <di:waypoint x="3098" y="288" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index ba8924ea..751391c7 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -161,11 +161,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmn:textAnnotation> <bpmn:textAnnotation id="TextAnnotation_1o7v81w"> <bpmn:text>Information in message: -- downloadedResourceHash: String - downloadedBytes: long - downloadedDurationMillis: long - downloadResourceReference: Reference -- downloadResourceHash: String - errors: List</bpmn:text> </bpmn:textAnnotation> <bpmn:textAnnotation id="TextAnnotation_17fzn7d"> @@ -205,7 +203,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> - <dc:Bounds x="1790" y="439" width="250" height="113" /> + <dc:Bounds x="1790" y="439" width="250.00000000000003" height="83.6707152496626" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> @@ -316,14 +314,14 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2582" y="450" /> <di:waypoint x="2606" y="533" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> - <di:waypoint x="1008" y="544" /> - <di:waypoint x="1014" y="500" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> <di:waypoint x="1344" y="500" /> <di:waypoint x="1349" y="543" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> + <di:waypoint x="1008" y="544" /> + <di:waypoint x="1014" y="500" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_14ee8kb" bpmnElement="Event_0olr5yw"> <dc:Bounds x="612" y="482" width="36" height="36" /> <bpmndi:BPMNLabel> From 98e406691f980070b17a8c32bffa0c9c8eab38fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Feb 2025 16:06:57 +0100 Subject: [PATCH 020/382] added ping speed units value set to ping and pong processes --- src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index be492b3c..373a42d0 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -65,16 +65,17 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var tStopPingAutoStart = "fhir/Task/dsf-task-stop-ping-autostart.xml"; var vPing = "fhir/ValueSet/dsf-ping.xml"; + var vPingUnits = "fhir/ValueSet/dsf-ping-units.xml"; var vPingStatus = "fhir/ValueSet/dsf-ping-status.xml"; var vPongStatus = "fhir/ValueSet/dsf-pong-status.xml"; return Map.of(ConstantsPing.PROCESS_NAME_FULL_PING, Arrays.asList( - aPing, cPing, cPingStatus, sPingStatus, sStartPing, sPong, tStartPing, vPing, vPingStatus), + aPing, cPing, cPingStatus, sPingStatus, sStartPing, sPong, tStartPing, vPing, vPingStatus, vPingUnits), ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, tStopPingAutoStart, vPing), ConstantsPing.PROCESS_NAME_FULL_PONG, - Arrays.asList(aPong, cPing, cPingStatus, sPingStatus, sPing, vPing, vPongStatus)); + Arrays.asList(aPong, cPing, cPingStatus, sPingStatus, sPing, vPing, vPongStatus, vPingUnits)); } } From 3e9d72be7ddfeb39f6fc87b08db1b6223b47ac8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 14:33:28 +0100 Subject: [PATCH 021/382] Added --- .../dsf-task-cleanup-pong.xml | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml new file mode 100644 index 00000000..ca468cc9 --- /dev/null +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -0,0 +1,130 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/StructureDefinition/task-cleanup-pong" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="TaskCleanupPong" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://dsf.dev/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesCanonical"> + <path value="Task.instantiatesCanonical" /> + <fixedCanonical value="http://dsf.dev/bpe/Process/pong|#{version}" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="4" /> + <max value="4" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="ping" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <min value="1" /> + </element> + <element id="Task.output:pong-status"> + <path value="Task.output"/> + <sliceName value="pong-status"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.output:pong-status.extension"> + <path value="Task.output.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.output:pong-status.extension:pong-status-extension"> + <path value="Task.output.extension" /> + <sliceName value="pong-status-extension" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status|#{version}" /> + </type> + </element> + <element id="Task.output:pong-status.type"> + <path value="Task.output.type"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> + </binding> + </element> + <element id="Task.output:pong-status.type.coding"> + <path value="Task.output.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.output:pong-status.type.coding.system"> + <path value="Task.output.type.coding.system"/> + <min value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.output:pong-status.type.coding.code"> + <path value="Task.output.type.coding.code"/> + <min value="1"/> + <fixedCode value="pong-status"/> + </element> + <element id="Task.output:pong-status.value[x]"> + <path value="Task.output.value[x]"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Task.output:pong-status.value[x].system"> + <path value="Task.output.value[x].system"/> + <min value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status"/> + </element> + <element id="Task.output:pong-status.value[x].code"> + <path value="Task.output.value[x].code"/> + <min value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/pong-status|#{version}"/> + </binding> + </element> + </differential> +</StructureDefinition> \ No newline at end of file From c65c8e82608e21c4ce84c1219ac866dc6ed3e854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 14:34:57 +0100 Subject: [PATCH 022/382] Added Cleanup Pong task to plugin definition --- src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index 373a42d0..f07ae15d 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -59,6 +59,7 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var sStartPing = "fhir/StructureDefinition/dsf-task-start-ping.xml"; var sStartPingAutostart = "fhir/StructureDefinition/dsf-task-start-ping-autostart.xml"; var sStopPingAutostart = "fhir/StructureDefinition/dsf-task-stop-ping-autostart.xml"; + var sCleanupPong = "fhir/StructureDefinition/dsf-task-pong-cleanup-pong.xml"; var tStartPing = "fhir/Task/dsf-task-start-ping.xml"; var tStartPingAutoStart = "fhir/Task/dsf-task-start-ping-autostart.xml"; @@ -71,7 +72,7 @@ public Map<String, List<String>> getFhirResourcesByProcessId() return Map.of(ConstantsPing.PROCESS_NAME_FULL_PING, Arrays.asList( - aPing, cPing, cPingStatus, sPingStatus, sStartPing, sPong, tStartPing, vPing, vPingStatus, vPingUnits), + aPing, cPing, cPingStatus, sPingStatus, sStartPing, sPong, sCleanupPong, tStartPing, vPing, vPingStatus, vPingUnits), ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, tStopPingAutoStart, vPing), From aa3264917411bb129df9931618d95e2696eb8762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 14:37:03 +0100 Subject: [PATCH 023/382] Added Cleanup Pong implementation class --- .../java/dev/dsf/bpe/message/CleanupPong.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/main/java/dev/dsf/bpe/message/CleanupPong.java diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPong.java b/src/main/java/dev/dsf/bpe/message/CleanupPong.java new file mode 100644 index 00000000..d3e861df --- /dev/null +++ b/src/main/java/dev/dsf/bpe/message/CleanupPong.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.message; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; +import dev.dsf.bpe.v1.variables.Variables; + +public class CleanupPong extends AbstractTaskMessageSend +{ + public CleanupPong(ProcessPluginApi api) + { + super(api); + } + + @Override + protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, + Variables variables) + { + System.out.println("Getting additional input parameters for pong cleanup"); + return super.getAdditionalInputParameters(execution, variables); + } +} From 9d9b1f28bc49925ba41e8b19c4593d270bce7e49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 14:46:56 +0100 Subject: [PATCH 024/382] code in type needs to be lowercase --- .../fhir/StructureDefinition/dsf-extension-ping-status.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index bd7dd4e7..7bfcb167 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -149,7 +149,7 @@ <element id="Extension.extension:download-speed.value[x]"> <path value="Extension.extension.value[x]"/> <type> - <code value="Decimal"/> + <code value="decimal"/> </type> </element> @@ -181,7 +181,7 @@ <element id="Extension.extension:upload-speed.value[x]"> <path value="Extension.extension.value[x]"/> <type> - <code value="Decimal"/> + <code value="decimal"/> </type> </element> From 116afa2bf7184d189f97432ed3251fa847466cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 14:56:53 +0100 Subject: [PATCH 025/382] code in type needs to be lowercase --- src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index 8b92f1d1..367bfe80 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -154,7 +154,7 @@ <min value="1"/> <max value="1"/> <type> - <code value="Integer"/> + <code value="integer"/> </type> </element> <element id="Task.output:pong-status"> From 6b7ef24a318617b01dcb891df69eb46c5a29d0b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 16:02:24 +0100 Subject: [PATCH 026/382] Fixed fhir element definition --- .../dsf-extension-ping-status.xml | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 7bfcb167..6051b0a4 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -127,19 +127,26 @@ <min value="0"/> <max value="1"/> </element> - <element id="Extension.extension:download-speed.unit"> - <path value="Extension.extension.unit"/> + <element id="Extension.extension:download-speed.extension:unit"> + <path value="Extension.extension.extension"/> + <sliceName value="unit"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:download-speed.extension:unit.value[x]"> + <path value="Extension.extension.extension.value[x]"/> + <min value="1"/> <type> <code value="Coding"/> </type> </element> - <element id="Extension.extension:download-speed.unit.system"> - <path value="Extension.extension.coding.system"/> + <element id="Extension.extension:download-speed.extension:unit.value[x].system"> + <path value="Extension.extension.extension.value[x].system"/> <min value="1"/> <fixedUri value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> </element> - <element id="Extension.extension:download-speed.unit.code"> - <path value="Extension.extension.coding.code"/> + <element id="Extension.extension:download-speed.extension:unit.value[x].code"> + <path value="Extension.extension.extension.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> @@ -152,26 +159,32 @@ <code value="decimal"/> </type> </element> - <element id="Extension.extension:upload-speed"> <path value="Extension.extension"/> <sliceName value="upload-speed"/> <min value="0"/> <max value="1"/> </element> - <element id="Extension.extension:upload-speed.unit"> - <path value="Extension.extension.unit"/> + <element id="Extension.extension:upload-speed.extension:unit"> + <path value="Extension.extension.extension"/> + <sliceName value="unit"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:upload-speed.extension:unit.value[x]"> + <path value="Extension.extension.extension.value[x]"/> + <min value="1"/> <type> <code value="Coding"/> </type> </element> - <element id="Extension.extension:upload-speed.unit.system"> - <path value="Extension.extension.coding.system"/> + <element id="Extension.extension:upload-speed.extension:unit.value[x].system"> + <path value="Extension.extension.extension.value[x].system"/> <min value="1"/> <fixedUri value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> </element> - <element id="Extension.extension:upload-speed.unit.code"> - <path value="Extension.extension.coding.code"/> + <element id="Extension.extension:upload-speed.extension:unit.value[x].code"> + <path value="Extension.extension.extension.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> @@ -184,7 +197,6 @@ <code value="decimal"/> </type> </element> - <element id="Extension.url"> <path value="Extension.url"/> <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> From 79b8a2b1a7470a55a7a68820572b16a1749d4205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 17:13:27 +0100 Subject: [PATCH 027/382] Fixed fhir element definition for download-resource-size-bytes task input and added it to test case --- .../StructureDefinition/dsf-task-start-ping.xml | 13 +++++++++++++ .../java/dev/dsf/fhir/profiles/TaskProfileTest.java | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index e3e4da38..9a93b7aa 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -101,10 +101,23 @@ <element id="Task.input:download-resource-size-bytes.type"> <path value="Task.input.type" /> <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> <strength value="required" /> <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> </binding> </element> + <element id="Task.input:download-resource-size-bytes.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="download-resource-size-bytes" /> + </element> <element id="Task.output:ping-status"> <path value="Task.output"/> <sliceName value="ping-status"/> diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 75c355aa..0c06246f 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -6,6 +6,7 @@ import java.util.Date; import java.util.UUID; +import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.StringType; @@ -182,6 +183,10 @@ public void testTaskStartPingProcessProfileValidWithTargetEndpoints() throws Exc "Endpoint?identifier=http://dsf.dev/sid/endpoint-identifier|endpoint.target.org")) .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS); + task.addInput() + .setValue(new IntegerType(1)) + .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); From 402b062c0eb0aac985aba8e2dae7ee3f9f03ed99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 17:14:41 +0100 Subject: [PATCH 028/382] Moved correct input parameter to createValidTaskStartPingProcess --- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 0c06246f..e19f3754 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -183,10 +183,6 @@ public void testTaskStartPingProcessProfileValidWithTargetEndpoints() throws Exc "Endpoint?identifier=http://dsf.dev/sid/endpoint-identifier|endpoint.target.org")) .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS); - task.addInput() - .setValue(new IntegerType(1)) - .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -306,6 +302,10 @@ private Task createValidTaskStartPingProcess() task.addInput().setValue(new StringType(ConstantsPing.PROFILE_DSF_TASK_START_PING_MESSAGE_NAME)).getType() .addCoding(BpmnMessage.messageName()); + task.addInput() + .setValue(new IntegerType(1)) + .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES); return task; } From e3544fe38abdd42add8ad19594398fa10a00ff13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 17:19:51 +0100 Subject: [PATCH 029/382] Added explicit type name extension to download-resource-size-bytes slicing with value "Parameter" --- .../resources/fhir/StructureDefinition/dsf-task-start-ping.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index 9a93b7aa..fffb9a3d 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -93,6 +93,9 @@ </type> </element> <element id="Task.input:download-resource-size-bytes"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> <path value="Task.input" /> <sliceName value="download-resource-size-bytes" /> <min value="1" /> From baa452248064d919703ac09e16268074c8f760a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 17:34:07 +0100 Subject: [PATCH 030/382] Forgot to increase Task.input cardinality --- src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index 367bfe80..f32e8b43 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -30,8 +30,8 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="4" /> - <max value="4" /> + <min value="5" /> + <max value="5" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> From 8c7cd57e3b8705647dd00ddaec84149bbed1a020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Feb 2025 17:37:44 +0100 Subject: [PATCH 031/382] Added download-resource-size-bytes as input parameter to make createValidTaskPing actually valid again --- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index e19f3754..8420d19f 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -386,6 +386,10 @@ private Task createValidTaskPing() .setIdentifier(EndpointIdentifier.withValue("endpoint.target.org"))) .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER); + task.addInput() + .setValue(new IntegerType(1)) + .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES); return task; } From 94c6e1d90ef371a8334cbf78be322282d3e6a49e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 13:40:02 +0100 Subject: [PATCH 032/382] Added to represent download and upload speeds + unit for a ping status element --- .../dsf-extension-network-speed.xml | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml new file mode 100644 index 00000000..c195368e --- /dev/null +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml @@ -0,0 +1,111 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag"/> + <code value="ALL"/> + </tag> + </meta> + <url value="http://dsf.dev/fhir/StructureDefinition/network-speed"/> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="NetworkSpeed"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + + <fhirVersion value="4.0.1"/> + <kind value="complex-type"/> + <abstract value="false"/> + <context> + <type value="element"/> + <expression value="Extension.extension"/> + </context> + <type value="Extension"/> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> + <derivation value="constraint"/> + <differential> + <element id="Extension.extension"> + <path value="Extension.extension"/> + <slicing> + <discriminator> + <type value="value"/> + <path value="url"/> + </discriminator> + <rules value="open"/> + </slicing> + <min value="3"/> + <max value="3"/> + </element> + <element id="Extension.extension:download-speed"> + <path value="Extension.extension"/> + <sliceName value="download-speed"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:download-speed.url"> + <path value="Extension.extension.url"/> + <fixedUri value="download-speed"/> + </element> + <element id="Extension.extension:download-speed.value[x]"> + <path value="Extension.extension.value[x]"/> + <type> + <code value="decimal"/> + </type> + </element> + <element id="Extension.extension:upload-speed"> + <path value="Extension.extension"/> + <sliceName value="upload-speed"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:upload-speed.url"> + <path value="Extension.extension.url"/> + <fixedUri value="upload-speed"/> + </element> + <element id="Extension.extension:upload-speed.value[x]"> + <path value="Extension.extension.value[x]"/> + <type> + <code value="decimal"/> + </type> + </element> + <element id="Extension.extension:unit"> + <path value="Extension.extension"/> + <sliceName value="unit"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:unit.url"> + <path value="Extension.extension.url"/> + <fixedUri value="unit"/> + </element> + <element id="Extension.extension:unit.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Extension.extension:unit.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> + </element> + <element id="Extension.extension:unit.value[x].code"> + <path value="Extension.extension.value[x].code"/> + <min value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> + </binding> + </element> + <element id="Extension.url"> + <path value="Extension.url"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed"/> + </element> + <element id="Extension.value[x]"> + <path value="Extension.value[x]"/> + <max value="0"/> + </element> + </differential> +</StructureDefinition> \ No newline at end of file From 82c23ae583e6674ce91b27b8444c09a10e2a36fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 16:07:24 +0100 Subject: [PATCH 033/382] Added date back in after it was removed before --- .../fhir/StructureDefinition/dsf-extension-network-speed.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml index c195368e..a5f4724f 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml @@ -13,7 +13,7 @@ <status value="unknown" /> <experimental value="false" /> <!-- date managed by bpe --> - + <date value="#{date}" /> <fhirVersion value="4.0.1"/> <kind value="complex-type"/> <abstract value="false"/> From a22216ea01bb8fed62f0a7b51c72a4155c867dfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 16:28:43 +0100 Subject: [PATCH 034/382] Fixed url --- .../fhir/StructureDefinition/dsf-extension-network-speed.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml index a5f4724f..826ee362 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml @@ -5,7 +5,7 @@ <code value="ALL"/> </tag> </meta> - <url value="http://dsf.dev/fhir/StructureDefinition/network-speed"/> + <url value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed"/> <!-- version managed by bpe --> <version value="#{version}" /> <name value="NetworkSpeed"/> From 711212583fe02aa743b92c9a85393177a937f89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 17:34:47 +0100 Subject: [PATCH 035/382] Added network-speed concept --- src/main/resources/fhir/CodeSystem/dsf-ping.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping.xml b/src/main/resources/fhir/CodeSystem/dsf-ping.xml index ff37adc2..dad0fbd1 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping.xml @@ -51,4 +51,9 @@ <display value="Download Resource Size Bytes"/> <definition value="Size of the resource to download for speed measurements in bytes"/> </concept> + <concept> + <code value="network-speed"/> + <display value="Network Speed"/> + <definition value="Network speed in both upload and download of a specific endpoint"/> + </concept> </CodeSystem> \ No newline at end of file From c1dba2700243d0b67150e38e5fd787f05c793c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 17:36:30 +0100 Subject: [PATCH 036/382] Added network speed extension to loaded resources --- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 8420d19f..95a69a3d 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -42,7 +42,7 @@ public class TaskProfileTest def.getResourceReleaseDate(), Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-ping-status.xml", "dsf-task-ping.xml", "dsf-task-pong.xml", "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", - "dsf-task-stop-ping-autostart.xml"), + "dsf-task-stop-ping-autostart.xml", "dsf-extension-network-speed.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", "dsf-ping-status.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", From 67f1e620f3929e0dfbffd3d9888f3e6e6283ef42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 18:07:02 +0100 Subject: [PATCH 037/382] Decided to have the network speed extension only provide general network speed + unit elements and the way they are used in the ping status extension defines if they are to be interpreted as download or upload speeds --- .../dsf-extension-network-speed.xml | 26 ++---- .../dsf-extension-ping-status.xml | 84 +++++++++---------- 2 files changed, 45 insertions(+), 65 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml index 826ee362..d7b046b6 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml @@ -37,33 +37,17 @@ <min value="3"/> <max value="3"/> </element> - <element id="Extension.extension:download-speed"> + <element id="Extension.extension:network-speed"> <path value="Extension.extension"/> - <sliceName value="download-speed"/> + <sliceName value="network-speed"/> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:download-speed.url"> + <element id="Extension.extension:network-speed.url"> <path value="Extension.extension.url"/> - <fixedUri value="download-speed"/> + <fixedUri value="network-speed"/> </element> - <element id="Extension.extension:download-speed.value[x]"> - <path value="Extension.extension.value[x]"/> - <type> - <code value="decimal"/> - </type> - </element> - <element id="Extension.extension:upload-speed"> - <path value="Extension.extension"/> - <sliceName value="upload-speed"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:upload-speed.url"> - <path value="Extension.extension.url"/> - <fixedUri value="upload-speed"/> - </element> - <element id="Extension.extension:upload-speed.value[x]"> + <element id="Extension.extension:network-speed.value[x]"> <path value="Extension.extension.value[x]"/> <type> <code value="decimal"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 6051b0a4..1fdeef01 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -34,6 +34,8 @@ </discriminator> <rules value="open"/> </slicing> + <min value="3"/> + <max value="5"/> </element> <element id="Extension.extension:correlation-key"> <path value="Extension.extension"/> @@ -127,37 +129,34 @@ <min value="0"/> <max value="1"/> </element> - <element id="Extension.extension:download-speed.extension:unit"> - <path value="Extension.extension.extension"/> - <sliceName value="unit"/> + <element id="Extension.extension:download-speed.extension"> + <path value="Extension.extension.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:download-speed.extension:unit.value[x]"> - <path value="Extension.extension.extension.value[x]"/> - <min value="1"/> + <element id="Extension.extension:download-speed.extension:network-speed-extension"> + <path value="Extension.extension.extension" /> + <sliceName value="network-speed-extension" /> + <min value="1" /> <type> - <code value="Coding"/> + <code value="Extension" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed|#{version}" /> </type> </element> - <element id="Extension.extension:download-speed.extension:unit.value[x].system"> - <path value="Extension.extension.extension.value[x].system"/> - <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> - </element> - <element id="Extension.extension:download-speed.extension:unit.value[x].code"> - <path value="Extension.extension.extension.value[x].code"/> - <min value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> - </binding> + <element id="Extension.extension:download-speed.url"> + <path value="Extension.extension.url"/> + <fixedUri value="download-speed"/> </element> <element id="Extension.extension:download-speed.value[x]"> <path value="Extension.extension.value[x]"/> - <type> - <code value="decimal"/> - </type> + <max value="0"/> </element> <element id="Extension.extension:upload-speed"> <path value="Extension.extension"/> @@ -165,37 +164,34 @@ <min value="0"/> <max value="1"/> </element> - <element id="Extension.extension:upload-speed.extension:unit"> - <path value="Extension.extension.extension"/> - <sliceName value="unit"/> + <element id="Extension.extension:upload-speed.extension"> + <path value="Extension.extension.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:upload-speed.extension:unit.value[x]"> - <path value="Extension.extension.extension.value[x]"/> - <min value="1"/> + <element id="Extension.extension:upload-speed.extension:network-speed-extension"> + <path value="Extension.extension.extension" /> + <sliceName value="network-speed-extension" /> + <min value="1" /> <type> - <code value="Coding"/> + <code value="Extension" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed|#{version}" /> </type> </element> - <element id="Extension.extension:upload-speed.extension:unit.value[x].system"> - <path value="Extension.extension.extension.value[x].system"/> - <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> - </element> - <element id="Extension.extension:upload-speed.extension:unit.value[x].code"> - <path value="Extension.extension.extension.value[x].code"/> - <min value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> - </binding> + <element id="Extension.extension:upload-speed.url"> + <path value="Extension.extension.url"/> + <fixedUri value="upload-speed"/> </element> <element id="Extension.extension:upload-speed.value[x]"> <path value="Extension.extension.value[x]"/> - <type> - <code value="decimal"/> - </type> + <max value="0"/> </element> <element id="Extension.url"> <path value="Extension.url"/> From 05aef22d6b3930a28513731c9f7081acbfc396e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 18:08:38 +0100 Subject: [PATCH 038/382] Added missing code systems and value sets to load. Also, now loads network speed extension before ping status extension as ping status extension references network speed extension which needs to be loaded before ping status extension gets loaded --- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 95a69a3d..6ec70ea6 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -40,13 +40,13 @@ public class TaskProfileTest @ClassRule public static final ValidationSupportRule validationRule = new ValidationSupportRule(def.getResourceVersion(), def.getResourceReleaseDate(), - Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-ping-status.xml", "dsf-task-ping.xml", + Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-network-speed.xml", "dsf-extension-ping-status.xml", "dsf-task-ping.xml", "dsf-task-pong.xml", "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", - "dsf-task-stop-ping-autostart.xml", "dsf-extension-network-speed.xml"), + "dsf-task-stop-ping-autostart.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", - "dsf-ping-status.xml"), + "dsf-ping-status.xml", "dsf-ping-units.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", - "dsf-ping-status.xml", "dsf-pong-status.xml")); + "dsf-ping-status.xml", "dsf-pong-status.xml", "dsf-ping-units.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); From c81cabaa1173a0a053a327c69a908e1c5b404445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 18:31:34 +0100 Subject: [PATCH 039/382] Forgot to change usages of pong-sent from changing it in 4d6f6e512ec2056ada7acb3e897d7df39c015bc5 from pong-send to pong-sent --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 +- src/main/java/dev/dsf/bpe/message/SendPong.java | 2 +- src/main/resources/fhir/CodeSystem/dsf-ping-status.xml | 4 ++-- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index f8566ef2..3f2169a7 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -45,7 +45,7 @@ public interface ConstantsPing String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE = "not-reachable"; String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING = "pong-missing"; String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED = "pong-received"; - String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SEND = "pong-send"; + String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT = "pong-sent"; String EXTENSION_URL_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status"; String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 123a3441..571c9d44 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -46,7 +46,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Target target = variables.getTarget(); Task mainTask = variables.getStartTask(); mainTask.addOutput(statusGenerator.createPongStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SEND)); + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); variables.updateTask(mainTask); } diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml index 1045752c..b4343ccd 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml @@ -42,8 +42,8 @@ <definition value="Pong received from target organization" /> </concept> <concept> - <code value="pong-send" /> - <display value="Pong send" /> + <code value="pong-sent" /> + <display value="Pong sent" /> <definition value="Pong successfully sent to target organization" /> </concept> </CodeSystem> \ No newline at end of file diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 6ec70ea6..7de39697 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -353,7 +353,7 @@ public String getCorrelationKey() }; Task task = createValidTaskPing(); task.addOutput(new PingStatusGenerator().createPongStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SEND)); + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); From c6182e60c58f4bf109d4dd16bd21718c4e9ac9fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 18:41:15 +0100 Subject: [PATCH 040/382] Forgot to make the second Mbps MBps instead. --- src/main/resources/fhir/CodeSystem/dsf-ping-units.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml index fdc3601e..62b037a1 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml @@ -33,12 +33,12 @@ </concept> <concept> <code value="megabits-per-second"/> - <display value="mbps"/> + <display value="Mbps"/> <definition value="Download speed unit in megabits per second" /> </concept> <concept> - <code value="megabits-per-second"/> - <display value="mbps"/> - <definition value="Download speed unit in megabits per second" /> + <code value="megabytes-per-second"/> + <display value="MBps"/> + <definition value="Download speed unit in megabytes per second" /> </concept> </CodeSystem> \ No newline at end of file From fdaac84f7f7068d496817974880fb0e08a1b7b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 18:43:05 +0100 Subject: [PATCH 041/382] Added units to constants --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 3f2169a7..236630ec 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -47,6 +47,11 @@ public interface ConstantsPing String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED = "pong-received"; String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT = "pong-sent"; + String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; + String CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND = "bytes-per-second"; + String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND = "megabits-per-second"; + String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND = "megabytes-per-second"; + String EXTENSION_URL_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status"; String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; From 76d385391e0ed3ffbb1409296e6d8831cc7507c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 18:48:04 +0100 Subject: [PATCH 042/382] Added download and upload speed extension urls --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 236630ec..f700b7eb 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -57,6 +57,8 @@ public interface ConstantsPing String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; String EXTENSION_URL_ENDPOINT_IDENTIFIER = "endpoint-identifier"; String EXTENSION_URL_ERROR_MESSAGE = "error-message"; + String EXTENSION_URL_DOWNLOAD_SPEED = "download-speed"; + String EXTENSION_URL_UPLOAD_SPEED = "upload-speed"; String BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL = "timerInterval"; String BPMN_EXECUTION_VARIABLE_STOP_TIMER = "stopTimer"; From 2511742526b1769213b61c8c9c2c3c5c1c855afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 18:50:36 +0100 Subject: [PATCH 043/382] Added network speed extension url --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index f700b7eb..5a294cb3 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -53,6 +53,7 @@ public interface ConstantsPing String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND = "megabytes-per-second"; String EXTENSION_URL_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status"; + String EXTENSION_URL_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; String EXTENSION_URL_ENDPOINT_IDENTIFIER = "endpoint-identifier"; From ec742b24987e92a9ba711e7ebec2185695f16c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 18:53:42 +0100 Subject: [PATCH 044/382] Added network speed unit extension url --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 5a294cb3..e6551775 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -60,6 +60,7 @@ public interface ConstantsPing String EXTENSION_URL_ERROR_MESSAGE = "error-message"; String EXTENSION_URL_DOWNLOAD_SPEED = "download-speed"; String EXTENSION_URL_UPLOAD_SPEED = "upload-speed"; + String EXTENSION_URL_NETWORK_SPEED_UNIT = "unit"; String BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL = "timerInterval"; String BPMN_EXECUTION_VARIABLE_STOP_TIMER = "stopTimer"; From a7f22fb4a697789ef5c1df9f9aabee2fdeaa56e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 18:56:38 +0100 Subject: [PATCH 045/382] Renamed url to be in line with other code systems --- src/main/resources/fhir/CodeSystem/dsf-ping-units.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml index 62b037a1..5dc9e976 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping-units" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping_Units" /> From b442b6d6ad73e9243b4cc8330054742e0409a12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 18:57:05 +0100 Subject: [PATCH 046/382] Added ping units code system url --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index e6551775..375c02e4 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -47,6 +47,7 @@ public interface ConstantsPing String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED = "pong-received"; String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT = "pong-sent"; + String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units"; String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; String CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND = "bytes-per-second"; String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND = "megabits-per-second"; From 30c2916ad83f500d10eea222f10543ea11a6b88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 19:00:41 +0100 Subject: [PATCH 047/382] Added utility functions for download and upload speed extensions --- .../dev/dsf/bpe/util/PingStatusGenerator.java | 49 +++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java index 142ded7d..ab56813a 100644 --- a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java @@ -1,6 +1,7 @@ package dev.dsf.bpe.util; import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task.TaskOutputComponent; @@ -17,10 +18,21 @@ public TaskOutputComponent createPingStatusOutput(Target target, String statusCo return createPingStatusOutput(target, statusCode, null); } + public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, int downloadSpeed, int uploadSpeed, String unit) + { + return createPingStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); + } + public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, String errorMessage) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, - errorMessage); + errorMessage, -1, -1, null); + } + + public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, String errorMessage, int downloadSpeed, int uploadSpeed, String unit) + { + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, + errorMessage, downloadSpeed, uploadSpeed, unit); } public TaskOutputComponent createPongStatusOutput(Target target, String statusCode) @@ -28,14 +40,25 @@ public TaskOutputComponent createPongStatusOutput(Target target, String statusCo return createPongStatusOutput(target, statusCode, null); } + public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, int downloadSpeed, int uploadSpeed, String unit) + { + return createPongStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); + } + public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, String errorMessage) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, - errorMessage); + errorMessage, -1, -1, null); + } + + public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, String errorMessage, int downloadSpeed, int uploadSpeed, String unit) + { + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, + errorMessage, downloadSpeed, uploadSpeed, unit); } private TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, - String errorMessage) + String errorMessage, int downloadSpeed, int uploadSpeed, String unit) { TaskOutputComponent output = new TaskOutputComponent(); output.setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); @@ -52,6 +75,26 @@ private TaskOutputComponent createStatusOutput(Target target, String outputParam extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE) .setValue(new StringType(errorMessage)); + if(downloadSpeed >= 0 && unit != null) + { + Extension downloadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED) + .addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + downloadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED) + .setValue(new DecimalType(downloadSpeed)); + downloadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + } + + if(uploadSpeed >= 0 && unit != null) + { + Extension uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED) + .addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + uploadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED) + .setValue(new DecimalType(uploadSpeed)); + uploadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + } + return output; } } From a9d8a5d7de0f5bb74805c42bfe3beb435ad96ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 24 Feb 2025 19:06:14 +0100 Subject: [PATCH 048/382] Added test for new ping status output parameter for download and upload speeds --- .../dsf/fhir/profiles/TaskProfileTest.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 7de39697..220c2b70 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -248,6 +248,49 @@ public String getCorrelationKey() || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + @Test + public void testTaskStartPingProcessProfileValidWithBusinessKeyAndPingStatusOutputWithDownloadAndUploadSpeeds() throws Exception + { + Target target = new Target() + { + @Override + public String getOrganizationIdentifierValue() + { + return "target.org"; + } + + @Override + public String getEndpointUrl() + { + return "https://endpoint.target.org/fhir"; + } + + @Override + public String getEndpointIdentifierValue() + { + return "endpoint.target.org"; + } + + @Override + public String getCorrelationKey() + { + return UUID.randomUUID().toString(); + } + }; + + Task task = createValidTaskStartPingProcess(); + task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType() + .addCoding(BpmnMessage.businessKey()); + task.addOutput(new PingStatusGenerator().createPingStatusOutput(target, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED, 0,0, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND)); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + @Test public void testTaskStartPingProcessProfileNotValid1() throws Exception { From a42d23b2ca3d04a80aea4ed5c6fb83bd6b91c17f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 09:21:23 +0100 Subject: [PATCH 049/382] Extension.extension only has 2 slices: network-speed and unit --- .../fhir/StructureDefinition/dsf-extension-network-speed.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml index d7b046b6..92fada8b 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml @@ -34,8 +34,8 @@ </discriminator> <rules value="open"/> </slicing> - <min value="3"/> - <max value="3"/> + <min value="2"/> + <max value="2"/> </element> <element id="Extension.extension:network-speed"> <path value="Extension.extension"/> From 37f15cc12e6cdad123135165e6e51fc9f7097a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 11:36:19 +0100 Subject: [PATCH 050/382] CodeSystem dsf-ping-units.xml has url .../ping-units and not .../dsf-ping-units --- .../fhir/StructureDefinition/dsf-extension-network-speed.xml | 4 ++-- src/main/resources/fhir/ValueSet/dsf-ping-units.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml index 92fada8b..16872981 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml @@ -73,14 +73,14 @@ <element id="Extension.extension:unit.value[x].system"> <path value="Extension.extension.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-units"/> </element> <element id="Extension.extension:unit.value[x].code"> <path value="Extension.extension.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units"/> + <valueSet value="http://dsf.dev/fhir/CodeSystem/ping-units"/> </binding> </element> <element id="Extension.url"> diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml b/src/main/resources/fhir/ValueSet/dsf-ping-units.xml index d5020dc1..124233e4 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml +++ b/src/main/resources/fhir/ValueSet/dsf-ping-units.xml @@ -21,7 +21,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/dsf-ping-units" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-units" /> <version value="#{version}" /> </include> </compose> From 70b0dec7329fe215e8eb4f66d813b7fe2723dedc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 11:37:37 +0100 Subject: [PATCH 051/382] Extension now gets added correctly. Added missing url value for network-speed-extension's Extension.extension:network-speed.url element in ConstantsPing --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + .../dev/dsf/bpe/util/PingStatusGenerator.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 375c02e4..d4bd4dee 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -62,6 +62,7 @@ public interface ConstantsPing String EXTENSION_URL_DOWNLOAD_SPEED = "download-speed"; String EXTENSION_URL_UPLOAD_SPEED = "upload-speed"; String EXTENSION_URL_NETWORK_SPEED_UNIT = "unit"; + String EXTENSION_URL_NETWORK_SPEED_VALUE = "network-speed"; String BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL = "timerInterval"; String BPMN_EXECUTION_VARIABLE_STOP_TIMER = "stopTimer"; diff --git a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java index ab56813a..f60b63e1 100644 --- a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java @@ -77,21 +77,21 @@ private TaskOutputComponent createStatusOutput(Target target, String outputParam if(downloadSpeed >= 0 && unit != null) { - Extension downloadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED) - .addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); - downloadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED) + Extension downloadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); + Extension networkSpeed = downloadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); - downloadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } if(uploadSpeed >= 0 && unit != null) { - Extension uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED) - .addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); - uploadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED) - .setValue(new DecimalType(uploadSpeed)); - uploadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) + Extension uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); + Extension networkSpeed = uploadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) + .setValue(new DecimalType(downloadSpeed)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } From 8d4ba6bfc48a5d9dd7f007f8ca6a7598357d5b06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 11:54:22 +0100 Subject: [PATCH 052/382] Download-resource-size-bytes input parameter may be omitted to keep compatibility to older plugin versions --- src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index f32e8b43..f6da6df1 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -120,7 +120,7 @@ <element id="Task.input:download-resource-size-bytes"> <path value="Task.input"/> <sliceName value="download-resource-size-bytes"/> - <min value="1"/> + <min value="0"/> <max value="1"/> </element> <element id="Task.input:download-resource-size-bytes.type"> From 5054a1a8e09784ae232133a6256af7b4895fb121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 13:33:12 +0100 Subject: [PATCH 053/382] Fixed meta tag system referencing CodeSystem instead of ValueSet --- src/main/resources/fhir/ValueSet/dsf-ping-units.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml b/src/main/resources/fhir/ValueSet/dsf-ping-units.xml index 124233e4..9f236805 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml +++ b/src/main/resources/fhir/ValueSet/dsf-ping-units.xml @@ -2,7 +2,7 @@ <meta> <tag> <system - value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + value="http://dsf.dev/fhir/ValueSet/read-access-tag" /> <code value="ALL" /> </tag> </meta> From 52e9734b1e35ac42edd3e7c04025eb0d6a268d79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 13:33:24 +0100 Subject: [PATCH 054/382] Fixed CodeSystem being used as ValueSet --- .../fhir/StructureDefinition/dsf-extension-network-speed.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml index 16872981..58fbf85d 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml @@ -80,7 +80,7 @@ <min value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/CodeSystem/ping-units"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-units"/> </binding> </element> <element id="Extension.url"> From 002d7e4a222c63fdf1300108e8008b10f9ac325d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 15:46:42 +0100 Subject: [PATCH 055/382] Added concept for download-resource-reference needed in input parameter for ping-task --- src/main/resources/fhir/CodeSystem/dsf-ping.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping.xml b/src/main/resources/fhir/CodeSystem/dsf-ping.xml index dad0fbd1..19ca1186 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping.xml @@ -51,6 +51,11 @@ <display value="Download Resource Size Bytes"/> <definition value="Size of the resource to download for speed measurements in bytes"/> </concept> + <concept> + <code value="download-resource-reference" /> + <display value="Download Resource Reference"/> + <definition value="Reference to the resource to be downloaded for measuring network speed" /> + </concept> <concept> <code value="network-speed"/> <display value="Network Speed"/> From e9bd41824a1e02f3fdf620b044c28e2fabeb8376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 17:29:18 +0100 Subject: [PATCH 056/382] Added input parameter for download-resource-reference --- .../StructureDefinition/dsf-task-ping.xml | 52 +++++++++++ .../StructureDefinition/dsf-task-pong.xml | 92 +++++++++++++++++++ 2 files changed, 144 insertions(+) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index f6da6df1..d9f29591 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -157,6 +157,58 @@ <code value="integer"/> </type> </element> + <element id="Task.input:download-resource-reference"> + <path value="Task.input"/> + <sliceName value="download-resource-reference"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Task.input:download-resource-reference.type"> + <path value="Task.input.type"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> + </binding> + </element> + <element id="Task.input:download-resource-reference.type.coding"> + <path value="Task.input.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:download-resource-reference.type.coding.system"> + <path value="Task.input.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:download-resource-reference.type.coding.code"> + <path value="Task.input.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="download-resource-reference"/> + </element> + <element id="Task.input:download-resource-reference.value[x]"> + <path value="Task.input.value[x]"/> + <type> + <code value="Reference" /> + <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> + </type> + </element> + <element id="Task.input:download-resource-reference.value[x].reference"> + <path value="Task.input.value[x].reference"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:download-resource-reference.value[x].type"> + <path value="Task.input.value[x].type"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="Binary"/> + </element> + <element id="Task.input:download-resource-reference.value[x].identifier"> + <path value="Task.input.value[x].identifier"/> + <max value="0"/> + </element> <element id="Task.output:pong-status"> <path value="Task.output"/> <sliceName value="pong-status"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index 225c13bb..c5eafd65 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -60,5 +60,97 @@ <sliceName value="correlation-key" /> <min value="1" /> </element> + <element id="Task.input:download-resource-size-bytes"> + <path value="Task.input"/> + <sliceName value="download-resource-size-bytes"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Task.input:download-resource-size-bytes.type"> + <path value="Task.input.type"/> + <min value="1"/> + <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> + </binding> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding"> + <path value="Task.input.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding.system"> + <path value="Task.input.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding.code"> + <path value="Task.input.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="download-resource-size-bytes"/> + </element> + <element id="Task.input:download-resource-size-bytes.value[x]"> + <path value="Task.input.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="integer"/> + </type> + </element> + <element id="Task.input:download-resource-reference"> + <path value="Task.input"/> + <sliceName value="download-resource-reference"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Task.input:download-resource-reference.type"> + <path value="Task.input.type"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> + </binding> + </element> + <element id="Task.input:download-resource-reference.type.coding"> + <path value="Task.input.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:download-resource-reference.type.coding.system"> + <path value="Task.input.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:download-resource-reference.type.coding.code"> + <path value="Task.input.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="download-resource-reference"/> + </element> + <element id="Task.input:download-resource-reference.value[x]"> + <path value="Task.input.value[x]"/> + <type> + <code value="Reference" /> + <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> + </type> + </element> + <element id="Task.input:download-resource-reference.value[x].reference"> + <path value="Task.input.value[x].reference"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:download-resource-reference.value[x].type"> + <path value="Task.input.value[x].type"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="Binary"/> + </element> + <element id="Task.input:download-resource-reference.value[x].identifier"> + <path value="Task.input.value[x].identifier"/> + <max value="0"/> + </element> </differential> </StructureDefinition> \ No newline at end of file From 8b0292308c3ad375630231ec41382c5effb0c4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 18:06:12 +0100 Subject: [PATCH 057/382] Made naming consistent for downloadedBytes in ping and pong processes --- src/main/resources/bpe/ping.bpmn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 9143c207..dc7934ce 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -139,7 +139,7 @@ <bpmn:textAnnotation id="TextAnnotation_0smygq5"> <bpmn:text>Information in message: - downloadDurationMillis: long -- bytesDownloaded: long</bpmn:text> +- downloadedBytes: long</bpmn:text> </bpmn:textAnnotation> <bpmn:textAnnotation id="TextAnnotation_08ic0l2"> <bpmn:text>downloads up to maxDownloadSizeBytes</bpmn:text> @@ -296,7 +296,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> - <dc:Bounds x="2590" y="612" width="239.99152587125295" height="54.858934169278996" /> + <dc:Bounds x="2590" y="612" width="239.98257839721254" height="54.98693379790941" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> From 0bd0a5ea5c07463044181d2e528077a5d4d20b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 18:48:53 +0100 Subject: [PATCH 058/382] Added codes for downloaded-bytes and downloaded-duration --- src/main/resources/fhir/CodeSystem/dsf-ping.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping.xml b/src/main/resources/fhir/CodeSystem/dsf-ping.xml index 19ca1186..d46ee396 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping.xml @@ -61,4 +61,14 @@ <display value="Network Speed"/> <definition value="Network speed in both upload and download of a specific endpoint"/> </concept> + <concept> + <code value="downloaded-bytes"/> + <display value="Downloaded Bytes"/> + <definition value="Amount of bytes downloaded to measure network speed"/> + </concept> + <concept> + <code value="downloaded-duration-millis"/> + <display value="Downloaded Duration Millis"/> + <definition value="Duration it took for the resource to be downloaded to measure network speed"/> + </concept> </CodeSystem> \ No newline at end of file From 5d7537e9b21b002a2278f8d48c9a8f7c45a019fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 25 Feb 2025 18:49:52 +0100 Subject: [PATCH 059/382] Added downloaded-bytes and downloaded-duration as input parameters --- .../StructureDefinition/dsf-task-pong.xml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index c5eafd65..48f64ea3 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -152,5 +152,77 @@ <path value="Task.input.value[x].identifier"/> <max value="0"/> </element> + <element id="Task.input:downloaded-bytes"> + <path value="Task.input"/> + <sliceName value="downloaded-bytes"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-bytes.type"> + <path value="Task.input.type"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-bytes.type.coding"> + <path value="Task.input.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-bytes.type.coding.system"> + <path value="Task.input.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:downloaded-bytes.type.coding.code"> + <path value="Task.input.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="downloaded-bytes"/> + </element> + <element id="Task.input:downloaded-bytes.value[x]"> + <path value="Task.input.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="integer"/> + </type> + </element> + <element id="Task.input:downloaded-duration-millis"> + <path value="Task.input"/> + <sliceName value="downloaded-duration-millis"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-duration-millis.type"> + <path value="Task.input.type"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-duration-millis.type.coding"> + <path value="Task.input.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-duration-millis.type.coding.system"> + <path value="Task.input.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:downloaded-duration-millis.type.coding.code"> + <path value="Task.input.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="downloaded-duration-millis"/> + </element> + <element id="Task.input:downloaded-duration-millis.value[x]"> + <path value="Task.input.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="decimal"/> + </type> + </element> </differential> </StructureDefinition> \ No newline at end of file From 768a6219ce1a463f856f6e16f974fed8febb6aeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 09:37:17 +0100 Subject: [PATCH 060/382] Cleanup message does not need pong status output parameter. Pong status is added to the task starting the process: ping --- .../dsf-task-cleanup-pong.xml | 66 ------------------- 1 file changed, 66 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index ca468cc9..04b5cf80 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -60,71 +60,5 @@ <sliceName value="correlation-key" /> <min value="1" /> </element> - <element id="Task.output:pong-status"> - <path value="Task.output"/> - <sliceName value="pong-status"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Task.output:pong-status.extension"> - <path value="Task.output.extension" /> - <slicing> - <discriminator> - <type value="value" /> - <path value="url" /> - </discriminator> - <rules value="open" /> - </slicing> - </element> - <element id="Task.output:pong-status.extension:pong-status-extension"> - <path value="Task.output.extension" /> - <sliceName value="pong-status-extension" /> - <min value="1" /> - <type> - <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status|#{version}" /> - </type> - </element> - <element id="Task.output:pong-status.type"> - <path value="Task.output.type"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> - </binding> - </element> - <element id="Task.output:pong-status.type.coding"> - <path value="Task.output.type.coding"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Task.output:pong-status.type.coding.system"> - <path value="Task.output.type.coding.system"/> - <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> - </element> - <element id="Task.output:pong-status.type.coding.code"> - <path value="Task.output.type.coding.code"/> - <min value="1"/> - <fixedCode value="pong-status"/> - </element> - <element id="Task.output:pong-status.value[x]"> - <path value="Task.output.value[x]"/> - <type> - <code value="Coding"/> - </type> - </element> - <element id="Task.output:pong-status.value[x].system"> - <path value="Task.output.value[x].system"/> - <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status"/> - </element> - <element id="Task.output:pong-status.value[x].code"> - <path value="Task.output.value[x].code"/> - <min value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/pong-status|#{version}"/> - </binding> - </element> </differential> </StructureDefinition> \ No newline at end of file From 914ca24aa732f0caff6c408113acb6d55b03eb95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 09:58:59 +0100 Subject: [PATCH 061/382] Added helper class to create Input Parameters downloaded-duration-millis and downloaded-bytes --- .../bpe/util/NetworkSpeedMetricGenerator.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java diff --git a/src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java b/src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java new file mode 100644 index 00000000..13af5db8 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java @@ -0,0 +1,29 @@ +package dev.dsf.bpe.util; + +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.DecimalType; +import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; + +public class NetworkSpeedMetricGenerator +{ + public Task.ParameterComponent createDownloadedDurationMillis(long duration) + { + Task.ParameterComponent downloadedDuration = new Task.ParameterComponent(); + downloadedDuration.setValue(new DecimalType(duration)).getType().addCoding( + new Coding(ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, null)); + return downloadedDuration; + } + + public Task.ParameterComponent createDownloadedBytes(int bytes) + { + Task.ParameterComponent downloadedBytes = new Task.ParameterComponent(); + downloadedBytes.setValue(new IntegerType(bytes)).getType().addCoding( + new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, + null)); + return downloadedBytes; + } +} From c39028bbe002756b5d85c1fa84fdae066f903ede Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 09:59:29 +0100 Subject: [PATCH 062/382] Added downloaded-duration-millis and downloaded-bytes as constants from ping CodeSystem --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index d4bd4dee..5e3b49d3 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -39,6 +39,8 @@ public interface ConstantsPing String CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS = "target-endpoints"; String CODESYSTEM_DSF_PING_VALUE_TIMER_INTERVAL = "timer-interval"; String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES = "download-resource-size-bytes"; + String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS = "downloaded-duration-millis"; + String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES = "downloaded-bytes"; String CODESYSTEM_DSF_PING_STATUS = "http://dsf.dev/fhir/CodeSystem/ping-status"; String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED = "not-allowed"; From 27ad7b7b4dcb10ef6263db8cdba9930f2ada8e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:01:40 +0100 Subject: [PATCH 063/382] Added downloaded-duration-millis and downloaded-bytes as input parameters and fixed message name --- .../dsf-task-cleanup-pong.xml | 74 ++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index 04b5cf80..6a4241f7 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -42,7 +42,7 @@ </element> <element id="Task.input:message-name.value[x]"> <path value="Task.input.value[x]" /> - <fixedString value="ping" /> + <fixedString value="cleanup-pong" /> </element> <element id="Task.input:business-key"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -60,5 +60,77 @@ <sliceName value="correlation-key" /> <min value="1" /> </element> + <element id="Task.input:downloaded-bytes"> + <path value="Task.input"/> + <sliceName value="downloaded-bytes"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-bytes.type"> + <path value="Task.input.type"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-bytes.type.coding"> + <path value="Task.input.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-bytes.type.coding.system"> + <path value="Task.input.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:downloaded-bytes.type.coding.code"> + <path value="Task.input.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="downloaded-bytes"/> + </element> + <element id="Task.input:downloaded-bytes.value[x]"> + <path value="Task.input.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="integer"/> + </type> + </element> + <element id="Task.input:downloaded-duration-millis"> + <path value="Task.input"/> + <sliceName value="downloaded-duration-millis"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-duration-millis.type"> + <path value="Task.input.type"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-duration-millis.type.coding"> + <path value="Task.input.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:downloaded-duration-millis.type.coding.system"> + <path value="Task.input.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:downloaded-duration-millis.type.coding.code"> + <path value="Task.input.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="downloaded-duration-millis"/> + </element> + <element id="Task.input:downloaded-duration-millis.value[x]"> + <path value="Task.input.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="decimal"/> + </type> + </element> </differential> </StructureDefinition> \ No newline at end of file From b810c2ad54549559229a6fa7d644d84ed597d3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:06:06 +0100 Subject: [PATCH 064/382] Added field injections for Cleanup Pong task --- src/main/resources/bpe/ping.bpmn | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index dc7934ce..5493c42a 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -84,6 +84,17 @@ <bpmn:outgoing>Flow_1v37fff</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sendTask id="Activity_0vw65a2" name="Cleanup Pong" camunda:class="dev.dsf.bpe.message.CleanupPong"> + <bpmn:extensionElements> + <camunda:field name="profile"> + <camunda:string>http://dsf.dev/fhir/StructureDefinition/task-cleanup-pong|#{version}</camunda:string> + </camunda:field> + <camunda:field name="messageName"> + <camunda:string>cleanup-pong</camunda:string> + </camunda:field> + <camunda:field name="instantiatesCanonical"> + <camunda:string>http://dsf.dev/bpe/Process/pong|#{version}</camunda:string> + </camunda:field> + </bpmn:extensionElements> <bpmn:incoming>Flow_1v37fff</bpmn:incoming> <bpmn:incoming>Flow_0jcfur3</bpmn:incoming> <bpmn:outgoing>Flow_0pj6d62</bpmn:outgoing> From cc8b7440fa156c3db5f8ec680e7518e30a3b8660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:11:55 +0100 Subject: [PATCH 065/382] CleanupPong message name should be camel-case --- src/main/resources/bpe/ping.bpmn | 2 +- .../fhir/StructureDefinition/dsf-task-cleanup-pong.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 5493c42a..69bf400f 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -89,7 +89,7 @@ <camunda:string>http://dsf.dev/fhir/StructureDefinition/task-cleanup-pong|#{version}</camunda:string> </camunda:field> <camunda:field name="messageName"> - <camunda:string>cleanup-pong</camunda:string> + <camunda:string>cleanupPong</camunda:string> </camunda:field> <camunda:field name="instantiatesCanonical"> <camunda:string>http://dsf.dev/bpe/Process/pong|#{version}</camunda:string> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index 6a4241f7..e56811c3 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -42,7 +42,7 @@ </element> <element id="Task.input:message-name.value[x]"> <path value="Task.input.value[x]" /> - <fixedString value="cleanup-pong" /> + <fixedString value="cleanupPong" /> </element> <element id="Task.input:business-key"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> From caf196b5b1c93ebc3ac7735f9d2340ef5c014007 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:13:21 +0100 Subject: [PATCH 066/382] Added profile, process uri and message name for cleanup pong message --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 5e3b49d3..ec3cc403 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -32,6 +32,10 @@ public interface ConstantsPing String PROFILE_DSF_TASK_PONG_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PONG; String PROFILE_DSF_TASK_PONG_MESSAGE_NAME = "pong"; + String PROFILE_DSF_TASK_CLEANUP_PONG = "http://dsf.dev/fhir/StructureDefinition/task-cleanup-pong"; + String PROFILE_DSF_TASK_CLEANUP_PONG_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PONG; + String PROFILE_DSF_TASK_CLEANUP_PONG_MESSAGE_NAME = "cleanupPong"; + String CODESYSTEM_DSF_PING = "http://dsf.dev/fhir/CodeSystem/ping"; String CODESYSTEM_DSF_PING_VALUE_PING_STATUS = "ping-status"; String CODESYSTEM_DSF_PING_VALUE_PONG_STATUS = "pong-status"; From 69752057038a1a1f7fd07ed18eb71668cccce28b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:21:59 +0100 Subject: [PATCH 067/382] Adjusted cardinality. Message-name, business-key and correlation-key have to be present, downloaded-bytes and downloaded-duration-millis are optional in case slim ping was run --- .../fhir/StructureDefinition/dsf-task-cleanup-pong.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index e56811c3..f41cac35 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -30,8 +30,8 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="4" /> - <max value="4" /> + <min value="3" /> + <max value="5" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> From 5fc986ffa78ad751199f0cee8cc585be396c0843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:26:17 +0100 Subject: [PATCH 068/382] Adjusted cardinality to include optional input parameters downloaded-duration-millis and downloaded-bytes --- src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index 48f64ea3..a0ccbb49 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -31,7 +31,7 @@ </extension> <path value="Task.input" /> <min value="3" /> - <max value="3" /> + <max value="5" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> From 1a182236d47f5f2b9d00c72c388972b921c29627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:27:18 +0100 Subject: [PATCH 069/382] Added tests for cleanup pong task and pong task with network speed metrics added as input parameters --- .../dsf/fhir/profiles/TaskProfileTest.java | 58 ++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 220c2b70..56ad81fc 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -22,6 +22,7 @@ import ca.uhn.fhir.validation.ValidationResult; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; +import dev.dsf.bpe.util.NetworkSpeedMetricGenerator; import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; @@ -42,7 +43,7 @@ public class TaskProfileTest def.getResourceReleaseDate(), Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-network-speed.xml", "dsf-extension-ping-status.xml", "dsf-task-ping.xml", "dsf-task-pong.xml", "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", - "dsf-task-stop-ping-autostart.xml"), + "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", "dsf-ping-status.xml", "dsf-ping-units.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", @@ -449,6 +450,34 @@ public void testTaskPongValid() throws Exception || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + @Test + public void testTaskPongValidWithDownloadedDurationMillisAndDownloadedBytesPresent() + { + Task task = createValidTaskPong(); + + NetworkSpeedMetricGenerator networkSpeedMetricGenerator = new NetworkSpeedMetricGenerator(); + task.addInput(networkSpeedMetricGenerator.createDownloadedBytes(1000)); + task.addInput(networkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + @Test + public void testTaskCleanupPongValid() + { + Task task = createValidTaskCleanupPong(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + private Task createValidTaskPong() { Task task = new Task(); @@ -471,4 +500,31 @@ private Task createValidTaskPong() return task; } + + private Task createValidTaskCleanupPong() + { + NetworkSpeedMetricGenerator networkSpeedMetricGenerator = new NetworkSpeedMetricGenerator(); + + Task task = new Task(); + task.getMeta().addProfile(ConstantsPing.PROFILE_DSF_TASK_CLEANUP_PONG); + task.setInstantiatesCanonical(ConstantsPing.PROFILE_DSF_TASK_CLEANUP_PONG_PROCESS_URI + "|" + def.getResourceVersion()); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()) + .setIdentifier(OrganizationIdentifier.withValue("DIC 1")); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()) + .setIdentifier(OrganizationIdentifier.withValue("TTP")); + + task.addInput().setValue(new StringType(ConstantsPing.PROFILE_DSF_TASK_CLEANUP_PONG_MESSAGE_NAME)).getType() + .addCoding(BpmnMessage.messageName()); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() + .addCoding(BpmnMessage.businessKey()); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() + .addCoding(BpmnMessage.correlationKey()); + + task.addInput(networkSpeedMetricGenerator.createDownloadedBytes(1000)); + task.addInput(networkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); + return task; + } } From 01fc9de328027bfc84814412735973abc4f74a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:28:52 +0100 Subject: [PATCH 070/382] Added ping units CodeSystem --- src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index f07ae15d..fa81981b 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -52,6 +52,7 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var cPing = "fhir/CodeSystem/dsf-ping.xml"; var cPingStatus = "fhir/CodeSystem/dsf-ping-status.xml"; + var cPingUnits = "fhir/CodeSystem/dsf-ping-units.xml"; var sPingStatus = "fhir/StructureDefinition/dsf-extension-ping-status.xml"; var sPing = "fhir/StructureDefinition/dsf-task-ping.xml"; @@ -72,11 +73,11 @@ public Map<String, List<String>> getFhirResourcesByProcessId() return Map.of(ConstantsPing.PROCESS_NAME_FULL_PING, Arrays.asList( - aPing, cPing, cPingStatus, sPingStatus, sStartPing, sPong, sCleanupPong, tStartPing, vPing, vPingStatus, vPingUnits), + aPing, cPing, cPingStatus, cPingUnits, sPingStatus, sStartPing, sPong, sCleanupPong, tStartPing, vPing, vPingStatus, vPingUnits), ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, tStopPingAutoStart, vPing), ConstantsPing.PROCESS_NAME_FULL_PONG, - Arrays.asList(aPong, cPing, cPingStatus, sPingStatus, sPing, vPing, vPongStatus, vPingUnits)); + Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, sPingStatus, sPing, vPing, vPongStatus, vPingUnits)); } } From 3be5492938682f4b27c1155a95c8b2362ea0454a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:30:46 +0100 Subject: [PATCH 071/382] Ran format-and-sort --- .../dsf/bpe/PingProcessPluginDefinition.java | 10 ++--- .../service/EstimateCleanupTimerDuration.java | 1 + .../dev/dsf/bpe/spring/config/PingConfig.java | 2 +- .../bpe/util/NetworkSpeedMetricGenerator.java | 9 ++-- .../dev/dsf/bpe/util/PingStatusGenerator.java | 41 +++++++++++-------- .../dsf/fhir/profiles/TaskProfileTest.java | 24 +++++------ 6 files changed, 47 insertions(+), 40 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index fa81981b..24743d9b 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -71,13 +71,13 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var vPingStatus = "fhir/ValueSet/dsf-ping-status.xml"; var vPongStatus = "fhir/ValueSet/dsf-pong-status.xml"; - return Map.of(ConstantsPing.PROCESS_NAME_FULL_PING, - Arrays.asList( - aPing, cPing, cPingStatus, cPingUnits, sPingStatus, sStartPing, sPong, sCleanupPong, tStartPing, vPing, vPingStatus, vPingUnits), + return Map.of( + ConstantsPing.PROCESS_NAME_FULL_PING, Arrays.asList(aPing, cPing, cPingStatus, cPingUnits, sPingStatus, + sStartPing, sPong, sCleanupPong, tStartPing, vPing, vPingStatus, vPingUnits), ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, tStopPingAutoStart, vPing), - ConstantsPing.PROCESS_NAME_FULL_PONG, - Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, sPingStatus, sPing, vPing, vPongStatus, vPingUnits)); + ConstantsPing.PROCESS_NAME_FULL_PONG, Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, sPingStatus, + sPing, vPing, vPongStatus, vPingUnits)); } } diff --git a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java index 9c03f129..e26d7eac 100644 --- a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java @@ -12,6 +12,7 @@ public class EstimateCleanupTimerDuration extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(EstimateCleanupTimerDuration.class); + public EstimateCleanupTimerDuration(ProcessPluginApi api) { super(api); diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index b2802fac..1d4a98a3 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -15,10 +15,10 @@ import dev.dsf.bpe.service.LogNoResponse; import dev.dsf.bpe.service.LogPing; import dev.dsf.bpe.service.LogSendError; -import dev.dsf.bpe.service.StoreResults; import dev.dsf.bpe.service.SelectPingTargets; import dev.dsf.bpe.service.SelectPongTarget; import dev.dsf.bpe.service.SetTargetAndConfigureTimer; +import dev.dsf.bpe.service.StoreResults; import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; diff --git a/src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java b/src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java index 13af5db8..d538c7c9 100644 --- a/src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java @@ -12,8 +12,8 @@ public class NetworkSpeedMetricGenerator public Task.ParameterComponent createDownloadedDurationMillis(long duration) { Task.ParameterComponent downloadedDuration = new Task.ParameterComponent(); - downloadedDuration.setValue(new DecimalType(duration)).getType().addCoding( - new Coding(ConstantsPing.CODESYSTEM_DSF_PING, + downloadedDuration.setValue(new DecimalType(duration)).getType() + .addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, null)); return downloadedDuration; } @@ -21,9 +21,8 @@ public Task.ParameterComponent createDownloadedDurationMillis(long duration) public Task.ParameterComponent createDownloadedBytes(int bytes) { Task.ParameterComponent downloadedBytes = new Task.ParameterComponent(); - downloadedBytes.setValue(new IntegerType(bytes)).getType().addCoding( - new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, - null)); + downloadedBytes.setValue(new IntegerType(bytes)).getType().addCoding(new Coding( + ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, null)); return downloadedBytes; } } diff --git a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java index f60b63e1..38948151 100644 --- a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java @@ -18,21 +18,23 @@ public TaskOutputComponent createPingStatusOutput(Target target, String statusCo return createPingStatusOutput(target, statusCode, null); } - public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, int downloadSpeed, int uploadSpeed, String unit) + public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, int downloadSpeed, + int uploadSpeed, String unit) { return createPingStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, String errorMessage) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, - errorMessage, -1, -1, null); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessage, + -1, -1, null); } - public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, String errorMessage, int downloadSpeed, int uploadSpeed, String unit) + public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, String errorMessage, + int downloadSpeed, int uploadSpeed, String unit) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, - errorMessage, downloadSpeed, uploadSpeed, unit); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessage, + downloadSpeed, uploadSpeed, unit); } public TaskOutputComponent createPongStatusOutput(Target target, String statusCode) @@ -40,21 +42,23 @@ public TaskOutputComponent createPongStatusOutput(Target target, String statusCo return createPongStatusOutput(target, statusCode, null); } - public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, int downloadSpeed, int uploadSpeed, String unit) + public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, int downloadSpeed, + int uploadSpeed, String unit) { return createPongStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, String errorMessage) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, - errorMessage, -1, -1, null); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessage, + -1, -1, null); } - public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, String errorMessage, int downloadSpeed, int uploadSpeed, String unit) + public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, String errorMessage, + int downloadSpeed, int uploadSpeed, String unit) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, - errorMessage, downloadSpeed, uploadSpeed, unit); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessage, + downloadSpeed, uploadSpeed, unit); } private TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, @@ -75,20 +79,23 @@ private TaskOutputComponent createStatusOutput(Target target, String outputParam extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE) .setValue(new StringType(errorMessage)); - if(downloadSpeed >= 0 && unit != null) + if (downloadSpeed >= 0 && unit != null) { - Extension downloadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); - Extension networkSpeed = downloadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + Extension downloadSpeedExtension = extension.addExtension() + .setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); + Extension networkSpeed = downloadSpeedExtension.addExtension() + .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } - if(uploadSpeed >= 0 && unit != null) + if (uploadSpeed >= 0 && unit != null) { Extension uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); - Extension networkSpeed = uploadSpeedExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + Extension networkSpeed = uploadSpeedExtension.addExtension() + .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 56ad81fc..d6a047e6 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -41,9 +41,10 @@ public class TaskProfileTest @ClassRule public static final ValidationSupportRule validationRule = new ValidationSupportRule(def.getResourceVersion(), def.getResourceReleaseDate(), - Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-network-speed.xml", "dsf-extension-ping-status.xml", "dsf-task-ping.xml", - "dsf-task-pong.xml", "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", - "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), + Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-network-speed.xml", "dsf-extension-ping-status.xml", + "dsf-task-ping.xml", "dsf-task-pong.xml", "dsf-task-start-ping.xml", + "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", + "dsf-task-cleanup-pong.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", "dsf-ping-status.xml", "dsf-ping-units.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", @@ -250,7 +251,8 @@ public String getCorrelationKey() } @Test - public void testTaskStartPingProcessProfileValidWithBusinessKeyAndPingStatusOutputWithDownloadAndUploadSpeeds() throws Exception + public void testTaskStartPingProcessProfileValidWithBusinessKeyAndPingStatusOutputWithDownloadAndUploadSpeeds() + throws Exception { Target target = new Target() { @@ -283,7 +285,8 @@ public String getCorrelationKey() task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); task.addOutput(new PingStatusGenerator().createPingStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED, 0,0, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND)); + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED, 0, 0, + ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND)); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -346,9 +349,7 @@ private Task createValidTaskStartPingProcess() task.addInput().setValue(new StringType(ConstantsPing.PROFILE_DSF_TASK_START_PING_MESSAGE_NAME)).getType() .addCoding(BpmnMessage.messageName()); - task.addInput() - .setValue(new IntegerType(1)) - .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + task.addInput().setValue(new IntegerType(1)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES); return task; @@ -430,9 +431,7 @@ private Task createValidTaskPing() .setIdentifier(EndpointIdentifier.withValue("endpoint.target.org"))) .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER); - task.addInput() - .setValue(new IntegerType(1)) - .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + task.addInput().setValue(new IntegerType(1)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES); return task; @@ -507,7 +506,8 @@ private Task createValidTaskCleanupPong() Task task = new Task(); task.getMeta().addProfile(ConstantsPing.PROFILE_DSF_TASK_CLEANUP_PONG); - task.setInstantiatesCanonical(ConstantsPing.PROFILE_DSF_TASK_CLEANUP_PONG_PROCESS_URI + "|" + def.getResourceVersion()); + task.setInstantiatesCanonical( + ConstantsPing.PROFILE_DSF_TASK_CLEANUP_PONG_PROCESS_URI + "|" + def.getResourceVersion()); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); task.setAuthoredOn(new Date()); From 999e03295c2592ab1e2c6fee83eccaae2a653966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:31:29 +0100 Subject: [PATCH 072/382] Adjusted to include new fhir resources --- .../java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java index 978fd13e..4517171f 100644 --- a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java +++ b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java @@ -20,7 +20,7 @@ public void testResourceLoading() throws Exception var ping = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING); assertNotNull(ping); - assertEquals(9, ping.stream().filter(this::exists).count()); + assertEquals(12, ping.stream().filter(this::exists).count()); var pingAutostart = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART); assertNotNull(pingAutostart); @@ -28,7 +28,7 @@ public void testResourceLoading() throws Exception var pong = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PONG); assertNotNull(pong); - assertEquals(7, pong.stream().filter(this::exists).count()); + assertEquals(9, pong.stream().filter(this::exists).count()); } private boolean exists(String file) From 02512c230507e4cf35b36e75bc6a7dcdffbaa4a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:37:47 +0100 Subject: [PATCH 073/382] Fixed wrong auto-complete --- src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index 24743d9b..ed1eecb3 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -60,7 +60,7 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var sStartPing = "fhir/StructureDefinition/dsf-task-start-ping.xml"; var sStartPingAutostart = "fhir/StructureDefinition/dsf-task-start-ping-autostart.xml"; var sStopPingAutostart = "fhir/StructureDefinition/dsf-task-stop-ping-autostart.xml"; - var sCleanupPong = "fhir/StructureDefinition/dsf-task-pong-cleanup-pong.xml"; + var sCleanupPong = "fhir/StructureDefinition/dsf-task-cleanup-pong.xml"; var tStartPing = "fhir/Task/dsf-task-start-ping.xml"; var tStartPingAutoStart = "fhir/Task/dsf-task-start-ping-autostart.xml"; From b6a13c3cceb42cf700460b1dfdaf4b1908ce5b31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:49:43 +0100 Subject: [PATCH 074/382] Added download-resource-reference from ping-CodeSystem as constant --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index ec3cc403..366cb1f3 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -45,6 +45,7 @@ public interface ConstantsPing String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES = "download-resource-size-bytes"; String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS = "downloaded-duration-millis"; String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES = "downloaded-bytes"; + String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE = "download-resource-reference"; String CODESYSTEM_DSF_PING_STATUS = "http://dsf.dev/fhir/CodeSystem/ping-status"; String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED = "not-allowed"; From 5aa5a562595ace1cfb150418496aa8b016ed711c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 10:52:56 +0100 Subject: [PATCH 075/382] Added util classes to create download-resource-reference and download-resource-size input parameters --- .../DownloadResourceReferenceGenerator.java | 24 +++++++++++++++++++ .../util/DownloadResourceSizeGenerator.java | 17 +++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java create mode 100644 src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java diff --git a/src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java b/src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java new file mode 100644 index 00000000..002b2245 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java @@ -0,0 +1,24 @@ +package dev.dsf.bpe.util; + +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; + +public class DownloadResourceReferenceGenerator +{ + public static Task.ParameterComponent create(String uri) + { + Reference reference = new Reference(uri); + reference.setType("Binary"); + return create(reference); + } + + public static Task.ParameterComponent create(Reference reference) + { + Task.ParameterComponent param = new Task.ParameterComponent(); + param.setValue(reference).getType().addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, null)); + return param; + } +} diff --git a/src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java new file mode 100644 index 00000000..2a810093 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java @@ -0,0 +1,17 @@ +package dev.dsf.bpe.util; + +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; + +public class DownloadResourceSizeGenerator +{ + public static Task.ParameterComponent create(int sizeBytes) + { + Task.ParameterComponent param = new Task.ParameterComponent(); + param.setValue(new IntegerType(sizeBytes)).getType().addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, null)); + return param; + } +} From 4ee2dac052f05680610d16884f7995e49f6be7b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 11:04:14 +0100 Subject: [PATCH 076/382] Adjusted cardinality for optional download-resource-size-bytes and download-resource-reference inputs --- src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index d9f29591..d41aed7e 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -30,8 +30,8 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="5" /> - <max value="5" /> + <min value="4" /> + <max value="6" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> From 057a17b46fc8517cefe9d3cb49637689e6813e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 11:07:35 +0100 Subject: [PATCH 077/382] Adjusted createValidTaskPing() to not include optional input parameters and added test for ping task with both optional input parameters set --- .../dsf/fhir/profiles/TaskProfileTest.java | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index d6a047e6..86d8dd10 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -22,6 +22,8 @@ import ca.uhn.fhir.validation.ValidationResult; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; +import dev.dsf.bpe.util.DownloadResourceReferenceGenerator; +import dev.dsf.bpe.util.DownloadResourceSizeGenerator; import dev.dsf.bpe.util.NetworkSpeedMetricGenerator; import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; @@ -407,6 +409,49 @@ public String getCorrelationKey() || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + @Test + public void testTaskPingValidWithPingStatusOutputAndDownloadResourceSizeAndDownloadResourceReference() throws Exception + { + Target target = new Target() + { + @Override + public String getOrganizationIdentifierValue() + { + return "target.org"; + } + + @Override + public String getEndpointUrl() + { + return "https://endpoint.target.org/fhir"; + } + + @Override + public String getEndpointIdentifierValue() + { + return "endpoint.target.org"; + } + + @Override + public String getCorrelationKey() + { + return UUID.randomUUID().toString(); + } + }; + Task task = createValidTaskPing(); + task.addOutput(new PingStatusGenerator().createPongStatusOutput(target, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); + + task.addInput(DownloadResourceSizeGenerator.create(1000)); + task.addInput(DownloadResourceReferenceGenerator.create("https://test.endpoint.org/fhir/Binary")); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + private Task createValidTaskPing() { Task task = new Task(); @@ -431,8 +476,6 @@ private Task createValidTaskPing() .setIdentifier(EndpointIdentifier.withValue("endpoint.target.org"))) .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER); - task.addInput().setValue(new IntegerType(1)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES); return task; } From 2e81113f89467d9a840c5bce999c97ee3802b99e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 11:51:17 +0100 Subject: [PATCH 078/382] Pong does not need download-resource-size-bytes input parameter --- .../StructureDefinition/dsf-task-pong.xml | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index a0ccbb49..62e404c3 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -60,46 +60,6 @@ <sliceName value="correlation-key" /> <min value="1" /> </element> - <element id="Task.input:download-resource-size-bytes"> - <path value="Task.input"/> - <sliceName value="download-resource-size-bytes"/> - <min value="0"/> - <max value="1"/> - </element> - <element id="Task.input:download-resource-size-bytes.type"> - <path value="Task.input.type"/> - <min value="1"/> - <max value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> - </binding> - </element> - <element id="Task.input:download-resource-size-bytes.type.coding"> - <path value="Task.input.type.coding"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Task.input:download-resource-size-bytes.type.coding.system"> - <path value="Task.input.type.coding.system"/> - <min value="1"/> - <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> - </element> - <element id="Task.input:download-resource-size-bytes.type.coding.code"> - <path value="Task.input.type.coding.code"/> - <min value="1"/> - <max value="1"/> - <fixedCode value="download-resource-size-bytes"/> - </element> - <element id="Task.input:download-resource-size-bytes.value[x]"> - <path value="Task.input.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="integer"/> - </type> - </element> <element id="Task.input:download-resource-reference"> <path value="Task.input"/> <sliceName value="download-resource-reference"/> From 9fd8d27f8a788e1a82d7e58b107d5e94b92db653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 12:47:25 +0100 Subject: [PATCH 079/382] Added utils classes to generate input parameters downloaded-bytes and downloaded-duration-millis --- .../dsf/bpe/util/DownloadedBytesGenerator.java | 17 +++++++++++++++++ .../DownloadedDurationMillisGenerator.java | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/main/java/dev/dsf/bpe/util/DownloadedBytesGenerator.java create mode 100644 src/main/java/dev/dsf/bpe/util/DownloadedDurationMillisGenerator.java diff --git a/src/main/java/dev/dsf/bpe/util/DownloadedBytesGenerator.java b/src/main/java/dev/dsf/bpe/util/DownloadedBytesGenerator.java new file mode 100644 index 00000000..b9dec52d --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/DownloadedBytesGenerator.java @@ -0,0 +1,17 @@ +package dev.dsf.bpe.util; + +import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; + +public class DownloadedBytesGenerator +{ + public static Task.ParameterComponent create(int bytes) + { + Task.ParameterComponent param = new Task.ParameterComponent(); + param.setValue(new IntegerType(bytes)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES); + return param; + } +} diff --git a/src/main/java/dev/dsf/bpe/util/DownloadedDurationMillisGenerator.java b/src/main/java/dev/dsf/bpe/util/DownloadedDurationMillisGenerator.java new file mode 100644 index 00000000..7de7b2a2 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/DownloadedDurationMillisGenerator.java @@ -0,0 +1,18 @@ +package dev.dsf.bpe.util; + +import org.hl7.fhir.r4.model.DecimalType; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; + +public class DownloadedDurationMillisGenerator +{ + public static Task.ParameterComponent create(long durationMillis) + { + Task.ParameterComponent param = new Task.ParameterComponent(); + param.setValue(new DecimalType(durationMillis)).getType().addCoding() + .setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS); + return param; + } +} From d5839f5494e00062475aca716fc2d06eead49074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 12:47:55 +0100 Subject: [PATCH 080/382] Added missing input parameters --- src/main/java/dev/dsf/bpe/message/CleanupPong.java | 6 ++++-- src/main/java/dev/dsf/bpe/message/SendPing.java | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPong.java b/src/main/java/dev/dsf/bpe/message/CleanupPong.java index d3e861df..86e23030 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPong.java @@ -5,6 +5,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.util.NetworkSpeedMetricGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Variables; @@ -20,7 +21,8 @@ public CleanupPong(ProcessPluginApi api) protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - System.out.println("Getting additional input parameters for pong cleanup"); - return super.getAdditionalInputParameters(execution, variables); + NetworkSpeedMetricGenerator networkSpeedMetricGenerator = new NetworkSpeedMetricGenerator(); + return Stream.of(networkSpeedMetricGenerator.createDownloadedBytes(0), + networkSpeedMetricGenerator.createDownloadedDurationMillis(0)); } } diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index 421fc176..f4cd8021 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -10,6 +10,8 @@ import org.hl7.fhir.r4.model.Task.ParameterComponent; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.DownloadResourceReferenceGenerator; +import dev.dsf.bpe.util.DownloadResourceSizeGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Variables; @@ -29,7 +31,8 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut { return Stream.of(api.getTaskHelper().createInput( new Reference().setIdentifier(getLocalEndpointIdentifier()).setType(ResourceType.Endpoint.name()), - ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER)); + ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER), + DownloadResourceSizeGenerator.create(0), DownloadResourceReferenceGenerator.create("https://test.org/fhir/Binary/foo")); } @Override From 2d5249e7b3f316841834e7910cfa916e0d130484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 15:33:27 +0100 Subject: [PATCH 081/382] Added input parameter error-message to be able to send possible error messages back to ping process and add them there as output parameters of the start task for that pong instance --- .../resources/fhir/CodeSystem/dsf-ping.xml | 5 +++ .../StructureDefinition/dsf-task-pong.xml | 36 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping.xml b/src/main/resources/fhir/CodeSystem/dsf-ping.xml index d46ee396..bc70ab9d 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping.xml @@ -71,4 +71,9 @@ <display value="Downloaded Duration Millis"/> <definition value="Duration it took for the resource to be downloaded to measure network speed"/> </concept> + <concept> + <code value="error-message"/> + <display value="Error Message"/> + <definition value="Error message to be added as an output parameter in the Start Ping Task"/> + </concept> </CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index 62e404c3..5b996182 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -184,5 +184,41 @@ <code value="decimal"/> </type> </element> + <element id="Task.input:error-message"> + <path value="Task.input"/> + <sliceName value="error-message"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Task.input:error-message.type"> + <path value="Task.input.type"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:error-message.type.coding"> + <path value="Task.input.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:error-message.type.coding.system"> + <path value="Task.input.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:error-message.type.coding.code"> + <path value="Task.input.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="error-message"/> + </element> + <element id="Task.input:error-message.value[x]"> + <path value="Task.input.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="string"/> + </type> + </element> </differential> </StructureDefinition> \ No newline at end of file From ffacfc5da0c18c4be8ceab1e450932e6f63bbc87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 15:35:58 +0100 Subject: [PATCH 082/382] Added dummy input parameters --- src/main/java/dev/dsf/bpe/message/SendPong.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 571c9d44..db582d80 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -1,12 +1,16 @@ package dev.dsf.bpe.message; import java.util.Objects; +import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; +import dev.dsf.bpe.util.DownloadResourceReferenceGenerator; +import dev.dsf.bpe.util.DownloadedBytesGenerator; +import dev.dsf.bpe.util.DownloadedDurationMillisGenerator; import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; @@ -38,6 +42,15 @@ public void afterPropertiesSet() throws Exception Objects.requireNonNull(errorMailService, "errorMailService"); } + @Override + protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, + Variables variables) + { + return Stream.of(DownloadedBytesGenerator.create(0), DownloadedDurationMillisGenerator.create(0), + DownloadResourceReferenceGenerator.create("http://example.org/fhir/Binary/bar") + ); + } + @Override protected void doExecute(DelegateExecution execution, Variables variables) throws Exception { From 275ac4c2e0d9c4ccc50fce7b524d3f722eb34fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 16:57:06 +0100 Subject: [PATCH 083/382] Added download-resource-size-bytes input parameter from start task's input parameter --- .../dev/dsf/bpe/message/SendStartPing.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendStartPing.java b/src/main/java/dev/dsf/bpe/message/SendStartPing.java index b38590fd..42dfe966 100644 --- a/src/main/java/dev/dsf/bpe/message/SendStartPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendStartPing.java @@ -23,10 +23,24 @@ public SendStartPing(ProcessPluginApi api) @Override protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - return variables.getStartTask().getInput().stream().filter(Task.ParameterComponent::hasType) - .filter(i -> i.getType().getCoding().stream() - .anyMatch(c -> ConstantsPing.CODESYSTEM_DSF_PING.equals(c.getSystem()) - && ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS.equals(c.getCode()))); + return Stream.concat(variables.getStartTask().getInput().stream().filter(Task.ParameterComponent::hasType) + .filter(i -> i.getType().getCoding().stream().anyMatch( + c -> ConstantsPing.CODESYSTEM_DSF_PING.equals(c.getSystem()) + && ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS.equals(c.getCode()))), + Stream.of(getDownloadResourceSizeInputParameter(variables))); + } + + private ParameterComponent getDownloadResourceSizeInputParameter(Variables variables) + { + return variables.getStartTask().getInput().stream().filter(this::isDownloadResourceSizeParameter).findFirst().orElseThrow(); + } + + private boolean isDownloadResourceSizeParameter(ParameterComponent parameterComponent) + { + return parameterComponent.getType().getCoding().stream() + .anyMatch(t -> + ConstantsPing.CODESYSTEM_DSF_PING.equals(t.getSystem()) + && ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES.equals(t.getCode())); } @Override From eb07c3de931b464dc5c4991a297c66a1ab7cd253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 16:59:30 +0100 Subject: [PATCH 084/382] Added download-resource-size-bytes as input parameter to task-start-ping-autostart --- .../dsf-task-start-ping-autostart.xml | 33 +++++++++++++++++-- .../dsf/fhir/profiles/TaskProfileTest.java | 2 ++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml index 0683d5a6..ea9ca7bf 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml @@ -30,8 +30,8 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="1" /> - <max value="4" /> + <min value="2" /> + <max value="5" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -138,5 +138,34 @@ <expression value="matches('^P(?:([0-9]+)Y)?(?:([0-9]+)M)?(?:([0-9]+)D)?(T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:([0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?$')" /> </constraint> </element> + <element id="Task.input:download-resource-size-bytes"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="download-resource-size-bytes" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:download-resource-size-bytes.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> + </binding> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="download-resource-size-bytes" /> + </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 86d8dd10..f3416c4e 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -131,6 +131,8 @@ private Task createValidTaskStartAutostartProcess() task.addInput().setValue(new StringType(ConstantsPing.PROFILE_DSF_TASK_START_PING_AUTOSTART_MESSAGE_NAME)) .getType().addCoding(BpmnMessage.messageName()); + task.addInput(DownloadResourceSizeGenerator.create(0)); + return task; } From eef7b777018753e4d208cfa0c3e31f0bd2557410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 17:01:18 +0100 Subject: [PATCH 085/382] Ran format-and-sort --- src/main/java/dev/dsf/bpe/message/SendPing.java | 11 +++++++---- src/main/java/dev/dsf/bpe/message/SendPong.java | 3 +-- .../java/dev/dsf/bpe/message/SendStartPing.java | 15 ++++++++------- .../util/DownloadResourceReferenceGenerator.java | 3 ++- .../bpe/util/DownloadResourceSizeGenerator.java | 3 ++- .../dev/dsf/fhir/profiles/TaskProfileTest.java | 3 ++- 6 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index f4cd8021..e62fe3ac 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -29,10 +29,13 @@ public SendPing(ProcessPluginApi api) @Override protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - return Stream.of(api.getTaskHelper().createInput( - new Reference().setIdentifier(getLocalEndpointIdentifier()).setType(ResourceType.Endpoint.name()), - ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER), - DownloadResourceSizeGenerator.create(0), DownloadResourceReferenceGenerator.create("https://test.org/fhir/Binary/foo")); + return Stream.of( + api.getTaskHelper().createInput( + new Reference().setIdentifier(getLocalEndpointIdentifier()) + .setType(ResourceType.Endpoint.name()), + ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER), + DownloadResourceSizeGenerator.create(0), + DownloadResourceReferenceGenerator.create("https://test.org/fhir/Binary/foo")); } @Override diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index db582d80..80f72962 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -47,8 +47,7 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE Variables variables) { return Stream.of(DownloadedBytesGenerator.create(0), DownloadedDurationMillisGenerator.create(0), - DownloadResourceReferenceGenerator.create("http://example.org/fhir/Binary/bar") - ); + DownloadResourceReferenceGenerator.create("http://example.org/fhir/Binary/bar")); } @Override diff --git a/src/main/java/dev/dsf/bpe/message/SendStartPing.java b/src/main/java/dev/dsf/bpe/message/SendStartPing.java index 42dfe966..c7cdeadc 100644 --- a/src/main/java/dev/dsf/bpe/message/SendStartPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendStartPing.java @@ -23,23 +23,24 @@ public SendStartPing(ProcessPluginApi api) @Override protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - return Stream.concat(variables.getStartTask().getInput().stream().filter(Task.ParameterComponent::hasType) - .filter(i -> i.getType().getCoding().stream().anyMatch( - c -> ConstantsPing.CODESYSTEM_DSF_PING.equals(c.getSystem()) - && ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS.equals(c.getCode()))), + return Stream.concat( + variables.getStartTask().getInput().stream().filter(Task.ParameterComponent::hasType).filter(i -> i + .getType().getCoding().stream() + .anyMatch(c -> ConstantsPing.CODESYSTEM_DSF_PING.equals(c.getSystem()) + && ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS.equals(c.getCode()))), Stream.of(getDownloadResourceSizeInputParameter(variables))); } private ParameterComponent getDownloadResourceSizeInputParameter(Variables variables) { - return variables.getStartTask().getInput().stream().filter(this::isDownloadResourceSizeParameter).findFirst().orElseThrow(); + return variables.getStartTask().getInput().stream().filter(this::isDownloadResourceSizeParameter).findFirst() + .orElseThrow(); } private boolean isDownloadResourceSizeParameter(ParameterComponent parameterComponent) { return parameterComponent.getType().getCoding().stream() - .anyMatch(t -> - ConstantsPing.CODESYSTEM_DSF_PING.equals(t.getSystem()) + .anyMatch(t -> ConstantsPing.CODESYSTEM_DSF_PING.equals(t.getSystem()) && ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES.equals(t.getCode())); } diff --git a/src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java b/src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java index 002b2245..e974f93b 100644 --- a/src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java @@ -18,7 +18,8 @@ public static Task.ParameterComponent create(String uri) public static Task.ParameterComponent create(Reference reference) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(reference).getType().addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, null)); + param.setValue(reference).getType().addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, null)); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java index 2a810093..6402c7df 100644 --- a/src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java @@ -11,7 +11,8 @@ public class DownloadResourceSizeGenerator public static Task.ParameterComponent create(int sizeBytes) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(new IntegerType(sizeBytes)).getType().addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, null)); + param.setValue(new IntegerType(sizeBytes)).getType().addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, null)); return param; } } diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index f3416c4e..b4c9f1bb 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -412,7 +412,8 @@ public String getCorrelationKey() } @Test - public void testTaskPingValidWithPingStatusOutputAndDownloadResourceSizeAndDownloadResourceReference() throws Exception + public void testTaskPingValidWithPingStatusOutputAndDownloadResourceSizeAndDownloadResourceReference() + throws Exception { Target target = new Target() { From af62034f40b456ff7008170338acfcb00a484d27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 17:14:06 +0100 Subject: [PATCH 086/382] Added missing $ --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 1d4a98a3..5ba6a42b 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -38,11 +38,11 @@ public class PingConfig private boolean sendPongProcessFailedMail; @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.") - @Value("{dev.dsf.bpe.ping.maxDownloadSize:10000000}") + @Value("${dev.dsf.bpe.ping.maxDownloadSize:10000000}") private long maxDownloadSizeBytes; @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.") - @Value("{dev.dsf.bpe.ping.maxUploadSize:10000000}") + @Value("${dev.dsf.bpe.ping.maxUploadSize:10000000}") private long maxUploadSizeBytes; @Bean From ac107e4b9c6aee00e56b19e6504b8dcfdd1900c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 17:30:37 +0100 Subject: [PATCH 087/382] Added missing beans --- .../dev/dsf/bpe/spring/config/PingConfig.java | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 5ba6a42b..1090bf2e 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -9,15 +9,28 @@ import dev.dsf.bpe.listener.SetCorrelationKeyListener; import dev.dsf.bpe.mail.ErrorMailService; +import dev.dsf.bpe.message.CleanupPong; import dev.dsf.bpe.message.SendPing; import dev.dsf.bpe.message.SendPong; import dev.dsf.bpe.message.SendStartPing; +import dev.dsf.bpe.service.Cleanup; +import dev.dsf.bpe.service.DownloadResourceAndMeasureSpeed; +import dev.dsf.bpe.service.EstimateCleanupTimerDuration; +import dev.dsf.bpe.service.GenerateResource; +import dev.dsf.bpe.service.LogAndSaveAndStoreError; +import dev.dsf.bpe.service.LogAndSaveError; +import dev.dsf.bpe.service.LogAndSaveNoResponse; +import dev.dsf.bpe.service.LogAndSaveSendError; +import dev.dsf.bpe.service.LogAndStoreSendError; import dev.dsf.bpe.service.LogNoResponse; import dev.dsf.bpe.service.LogPing; import dev.dsf.bpe.service.LogSendError; +import dev.dsf.bpe.service.SaveDownloadSpeeds; import dev.dsf.bpe.service.SelectPingTargets; import dev.dsf.bpe.service.SelectPongTarget; import dev.dsf.bpe.service.SetTargetAndConfigureTimer; +import dev.dsf.bpe.service.StoreDownloadSpeeds; +import dev.dsf.bpe.service.StoreResource; import dev.dsf.bpe.service.StoreResults; import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -134,4 +147,95 @@ public SendPong sendPong() { return new SendPong(api, responseGenerator(), errorLogger()); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public StoreResource storeResource() + { + return new StoreResource(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public LogAndSaveNoResponse logAndSaveNoResponse() + { + return new LogAndSaveNoResponse(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public CleanupPong cleanupPong() + { + return new CleanupPong(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public DownloadResourceAndMeasureSpeed downloadResourceAndMeasureSpeed() + { + return new DownloadResourceAndMeasureSpeed(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public GenerateResource generateResource() + { + return new GenerateResource(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public LogAndSaveSendError logAndSaveSendError() + { + return new LogAndSaveSendError(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public LogAndStoreSendError logAndStoreSendError() + { + return new LogAndStoreSendError(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public Cleanup cleanup() + { + return new Cleanup(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public LogAndSaveAndStoreError logAndSaveAndStoreError() + { + return new LogAndSaveAndStoreError(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public LogAndSaveError logAndSaveError() + { + return new LogAndSaveError(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public SaveDownloadSpeeds saveDownloadSpeeds() + { + return new SaveDownloadSpeeds(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public StoreDownloadSpeeds storeDownloadSpeeds() + { + return new StoreDownloadSpeeds(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public EstimateCleanupTimerDuration estimateCleanupTimerDuration() + { + return new EstimateCleanupTimerDuration(api); + } } From 7afe61b576b6f0086558900e73d05aa8e4bcec41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 17:31:28 +0100 Subject: [PATCH 088/382] Added missing download-resource-size-bytes input parameter --- .../fhir/Task/dsf-task-start-ping-autostart.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml index 60d7e8f5..a9c9b3f4 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml @@ -53,4 +53,13 @@ </type> <valueString value="PT24H"></valueString> </input> + <input> + <type> + <coding> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <code value="download-resource-size-bytes"/> + </coding> + </type> + <valueInteger value="10000000"/> + </input> </Task> From 18afce44199461b61c22ba14a5e38286cf7aec83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 17:32:15 +0100 Subject: [PATCH 089/382] Used one xml tag instead of two where possible --- .../fhir/Task/dsf-task-start-ping-autostart.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml index a9c9b3f4..a754611b 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml @@ -38,20 +38,20 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping"></system> - <code value="target-endpoints"></code> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <code value="target-endpoints"/> </coding> </type> - <valueString value="Endpoint?status=active&identifier=http://dsf.dev/sid/endpoint-identifier|"></valueString> + <valueString value="Endpoint?status=active&identifier=http://dsf.dev/sid/endpoint-identifier|"/> </input> <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping"></system> - <code value="timer-interval"></code> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <code value="timer-interval"/> </coding> </type> - <valueString value="PT24H"></valueString> + <valueString value="PT24H"/> </input> <input> <type> From 56777bc38c450ba9c7e3c65dbd76806f3add59b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 17:35:29 +0100 Subject: [PATCH 090/382] meta.tag.system must be a CodeSystem not a ValueSet --- src/main/resources/fhir/ValueSet/dsf-ping-units.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml b/src/main/resources/fhir/ValueSet/dsf-ping-units.xml index 9f236805..124233e4 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml +++ b/src/main/resources/fhir/ValueSet/dsf-ping-units.xml @@ -2,7 +2,7 @@ <meta> <tag> <system - value="http://dsf.dev/fhir/ValueSet/read-access-tag" /> + value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> <code value="ALL" /> </tag> </meta> From 26017604ccde684a936a1ef904c6a18cd4ae23a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 17:50:03 +0100 Subject: [PATCH 091/382] Moved DownloadedBytesGenerator, DownloadedDurationMillisGenerator, DownloadResourceReferenceGenerator, DownloadResourceSizeGenerator and NetworkSpeedMetricGenerator to more appropriate packages --- src/main/java/dev/dsf/bpe/message/CleanupPong.java | 2 +- src/main/java/dev/dsf/bpe/message/SendPing.java | 4 ++-- src/main/java/dev/dsf/bpe/message/SendPong.java | 6 +++--- .../generator}/DownloadResourceReferenceGenerator.java | 2 +- .../input/generator}/DownloadResourceSizeGenerator.java | 2 +- .../input/generator}/DownloadedBytesGenerator.java | 2 +- .../input/generator}/DownloadedDurationMillisGenerator.java | 2 +- .../input/generator}/NetworkSpeedMetricGenerator.java | 2 +- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 6 +++--- 9 files changed, 14 insertions(+), 14 deletions(-) rename src/main/java/dev/dsf/bpe/util/{ => task/input/generator}/DownloadResourceReferenceGenerator.java (93%) rename src/main/java/dev/dsf/bpe/util/{ => task/input/generator}/DownloadResourceSizeGenerator.java (91%) rename src/main/java/dev/dsf/bpe/util/{ => task/input/generator}/DownloadedBytesGenerator.java (91%) rename src/main/java/dev/dsf/bpe/util/{ => task/input/generator}/DownloadedDurationMillisGenerator.java (91%) rename src/main/java/dev/dsf/bpe/util/{ => task/input/generator}/NetworkSpeedMetricGenerator.java (95%) diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPong.java b/src/main/java/dev/dsf/bpe/message/CleanupPong.java index 86e23030..2e681147 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPong.java @@ -5,7 +5,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import dev.dsf.bpe.util.NetworkSpeedMetricGenerator; +import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Variables; diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index e62fe3ac..d96b9043 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -10,8 +10,8 @@ import org.hl7.fhir.r4.model.Task.ParameterComponent; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.DownloadResourceReferenceGenerator; -import dev.dsf.bpe.util.DownloadResourceSizeGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Variables; diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 80f72962..50a9696f 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -8,9 +8,9 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; -import dev.dsf.bpe.util.DownloadResourceReferenceGenerator; -import dev.dsf.bpe.util.DownloadedBytesGenerator; -import dev.dsf.bpe.util.DownloadedDurationMillisGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; diff --git a/src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java similarity index 93% rename from src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java rename to src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java index e974f93b..0857e824 100644 --- a/src/main/java/dev/dsf/bpe/util/DownloadResourceReferenceGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.util; +package dev.dsf.bpe.util.task.input.generator; import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.Reference; diff --git a/src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java similarity index 91% rename from src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java rename to src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java index 6402c7df..8071fc20 100644 --- a/src/main/java/dev/dsf/bpe/util/DownloadResourceSizeGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.util; +package dev.dsf.bpe.util.task.input.generator; import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.IntegerType; diff --git a/src/main/java/dev/dsf/bpe/util/DownloadedBytesGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java similarity index 91% rename from src/main/java/dev/dsf/bpe/util/DownloadedBytesGenerator.java rename to src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java index b9dec52d..e75d0705 100644 --- a/src/main/java/dev/dsf/bpe/util/DownloadedBytesGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.util; +package dev.dsf.bpe.util.task.input.generator; import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.Task; diff --git a/src/main/java/dev/dsf/bpe/util/DownloadedDurationMillisGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java similarity index 91% rename from src/main/java/dev/dsf/bpe/util/DownloadedDurationMillisGenerator.java rename to src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java index 7de7b2a2..313155c3 100644 --- a/src/main/java/dev/dsf/bpe/util/DownloadedDurationMillisGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.util; +package dev.dsf.bpe.util.task.input.generator; import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Task; diff --git a/src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java similarity index 95% rename from src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java rename to src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java index d538c7c9..f6fe591c 100644 --- a/src/main/java/dev/dsf/bpe/util/NetworkSpeedMetricGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.util; +package dev.dsf.bpe.util.task.input.generator; import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.DecimalType; diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index b4c9f1bb..e90d5959 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -22,9 +22,9 @@ import ca.uhn.fhir.validation.ValidationResult; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; -import dev.dsf.bpe.util.DownloadResourceReferenceGenerator; -import dev.dsf.bpe.util.DownloadResourceSizeGenerator; -import dev.dsf.bpe.util.NetworkSpeedMetricGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; +import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; From 5a072827136aca7e1c3296332bcc0dcd37151c58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 17:57:42 +0100 Subject: [PATCH 092/382] Renamed downloadResourceSize to downloadResourceSizeBytes for consistency --- src/main/resources/bpe/ping.bpmn | 379 ++++++++++++++++--------------- src/main/resources/bpe/pong.bpmn | 112 ++++----- 2 files changed, 252 insertions(+), 239 deletions(-) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 69bf400f..fb956eb8 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -188,12 +188,12 @@ <bpmn:outgoing>Flow_0j92st0</bpmn:outgoing> </bpmn:serviceTask> <bpmn:exclusiveGateway id="Gateway_0xw5i5v" default="Flow_152nb9r"> - <bpmn:incoming>Flow_0fpikty</bpmn:incoming> + <bpmn:incoming>Flow_0fxlsv3</bpmn:incoming> <bpmn:outgoing>Flow_152nb9r</bpmn:outgoing> <bpmn:outgoing>Flow_0iuuyo1</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:startEvent id="StartPingMessageStartEvent" name="startPing"> - <bpmn:outgoing>Flow_0fpikty</bpmn:outgoing> + <bpmn:outgoing>Flow_0e35w2m</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_1t2j917" messageRef="Message_1pklz6t" /> </bpmn:startEvent> <bpmn:sequenceFlow id="Flow_0j92st0" sourceRef="SelectPingTargets" targetRef="SubProcess" /> @@ -204,10 +204,15 @@ <bpmn:sequenceFlow id="Flow_0gubpgz" sourceRef="Activity_0802w0b" targetRef="SaveResults" /> <bpmn:sequenceFlow id="Flow_1du5wys" sourceRef="SaveResults" targetRef="EndEvent" /> <bpmn:sequenceFlow id="Flow_0iuuyo1" sourceRef="Gateway_0xw5i5v" targetRef="Gateway_0bifi5h"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSize < 0}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1c15ef2" sourceRef="Gateway_0bifi5h" targetRef="SelectPingTargets" /> - <bpmn:sequenceFlow id="Flow_0fpikty" sourceRef="StartPingMessageStartEvent" targetRef="Gateway_0xw5i5v" /> + <bpmn:sequenceFlow id="Flow_0e35w2m" sourceRef="StartPingMessageStartEvent" targetRef="Activity_1wdftvk" /> + <bpmn:sequenceFlow id="Flow_0fxlsv3" sourceRef="Activity_1wdftvk" targetRef="Gateway_0xw5i5v" /> + <bpmn:serviceTask id="Activity_1wdftvk" name="Set Download Resource Size" camunda:class="dev.dsf.bpe.service.SetDownloadResourceSize"> + <bpmn:incoming>Flow_0e35w2m</bpmn:incoming> + <bpmn:outgoing>Flow_0fxlsv3</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:textAnnotation id="TextAnnotation_1ig0151"> <bpmn:text>Includes download speeds and errors of all pongs</bpmn:text> </bpmn:textAnnotation> @@ -216,7 +221,7 @@ </bpmn:textAnnotation> <bpmn:textAnnotation id="TextAnnotation_0dhecha"> <bpmn:text>Process Parameters -- downloadResourceSize read from Input Paramater (default tbd) +- downloadResourceSizeBytes read from Input Paramater (default tbd) - maxDownloadSizeBytes read from environment variable (default tbd) - maxUpdloadSizeBytes read from environment variables (default tbd)</bpmn:text> </bpmn:textAnnotation> @@ -235,296 +240,304 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> + <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> + <dc:Bounds x="3100" y="239" width="160" height="49" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0o5toqz" bpmnElement="TextAnnotation_1j1ytqy"> + <dc:Bounds x="430" y="580" width="170" height="40" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ne04k7" bpmnElement="TextAnnotation_0dhecha"> + <dc:Bounds x="400" y="220" width="419.98765969802554" height="69.68641114982579" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> + <dc:Bounds x="3030" y="490" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> + <dc:Bounds x="230" y="80" width="420" height="70" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ydgq5s" bpmnElement="StartPingMessageStartEvent"> + <dc:Bounds x="152" y="342" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="151" y="385" width="44" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> + <dc:Bounds x="260" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_06i4ly8" bpmnElement="Activity_16rb6hc"> + <dc:Bounds x="690" y="460" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0fhb8wi" bpmnElement="Activity_0nwtf8o"> + <dc:Bounds x="530" y="460" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> + <dc:Bounds x="3030" y="330" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> + <dc:Bounds x="3160" y="330" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> + <dc:Bounds x="3282" y="352" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ob9la3" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> + <dc:Bounds x="815" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0wi2en6" bpmnElement="SelectPingTargets"> + <dc:Bounds x="900" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1v2z49g" bpmnElement="Gateway_0xw5i5v" isMarkerVisible="true"> + <dc:Bounds x="435" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> - <dc:Bounds x="970" y="180" width="1930" height="560" /> + <dc:Bounds x="1040" y="180" width="1930" height="560" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> + <dc:Bounds x="1270" y="220" width="250" height="70" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> + <dc:Bounds x="2660" y="612" width="239.98257839721254" height="54.98693379790941" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> + <dc:Bounds x="1980" y="622" width="170" height="37" /> + <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0qz7nye" bpmnElement="SubProcessStartEvent"> - <dc:Bounds x="992" y="342" width="36" height="36" /> + <dc:Bounds x="1062" y="342" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_13ugi24" bpmnElement="PongTimer"> - <dc:Bounds x="1442" y="432" width="36" height="36" /> + <dc:Bounds x="1512" y="432" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1443" y="475" width="34" height="14" /> + <dc:Bounds x="1513" y="475" width="34" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1xv73wh" bpmnElement="PongCatchEvent"> - <dc:Bounds x="1642" y="342" width="36" height="36" /> + <dc:Bounds x="1712" y="342" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1647" y="318" width="26" height="14" /> + <dc:Bounds x="1717" y="318" width="26" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_01k7kv3" bpmnElement="EventBasedGateway"> - <dc:Bounds x="1345" y="335" width="50" height="50" /> + <dc:Bounds x="1415" y="335" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0icju6y" bpmnElement="LogNoResponse"> - <dc:Bounds x="1530" y="410" width="100" height="80" /> + <dc:Bounds x="1600" y="410" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1ipvtcp" bpmnElement="Gateway_0z5gz96" isMarkerVisible="true"> - <dc:Bounds x="1245" y="335" width="50" height="50" /> + <dc:Bounds x="1315" y="335" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_06ufst4" bpmnElement="LogSendError"> - <dc:Bounds x="1530" y="500" width="100" height="80" /> + <dc:Bounds x="1600" y="500" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0zk1xt7" bpmnElement="Gateway_09z7b0z" isMarkerVisible="true"> - <dc:Bounds x="1685" y="425" width="50" height="50" /> + <dc:Bounds x="1755" y="425" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19as0g5" bpmnElement="SubProcessEndEvent"> - <dc:Bounds x="1792" y="432" width="36" height="36" /> + <dc:Bounds x="1862" y="432" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_004x7xw" bpmnElement="Activity_0ri6fnv"> - <dc:Bounds x="1100" y="320" width="100" height="80" /> + <dc:Bounds x="1170" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0gumkp5" bpmnElement="Gateway_0p0be0a" isMarkerVisible="true"> - <dc:Bounds x="1895" y="335" width="50" height="50" /> + <dc:Bounds x="1965" y="335" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_14o9c36" bpmnElement="Activity_0h9o9u7"> - <dc:Bounds x="2000" y="480" width="100" height="80" /> + <dc:Bounds x="2070" y="480" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1uxa2sw" bpmnElement="Activity_0vw65a2"> - <dc:Bounds x="2440" y="480" width="100" height="80" /> + <dc:Bounds x="2510" y="480" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0djpma6" bpmnElement="Activity_0akr23c"> - <dc:Bounds x="2140" y="600" width="100" height="80" /> + <dc:Bounds x="2210" y="600" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> - <dc:Bounds x="2565" y="335" width="50" height="50" /> + <dc:Bounds x="2635" y="335" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1ivv0nj" bpmnElement="Activity_0i9uqk0"> - <dc:Bounds x="2680" y="320" width="100" height="80" /> + <dc:Bounds x="2750" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> - <dc:Bounds x="2842" y="342" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> - <dc:Bounds x="1200" y="220" width="250" height="70" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> - <dc:Bounds x="2590" y="612" width="239.98257839721254" height="54.98693379790941" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> - <dc:Bounds x="1910" y="622" width="170" height="37" /> - <bpmndi:BPMNLabel /> + <dc:Bounds x="2912" y="342" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> + <di:waypoint x="1252" y="320" /> + <di:waypoint x="1276" y="290" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> + <di:waypoint x="2074" y="622" /> + <di:waypoint x="2102" y="560" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> + <di:waypoint x="2610" y="550" /> + <di:waypoint x="2716" y="612" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_0968qvb" bpmnElement="Event_0i4slcz"> - <dc:Bounds x="2082" y="542" width="36" height="36" /> + <dc:Bounds x="2152" y="542" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2128" y="546" width="83" height="27" /> + <dc:Bounds x="2198" y="546" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_1hlvqjb" bpmnElement="Flow_10epxa2"> - <di:waypoint x="1028" y="360" /> - <di:waypoint x="1100" y="360" /> + <di:waypoint x="1098" y="360" /> + <di:waypoint x="1170" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0gkyk6o" bpmnElement="Flow_0y9usku"> - <di:waypoint x="1370" y="385" /> - <di:waypoint x="1370" y="450" /> - <di:waypoint x="1442" y="450" /> + <di:waypoint x="1440" y="385" /> + <di:waypoint x="1440" y="450" /> + <di:waypoint x="1512" y="450" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0gf051n" bpmnElement="Flow_1fjeq2h"> - <di:waypoint x="1478" y="450" /> - <di:waypoint x="1530" y="450" /> + <di:waypoint x="1548" y="450" /> + <di:waypoint x="1600" y="450" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_132kwps" bpmnElement="Flow_1lghrxh"> - <di:waypoint x="1395" y="360" /> - <di:waypoint x="1642" y="360" /> + <di:waypoint x="1465" y="360" /> + <di:waypoint x="1712" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_12u1pw1" bpmnElement="Flow_03hkxbe"> - <di:waypoint x="1678" y="360" /> - <di:waypoint x="1895" y="360" /> + <di:waypoint x="1748" y="360" /> + <di:waypoint x="1965" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1lwj0ih" bpmnElement="Flow_1j54c2s"> - <di:waypoint x="1295" y="360" /> - <di:waypoint x="1345" y="360" /> + <di:waypoint x="1365" y="360" /> + <di:waypoint x="1415" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1k895i8" bpmnElement="Flow_136htek"> - <di:waypoint x="1630" y="450" /> - <di:waypoint x="1685" y="450" /> + <di:waypoint x="1700" y="450" /> + <di:waypoint x="1755" y="450" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0z1aurb" bpmnElement="Flow_08vgmf6"> - <di:waypoint x="1200" y="360" /> - <di:waypoint x="1245" y="360" /> + <di:waypoint x="1270" y="360" /> + <di:waypoint x="1315" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0ffsn0i" bpmnElement="Flow_101sqed"> - <di:waypoint x="1270" y="385" /> - <di:waypoint x="1270" y="540" /> - <di:waypoint x="1530" y="540" /> + <di:waypoint x="1340" y="385" /> + <di:waypoint x="1340" y="540" /> + <di:waypoint x="1600" y="540" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1195" y="506" width="70" height="27" /> + <dc:Bounds x="1265" y="506" width="70" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1va7dmx" bpmnElement="Flow_16ssf4a"> - <di:waypoint x="1630" y="540" /> - <di:waypoint x="1710" y="540" /> - <di:waypoint x="1710" y="475" /> + <di:waypoint x="1700" y="540" /> + <di:waypoint x="1780" y="540" /> + <di:waypoint x="1780" y="475" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1ce9w6g" bpmnElement="Flow_1ho1hys"> - <di:waypoint x="1735" y="450" /> - <di:waypoint x="1792" y="450" /> + <di:waypoint x="1805" y="450" /> + <di:waypoint x="1862" y="450" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1iq5cwe" bpmnElement="Flow_13u1nzy"> - <di:waypoint x="1945" y="360" /> - <di:waypoint x="2565" y="360" /> + <di:waypoint x="2015" y="360" /> + <di:waypoint x="2635" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1skpxus" bpmnElement="Flow_1yt9547"> - <di:waypoint x="1920" y="385" /> - <di:waypoint x="1920" y="520" /> - <di:waypoint x="2000" y="520" /> + <di:waypoint x="1990" y="385" /> + <di:waypoint x="1990" y="520" /> + <di:waypoint x="2070" y="520" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1omiu15" bpmnElement="Flow_1v37fff"> - <di:waypoint x="2100" y="520" /> - <di:waypoint x="2440" y="520" /> + <di:waypoint x="2170" y="520" /> + <di:waypoint x="2510" y="520" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1lmv30e" bpmnElement="Flow_0jcfur3"> - <di:waypoint x="2240" y="640" /> - <di:waypoint x="2340" y="640" /> - <di:waypoint x="2340" y="520" /> - <di:waypoint x="2440" y="520" /> + <di:waypoint x="2310" y="640" /> + <di:waypoint x="2410" y="640" /> + <di:waypoint x="2410" y="520" /> + <di:waypoint x="2510" y="520" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0dd7vlu" bpmnElement="Flow_0pj6d62"> - <di:waypoint x="2540" y="520" /> - <di:waypoint x="2590" y="520" /> - <di:waypoint x="2590" y="385" /> + <di:waypoint x="2610" y="520" /> + <di:waypoint x="2660" y="520" /> + <di:waypoint x="2660" y="385" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1figpr1" bpmnElement="Flow_10h6pqh"> - <di:waypoint x="2100" y="578" /> - <di:waypoint x="2100" y="640" /> - <di:waypoint x="2140" y="640" /> + <di:waypoint x="2170" y="578" /> + <di:waypoint x="2170" y="640" /> + <di:waypoint x="2210" y="640" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0v8dcpi" bpmnElement="Flow_03nx6rk"> - <di:waypoint x="2615" y="360" /> - <di:waypoint x="2680" y="360" /> + <di:waypoint x="2685" y="360" /> + <di:waypoint x="2750" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0ghffjh" bpmnElement="Flow_0v6axlv"> - <di:waypoint x="2780" y="360" /> - <di:waypoint x="2842" y="360" /> + <di:waypoint x="2850" y="360" /> + <di:waypoint x="2912" y="360" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> - <di:waypoint x="1182" y="320" /> - <di:waypoint x="1206" y="290" /> + <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> + <di:waypoint x="539" y="540" /> + <di:waypoint x="498" y="580" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> - <di:waypoint x="2540" y="550" /> - <di:waypoint x="2646" y="612" /> + <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> + <di:waypoint x="3123" y="490" /> + <di:waypoint x="3094" y="410" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> - <di:waypoint x="2004" y="622" /> - <di:waypoint x="2032" y="560" /> + <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> + <di:waypoint x="3189" y="330" /> + <di:waypoint x="3168" y="288" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0e35w2m_di" bpmnElement="Flow_0e35w2m"> + <di:waypoint x="188" y="360" /> + <di:waypoint x="260" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0fxlsv3_di" bpmnElement="Flow_0fxlsv3"> + <di:waypoint x="360" y="360" /> + <di:waypoint x="435" y="360" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="BPMNShape_06i4ly8" bpmnElement="Activity_16rb6hc"> - <dc:Bounds x="620" y="460" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0fhb8wi" bpmnElement="Activity_0nwtf8o"> - <dc:Bounds x="460" y="460" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> - <dc:Bounds x="2960" y="330" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> - <dc:Bounds x="3090" y="330" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> - <dc:Bounds x="3212" y="352" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0ob9la3" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> - <dc:Bounds x="745" y="335" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0wi2en6" bpmnElement="SelectPingTargets"> - <dc:Bounds x="830" y="320" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1v2z49g" bpmnElement="Gateway_0xw5i5v" isMarkerVisible="true"> - <dc:Bounds x="365" y="335" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0ydgq5s" bpmnElement="StartPingMessageStartEvent"> - <dc:Bounds x="162" y="342" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="161" y="385" width="44" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> - <dc:Bounds x="3030" y="239" width="160" height="49" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0o5toqz" bpmnElement="TextAnnotation_1j1ytqy"> - <dc:Bounds x="360" y="580" width="170" height="40" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0ne04k7" bpmnElement="TextAnnotation_0dhecha"> - <dc:Bounds x="330" y="220" width="420" height="69" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> - <dc:Bounds x="2960" y="490" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> - <dc:Bounds x="160" y="80" width="420" height="70" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_09zmq8d" bpmnElement="Flow_0j92st0"> - <di:waypoint x="930" y="360" /> - <di:waypoint x="970" y="360" /> + <di:waypoint x="1000" y="360" /> + <di:waypoint x="1040" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_036wiw0" bpmnElement="Flow_1bfs68o"> - <di:waypoint x="2900" y="370" /> - <di:waypoint x="2960" y="370" /> + <di:waypoint x="2970" y="370" /> + <di:waypoint x="3030" y="370" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1ttfs4u" bpmnElement="Flow_1qz7z39"> - <di:waypoint x="560" y="500" /> - <di:waypoint x="620" y="500" /> + <di:waypoint x="630" y="500" /> + <di:waypoint x="690" y="500" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_172mwqu" bpmnElement="Flow_0m0hq4h"> - <di:waypoint x="720" y="500" /> - <di:waypoint x="770" y="500" /> - <di:waypoint x="770" y="385" /> + <di:waypoint x="790" y="500" /> + <di:waypoint x="840" y="500" /> + <di:waypoint x="840" y="385" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0u9gpv1" bpmnElement="Flow_152nb9r"> - <di:waypoint x="390" y="385" /> - <di:waypoint x="390" y="500" /> + <di:waypoint x="460" y="385" /> <di:waypoint x="460" y="500" /> + <di:waypoint x="530" y="500" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1fbz0br" bpmnElement="Flow_0gubpgz"> - <di:waypoint x="3060" y="370" /> - <di:waypoint x="3090" y="370" /> + <di:waypoint x="3130" y="370" /> + <di:waypoint x="3160" y="370" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_00ieeud" bpmnElement="Flow_1du5wys"> - <di:waypoint x="3190" y="370" /> - <di:waypoint x="3212" y="370" /> + <di:waypoint x="3260" y="370" /> + <di:waypoint x="3282" y="370" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0t4fqb7" bpmnElement="Flow_0iuuyo1"> - <di:waypoint x="415" y="360" /> - <di:waypoint x="745" y="360" /> + <di:waypoint x="485" y="360" /> + <di:waypoint x="815" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1e1kjcl" bpmnElement="Flow_1c15ef2"> - <di:waypoint x="795" y="360" /> - <di:waypoint x="830" y="360" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_11qkk0c" bpmnElement="Flow_0fpikty"> - <di:waypoint x="198" y="360" /> - <di:waypoint x="365" y="360" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> - <di:waypoint x="469" y="540" /> - <di:waypoint x="428" y="580" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> - <di:waypoint x="3053" y="490" /> - <di:waypoint x="3024" y="410" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> - <di:waypoint x="3119" y="330" /> - <di:waypoint x="3098" y="288" /> + <di:waypoint x="865" y="360" /> + <di:waypoint x="900" y="360" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 751391c7..a9883cb8 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -122,7 +122,7 @@ <bpmn:sequenceFlow id="Flow_0huy3o3" sourceRef="PingMessageStartEvent" targetRef="Gateway_1jwjxzn" /> <bpmn:sequenceFlow id="Flow_10z0d4x" sourceRef="Gateway_1jwjxzn" targetRef="Activity_095j2gg" /> <bpmn:sequenceFlow id="Flow_08gidyv" sourceRef="Gateway_1jwjxzn" targetRef="Gateway_1ggdr8l"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSize < 0}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_0zphif7" sourceRef="Activity_095j2gg" targetRef="Gateway_0fvmtve" /> <bpmn:sequenceFlow id="Flow_061qpt4" sourceRef="LogPing" targetRef="SelectPongTarget" /> @@ -178,7 +178,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmn:textAnnotation> <bpmn:textAnnotation id="TextAnnotation_14ea4yc"> <bpmn:text>Process Parameters -- downloadResourceSize read from Input Paramater (no default, value from message expected) +- downloadResourceSizeBytes read from Input Paramater (no default, value from message expected) - maxDownloadSizeBytes read from environment variable (default tbd) - maxUpdloadSizeBytes read from environment variables (default tbd)</bpmn:text> </bpmn:textAnnotation> @@ -194,34 +194,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> - <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> - <dc:Bounds x="160" y="80" width="420" height="70" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1cled7l_di" bpmnElement="TextAnnotation_1cled7l"> - <dc:Bounds x="580" y="353" width="170" height="37" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> - <dc:Bounds x="1790" y="439" width="250.00000000000003" height="83.6707152496626" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> - <dc:Bounds x="2560" y="533" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> - <dc:Bounds x="1300" y="543" width="275" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> - <dc:Bounds x="920" y="544" width="170" height="40" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1bdbmbf" bpmnElement="TextAnnotation_14ea4yc"> - <dc:Bounds x="280" y="183" width="585" height="69" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> <dc:Bounds x="172" y="292" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -302,36 +274,44 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Activity_06klx97_di" bpmnElement="Activity_0xcqxjs"> <dc:Bounds x="1290" y="420" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> - <di:waypoint x="602" y="420" /> - <di:waypoint x="618" y="390" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> - <di:waypoint x="1876" y="350" /> - <di:waypoint x="1845" y="439" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2582" y="450" /> - <di:waypoint x="2606" y="533" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> - <di:waypoint x="1344" y="500" /> - <di:waypoint x="1349" y="543" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> - <di:waypoint x="1008" y="544" /> - <di:waypoint x="1014" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="BPMNShape_14ee8kb" bpmnElement="Event_0olr5yw"> - <dc:Bounds x="612" y="482" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="649" y="516" width="83" height="27" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> + <dc:Bounds x="160" y="80" width="420" height="70" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_1cled7l_di" bpmnElement="TextAnnotation_1cled7l"> + <dc:Bounds x="580" y="353" width="170" height="37" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> + <dc:Bounds x="1790" y="439" width="250.00000000000003" height="83.6707152496626" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> + <dc:Bounds x="2560" y="533" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> + <dc:Bounds x="1300" y="543" width="275" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> + <dc:Bounds x="920" y="544" width="170" height="40" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1bdbmbf" bpmnElement="TextAnnotation_14ea4yc"> + <dc:Bounds x="280" y="183" width="585" height="70" /> + <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> <dc:Bounds x="1742" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1779" y="363" width="87" height="14" /> + <dc:Bounds x="1780" y="363" width="86" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_14ee8kb" bpmnElement="Event_0olr5yw"> + <dc:Bounds x="612" y="482" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="649" y="516" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Flow_0huy3o3_di" bpmnElement="Flow_0huy3o3"> @@ -447,6 +427,26 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1230" y="460" /> <di:waypoint x="1290" y="460" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> + <di:waypoint x="602" y="420" /> + <di:waypoint x="618" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> + <di:waypoint x="1876" y="350" /> + <di:waypoint x="1845" y="439" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> + <di:waypoint x="2582" y="450" /> + <di:waypoint x="2606" y="533" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> + <di:waypoint x="1008" y="544" /> + <di:waypoint x="1014" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> + <di:waypoint x="1344" y="500" /> + <di:waypoint x="1349" y="543" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From ee960ba8a7a1c0755be6c2fce2bb6827d2f8c5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 17:58:07 +0100 Subject: [PATCH 093/382] Added downloadResourceSizeBytes bpmn execution variable to constants --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 366cb1f3..dd4b79bf 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -73,6 +73,7 @@ public interface ConstantsPing String BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL = "timerInterval"; String BPMN_EXECUTION_VARIABLE_STOP_TIMER = "stopTimer"; + String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES = "downloadResourceSizeBytes"; String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; } From 51b2586b71e48b5f73f8737326307dcc39beaf03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 17:59:35 +0100 Subject: [PATCH 094/382] Added additional service task to set bpmn execution variable downloadResourceSizeBytes --- .../bpe/service/SetDownloadResourceSize.java | 32 +++++++++++++++++++ .../dev/dsf/bpe/spring/config/PingConfig.java | 8 +++++ 2 files changed, 40 insertions(+) create mode 100644 src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java new file mode 100644 index 00000000..7f02f87a --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -0,0 +1,32 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.IntegerType; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class SetDownloadResourceSize extends AbstractServiceDelegate +{ + public SetDownloadResourceSize(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, getDownloadResourceSize(variables)); + } + + private int getDownloadResourceSize(Variables variables) + { + return api.getTaskHelper() + .getFirstInputParameterValue(variables.getStartTask(), ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, IntegerType.class) + .orElseThrow().getValue(); + } +} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 1090bf2e..f50de40b 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -28,6 +28,7 @@ import dev.dsf.bpe.service.SaveDownloadSpeeds; import dev.dsf.bpe.service.SelectPingTargets; import dev.dsf.bpe.service.SelectPongTarget; +import dev.dsf.bpe.service.SetDownloadResourceSize; import dev.dsf.bpe.service.SetTargetAndConfigureTimer; import dev.dsf.bpe.service.StoreDownloadSpeeds; import dev.dsf.bpe.service.StoreResource; @@ -238,4 +239,11 @@ public EstimateCleanupTimerDuration estimateCleanupTimerDuration() { return new EstimateCleanupTimerDuration(api); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public SetDownloadResourceSize setDownloadResourceSize() + { + return new SetDownloadResourceSize(api); + } } From 1f6c63671111149ae0c4339339c241428d949f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 18:01:59 +0100 Subject: [PATCH 095/382] Ran format-and-sort --- src/main/java/dev/dsf/bpe/message/SendPong.java | 2 +- src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java | 3 ++- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 50a9696f..aca91563 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -8,10 +8,10 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; +import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; -import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index 7f02f87a..1bff46f2 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -19,7 +19,8 @@ public SetDownloadResourceSize(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, getDownloadResourceSize(variables)); + variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, + getDownloadResourceSize(variables)); } private int getDownloadResourceSize(Variables variables) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index e90d5959..ff970ed2 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -22,10 +22,10 @@ import ca.uhn.fhir.validation.ValidationResult; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; +import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; -import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; import dev.dsf.bpe.v1.constants.NamingSystems.OrganizationIdentifier; From 6a7568edf35f03a06459425583a335398ff14c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 18:05:37 +0100 Subject: [PATCH 096/382] Forgot to add service task to set downloadResourceSizeBytes execution variable in pong as well --- src/main/resources/bpe/pong.bpmn | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index a9883cb8..0e2781cf 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -2,11 +2,11 @@ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_127i10h" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.17.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.20.0"> <bpmn:process id="dsfdev_pong" isExecutable="true" camunda:versionTag="#{version}" camunda:historyTimeToLive="180"> <bpmn:startEvent id="PingMessageStartEvent" name="ping"> - <bpmn:outgoing>Flow_0huy3o3</bpmn:outgoing> + <bpmn:outgoing>Flow_19b3cp4</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_128t2ek" messageRef="Message_0u91abp" /> </bpmn:startEvent> <bpmn:exclusiveGateway id="Gateway_1jwjxzn" default="Flow_10z0d4x"> - <bpmn:incoming>Flow_0huy3o3</bpmn:incoming> + <bpmn:incoming>Flow_05347ru</bpmn:incoming> <bpmn:outgoing>Flow_10z0d4x</bpmn:outgoing> <bpmn:outgoing>Flow_08gidyv</bpmn:outgoing> </bpmn:exclusiveGateway> @@ -119,7 +119,6 @@ <bpmn:outgoing>Flow_0yr2pmf</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_0ty7e1r" errorRef="Error_1j0t9ud" /> </bpmn:boundaryEvent> - <bpmn:sequenceFlow id="Flow_0huy3o3" sourceRef="PingMessageStartEvent" targetRef="Gateway_1jwjxzn" /> <bpmn:sequenceFlow id="Flow_10z0d4x" sourceRef="Gateway_1jwjxzn" targetRef="Activity_095j2gg" /> <bpmn:sequenceFlow id="Flow_08gidyv" sourceRef="Gateway_1jwjxzn" targetRef="Gateway_1ggdr8l"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> @@ -151,6 +150,12 @@ <bpmn:sequenceFlow id="Flow_165e73u" sourceRef="Activity_0mwyelp" targetRef="Activity_0otptjn" /> <bpmn:sequenceFlow id="Flow_1w09zt7" sourceRef="Activity_1m4wavi" targetRef="Activity_04mv5cn" /> <bpmn:sequenceFlow id="Flow_03hviat" sourceRef="Activity_04mv5cn" targetRef="Activity_0xcqxjs" /> + <bpmn:serviceTask id="Activity_1wdftvk" name="Set Download Resource Size" camunda:class="dev.dsf.bpe.service.SetDownloadResourceSize"> + <bpmn:incoming>Flow_19b3cp4</bpmn:incoming> + <bpmn:outgoing>Flow_05347ru</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_19b3cp4" sourceRef="PingMessageStartEvent" targetRef="Activity_1wdftvk" /> + <bpmn:sequenceFlow id="Flow_05347ru" sourceRef="Activity_1wdftvk" targetRef="Gateway_1jwjxzn" /> <bpmn:textAnnotation id="TextAnnotation_02e4h2c"> <bpmn:text>Log = logger Save = save as execution variable @@ -302,6 +307,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="280" y="183" width="585" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> + <dc:Bounds x="290" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> <dc:Bounds x="1742" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -314,10 +323,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="649" y="516" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Flow_0huy3o3_di" bpmnElement="Flow_0huy3o3"> - <di:waypoint x="208" y="310" /> - <di:waypoint x="455" y="310" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> <di:waypoint x="480" y="335" /> <di:waypoint x="480" y="460" /> @@ -447,6 +452,14 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1344" y="500" /> <di:waypoint x="1349" y="543" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> + <di:waypoint x="208" y="310" /> + <di:waypoint x="290" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_05347ru_di" bpmnElement="Flow_05347ru"> + <di:waypoint x="390" y="310" /> + <di:waypoint x="455" y="310" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From 4844aeb828be635cfc33864edc3e4cd87125d29f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 18:15:57 +0100 Subject: [PATCH 097/382] Made NetworkSpeedMetricGenerator provide static methods like other input generators --- src/main/java/dev/dsf/bpe/message/CleanupPong.java | 5 ++--- .../task/input/generator/NetworkSpeedMetricGenerator.java | 4 ++-- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 5 ++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPong.java b/src/main/java/dev/dsf/bpe/message/CleanupPong.java index 2e681147..b21531b4 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPong.java @@ -21,8 +21,7 @@ public CleanupPong(ProcessPluginApi api) protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - NetworkSpeedMetricGenerator networkSpeedMetricGenerator = new NetworkSpeedMetricGenerator(); - return Stream.of(networkSpeedMetricGenerator.createDownloadedBytes(0), - networkSpeedMetricGenerator.createDownloadedDurationMillis(0)); + return Stream.of(NetworkSpeedMetricGenerator.createDownloadedBytes(0), + NetworkSpeedMetricGenerator.createDownloadedDurationMillis(0)); } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java index f6fe591c..b1d33761 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java @@ -9,7 +9,7 @@ public class NetworkSpeedMetricGenerator { - public Task.ParameterComponent createDownloadedDurationMillis(long duration) + public static Task.ParameterComponent createDownloadedDurationMillis(long duration) { Task.ParameterComponent downloadedDuration = new Task.ParameterComponent(); downloadedDuration.setValue(new DecimalType(duration)).getType() @@ -18,7 +18,7 @@ public Task.ParameterComponent createDownloadedDurationMillis(long duration) return downloadedDuration; } - public Task.ParameterComponent createDownloadedBytes(int bytes) + public static Task.ParameterComponent createDownloadedBytes(int bytes) { Task.ParameterComponent downloadedBytes = new Task.ParameterComponent(); downloadedBytes.setValue(new IntegerType(bytes)).getType().addCoding(new Coding( diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index ff970ed2..1aa153cc 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -500,9 +500,8 @@ public void testTaskPongValidWithDownloadedDurationMillisAndDownloadedBytesPrese { Task task = createValidTaskPong(); - NetworkSpeedMetricGenerator networkSpeedMetricGenerator = new NetworkSpeedMetricGenerator(); - task.addInput(networkSpeedMetricGenerator.createDownloadedBytes(1000)); - task.addInput(networkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); + task.addInput(NetworkSpeedMetricGenerator.createDownloadedBytes(1000)); + task.addInput(NetworkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); From da34fe4a58e9943aa9bd1e2165cc290fb0722ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 18:21:26 +0100 Subject: [PATCH 098/382] Pong Task has a maximum of 6 inputs, not 5. Added test to confirm --- src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml | 2 +- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index 5b996182..7d288463 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -31,7 +31,7 @@ </extension> <path value="Task.input" /> <min value="3" /> - <max value="5" /> + <max value="6" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 1aa153cc..bcdda454 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -496,10 +496,11 @@ public void testTaskPongValid() throws Exception } @Test - public void testTaskPongValidWithDownloadedDurationMillisAndDownloadedBytesPresent() + public void testTaskPongValidWithReferenceAndDownloadedDurationMillisAndDownloadedBytesPresent() { Task task = createValidTaskPong(); + task.addInput(DownloadResourceReferenceGenerator.create("https://test.endpoint.org/fhir/Binary")); task.addInput(NetworkSpeedMetricGenerator.createDownloadedBytes(1000)); task.addInput(NetworkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); From 801f8addcf64bf7f70b546b8a48b843eb17df62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 18:24:51 +0100 Subject: [PATCH 099/382] Forgot to rename one instance of downloadResourceSize to downloadResourceSizeBytes --- src/main/resources/bpe/ping.bpmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index fb956eb8..25e3048d 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -133,7 +133,7 @@ <bpmn:sequenceFlow id="Flow_16ssf4a" sourceRef="LogSendError" targetRef="Gateway_09z7b0z" /> <bpmn:sequenceFlow id="Flow_1ho1hys" sourceRef="Gateway_09z7b0z" targetRef="SubProcessEndEvent" /> <bpmn:sequenceFlow id="Flow_13u1nzy" sourceRef="Gateway_0p0be0a" targetRef="Gateway_02orad4"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSize < 0}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1yt9547" sourceRef="Gateway_0p0be0a" targetRef="Activity_0h9o9u7" /> <bpmn:sequenceFlow id="Flow_1v37fff" sourceRef="Activity_0h9o9u7" targetRef="Activity_0vw65a2" /> From 0a3fe3ed65738051721d930ef4815a4e938a2247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 19:11:08 +0100 Subject: [PATCH 100/382] Replaced old condition with new check --- src/main/resources/bpe/pong.bpmn | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 0e2781cf..dee2fb3b 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -42,7 +42,7 @@ <bpmn:incoming>Flow_1eass2g</bpmn:incoming> <bpmn:outgoing>Flow_0fzmjzb</bpmn:outgoing> </bpmn:sendTask> - <bpmn:exclusiveGateway id="Gateway_0eiy9fm" default="Flow_00t1ck1"> + <bpmn:exclusiveGateway id="Gateway_0eiy9fm" default="Flow_1bzjspe"> <bpmn:incoming>Flow_0fzmjzb</bpmn:incoming> <bpmn:outgoing>Flow_0h8flp6</bpmn:outgoing> <bpmn:outgoing>Flow_1bzjspe</bpmn:outgoing> @@ -132,10 +132,10 @@ <bpmn:sequenceFlow id="Flow_0h8flp6" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0t0ex36"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'not-reachable'}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_1bzjspe" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1l5dkpz"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${bidirectionalResourceDownload == true}</bpmn:conditionExpression> + <bpmn:sequenceFlow id="Flow_1bzjspe" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1l5dkpz" /> + <bpmn:sequenceFlow id="Flow_00t1ck1" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1uvkqh3"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_00t1ck1" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1uvkqh3" /> <bpmn:sequenceFlow id="Flow_05ucfds" sourceRef="Activity_0t0ex36" targetRef="Gateway_1uvkqh3" /> <bpmn:sequenceFlow id="Flow_0rj915n" sourceRef="Gateway_1l5dkpz" targetRef="Event_1xvd4tr" /> <bpmn:sequenceFlow id="Flow_17x98wg" sourceRef="Gateway_1l5dkpz" targetRef="Event_0o4l2t4" /> @@ -288,7 +288,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> - <dc:Bounds x="1790" y="439" width="250.00000000000003" height="83.6707152496626" /> + <dc:Bounds x="1790" y="439" width="250" height="84" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> From 00d5856625d8214362dbcd8e9faf39152ad631de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 19:23:28 +0100 Subject: [PATCH 101/382] Added service task to save pong result as execution variable to be read later. Only slim ping result for now --- .../java/dev/dsf/bpe/service/SavePong.java | 29 ++ .../dev/dsf/bpe/spring/config/PingConfig.java | 8 + src/main/resources/bpe/ping.bpmn | 273 +++++++++--------- 3 files changed, 180 insertions(+), 130 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/service/SavePong.java diff --git a/src/main/java/dev/dsf/bpe/service/SavePong.java b/src/main/java/dev/dsf/bpe/service/SavePong.java new file mode 100644 index 00000000..e0f8753c --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/SavePong.java @@ -0,0 +1,29 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; +import dev.dsf.bpe.v1.variables.Variables; + +public class SavePong extends AbstractServiceDelegate +{ + public SavePong(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + Target target = variables.getTarget(); + String correlationKey = target.getCorrelationKey(); + delegateExecution.removeVariable("statusCode"); + variables.setString("statusCode_" + correlationKey, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED); + + //TODO: add other information: downloaded-bytes, downloaded-duration-millis, error-message + } +} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index f50de40b..594bb800 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -26,6 +26,7 @@ import dev.dsf.bpe.service.LogPing; import dev.dsf.bpe.service.LogSendError; import dev.dsf.bpe.service.SaveDownloadSpeeds; +import dev.dsf.bpe.service.SavePong; import dev.dsf.bpe.service.SelectPingTargets; import dev.dsf.bpe.service.SelectPongTarget; import dev.dsf.bpe.service.SetDownloadResourceSize; @@ -246,4 +247,11 @@ public SetDownloadResourceSize setDownloadResourceSize() { return new SetDownloadResourceSize(api); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public SavePong savePong() + { + return new SavePong(api); + } } diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 25e3048d..e3144903 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -24,7 +24,7 @@ </bpmn:intermediateCatchEvent> <bpmn:intermediateCatchEvent id="PongCatchEvent" name="Pong"> <bpmn:incoming>Flow_1lghrxh</bpmn:incoming> - <bpmn:outgoing>Flow_03hkxbe</bpmn:outgoing> + <bpmn:outgoing>Flow_1ewmc79</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_0ismjkr" messageRef="Message_10o3b8y" /> </bpmn:intermediateCatchEvent> <bpmn:eventBasedGateway id="EventBasedGateway"> @@ -75,7 +75,7 @@ <bpmn:outgoing>Flow_08vgmf6</bpmn:outgoing> </bpmn:sendTask> <bpmn:exclusiveGateway id="Gateway_0p0be0a" default="Flow_1yt9547"> - <bpmn:incoming>Flow_03hkxbe</bpmn:incoming> + <bpmn:incoming>Flow_1jwekqw</bpmn:incoming> <bpmn:outgoing>Flow_13u1nzy</bpmn:outgoing> <bpmn:outgoing>Flow_1yt9547</bpmn:outgoing> </bpmn:exclusiveGateway> @@ -97,7 +97,7 @@ </bpmn:extensionElements> <bpmn:incoming>Flow_1v37fff</bpmn:incoming> <bpmn:incoming>Flow_0jcfur3</bpmn:incoming> - <bpmn:outgoing>Flow_0pj6d62</bpmn:outgoing> + <bpmn:outgoing>Flow_0klalf8</bpmn:outgoing> </bpmn:sendTask> <bpmn:serviceTask id="Activity_0akr23c" name="Log and Save Error" camunda:class="dev.dsf.bpe.service.LogAndSaveError"> <bpmn:incoming>Flow_10h6pqh</bpmn:incoming> @@ -105,15 +105,11 @@ </bpmn:serviceTask> <bpmn:exclusiveGateway id="Gateway_02orad4"> <bpmn:incoming>Flow_13u1nzy</bpmn:incoming> - <bpmn:incoming>Flow_0pj6d62</bpmn:incoming> + <bpmn:incoming>Flow_0n0yrky</bpmn:incoming> <bpmn:outgoing>Flow_03nx6rk</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="Activity_0i9uqk0" name="Save Download Speeds" camunda:class="dev.dsf.bpe.service.SaveDownloadSpeeds"> - <bpmn:incoming>Flow_03nx6rk</bpmn:incoming> - <bpmn:outgoing>Flow_0v6axlv</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:endEvent id="Event_1foycg9"> - <bpmn:incoming>Flow_0v6axlv</bpmn:incoming> + <bpmn:incoming>Flow_03nx6rk</bpmn:incoming> </bpmn:endEvent> <bpmn:boundaryEvent id="Event_0i4slcz" name="Invalid Resource Reference" attachedToRef="Activity_0h9o9u7"> <bpmn:outgoing>Flow_10h6pqh</bpmn:outgoing> @@ -123,7 +119,6 @@ <bpmn:sequenceFlow id="Flow_0y9usku" sourceRef="EventBasedGateway" targetRef="PongTimer" /> <bpmn:sequenceFlow id="Flow_1fjeq2h" sourceRef="PongTimer" targetRef="LogNoResponse" /> <bpmn:sequenceFlow id="Flow_1lghrxh" sourceRef="EventBasedGateway" targetRef="PongCatchEvent" /> - <bpmn:sequenceFlow id="Flow_03hkxbe" sourceRef="PongCatchEvent" targetRef="Gateway_0p0be0a" /> <bpmn:sequenceFlow id="Flow_1j54c2s" sourceRef="Gateway_0z5gz96" targetRef="EventBasedGateway" /> <bpmn:sequenceFlow id="Flow_136htek" sourceRef="LogNoResponse" targetRef="Gateway_09z7b0z" /> <bpmn:sequenceFlow id="Flow_08vgmf6" sourceRef="Activity_0ri6fnv" targetRef="Gateway_0z5gz96" /> @@ -138,10 +133,20 @@ <bpmn:sequenceFlow id="Flow_1yt9547" sourceRef="Gateway_0p0be0a" targetRef="Activity_0h9o9u7" /> <bpmn:sequenceFlow id="Flow_1v37fff" sourceRef="Activity_0h9o9u7" targetRef="Activity_0vw65a2" /> <bpmn:sequenceFlow id="Flow_0jcfur3" sourceRef="Activity_0akr23c" targetRef="Activity_0vw65a2" /> - <bpmn:sequenceFlow id="Flow_0pj6d62" sourceRef="Activity_0vw65a2" targetRef="Gateway_02orad4" /> <bpmn:sequenceFlow id="Flow_10h6pqh" sourceRef="Event_0i4slcz" targetRef="Activity_0akr23c" /> - <bpmn:sequenceFlow id="Flow_03nx6rk" sourceRef="Gateway_02orad4" targetRef="Activity_0i9uqk0" /> - <bpmn:sequenceFlow id="Flow_0v6axlv" sourceRef="Activity_0i9uqk0" targetRef="Event_1foycg9" /> + <bpmn:sequenceFlow id="Flow_03nx6rk" sourceRef="Gateway_02orad4" targetRef="Event_1foycg9" /> + <bpmn:serviceTask id="Activity_0i9uqk0" name="Save Download Speeds" camunda:class="dev.dsf.bpe.service.SaveDownloadSpeeds"> + <bpmn:incoming>Flow_0klalf8</bpmn:incoming> + <bpmn:outgoing>Flow_0n0yrky</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_0klalf8" sourceRef="Activity_0vw65a2" targetRef="Activity_0i9uqk0" /> + <bpmn:sequenceFlow id="Flow_0n0yrky" sourceRef="Activity_0i9uqk0" targetRef="Gateway_02orad4" /> + <bpmn:sequenceFlow id="Flow_1ewmc79" sourceRef="PongCatchEvent" targetRef="Activity_081me01" /> + <bpmn:serviceTask id="Activity_081me01" name="Save Pong" camunda:class="dev.dsf.bpe.service.SavePong"> + <bpmn:incoming>Flow_1ewmc79</bpmn:incoming> + <bpmn:outgoing>Flow_1jwekqw</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1jwekqw" sourceRef="Activity_081me01" targetRef="Gateway_0p0be0a" /> <bpmn:textAnnotation id="TextAnnotation_0uc8utt"> <bpmn:text>Information in message: - dowloadResourceSize: long @@ -240,78 +245,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> - <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> - <dc:Bounds x="3100" y="239" width="160" height="49" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0o5toqz" bpmnElement="TextAnnotation_1j1ytqy"> - <dc:Bounds x="430" y="580" width="170" height="40" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0ne04k7" bpmnElement="TextAnnotation_0dhecha"> - <dc:Bounds x="400" y="220" width="419.98765969802554" height="69.68641114982579" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> - <dc:Bounds x="3030" y="490" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> - <dc:Bounds x="230" y="80" width="420" height="70" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0ydgq5s" bpmnElement="StartPingMessageStartEvent"> - <dc:Bounds x="152" y="342" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="151" y="385" width="44" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> - <dc:Bounds x="260" y="320" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_06i4ly8" bpmnElement="Activity_16rb6hc"> - <dc:Bounds x="690" y="460" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0fhb8wi" bpmnElement="Activity_0nwtf8o"> - <dc:Bounds x="530" y="460" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> - <dc:Bounds x="3030" y="330" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> - <dc:Bounds x="3160" y="330" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> - <dc:Bounds x="3282" y="352" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0ob9la3" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> - <dc:Bounds x="815" y="335" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0wi2en6" bpmnElement="SelectPingTargets"> - <dc:Bounds x="900" y="320" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1v2z49g" bpmnElement="Gateway_0xw5i5v" isMarkerVisible="true"> - <dc:Bounds x="435" y="335" width="50" height="50" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> <dc:Bounds x="1040" y="180" width="1930" height="560" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> - <dc:Bounds x="1270" y="220" width="250" height="70" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> - <dc:Bounds x="2660" y="612" width="239.98257839721254" height="54.98693379790941" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> - <dc:Bounds x="1980" y="622" width="170" height="37" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0qz7nye" bpmnElement="SubProcessStartEvent"> <dc:Bounds x="1062" y="342" width="36" height="36" /> </bpmndi:BPMNShape> @@ -366,28 +302,32 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2210" y="600" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> - <dc:Bounds x="2635" y="335" width="50" height="50" /> + <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> + <dc:Bounds x="2912" y="342" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1ivv0nj" bpmnElement="Activity_0i9uqk0"> - <dc:Bounds x="2750" y="320" width="100" height="80" /> + <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> + <dc:Bounds x="1270" y="220" width="250" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> - <dc:Bounds x="2912" y="342" width="36" height="36" /> + <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> + <dc:Bounds x="2660" y="612" width="239.98257839721254" height="54.98693379790941" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> + <dc:Bounds x="1980" y="622" width="170" height="37" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1p3zvup" bpmnElement="Activity_0i9uqk0"> + <dc:Bounds x="2700" y="480" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> + <dc:Bounds x="2815" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_187dy31_di" bpmnElement="Activity_081me01"> + <dc:Bounds x="1820" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> - <di:waypoint x="1252" y="320" /> - <di:waypoint x="1276" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> - <di:waypoint x="2074" y="622" /> - <di:waypoint x="2102" y="560" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> - <di:waypoint x="2610" y="550" /> - <di:waypoint x="2716" y="612" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_0968qvb" bpmnElement="Event_0i4slcz"> <dc:Bounds x="2152" y="542" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -411,10 +351,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1465" y="360" /> <di:waypoint x="1712" y="360" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_12u1pw1" bpmnElement="Flow_03hkxbe"> - <di:waypoint x="1748" y="360" /> - <di:waypoint x="1965" y="360" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1lwj0ih" bpmnElement="Flow_1j54c2s"> <di:waypoint x="1365" y="360" /> <di:waypoint x="1415" y="360" /> @@ -446,7 +382,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1iq5cwe" bpmnElement="Flow_13u1nzy"> <di:waypoint x="2015" y="360" /> - <di:waypoint x="2635" y="360" /> + <di:waypoint x="2815" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1skpxus" bpmnElement="Flow_1yt9547"> <di:waypoint x="1990" y="385" /> @@ -463,44 +399,101 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2410" y="520" /> <di:waypoint x="2510" y="520" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_0dd7vlu" bpmnElement="Flow_0pj6d62"> - <di:waypoint x="2610" y="520" /> - <di:waypoint x="2660" y="520" /> - <di:waypoint x="2660" y="385" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1figpr1" bpmnElement="Flow_10h6pqh"> <di:waypoint x="2170" y="578" /> <di:waypoint x="2170" y="640" /> <di:waypoint x="2210" y="640" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0v8dcpi" bpmnElement="Flow_03nx6rk"> - <di:waypoint x="2685" y="360" /> - <di:waypoint x="2750" y="360" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_0ghffjh" bpmnElement="Flow_0v6axlv"> - <di:waypoint x="2850" y="360" /> + <di:waypoint x="2865" y="360" /> <di:waypoint x="2912" y="360" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> - <di:waypoint x="539" y="540" /> - <di:waypoint x="498" y="580" /> + <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> + <di:waypoint x="1252" y="320" /> + <di:waypoint x="1276" y="290" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> - <di:waypoint x="3123" y="490" /> - <di:waypoint x="3094" y="410" /> + <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> + <di:waypoint x="2610" y="550" /> + <di:waypoint x="2716" y="612" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> - <di:waypoint x="3189" y="330" /> - <di:waypoint x="3168" y="288" /> + <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> + <di:waypoint x="2074" y="622" /> + <di:waypoint x="2102" y="560" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0e35w2m_di" bpmnElement="Flow_0e35w2m"> - <di:waypoint x="188" y="360" /> - <di:waypoint x="260" y="360" /> + <bpmndi:BPMNEdge id="Flow_0klalf8_di" bpmnElement="Flow_0klalf8"> + <di:waypoint x="2610" y="520" /> + <di:waypoint x="2700" y="520" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0fxlsv3_di" bpmnElement="Flow_0fxlsv3"> - <di:waypoint x="360" y="360" /> - <di:waypoint x="435" y="360" /> + <bpmndi:BPMNEdge id="Flow_0n0yrky_di" bpmnElement="Flow_0n0yrky"> + <di:waypoint x="2800" y="520" /> + <di:waypoint x="2840" y="520" /> + <di:waypoint x="2840" y="385" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1ewmc79_di" bpmnElement="Flow_1ewmc79"> + <di:waypoint x="1748" y="360" /> + <di:waypoint x="1820" y="360" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1jwekqw_di" bpmnElement="Flow_1jwekqw"> + <di:waypoint x="1920" y="360" /> + <di:waypoint x="1965" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="BPMNShape_06i4ly8" bpmnElement="Activity_16rb6hc"> + <dc:Bounds x="690" y="460" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0fhb8wi" bpmnElement="Activity_0nwtf8o"> + <dc:Bounds x="530" y="460" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> + <dc:Bounds x="3030" y="330" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> + <dc:Bounds x="3160" y="330" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> + <dc:Bounds x="3282" y="352" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ob9la3" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> + <dc:Bounds x="815" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0wi2en6" bpmnElement="SelectPingTargets"> + <dc:Bounds x="900" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1v2z49g" bpmnElement="Gateway_0xw5i5v" isMarkerVisible="true"> + <dc:Bounds x="435" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ydgq5s" bpmnElement="StartPingMessageStartEvent"> + <dc:Bounds x="152" y="342" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="151" y="385" width="44" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> + <dc:Bounds x="260" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> + <dc:Bounds x="3100" y="239" width="160" height="49" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0o5toqz" bpmnElement="TextAnnotation_1j1ytqy"> + <dc:Bounds x="430" y="580" width="170" height="40" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0ne04k7" bpmnElement="TextAnnotation_0dhecha"> + <dc:Bounds x="400" y="220" width="419.98765969802554" height="69.68641114982579" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> + <dc:Bounds x="3030" y="490" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> + <dc:Bounds x="230" y="80" width="420" height="70" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_09zmq8d" bpmnElement="Flow_0j92st0"> <di:waypoint x="1000" y="360" /> <di:waypoint x="1040" y="360" /> @@ -539,6 +532,26 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="865" y="360" /> <di:waypoint x="900" y="360" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0e35w2m_di" bpmnElement="Flow_0e35w2m"> + <di:waypoint x="188" y="360" /> + <di:waypoint x="260" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0fxlsv3_di" bpmnElement="Flow_0fxlsv3"> + <di:waypoint x="360" y="360" /> + <di:waypoint x="435" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> + <di:waypoint x="539" y="540" /> + <di:waypoint x="498" y="580" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> + <di:waypoint x="3123" y="490" /> + <di:waypoint x="3094" y="410" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> + <di:waypoint x="3189" y="330" /> + <di:waypoint x="3168" y="288" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From 5b8867a002a49c1f72657ae957f4c3cc72424150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 26 Feb 2025 19:24:17 +0100 Subject: [PATCH 102/382] Ran format-and-sort --- src/main/java/dev/dsf/bpe/service/SavePong.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/SavePong.java b/src/main/java/dev/dsf/bpe/service/SavePong.java index e0f8753c..7628cb06 100644 --- a/src/main/java/dev/dsf/bpe/service/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/SavePong.java @@ -22,8 +22,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); delegateExecution.removeVariable("statusCode"); - variables.setString("statusCode_" + correlationKey, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED); + variables.setString("statusCode_" + correlationKey, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED); - //TODO: add other information: downloaded-bytes, downloaded-duration-millis, error-message + // TODO: add other information: downloaded-bytes, downloaded-duration-millis, error-message } } From bc90926a2010a1aa62a08317f17b6682b8624a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 09:04:07 +0100 Subject: [PATCH 103/382] Added cleanupPong to authorization rules --- .../fhir/ActivityDefinition/dsf-pong.xml | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/resources/fhir/ActivityDefinition/dsf-pong.xml b/src/main/resources/fhir/ActivityDefinition/dsf-pong.xml index 1a877ce9..efde8372 100644 --- a/src/main/resources/fhir/ActivityDefinition/dsf-pong.xml +++ b/src/main/resources/fhir/ActivityDefinition/dsf-pong.xml @@ -31,6 +31,32 @@ </valueCoding> </extension> </extension> + <extension url="http://dsf.dev/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="cleanupPong" /> + </extension> + <extension url="task-profile"> + <valueCanonical value="http://dsf.dev/fhir/StructureDefinition/task-cleanup-pong|#{version}" /> + </extension> + <extension url="requester"> + <valueCoding> + <system value="http://dsf.dev/fhir/CodeSystem/process-authorization" /> + <code value="REMOTE_ALL" /> + </valueCoding> + </extension> + <extension url="requester"> + <valueCoding> + <system value="http://dsf.dev/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> + </extension> + <extension url="recipient"> + <valueCoding> + <system value="http://dsf.dev/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> + </extension> + </extension> <url value="http://dsf.dev/bpe/Process/pong" /> <!-- version managed by bpe --> <version value="#{version}" /> From 80bce024883af42d00ce82e6dcc74e869e1f3660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 09:34:42 +0100 Subject: [PATCH 104/382] Set cleanupTimerDuration execution variable to dummy value to net get an exception where cleanupTimerDuration cannot be resolved --- .../java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java index e26d7eac..afb2974b 100644 --- a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java @@ -22,5 +22,6 @@ public EstimateCleanupTimerDuration(ProcessPluginApi api) protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { logger.info("Estimated cleanup timer duration"); + variables.setString("cleanupTimerDuration","PT20S"); } } From 6d504c59b2edf7a5f473100dd6dddae2c0baf134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 09:53:29 +0100 Subject: [PATCH 105/382] Ran format-and-sot --- .../java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java index afb2974b..eed8cbfe 100644 --- a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java @@ -22,6 +22,6 @@ public EstimateCleanupTimerDuration(ProcessPluginApi api) protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { logger.info("Estimated cleanup timer duration"); - variables.setString("cleanupTimerDuration","PT20S"); + variables.setString("cleanupTimerDuration", "PT20S"); } } From bd15613abb5db1c1f4f64eedf010577609a6b541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 11:30:35 +0100 Subject: [PATCH 106/382] Added retry time cycle to fix camunda error: OptimisticLockingException - ENGINE-03005 Execution of 'UPDATE VariableInstanceEntity[3107474d-f4f5-11ef-8d0e-0242ac160007]' failed. Entity was updated by another transaction concurrently --- src/main/resources/bpe/ping.bpmn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index e3144903..d4615fa9 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -108,7 +108,10 @@ <bpmn:incoming>Flow_0n0yrky</bpmn:incoming> <bpmn:outgoing>Flow_03nx6rk</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:endEvent id="Event_1foycg9"> + <bpmn:endEvent id="Event_1foycg9" camunda:asyncAfter="true"> + <bpmn:extensionElements> + <camunda:failedJobRetryTimeCycle>R3/PT5S</camunda:failedJobRetryTimeCycle> + </bpmn:extensionElements> <bpmn:incoming>Flow_03nx6rk</bpmn:incoming> </bpmn:endEvent> <bpmn:boundaryEvent id="Event_0i4slcz" name="Invalid Resource Reference" attachedToRef="Activity_0h9o9u7"> From 1f95a50df092576749253ae22547db9294095f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 12:24:10 +0100 Subject: [PATCH 107/382] cleanup-pong Task mustn't have a correlation key set --- .../fhir/StructureDefinition/dsf-task-cleanup-pong.xml | 2 +- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index f41cac35..6f47715e 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -58,7 +58,7 @@ </extension> <path value="Task.input" /> <sliceName value="correlation-key" /> - <min value="1" /> + <max value="0"/> </element> <element id="Task.input:downloaded-bytes"> <path value="Task.input"/> diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index bcdda454..916853d1 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -548,8 +548,6 @@ private Task createValidTaskPong() private Task createValidTaskCleanupPong() { - NetworkSpeedMetricGenerator networkSpeedMetricGenerator = new NetworkSpeedMetricGenerator(); - Task task = new Task(); task.getMeta().addProfile(ConstantsPing.PROFILE_DSF_TASK_CLEANUP_PONG); task.setInstantiatesCanonical( @@ -566,11 +564,9 @@ private Task createValidTaskCleanupPong() .addCoding(BpmnMessage.messageName()); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); - task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() - .addCoding(BpmnMessage.correlationKey()); - task.addInput(networkSpeedMetricGenerator.createDownloadedBytes(1000)); - task.addInput(networkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); + task.addInput(NetworkSpeedMetricGenerator.createDownloadedBytes(1000)); + task.addInput(NetworkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); return task; } } From b5b9a6adbd3255e3dd0764adeef67e5bbc385634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 13:23:58 +0100 Subject: [PATCH 108/382] Sending to non-subprocess requires no correlation-key to be present, otherwise DSF will try to correlate a process instance with the correlation key. This required the target to be recreated. This was done using an execution listener --- .../RemoveCorrelationKeyListener.java | 27 +++++++++++ .../dev/dsf/bpe/spring/config/PingConfig.java | 8 ++++ src/main/resources/bpe/ping.bpmn | 47 ++++++++++--------- 3 files changed, 59 insertions(+), 23 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/listener/RemoveCorrelationKeyListener.java diff --git a/src/main/java/dev/dsf/bpe/listener/RemoveCorrelationKeyListener.java b/src/main/java/dev/dsf/bpe/listener/RemoveCorrelationKeyListener.java new file mode 100644 index 00000000..e50b6ae1 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/listener/RemoveCorrelationKeyListener.java @@ -0,0 +1,27 @@ +package dev.dsf.bpe.listener; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.ExecutionListener; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.variables.Target; +import dev.dsf.bpe.v1.variables.Variables; + +public class RemoveCorrelationKeyListener implements ExecutionListener +{ + private final ProcessPluginApi api; + + public RemoveCorrelationKeyListener(ProcessPluginApi api) + { + this.api = api; + } + + @Override + public void notify(DelegateExecution delegateExecution) throws Exception + { + Variables variables = api.getVariables(delegateExecution); + Target oldTarget = variables.getTarget(); + variables.setTarget(variables.createTarget(oldTarget.getOrganizationIdentifierValue(), + oldTarget.getEndpointIdentifierValue(), oldTarget.getEndpointUrl())); + } +} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 594bb800..77e0193e 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -7,6 +7,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; +import dev.dsf.bpe.listener.RemoveCorrelationKeyListener; import dev.dsf.bpe.listener.SetCorrelationKeyListener; import dev.dsf.bpe.mail.ErrorMailService; import dev.dsf.bpe.message.CleanupPong; @@ -254,4 +255,11 @@ public SavePong savePong() { return new SavePong(api); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public RemoveCorrelationKeyListener removeCorrelationKeyListener() + { + return new RemoveCorrelationKeyListener(api); + } } diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index d4615fa9..1b960ed3 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -94,6 +94,7 @@ <camunda:field name="instantiatesCanonical"> <camunda:string>http://dsf.dev/bpe/Process/pong|#{version}</camunda:string> </camunda:field> + <camunda:executionListener class="dev.dsf.bpe.listener.RemoveCorrelationKeyListener" event="start" /> </bpmn:extensionElements> <bpmn:incoming>Flow_1v37fff</bpmn:incoming> <bpmn:incoming>Flow_0jcfur3</bpmn:incoming> @@ -305,9 +306,20 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2210" y="600" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> + <dc:Bounds x="2815" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> <dc:Bounds x="2912" y="342" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1p3zvup" bpmnElement="Activity_0i9uqk0"> + <dc:Bounds x="2700" y="480" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_187dy31_di" bpmnElement="Activity_081me01"> + <dc:Bounds x="1820" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> <dc:Bounds x="1270" y="220" width="250" height="70" /> <bpmndi:BPMNLabel /> @@ -320,17 +332,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1980" y="622" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1p3zvup" bpmnElement="Activity_0i9uqk0"> - <dc:Bounds x="2700" y="480" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> - <dc:Bounds x="2815" y="335" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_187dy31_di" bpmnElement="Activity_081me01"> - <dc:Bounds x="1820" y="320" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0968qvb" bpmnElement="Event_0i4slcz"> <dc:Bounds x="2152" y="542" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -411,18 +412,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2865" y="360" /> <di:waypoint x="2912" y="360" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> - <di:waypoint x="1252" y="320" /> - <di:waypoint x="1276" y="290" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> - <di:waypoint x="2610" y="550" /> - <di:waypoint x="2716" y="612" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> - <di:waypoint x="2074" y="622" /> - <di:waypoint x="2102" y="560" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0klalf8_di" bpmnElement="Flow_0klalf8"> <di:waypoint x="2610" y="520" /> <di:waypoint x="2700" y="520" /> @@ -440,6 +429,18 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1920" y="360" /> <di:waypoint x="1965" y="360" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> + <di:waypoint x="1252" y="320" /> + <di:waypoint x="1276" y="290" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> + <di:waypoint x="2610" y="550" /> + <di:waypoint x="2716" y="612" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> + <di:waypoint x="2074" y="622" /> + <di:waypoint x="2102" y="560" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_06i4ly8" bpmnElement="Activity_16rb6hc"> <dc:Bounds x="690" y="460" width="100" height="80" /> </bpmndi:BPMNShape> From 9d738992d65b48b51798dc6171d682a3d6193240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 14:49:52 +0100 Subject: [PATCH 109/382] Now saves missing pong status to execution variables --- .../dev/dsf/bpe/service/LogAndSaveNoResponse.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java b/src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java index ed951948..614e94ea 100644 --- a/src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java +++ b/src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java @@ -2,11 +2,14 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveNoResponse extends AbstractServiceDelegate @@ -21,6 +24,12 @@ public LogAndSaveNoResponse(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - logger.info("Logging and saving missing response"); + Target target = variables.getTarget(); + logger.info("No PONG received from endpoint '{}'", target.getEndpointIdentifierValue()); + + String correlationKey = target.getCorrelationKey(); + delegateExecution.removeVariable("statusCode"); + variables.setString("statusCode_" + correlationKey, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING); } } From 779ff865a25195581ae113a38109b765929206e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 20:02:26 +0100 Subject: [PATCH 110/382] Added resource generation --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 9 ++++ .../dev/dsf/bpe/service/GenerateResource.java | 41 ++++++++++++++++++- .../dev/dsf/bpe/service/StoreResource.java | 31 +++++++++++++- .../dsf/bpe/util/ReadAccessTagGenerator.java | 16 ++++++++ 4 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index dd4b79bf..b7c3ddcf 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -1,5 +1,6 @@ package dev.dsf.bpe; +import jakarta.ws.rs.core.MediaType; public interface ConstantsPing { @@ -60,6 +61,10 @@ public interface ConstantsPing String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND = "megabits-per-second"; String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND = "megabytes-per-second"; + + String CODESYSTEM_READ_ACCESS_TAG = "http://dsf.dev/fhir/CodeSystem/read-access-tag"; + String CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL = "ALL"; + String EXTENSION_URL_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status"; String EXTENSION_URL_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; @@ -74,6 +79,10 @@ public interface ConstantsPing String BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL = "timerInterval"; String BPMN_EXECUTION_VARIABLE_STOP_TIMER = "stopTimer"; String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES = "downloadResourceSizeBytes"; + String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE = "downloadResource"; + String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; + + MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; } diff --git a/src/main/java/dev/dsf/bpe/service/GenerateResource.java b/src/main/java/dev/dsf/bpe/service/GenerateResource.java index 90e46ee3..698e42e7 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateResource.java @@ -1,10 +1,17 @@ package dev.dsf.bpe.service; +import java.util.Base64; +import java.util.Random; +import java.util.UUID; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Binary; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ReadAccessTagGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -21,6 +28,38 @@ public GenerateResource(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - logger.info("Generating resource"); + int downloadResourceSizeBytes = getDownloadResourceSize(variables); + + variables.setByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE, + generateRandomBinaryContent(downloadResourceSizeBytes)); + + logger.info("Generated binary resource content for network speed measurement"); + } + + private byte[] generateRandomBinaryContent(int sizeBytes) + { + byte[] bytes = base64Encode(generateRandomByteArray((sizeBytes / 4) * 3)); + logger.info( + "Generated binary content for network speed measurement. Requested size was: {} bytes, generated size was : {}", + sizeBytes, bytes.length); + return bytes; + } + + private byte[] generateRandomByteArray(int sizeBytes) + { + Random rand = new Random(); + byte[] randomBytes = new byte[sizeBytes]; + rand.nextBytes(randomBytes); + return randomBytes; + } + + private byte[] base64Encode(byte[] content) + { + return Base64.getEncoder().encode(content); + } + + private int getDownloadResourceSize(Variables variables) + { + return variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); } } diff --git a/src/main/java/dev/dsf/bpe/service/StoreResource.java b/src/main/java/dev/dsf/bpe/service/StoreResource.java index 08f2a521..8124289b 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResource.java @@ -1,10 +1,18 @@ package dev.dsf.bpe.service; +import java.io.ByteArrayInputStream; +import java.util.UUID; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Binary; +import org.hl7.fhir.r4.model.DocumentReference; +import org.hl7.fhir.r4.model.Reference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ReadAccessTagGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -21,6 +29,27 @@ public StoreResource(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - logger.info("Storing resource"); + String localEndpointAddress = api.getEndpointProvider().getLocalEndpoint().orElseThrow().getAddress(); + + Binary downloadResource = storeBinary( + variables.getByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE)); + + String reference = localEndpointAddress + "/Binary/" + downloadResource.getId(); + + variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); + + logger.info("Stored binary resource for PING targets to download"); + } + + private Binary storeBinary(byte[] downloadResourceContent) + { + Binary downloadResource = new Binary(); + downloadResource.setContent(downloadResourceContent); + downloadResource.setContentType(ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE.toString()); + downloadResource.setId(UUID.randomUUID().toString()); + downloadResource.getMeta() + .addTag(ReadAccessTagGenerator.create(ConstantsPing.CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL)); + + return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().create(downloadResource); } } diff --git a/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java b/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java new file mode 100644 index 00000000..cf2c51df --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java @@ -0,0 +1,16 @@ +package dev.dsf.bpe.util; + +import org.hl7.fhir.r4.model.Coding; + +import dev.dsf.bpe.ConstantsPing; + +public class ReadAccessTagGenerator +{ + public static Coding create(String accessLevel) + { + Coding tag = new Coding(); + tag.setSystem(ConstantsPing.CODESYSTEM_READ_ACCESS_TAG); + tag.setCode(accessLevel); + return tag; + } +} From 3acbbc2c3dcc84963c1f8acf613924cf935e56f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 20:05:36 +0100 Subject: [PATCH 111/382] Changed default download resource size to 1MB as that is the default for the nginx proxy which would result into the process failing if data is transferred beyond this limit --- src/main/resources/fhir/Task/dsf-task-start-ping.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping.xml b/src/main/resources/fhir/Task/dsf-task-start-ping.xml index 215db8dd..0418156b 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping.xml @@ -42,7 +42,7 @@ <code value="download-resource-size-bytes" /> </coding> </type> - <valueInteger value="10000000"/> + <valueInteger value="1000000"/> </input> <input> <type> From 712aba618b3e3ea525b16ad4d389df535ac7a4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 20:11:49 +0100 Subject: [PATCH 112/382] Resource generation now limited to maxUploadSizeBytes --- src/main/java/dev/dsf/bpe/service/GenerateResource.java | 9 ++++++--- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/GenerateResource.java b/src/main/java/dev/dsf/bpe/service/GenerateResource.java index 698e42e7..0fedf575 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateResource.java @@ -19,10 +19,12 @@ public class GenerateResource extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(GenerateResource.class); + private final int maxUploadSizeBytes; - public GenerateResource(ProcessPluginApi api) + public GenerateResource(ProcessPluginApi api, int maxUploadSizeBytes) { super(api); + this.maxUploadSizeBytes = maxUploadSizeBytes; } @Override @@ -36,12 +38,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.info("Generated binary resource content for network speed measurement"); } - private byte[] generateRandomBinaryContent(int sizeBytes) + private byte[] generateRandomBinaryContent(int desiredSizeBytes) { + int sizeBytes = Math.min(maxUploadSizeBytes, desiredSizeBytes); byte[] bytes = base64Encode(generateRandomByteArray((sizeBytes / 4) * 3)); logger.info( "Generated binary content for network speed measurement. Requested size was: {} bytes, generated size was : {}", - sizeBytes, bytes.length); + desiredSizeBytes, bytes.length); return bytes; } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 77e0193e..513675cc 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -183,7 +183,7 @@ public DownloadResourceAndMeasureSpeed downloadResourceAndMeasureSpeed() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public GenerateResource generateResource() { - return new GenerateResource(api); + return new GenerateResource(api, (int) maxUploadSizeBytes); } @Bean From 4b56e0f1d3d91f51251e577f2f2b1220632f21a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 27 Feb 2025 20:50:21 +0100 Subject: [PATCH 113/382] Added resource cleanup --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + src/main/java/dev/dsf/bpe/service/Cleanup.java | 10 ++++++++-- src/main/java/dev/dsf/bpe/service/StoreResource.java | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index b7c3ddcf..d8b1ee2d 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -81,6 +81,7 @@ public interface ConstantsPing String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES = "downloadResourceSizeBytes"; String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE = "downloadResource"; String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; + String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID = "downloadResourceId"; MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 335c71d0..40aa15da 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -2,16 +2,18 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Binary; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class Cleanup extends AbstractServiceDelegate { - private final static Logger logger = LoggerFactory.getLogger(Cleanup.class.getName()); + private final static Logger logger = LoggerFactory.getLogger(Cleanup.class); public Cleanup(ProcessPluginApi api) { @@ -21,6 +23,10 @@ public Cleanup(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - logger.info("Cleaning up"); + String downloadResourceId = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID); + api.getFhirWebserviceClientProvider().getLocalWebserviceClient().delete(Binary.class, downloadResourceId); + api.getFhirWebserviceClientProvider().getLocalWebserviceClient().deletePermanently(Binary.class, + downloadResourceId); + logger.info("Cleanup completed. Deleted Binary resource with ID {}", downloadResourceId); } } diff --git a/src/main/java/dev/dsf/bpe/service/StoreResource.java b/src/main/java/dev/dsf/bpe/service/StoreResource.java index 8124289b..deb76fee 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResource.java @@ -37,6 +37,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable String reference = localEndpointAddress + "/Binary/" + downloadResource.getId(); variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); + variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID, + downloadResource.getIdElement().getIdPart()); logger.info("Stored binary resource for PING targets to download"); } From 3dcce38c675706e03a83cd838c41d750a12701c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 12:32:43 +0100 Subject: [PATCH 114/382] Removed maximum amount of error messages that can be added in pong process --- .../java/dev/dsf/bpe/message/SendPong.java | 3 +- .../dev/dsf/bpe/service/StoreResults.java | 3 +- .../dev/dsf/bpe/util/PingStatusGenerator.java | 29 +++++++++++-------- .../dsf-extension-ping-status.xml | 2 -- .../StructureDefinition/dsf-task-pong.xml | 2 -- .../dsf/fhir/profiles/TaskProfileTest.java | 22 +++++++++++++- 6 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index aca91563..d4b46b32 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -1,5 +1,6 @@ package dev.dsf.bpe.message; +import java.util.List; import java.util.Objects; import java.util.stream.Stream; @@ -78,7 +79,7 @@ protected void handleEndEventError(DelegateExecution execution, Variables variab String specialErrorMessage = createErrorMessage(exception); - mainTask.addOutput(statusGenerator.createPongStatusOutput(target, statusCode, specialErrorMessage)); + mainTask.addOutput(statusGenerator.createPongStatusOutput(target, statusCode, List.of(specialErrorMessage))); variables.updateTask(mainTask); if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode)) diff --git a/src/main/java/dev/dsf/bpe/service/StoreResults.java b/src/main/java/dev/dsf/bpe/service/StoreResults.java index b22c8f85..00c5a20f 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResults.java @@ -1,6 +1,7 @@ package dev.dsf.bpe.service; import java.util.Comparator; +import java.util.List; import java.util.Objects; import org.camunda.bpm.engine.delegate.BpmnError; @@ -54,7 +55,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw || ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statusCode)) { String errorMessage = variables.getString("errorMessage_" + correlationKey); - task.addOutput(statusGenerator.createPingStatusOutput(target, statusCode, errorMessage)); + task.addOutput(statusGenerator.createPingStatusOutput(target, statusCode, List.of(errorMessage))); if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode)) errorMailService.endpointNotReachableForPing(task.getIdElement(), target, errorMessage); diff --git a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java index 38948151..6185bd70 100644 --- a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java @@ -1,5 +1,7 @@ package dev.dsf.bpe.util; +import java.util.List; + import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Extension; @@ -24,16 +26,16 @@ public TaskOutputComponent createPingStatusOutput(Target target, String statusCo return createPingStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } - public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, String errorMessage) + public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, List<String> errorMessages) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessage, + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessages, -1, -1, null); } - public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, String errorMessage, + public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessage, + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessages, downloadSpeed, uploadSpeed, unit); } @@ -48,21 +50,21 @@ public TaskOutputComponent createPongStatusOutput(Target target, String statusCo return createPongStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } - public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, String errorMessage) + public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<String> errorMessages) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessage, + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessages, -1, -1, null); } - public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, String errorMessage, + public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessage, + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessages, downloadSpeed, uploadSpeed, unit); } private TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, - String errorMessage, int downloadSpeed, int uploadSpeed, String unit) + List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) { TaskOutputComponent output = new TaskOutputComponent(); output.setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); @@ -75,9 +77,12 @@ private TaskOutputComponent createStatusOutput(Target target, String outputParam .setValue(OrganizationIdentifier.withValue(target.getOrganizationIdentifierValue())); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER) .setValue(EndpointIdentifier.withValue(target.getEndpointIdentifierValue())); - if (errorMessage != null) - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE) - .setValue(new StringType(errorMessage)); + if (errorMessages != null) + for (String errorMessage : errorMessages) + { + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE) + .setValue(new StringType(errorMessage)); + } if (downloadSpeed >= 0 && unit != null) { diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 1fdeef01..420717ae 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -35,7 +35,6 @@ <rules value="open"/> </slicing> <min value="3"/> - <max value="5"/> </element> <element id="Extension.extension:correlation-key"> <path value="Extension.extension"/> @@ -110,7 +109,6 @@ <path value="Extension.extension"/> <sliceName value="error-message"/> <min value="0"/> - <max value="1"/> </element> <element id="Extension.extension:error-message.url"> <path value="Extension.extension.url"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index 7d288463..e230e381 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -31,7 +31,6 @@ </extension> <path value="Task.input" /> <min value="3" /> - <max value="6" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -188,7 +187,6 @@ <path value="Task.input"/> <sliceName value="error-message"/> <min value="0"/> - <max value="1"/> </element> <element id="Task.input:error-message.type"> <path value="Task.input.type"/> diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 916853d1..ba186faf 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Date; +import java.util.List; import java.util.UUID; import org.hl7.fhir.r4.model.IntegerType; @@ -25,6 +26,7 @@ import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; +import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; @@ -245,7 +247,7 @@ public String getCorrelationKey() task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); task.addOutput(new PingStatusGenerator().createPingStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE, "some error message")); + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE, List.of("some error message"))); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -511,6 +513,24 @@ public void testTaskPongValidWithReferenceAndDownloadedDurationMillisAndDownload || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + @Test + public void testTaskPongValidWithMultipleErrorMessages() + { + Task task = createValidTaskPong(); + + task.addInput(DownloadResourceReferenceGenerator.create("https://test.endpoint.org/fhir/Binary")); + task.addInput(NetworkSpeedMetricGenerator.createDownloadedBytes(1000)); + task.addInput(NetworkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); + task.addInput(ErrorMessageGenerator.create("Something went wrong")); + task.addInput(ErrorMessageGenerator.create("Something went wrong really badly")); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + @Test public void testTaskCleanupPongValid() { From e7450040601716a305648bebe01e695b764bdd36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 12:35:02 +0100 Subject: [PATCH 115/382] First try at implementing download speed measurement. Also, split DownloadResourceAndMeasureSpeed into DownloadResourceAndMeasureSpeed and DownloadResourceAndMeasureSpeedInSubProcess because saving to execution variables has to be handled differently whether it is a sub process or not. --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 9 ++ .../java/dev/dsf/bpe/message/SendPing.java | 24 ++--- .../DownloadResourceAndMeasureSpeed.java | 68 +++++++++++++- ...adResourceAndMeasureSpeedInSubProcess.java | 90 +++++++++++++++++++ .../dev/dsf/bpe/spring/config/PingConfig.java | 11 ++- .../bpe/util/BinaryResourceDownloader.java | 81 +++++++++++++++++ .../dsf/bpe/util/ErrorMessageListUtils.java | 30 +++++++ .../generator/ErrorMessageGenerator.java | 26 ++++++ src/main/resources/bpe/ping.bpmn | 2 +- 9 files changed, 326 insertions(+), 15 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java create mode 100644 src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java create mode 100644 src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java create mode 100644 src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index d8b1ee2d..a7c0dd37 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -1,5 +1,7 @@ package dev.dsf.bpe; +import java.util.regex.Pattern; + import jakarta.ws.rs.core.MediaType; public interface ConstantsPing @@ -54,6 +56,7 @@ public interface ConstantsPing String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING = "pong-missing"; String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED = "pong-received"; String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT = "pong-sent"; + String CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE = "error-message"; String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units"; String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; @@ -82,8 +85,14 @@ public interface ConstantsPing String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE = "downloadResource"; String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID = "downloadResourceId"; + String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; + String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; + String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; + String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; + + Pattern WEBSERVICE_URL_PATTERN = Pattern.compile("http(s?)://(\\w+)(\\.\\w+)*/fhir"); } diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index d96b9043..484691fc 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -29,13 +29,15 @@ public SendPing(ProcessPluginApi api) @Override protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - return Stream.of( - api.getTaskHelper().createInput( - new Reference().setIdentifier(getLocalEndpointIdentifier()) - .setType(ResourceType.Endpoint.name()), + String downloadResourceReference = variables.getString( + ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); + int downloadResourceSizeBytes = variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + + return Stream.of(api.getTaskHelper().createInput( + new Reference().setIdentifier(getLocalEndpointIdentifier()).setType(ResourceType.Endpoint.name()), ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER), - DownloadResourceSizeGenerator.create(0), - DownloadResourceReferenceGenerator.create("https://test.org/fhir/Binary/foo")); + DownloadResourceSizeGenerator.create(downloadResourceSizeBytes), + DownloadResourceReferenceGenerator.create(downloadResourceReference)); } @Override @@ -43,9 +45,9 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va Exception exception, String errorMessage) { String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null - && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() - ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED - : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; + && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() ? + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED : + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; execution.setVariableLocal("statusCode", statusCode); String specialErrorMessage = createErrorMessage(exception); @@ -60,8 +62,8 @@ protected void addErrorMessage(Task task, String errorMessage) private String createErrorMessage(Exception exception) { - if (exception instanceof WebApplicationException w - && (exception.getMessage() == null || exception.getMessage().isBlank())) + if (exception instanceof WebApplicationException w && (exception.getMessage() == null || exception.getMessage() + .isBlank())) { StatusType statusInfo = w.getResponse().getStatusInfo(); return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java index d6291ec3..797d0625 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java @@ -1,26 +1,90 @@ package dev.dsf.bpe.service; +import static dev.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST; +import static dev.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_STATUS_CODE; +import static dev.dsf.bpe.ConstantsPing.WEBSERVICE_URL_PATTERN; + +import java.io.IOException; +import java.io.InputStream; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.BinaryResourceDownloader; +import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate { public static final Logger logger = LoggerFactory.getLogger(DownloadResourceAndMeasureSpeed.class); + private final int maxDownloadSizeBytes; - public DownloadResourceAndMeasureSpeed(ProcessPluginApi api) + public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, int maxDownloadSizeBytes) { super(api); + this.maxDownloadSizeBytes = maxDownloadSizeBytes; } @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - logger.info("Downloading resource and measuring speed"); + Task task = variables.getStartTask(); + + int downloadResourceSizeBytes = variables.getInteger( + ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + + Reference downloadResourceReference = api.getTaskHelper() + .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, Reference.class) + .orElseThrow(); + + Matcher matcher = WEBSERVICE_URL_PATTERN.matcher(downloadResourceReference.getReference()); + boolean matched = matcher.find(); + if (matched) + { + String webserviceUrl = matcher.group(1); + InputStream binaryResourceInputStream = api.getFhirWebserviceClientProvider() + .getWebserviceClient(webserviceUrl).readBinary(getDownloadResourceId(downloadResourceReference), + ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE); + + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download( + binaryResourceInputStream, downloadResourceReference.getReference(), downloadResourceSizeBytes, + maxDownloadSizeBytes); + + if (downloadResult.getErrorMessage() != null) + { + variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, + downloadResult.getDownloadedBytes()); + variables.setLong( + ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS , + downloadResult.getDownloadedDurationMillis()); + } + else + { + ErrorMessageListUtils.add(downloadResult.getErrorMessage(), + BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, delegateExecution); + } + } + else + { + ErrorMessageListUtils.add("Invalid download resource url:" + downloadResourceReference.getReference(), + delegateExecution); + } + } + + private String getDownloadResourceId(Reference downloadResourceReference) + { + String[] split = downloadResourceReference.getReference().split("/"); + return split[split.length - 1]; } } diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java new file mode 100644 index 00000000..06a9b4ae --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -0,0 +1,90 @@ +package dev.dsf.bpe.service; + +import static dev.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST; +import static dev.dsf.bpe.ConstantsPing.WEBSERVICE_URL_PATTERN; + +import java.io.InputStream; +import java.util.regex.Matcher; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.BinaryResourceDownloader; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; +import dev.dsf.bpe.v1.variables.Variables; + +public class DownloadResourceAndMeasureSpeedInSubProcess extends AbstractServiceDelegate +{ + public static final Logger logger = LoggerFactory.getLogger(DownloadResourceAndMeasureSpeedInSubProcess.class); + private final int maxDownloadSizeBytes; + + public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api, int maxDownloadSizeBytes) + { + super(api); + this.maxDownloadSizeBytes = maxDownloadSizeBytes; + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + Task task = variables.getLatestTask(); + Target target = variables.getTarget(); + String correlationKey = target.getCorrelationKey(); + + int downloadResourceSizeBytes = variables.getInteger( + ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + + Reference downloadResourceReference = api.getTaskHelper() + .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, Reference.class) + .orElseThrow(); + + Matcher matcher = WEBSERVICE_URL_PATTERN.matcher(downloadResourceReference.getReference()); + boolean matched = matcher.find(); + if (matched) + { + String webserviceUrl = matcher.group(1); + + InputStream binaryResourceInputStream = api.getFhirWebserviceClientProvider() + .getWebserviceClient(webserviceUrl).readBinary(getDownloadResourceId(downloadResourceReference), + ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE); + + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download( + binaryResourceInputStream, downloadResourceReference.getReference(), downloadResourceSizeBytes, + maxDownloadSizeBytes); + + if (downloadResult.getErrorMessage() != null) + { + variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, + downloadResult.getDownloadedBytes()); + variables.setLong( + ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS + "_" + correlationKey, + downloadResult.getDownloadedDurationMillis()); + } + else + { + ErrorMessageListUtils.add(downloadResult.getErrorMessage(), + BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST + "_" + correlationKey, delegateExecution); + } + } + else + { + ErrorMessageListUtils.add("Invalid download resource url:" + downloadResourceReference.getReference(), + BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST + "_" + correlationKey, delegateExecution); + } + } + + private String getDownloadResourceId(Reference downloadResourceReference) + { + String[] split = downloadResourceReference.getReference().split("/"); + return split[split.length - 1]; + } +} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 513675cc..026a21ee 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -16,6 +16,7 @@ import dev.dsf.bpe.message.SendStartPing; import dev.dsf.bpe.service.Cleanup; import dev.dsf.bpe.service.DownloadResourceAndMeasureSpeed; +import dev.dsf.bpe.service.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.EstimateCleanupTimerDuration; import dev.dsf.bpe.service.GenerateResource; import dev.dsf.bpe.service.LogAndSaveAndStoreError; @@ -176,9 +177,17 @@ public CleanupPong cleanupPong() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public DownloadResourceAndMeasureSpeed downloadResourceAndMeasureSpeed() { - return new DownloadResourceAndMeasureSpeed(api); + return new DownloadResourceAndMeasureSpeed(api, (int) maxDownloadSizeBytes); } + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public DownloadResourceAndMeasureSpeedInSubProcess downloadResourceAndMeasureSpeedInSubProcess() + { + return new DownloadResourceAndMeasureSpeedInSubProcess(api, (int) maxDownloadSizeBytes); + } + + @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public GenerateResource generateResource() diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java new file mode 100644 index 00000000..943b872d --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -0,0 +1,81 @@ +package dev.dsf.bpe.util; + +import java.io.IOException; +import java.io.InputStream; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class BinaryResourceDownloader +{ + private static final Logger logger = LoggerFactory.getLogger(BinaryResourceDownloader.class); + + public DownloadResult download(InputStream inputStream, String reference, int downloadResourceSizeBytes, int maxDownloadSizeBytes) + { + DownloadResult downloadResult; + try (inputStream) + { + logger.info( + "Starting resource download for: '{}'. Requested resource size is {} bytes, maximum downloadable size is {} bytes", + reference, downloadResourceSizeBytes, maxDownloadSizeBytes); + long downloadStartTime = System.currentTimeMillis(); + int bufferSize = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); + byte[] buffer = new byte[bufferSize]; + int bytesRead = inputStream.read(buffer); + long downloadEndTime = System.currentTimeMillis(); + long downloadedDurationMillis = downloadEndTime - downloadStartTime; + downloadResult = new DownloadResult(bytesRead, downloadedDurationMillis); + logger.info("Finished downloading {} bytes. Took {}", bytesRead, toHoursMinutesSecondsMilliseconds(downloadedDurationMillis)); + + } catch (IOException e) + { + downloadResult = new DownloadResult(e.getMessage()); + } + return downloadResult; + } + + + private String toHoursMinutesSecondsMilliseconds(long millis) + { + long hours = (millis / 1000) / 60 / 60 % 24; + long minutes = (millis / 1000) / 60 % 60; + long seconds = (millis / 1000) % 60; + long milliSeconds = millis % 1000; + return String.format("%02d:%02d:%02d:%02dms", hours, minutes, seconds, milliSeconds); + } + + public static class DownloadResult { + private final int downloadedBytes; + private final long downloadedDurationMillis; + private final String errorMessage; + + public DownloadResult(int downloadedBytes, long downloadedDurationMillis) + { + this.downloadedBytes = downloadedBytes; + this.downloadedDurationMillis = downloadedDurationMillis; + errorMessage = null; + } + + public DownloadResult(String errorMessage) + { + downloadedBytes = 0; + downloadedDurationMillis = 0; + this.errorMessage = errorMessage; + } + + public int getDownloadedBytes() + { + return downloadedBytes; + } + + public long getDownloadedDurationMillis() + { + return downloadedDurationMillis; + } + + public String getErrorMessage() + { + return errorMessage; + } + } +} diff --git a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java new file mode 100644 index 00000000..39a3b314 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java @@ -0,0 +1,30 @@ +package dev.dsf.bpe.util; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import dev.dsf.bpe.ConstantsPing; + +public class ErrorMessageListUtils +{ + @SuppressWarnings("unchecked") + public static List<String> add(String error, DelegateExecution execution) + { + return add(error, ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, execution); + } + + @SuppressWarnings("unchecked") + public static List<String> add(String error, String variableName, DelegateExecution execution) + { + List<String> errorMessages = (List<String>) execution.getVariable(variableName); + if (errorMessages == null) + { + errorMessages = new ArrayList<>(); + execution.setVariable(variableName, errorMessages); + } + errorMessages.add(error); + return errorMessages; + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java new file mode 100644 index 00000000..db21ce48 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.util.task.input.generator; + +import java.util.List; +import java.util.stream.Collectors; + +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; + +public class ErrorMessageGenerator +{ + public static List<Task.ParameterComponent> create(List<String> errorMessages) + { + return errorMessages.stream().map(ErrorMessageGenerator::create).collect(Collectors.toList()); + } + + public static Task.ParameterComponent create(String errorMessage) + { + Task.ParameterComponent param = new Task.ParameterComponent(); + param.setValue(new StringType(errorMessage)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + .setCode(ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE); + return param; + } +} diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 1b960ed3..eefbdfe1 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -79,7 +79,7 @@ <bpmn:outgoing>Flow_13u1nzy</bpmn:outgoing> <bpmn:outgoing>Flow_1yt9547</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="Activity_0h9o9u7" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.DownloadResourceAndMeasureSpeed"> + <bpmn:serviceTask id="Activity_0h9o9u7" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.DownloadResourceAndMeasureSpeedInSubProcess"> <bpmn:incoming>Flow_1yt9547</bpmn:incoming> <bpmn:outgoing>Flow_1v37fff</bpmn:outgoing> </bpmn:serviceTask> From 633cf83f131169dd5e3f79efab5bf4135fbda29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 12:37:55 +0100 Subject: [PATCH 116/382] Ran format-and-sort --- .../java/dev/dsf/bpe/message/SendPing.java | 23 +++++++++++-------- .../java/dev/dsf/bpe/message/SendPong.java | 3 ++- .../DownloadResourceAndMeasureSpeed.java | 11 ++++----- ...adResourceAndMeasureSpeedInSubProcess.java | 6 ++--- .../bpe/util/BinaryResourceDownloader.java | 12 ++++++---- .../dev/dsf/bpe/util/PingStatusGenerator.java | 16 ++++++------- 6 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index 484691fc..dae13835 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -29,12 +29,15 @@ public SendPing(ProcessPluginApi api) @Override protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - String downloadResourceReference = variables.getString( - ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); - int downloadResourceSizeBytes = variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + String downloadResourceReference = variables + .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); + int downloadResourceSizeBytes = variables + .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); - return Stream.of(api.getTaskHelper().createInput( - new Reference().setIdentifier(getLocalEndpointIdentifier()).setType(ResourceType.Endpoint.name()), + return Stream.of( + api.getTaskHelper().createInput( + new Reference().setIdentifier(getLocalEndpointIdentifier()) + .setType(ResourceType.Endpoint.name()), ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER), DownloadResourceSizeGenerator.create(downloadResourceSizeBytes), DownloadResourceReferenceGenerator.create(downloadResourceReference)); @@ -45,9 +48,9 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va Exception exception, String errorMessage) { String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null - && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() ? - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED : - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; + && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() + ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED + : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; execution.setVariableLocal("statusCode", statusCode); String specialErrorMessage = createErrorMessage(exception); @@ -62,8 +65,8 @@ protected void addErrorMessage(Task task, String errorMessage) private String createErrorMessage(Exception exception) { - if (exception instanceof WebApplicationException w && (exception.getMessage() == null || exception.getMessage() - .isBlank())) + if (exception instanceof WebApplicationException w + && (exception.getMessage() == null || exception.getMessage().isBlank())) { StatusType statusInfo = w.getResponse().getStatusInfo(); return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index d4b46b32..c92000ef 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -79,7 +79,8 @@ protected void handleEndEventError(DelegateExecution execution, Variables variab String specialErrorMessage = createErrorMessage(exception); - mainTask.addOutput(statusGenerator.createPongStatusOutput(target, statusCode, List.of(specialErrorMessage))); + mainTask.addOutput( + statusGenerator.createPongStatusOutput(target, statusCode, List.of(specialErrorMessage))); variables.updateTask(mainTask); if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode)) diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java index 797d0625..658ad651 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java @@ -40,8 +40,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { Task task = variables.getStartTask(); - int downloadResourceSizeBytes = variables.getInteger( - ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + int downloadResourceSizeBytes = variables + .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); Reference downloadResourceReference = api.getTaskHelper() .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, @@ -65,14 +65,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, downloadResult.getDownloadedBytes()); - variables.setLong( - ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS , + variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS, downloadResult.getDownloadedDurationMillis()); } else { - ErrorMessageListUtils.add(downloadResult.getErrorMessage(), - BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, delegateExecution); + ErrorMessageListUtils.add(downloadResult.getErrorMessage(), BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, + delegateExecution); } } else diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java index 06a9b4ae..66dbc218 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -14,8 +14,8 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.BinaryResourceDownloader; +import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -39,8 +39,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - int downloadResourceSizeBytes = variables.getInteger( - ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + int downloadResourceSizeBytes = variables + .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); Reference downloadResourceReference = api.getTaskHelper() .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 943b872d..cbdfbc44 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -10,7 +10,8 @@ public class BinaryResourceDownloader { private static final Logger logger = LoggerFactory.getLogger(BinaryResourceDownloader.class); - public DownloadResult download(InputStream inputStream, String reference, int downloadResourceSizeBytes, int maxDownloadSizeBytes) + public DownloadResult download(InputStream inputStream, String reference, int downloadResourceSizeBytes, + int maxDownloadSizeBytes) { DownloadResult downloadResult; try (inputStream) @@ -25,9 +26,11 @@ public DownloadResult download(InputStream inputStream, String reference, int do long downloadEndTime = System.currentTimeMillis(); long downloadedDurationMillis = downloadEndTime - downloadStartTime; downloadResult = new DownloadResult(bytesRead, downloadedDurationMillis); - logger.info("Finished downloading {} bytes. Took {}", bytesRead, toHoursMinutesSecondsMilliseconds(downloadedDurationMillis)); + logger.info("Finished downloading {} bytes. Took {}", bytesRead, + toHoursMinutesSecondsMilliseconds(downloadedDurationMillis)); - } catch (IOException e) + } + catch (IOException e) { downloadResult = new DownloadResult(e.getMessage()); } @@ -44,7 +47,8 @@ private String toHoursMinutesSecondsMilliseconds(long millis) return String.format("%02d:%02d:%02d:%02dms", hours, minutes, seconds, milliSeconds); } - public static class DownloadResult { + public static class DownloadResult + { private final int downloadedBytes; private final long downloadedDurationMillis; private final String errorMessage; diff --git a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java index 6185bd70..ef3c3d95 100644 --- a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java @@ -28,15 +28,15 @@ public TaskOutputComponent createPingStatusOutput(Target target, String statusCo public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, List<String> errorMessages) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessages, - -1, -1, null); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, + errorMessages, -1, -1, null); } public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessages, - downloadSpeed, uploadSpeed, unit); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, + errorMessages, downloadSpeed, uploadSpeed, unit); } public TaskOutputComponent createPongStatusOutput(Target target, String statusCode) @@ -52,15 +52,15 @@ public TaskOutputComponent createPongStatusOutput(Target target, String statusCo public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<String> errorMessages) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessages, - -1, -1, null); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, + errorMessages, -1, -1, null); } public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessages, - downloadSpeed, uploadSpeed, unit); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, + errorMessages, downloadSpeed, uploadSpeed, unit); } private TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, From e93fe35997ebde5d3d1447ed5e3be2593b18af6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 15:09:50 +0100 Subject: [PATCH 117/382] Now only cleans up if resource was generated --- src/main/java/dev/dsf/bpe/service/Cleanup.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 40aa15da..da8265d4 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -23,10 +23,17 @@ public Cleanup(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + logger.info("Cleaning up..."); String downloadResourceId = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID); - api.getFhirWebserviceClientProvider().getLocalWebserviceClient().delete(Binary.class, downloadResourceId); - api.getFhirWebserviceClientProvider().getLocalWebserviceClient().deletePermanently(Binary.class, - downloadResourceId); - logger.info("Cleanup completed. Deleted Binary resource with ID {}", downloadResourceId); + if (downloadResourceId != null) + { + api.getFhirWebserviceClientProvider().getLocalWebserviceClient().delete(Binary.class, downloadResourceId); + api.getFhirWebserviceClientProvider().getLocalWebserviceClient().deletePermanently(Binary.class, + downloadResourceId); + logger.info("Deleted Binary resource with ID {}", downloadResourceId); + } else { + logger.info("Nothing to do"); + } + logger.info("Cleanup complete."); } } From b1300222f3995f058e6c002cbefe5cc51d39f45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 15:20:12 +0100 Subject: [PATCH 118/382] Added implementation --- .../java/dev/dsf/bpe/service/LogAndSaveSendError.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java index cf95679d..6c97522e 100644 --- a/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java @@ -5,8 +5,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveSendError extends AbstractServiceDelegate @@ -21,6 +25,10 @@ public LogAndSaveSendError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - logger.info("Logging and saving error during sending"); + String statusCode = (String) delegateExecution.getVariableLocal("statusCode"); + Target target = variables.getTarget(); + String correlationKey = target.getCorrelationKey(); + variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_STATUS_CODE + "_" + correlationKey, statusCode); + logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); } } From 57ed9ea237512047a87dcdbd8072b9d1b8e5227d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 15:26:07 +0100 Subject: [PATCH 119/382] Ran format-and-sort --- src/main/java/dev/dsf/bpe/service/Cleanup.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index da8265d4..60d8a936 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -31,7 +31,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable api.getFhirWebserviceClientProvider().getLocalWebserviceClient().deletePermanently(Binary.class, downloadResourceId); logger.info("Deleted Binary resource with ID {}", downloadResourceId); - } else { + } + else + { logger.info("Nothing to do"); } logger.info("Cleanup complete."); From 634a5526433a91b1e6881ed5ee670ebf4dfb8384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 15:26:27 +0100 Subject: [PATCH 120/382] Fixed wrong reference being built --- src/main/java/dev/dsf/bpe/service/StoreResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/StoreResource.java b/src/main/java/dev/dsf/bpe/service/StoreResource.java index deb76fee..16b44ae8 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResource.java @@ -34,7 +34,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Binary downloadResource = storeBinary( variables.getByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE)); - String reference = localEndpointAddress + "/Binary/" + downloadResource.getId(); + String reference = localEndpointAddress + "/" + downloadResource.getId(); variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID, From 6ae44a37d6aa6b8c036105df5a87868078f2134a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 15:34:48 +0100 Subject: [PATCH 121/382] Removed unnecessary import --- .../dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java index db21ce48..216373eb 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java @@ -3,7 +3,6 @@ import java.util.List; import java.util.stream.Collectors; -import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; From ab6004747b4e0a33b7887a99e8e5b1ad044c99e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 15:50:49 +0100 Subject: [PATCH 122/382] Now accounts for downloadResourceReference not being present depending on configuration --- src/main/java/dev/dsf/bpe/message/SendPing.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index dae13835..e7e18d26 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -34,13 +34,16 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut int downloadResourceSizeBytes = variables .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); - return Stream.of( - api.getTaskHelper().createInput( - new Reference().setIdentifier(getLocalEndpointIdentifier()) - .setType(ResourceType.Endpoint.name()), - ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER), - DownloadResourceSizeGenerator.create(downloadResourceSizeBytes), - DownloadResourceReferenceGenerator.create(downloadResourceReference)); + Stream<ParameterComponent> downloadResourceReferenceStream = downloadResourceReference == null ? Stream.empty() + : Stream.of(DownloadResourceReferenceGenerator.create(downloadResourceReference)); + Stream<ParameterComponent> downloadResourceSizeBytesStream = Stream + .of(DownloadResourceSizeGenerator.create(downloadResourceSizeBytes)); + Stream<ParameterComponent> endpointIdentifierStream = Stream.of(api.getTaskHelper().createInput( + new Reference().setIdentifier(getLocalEndpointIdentifier()).setType(ResourceType.Endpoint.name()), + ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER)); + + return Stream.concat(endpointIdentifierStream, + Stream.concat(downloadResourceReferenceStream, downloadResourceSizeBytesStream)); } @Override From 98d4bab5f64620d02aa9c92bd5cf3a662e3fff57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 16:21:13 +0100 Subject: [PATCH 123/382] Moved more common functionality in BinaryResourceDownloader --- .../DownloadResourceAndMeasureSpeed.java | 58 ++++--------------- ...adResourceAndMeasureSpeedInSubProcess.java | 53 +++-------------- .../bpe/util/BinaryResourceDownloader.java | 33 +++++++++-- 3 files changed, 50 insertions(+), 94 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java index 658ad651..eb68f1d0 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java @@ -1,16 +1,10 @@ package dev.dsf.bpe.service; import static dev.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST; -import static dev.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_STATUS_CODE; -import static dev.dsf.bpe.ConstantsPing.WEBSERVICE_URL_PATTERN; - -import java.io.IOException; -import java.io.InputStream; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; @@ -21,7 +15,6 @@ import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate @@ -39,51 +32,24 @@ public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, int maxDownloadSize protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { Task task = variables.getStartTask(); + String endpointIdentifier = variables + .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER); + String webserviceUrl = api.getEndpointProvider().getEndpointAddress(endpointIdentifier).orElseThrow(); - int downloadResourceSizeBytes = variables - .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); - - Reference downloadResourceReference = api.getTaskHelper() - .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, Reference.class) - .orElseThrow(); + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download(webserviceUrl, + variables, api, task, maxDownloadSizeBytes); - Matcher matcher = WEBSERVICE_URL_PATTERN.matcher(downloadResourceReference.getReference()); - boolean matched = matcher.find(); - if (matched) + if (downloadResult.getErrorMessage() != null) { - String webserviceUrl = matcher.group(1); - InputStream binaryResourceInputStream = api.getFhirWebserviceClientProvider() - .getWebserviceClient(webserviceUrl).readBinary(getDownloadResourceId(downloadResourceReference), - ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE); - - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download( - binaryResourceInputStream, downloadResourceReference.getReference(), downloadResourceSizeBytes, - maxDownloadSizeBytes); - - if (downloadResult.getErrorMessage() != null) - { - variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, - downloadResult.getDownloadedBytes()); - variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS, - downloadResult.getDownloadedDurationMillis()); - } - else - { - ErrorMessageListUtils.add(downloadResult.getErrorMessage(), BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, - delegateExecution); - } + variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, + downloadResult.getDownloadedBytes()); + variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS, + downloadResult.getDownloadedDurationMillis()); } else { - ErrorMessageListUtils.add("Invalid download resource url:" + downloadResourceReference.getReference(), + ErrorMessageListUtils.add(downloadResult.getErrorMessage(), BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, delegateExecution); } } - - private String getDownloadResourceId(Reference downloadResourceReference) - { - String[] split = downloadResourceReference.getReference().split("/"); - return split[split.length - 1]; - } } diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java index 66dbc218..da6d02ea 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -1,14 +1,9 @@ package dev.dsf.bpe.service; import static dev.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST; -import static dev.dsf.bpe.ConstantsPing.WEBSERVICE_URL_PATTERN; - -import java.io.InputStream; -import java.util.regex.Matcher; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,52 +34,22 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - int downloadResourceSizeBytes = variables - .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + String webserviceUrl = target.getEndpointUrl(); - Reference downloadResourceReference = api.getTaskHelper() - .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, Reference.class) - .orElseThrow(); + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download(webserviceUrl, + variables, api, task, maxDownloadSizeBytes); - Matcher matcher = WEBSERVICE_URL_PATTERN.matcher(downloadResourceReference.getReference()); - boolean matched = matcher.find(); - if (matched) + if (downloadResult.getErrorMessage() != null) { - String webserviceUrl = matcher.group(1); - - InputStream binaryResourceInputStream = api.getFhirWebserviceClientProvider() - .getWebserviceClient(webserviceUrl).readBinary(getDownloadResourceId(downloadResourceReference), - ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE); - - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download( - binaryResourceInputStream, downloadResourceReference.getReference(), downloadResourceSizeBytes, - maxDownloadSizeBytes); - - if (downloadResult.getErrorMessage() != null) - { - variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, - downloadResult.getDownloadedBytes()); - variables.setLong( - ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS + "_" + correlationKey, - downloadResult.getDownloadedDurationMillis()); - } - else - { - ErrorMessageListUtils.add(downloadResult.getErrorMessage(), - BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST + "_" + correlationKey, delegateExecution); - } + variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, + downloadResult.getDownloadedBytes()); + variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS + "_" + correlationKey, + downloadResult.getDownloadedDurationMillis()); } else { - ErrorMessageListUtils.add("Invalid download resource url:" + downloadResourceReference.getReference(), + ErrorMessageListUtils.add(downloadResult.getErrorMessage(), BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST + "_" + correlationKey, delegateExecution); } } - - private String getDownloadResourceId(Reference downloadResourceReference) - { - String[] split = downloadResourceReference.getReference().split("/"); - return split[split.length - 1]; - } } diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index cbdfbc44..ebc3eb61 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -3,26 +3,46 @@ import java.io.IOException; import java.io.InputStream; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.variables.Variables; + public class BinaryResourceDownloader { private static final Logger logger = LoggerFactory.getLogger(BinaryResourceDownloader.class); - public DownloadResult download(InputStream inputStream, String reference, int downloadResourceSizeBytes, + public DownloadResult download(String webserviceUrl, Variables variables, ProcessPluginApi api, Task task, int maxDownloadSizeBytes) { DownloadResult downloadResult; - try (inputStream) + + int downloadResourceSizeBytes = variables + .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + + Reference downloadResourceReference = api.getTaskHelper() + .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, Reference.class) + .orElseThrow(); + + InputStream binaryResourceInputStream = api.getFhirWebserviceClientProvider().getWebserviceClient(webserviceUrl) + .readBinary(getDownloadResourceId(downloadResourceReference), + ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE); + + try (binaryResourceInputStream) { logger.info( "Starting resource download for: '{}'. Requested resource size is {} bytes, maximum downloadable size is {} bytes", - reference, downloadResourceSizeBytes, maxDownloadSizeBytes); + webserviceUrl + "/" + getDownloadResourceId(downloadResourceReference), downloadResourceSizeBytes, + maxDownloadSizeBytes); long downloadStartTime = System.currentTimeMillis(); int bufferSize = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); byte[] buffer = new byte[bufferSize]; - int bytesRead = inputStream.read(buffer); + int bytesRead = binaryResourceInputStream.read(buffer); long downloadEndTime = System.currentTimeMillis(); long downloadedDurationMillis = downloadEndTime - downloadStartTime; downloadResult = new DownloadResult(bytesRead, downloadedDurationMillis); @@ -37,6 +57,11 @@ public DownloadResult download(InputStream inputStream, String reference, int do return downloadResult; } + private String getDownloadResourceId(Reference downloadResourceReference) + { + String[] split = downloadResourceReference.getReference().split("/"); + return split[1]; + } private String toHoursMinutesSecondsMilliseconds(long millis) { From f5864495e74c06ffa6f219b5adcdb74da46c0b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 16:23:24 +0100 Subject: [PATCH 124/382] Added SetEndpointIdentifier task because changes from last commit moved endpoint identifier to execution variable in DownloadResourceAndMeasureSpeed and the process required a way to get the endpoint identifier when doing slim ping --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 3 +- .../dev/dsf/bpe/service/SelectPongTarget.java | 11 +- .../bpe/service/SetEndpointIdentifier.java | 37 +++ .../dev/dsf/bpe/spring/config/PingConfig.java | 8 + src/main/resources/bpe/pong.bpmn | 246 +++++++++--------- 5 files changed, 177 insertions(+), 128 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/service/SetEndpointIdentifier.java diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index a7c0dd37..ae399761 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -89,10 +89,9 @@ public interface ConstantsPing String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; + String BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER = "targetEndpointIdentifier"; MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; - - Pattern WEBSERVICE_URL_PATTERN = Pattern.compile("http(s?)://(\\w+)(\\.\\w+)*/fhir"); } diff --git a/src/main/java/dev/dsf/bpe/service/SelectPongTarget.java b/src/main/java/dev/dsf/bpe/service/SelectPongTarget.java index 7e3f0d3d..b893bc81 100644 --- a/src/main/java/dev/dsf/bpe/service/SelectPongTarget.java +++ b/src/main/java/dev/dsf/bpe/service/SelectPongTarget.java @@ -32,7 +32,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw String correlationKey = api.getTaskHelper() .getFirstInputParameterStringValue(task, BpmnMessage.URL, BpmnMessage.Codes.CORRELATION_KEY).get(); String targetOrganizationIdentifierValue = task.getRequester().getIdentifier().getValue(); - String targetEndpointIdentifierValue = getEndpointIdentifierValue(task); + String targetEndpointIdentifierValue = variables + .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER); String targetEndpointAddress = api.getEndpointProvider().getEndpointAddress(targetEndpointIdentifierValue) .orElseThrow(() -> @@ -46,12 +47,4 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw variables.setTarget(variables.createTarget(targetOrganizationIdentifierValue, targetEndpointIdentifierValue, targetEndpointAddress, correlationKey)); } - - private String getEndpointIdentifierValue(Task task) - { - return api.getTaskHelper() - .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER, Reference.class) - .map(Reference::getIdentifier).map(Identifier::getValue).get(); - } } diff --git a/src/main/java/dev/dsf/bpe/service/SetEndpointIdentifier.java b/src/main/java/dev/dsf/bpe/service/SetEndpointIdentifier.java new file mode 100644 index 00000000..52c30cd9 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/SetEndpointIdentifier.java @@ -0,0 +1,37 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class SetEndpointIdentifier extends AbstractServiceDelegate +{ + public SetEndpointIdentifier(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + { + Task task = variables.getStartTask(); + String endpointIdentifierValue = getEndpointIdentifierValue(task); + variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER, + endpointIdentifierValue); + } + + private String getEndpointIdentifierValue(Task task) + { + return api.getTaskHelper() + .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER, Reference.class) + .map(Reference::getIdentifier).map(Identifier::getValue).get(); + } +} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 026a21ee..50420b58 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -32,6 +32,7 @@ import dev.dsf.bpe.service.SelectPingTargets; import dev.dsf.bpe.service.SelectPongTarget; import dev.dsf.bpe.service.SetDownloadResourceSize; +import dev.dsf.bpe.service.SetEndpointIdentifier; import dev.dsf.bpe.service.SetTargetAndConfigureTimer; import dev.dsf.bpe.service.StoreDownloadSpeeds; import dev.dsf.bpe.service.StoreResource; @@ -271,4 +272,11 @@ public RemoveCorrelationKeyListener removeCorrelationKeyListener() { return new RemoveCorrelationKeyListener(api); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public SetEndpointIdentifier setEndpointIdentifier() + { + return new SetEndpointIdentifier(api); + } } diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index dee2fb3b..04d7095b 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -6,7 +6,7 @@ <bpmn:messageEventDefinition id="MessageEventDefinition_128t2ek" messageRef="Message_0u91abp" /> </bpmn:startEvent> <bpmn:exclusiveGateway id="Gateway_1jwjxzn" default="Flow_10z0d4x"> - <bpmn:incoming>Flow_05347ru</bpmn:incoming> + <bpmn:incoming>Flow_0i7mizy</bpmn:incoming> <bpmn:outgoing>Flow_10z0d4x</bpmn:outgoing> <bpmn:outgoing>Flow_08gidyv</bpmn:outgoing> </bpmn:exclusiveGateway> @@ -152,10 +152,15 @@ <bpmn:sequenceFlow id="Flow_03hviat" sourceRef="Activity_04mv5cn" targetRef="Activity_0xcqxjs" /> <bpmn:serviceTask id="Activity_1wdftvk" name="Set Download Resource Size" camunda:class="dev.dsf.bpe.service.SetDownloadResourceSize"> <bpmn:incoming>Flow_19b3cp4</bpmn:incoming> - <bpmn:outgoing>Flow_05347ru</bpmn:outgoing> + <bpmn:outgoing>Flow_1oo1n55</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_19b3cp4" sourceRef="PingMessageStartEvent" targetRef="Activity_1wdftvk" /> - <bpmn:sequenceFlow id="Flow_05347ru" sourceRef="Activity_1wdftvk" targetRef="Gateway_1jwjxzn" /> + <bpmn:serviceTask id="Activity_13ypt7i" name="Set Endpoint Identifier" camunda:class="dev.dsf.bpe.service.SetEndpointIdentifier"> + <bpmn:incoming>Flow_1oo1n55</bpmn:incoming> + <bpmn:outgoing>Flow_0i7mizy</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1oo1n55" sourceRef="Activity_1wdftvk" targetRef="Activity_13ypt7i" /> + <bpmn:sequenceFlow id="Flow_0i7mizy" sourceRef="Activity_13ypt7i" targetRef="Gateway_1jwjxzn" /> <bpmn:textAnnotation id="TextAnnotation_02e4h2c"> <bpmn:text>Log = logger Save = save as execution variable @@ -199,266 +204,273 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> - <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> - <dc:Bounds x="172" y="292" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="180" y="335" width="21" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1jwjxzn_di" bpmnElement="Gateway_1jwjxzn" isMarkerVisible="true"> - <dc:Bounds x="455" y="285" width="50" height="50" /> + <dc:Bounds x="575" y="285" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_095j2gg_di" bpmnElement="Activity_095j2gg"> - <dc:Bounds x="530" y="420" width="100" height="80" /> + <dc:Bounds x="650" y="420" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0ko681m_di" bpmnElement="SelectPongTarget"> - <dc:Bounds x="1660" y="270" width="100" height="80" /> + <dc:Bounds x="1780" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1r1hob1" bpmnElement="Gateway_1ggdr8l" isMarkerVisible="true"> - <dc:Bounds x="1445" y="285" width="50" height="50" /> + <dc:Bounds x="1565" y="285" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1lhkmjw" bpmnElement="LogPing"> - <dc:Bounds x="1540" y="270" width="100" height="80" /> + <dc:Bounds x="1660" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1h1lrei_di" bpmnElement="Activity_005ywv2"> - <dc:Bounds x="1840" y="270" width="100" height="80" /> + <dc:Bounds x="1960" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0eiy9fm_di" bpmnElement="Gateway_0eiy9fm" isMarkerVisible="true"> - <dc:Bounds x="2025" y="285" width="50" height="50" /> + <dc:Bounds x="2145" y="285" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_02b3m47_di" bpmnElement="Activity_0t0ex36"> - <dc:Bounds x="2140" y="270" width="100" height="80" /> + <dc:Bounds x="2260" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_12p2jrx_di" bpmnElement="Gateway_1l5dkpz"> - <dc:Bounds x="2025" y="385" width="50" height="50" /> + <dc:Bounds x="2145" y="385" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1xvd4tr_di" bpmnElement="Event_1xvd4tr"> - <dc:Bounds x="2272" y="392" width="36" height="36" /> + <dc:Bounds x="2392" y="392" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2271" y="438" width="42" height="14" /> + <dc:Bounds x="2391" y="438" width="42" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0o4l2t4_di" bpmnElement="Event_0o4l2t4"> - <dc:Bounds x="2272" y="482" width="36" height="36" /> + <dc:Bounds x="2392" y="482" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1uvkqh3_di" bpmnElement="Gateway_1uvkqh3" isMarkerVisible="true"> - <dc:Bounds x="2335" y="285" width="50" height="50" /> + <dc:Bounds x="2455" y="285" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> - <dc:Bounds x="2632" y="292" width="36" height="36" /> + <dc:Bounds x="2752" y="292" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> - <dc:Bounds x="835" y="435" width="50" height="50" /> + <dc:Bounds x="955" y="435" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1imd3tw_di" bpmnElement="Activity_1umihbr"> - <dc:Bounds x="720" y="540" width="100" height="80" /> + <dc:Bounds x="840" y="540" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_05zzvx3_di" bpmnElement="Event_1qh25on"> - <dc:Bounds x="1742" y="595" width="36" height="36" /> + <dc:Bounds x="1862" y="595" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> - <dc:Bounds x="2520" y="370" width="100" height="80" /> + <dc:Bounds x="2640" y="370" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1xbj20p_di" bpmnElement="Activity_0mwyelp"> - <dc:Bounds x="2360" y="370" width="100" height="80" /> + <dc:Bounds x="2480" y="370" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1ouj7x3_di" bpmnElement="Activity_04mv5cn"> - <dc:Bounds x="1130" y="420" width="100" height="80" /> + <dc:Bounds x="1250" y="420" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1m4wavi_di" bpmnElement="Activity_1m4wavi"> - <dc:Bounds x="970" y="420" width="100" height="80" /> + <dc:Bounds x="1090" y="420" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_06klx97_di" bpmnElement="Activity_0xcqxjs"> - <dc:Bounds x="1290" y="420" width="100" height="80" /> + <dc:Bounds x="1410" y="420" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> - <dc:Bounds x="160" y="80" width="420" height="70" /> + <dc:Bounds x="280" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1cled7l_di" bpmnElement="TextAnnotation_1cled7l"> - <dc:Bounds x="580" y="353" width="170" height="37" /> + <dc:Bounds x="700" y="353" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> - <dc:Bounds x="1790" y="439" width="250" height="84" /> + <dc:Bounds x="1910" y="439" width="250" height="84" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> - <dc:Bounds x="2560" y="533" width="200" height="41" /> + <dc:Bounds x="2680" y="533" width="200" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> - <dc:Bounds x="1300" y="543" width="275" height="41" /> + <dc:Bounds x="1420" y="543" width="275" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> - <dc:Bounds x="920" y="544" width="170" height="40" /> + <dc:Bounds x="1040" y="544" width="170" height="40" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1bdbmbf" bpmnElement="TextAnnotation_14ea4yc"> - <dc:Bounds x="280" y="183" width="585" height="70" /> + <dc:Bounds x="400" y="183" width="585" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> + <dc:Bounds x="152" y="292" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="335" width="21" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> - <dc:Bounds x="290" y="270" width="100" height="80" /> + <dc:Bounds x="270" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> + <dc:Bounds x="430" y="270" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> - <dc:Bounds x="1742" y="332" width="36" height="36" /> + <dc:Bounds x="1862" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1780" y="363" width="86" height="14" /> + <dc:Bounds x="1900" y="363" width="86" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_14ee8kb" bpmnElement="Event_0olr5yw"> - <dc:Bounds x="612" y="482" width="36" height="36" /> + <dc:Bounds x="732" y="482" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="649" y="516" width="83" height="27" /> + <dc:Bounds x="770" y="516" width="82" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> - <di:waypoint x="480" y="335" /> - <di:waypoint x="480" y="460" /> - <di:waypoint x="530" y="460" /> + <di:waypoint x="600" y="335" /> + <di:waypoint x="600" y="460" /> + <di:waypoint x="650" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_08gidyv_di" bpmnElement="Flow_08gidyv"> - <di:waypoint x="505" y="310" /> - <di:waypoint x="1445" y="310" /> + <di:waypoint x="625" y="310" /> + <di:waypoint x="1565" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0zphif7_di" bpmnElement="Flow_0zphif7"> - <di:waypoint x="630" y="460" /> - <di:waypoint x="835" y="460" /> + <di:waypoint x="750" y="460" /> + <di:waypoint x="955" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_061qpt4_di" bpmnElement="Flow_061qpt4"> - <di:waypoint x="1640" y="310" /> - <di:waypoint x="1660" y="310" /> + <di:waypoint x="1760" y="310" /> + <di:waypoint x="1780" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1eass2g_di" bpmnElement="Flow_1eass2g"> - <di:waypoint x="1760" y="310" /> - <di:waypoint x="1840" y="310" /> + <di:waypoint x="1880" y="310" /> + <di:waypoint x="1960" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0gvrnxd_di" bpmnElement="Flow_0gvrnxd"> - <di:waypoint x="1390" y="460" /> - <di:waypoint x="1470" y="460" /> - <di:waypoint x="1470" y="335" /> + <di:waypoint x="1510" y="460" /> + <di:waypoint x="1590" y="460" /> + <di:waypoint x="1590" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1o3n9u6_di" bpmnElement="Flow_1o3n9u6"> - <di:waypoint x="1495" y="310" /> - <di:waypoint x="1540" y="310" /> + <di:waypoint x="1615" y="310" /> + <di:waypoint x="1660" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fzmjzb_di" bpmnElement="Flow_0fzmjzb"> - <di:waypoint x="1940" y="310" /> - <di:waypoint x="2025" y="310" /> + <di:waypoint x="2060" y="310" /> + <di:waypoint x="2145" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0h8flp6_di" bpmnElement="Flow_0h8flp6"> - <di:waypoint x="2075" y="310" /> - <di:waypoint x="2140" y="310" /> + <di:waypoint x="2195" y="310" /> + <di:waypoint x="2260" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1bzjspe_di" bpmnElement="Flow_1bzjspe"> - <di:waypoint x="2050" y="335" /> - <di:waypoint x="2050" y="385" /> + <di:waypoint x="2170" y="335" /> + <di:waypoint x="2170" y="385" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_00t1ck1_di" bpmnElement="Flow_00t1ck1"> - <di:waypoint x="2050" y="285" /> - <di:waypoint x="2050" y="250" /> - <di:waypoint x="2360" y="250" /> - <di:waypoint x="2360" y="285" /> + <di:waypoint x="2170" y="285" /> + <di:waypoint x="2170" y="250" /> + <di:waypoint x="2480" y="250" /> + <di:waypoint x="2480" y="285" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_05ucfds_di" bpmnElement="Flow_05ucfds"> - <di:waypoint x="2240" y="310" /> - <di:waypoint x="2335" y="310" /> + <di:waypoint x="2360" y="310" /> + <di:waypoint x="2455" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0rj915n_di" bpmnElement="Flow_0rj915n"> - <di:waypoint x="2075" y="410" /> - <di:waypoint x="2272" y="410" /> + <di:waypoint x="2195" y="410" /> + <di:waypoint x="2392" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_17x98wg_di" bpmnElement="Flow_17x98wg"> - <di:waypoint x="2050" y="435" /> - <di:waypoint x="2050" y="500" /> - <di:waypoint x="2272" y="500" /> + <di:waypoint x="2170" y="435" /> + <di:waypoint x="2170" y="500" /> + <di:waypoint x="2392" y="500" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0cl2bet_di" bpmnElement="Flow_0cl2bet"> - <di:waypoint x="2308" y="410" /> - <di:waypoint x="2360" y="410" /> + <di:waypoint x="2428" y="410" /> + <di:waypoint x="2480" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0wy02qe_di" bpmnElement="Flow_0wy02qe"> - <di:waypoint x="2308" y="500" /> - <di:waypoint x="2570" y="500" /> - <di:waypoint x="2570" y="450" /> + <di:waypoint x="2428" y="500" /> + <di:waypoint x="2690" y="500" /> + <di:waypoint x="2690" y="450" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1qzb40k_di" bpmnElement="Flow_1qzb40k"> - <di:waypoint x="2385" y="310" /> - <di:waypoint x="2632" y="310" /> + <di:waypoint x="2505" y="310" /> + <di:waypoint x="2752" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1qg0rto_di" bpmnElement="Flow_1qg0rto"> - <di:waypoint x="2620" y="410" /> - <di:waypoint x="2650" y="410" /> - <di:waypoint x="2650" y="328" /> + <di:waypoint x="2740" y="410" /> + <di:waypoint x="2770" y="410" /> + <di:waypoint x="2770" y="328" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> - <di:waypoint x="820" y="580" /> - <di:waypoint x="860" y="580" /> - <di:waypoint x="860" y="485" /> + <di:waypoint x="940" y="580" /> + <di:waypoint x="980" y="580" /> + <di:waypoint x="980" y="485" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0x7t1ii_di" bpmnElement="Flow_0x7t1ii"> - <di:waypoint x="885" y="460" /> - <di:waypoint x="970" y="460" /> + <di:waypoint x="1005" y="460" /> + <di:waypoint x="1090" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0uj7rm3_di" bpmnElement="Flow_0uj7rm3"> - <di:waypoint x="630" y="518" /> - <di:waypoint x="630" y="580" /> - <di:waypoint x="720" y="580" /> + <di:waypoint x="750" y="518" /> + <di:waypoint x="750" y="580" /> + <di:waypoint x="840" y="580" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0yr2pmf_di" bpmnElement="Flow_0yr2pmf"> - <di:waypoint x="1760" y="368" /> - <di:waypoint x="1760" y="595" /> + <di:waypoint x="1880" y="368" /> + <di:waypoint x="1880" y="595" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_165e73u_di" bpmnElement="Flow_165e73u"> - <di:waypoint x="2460" y="410" /> - <di:waypoint x="2520" y="410" /> + <di:waypoint x="2580" y="410" /> + <di:waypoint x="2640" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> - <di:waypoint x="1070" y="460" /> - <di:waypoint x="1130" y="460" /> + <di:waypoint x="1190" y="460" /> + <di:waypoint x="1250" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_03hviat_di" bpmnElement="Flow_03hviat"> - <di:waypoint x="1230" y="460" /> - <di:waypoint x="1290" y="460" /> + <di:waypoint x="1350" y="460" /> + <di:waypoint x="1410" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> - <di:waypoint x="602" y="420" /> - <di:waypoint x="618" y="390" /> + <di:waypoint x="722" y="420" /> + <di:waypoint x="738" y="390" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> - <di:waypoint x="1876" y="350" /> - <di:waypoint x="1845" y="439" /> + <di:waypoint x="1996" y="350" /> + <di:waypoint x="1965" y="439" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2582" y="450" /> - <di:waypoint x="2606" y="533" /> + <di:waypoint x="2702" y="450" /> + <di:waypoint x="2726" y="533" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> - <di:waypoint x="1008" y="544" /> - <di:waypoint x="1014" y="500" /> + <di:waypoint x="1128" y="544" /> + <di:waypoint x="1134" y="500" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> - <di:waypoint x="1344" y="500" /> - <di:waypoint x="1349" y="543" /> + <di:waypoint x="1464" y="500" /> + <di:waypoint x="1469" y="543" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> - <di:waypoint x="208" y="310" /> - <di:waypoint x="290" y="310" /> + <di:waypoint x="188" y="310" /> + <di:waypoint x="270" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> + <di:waypoint x="370" y="310" /> + <di:waypoint x="430" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_05347ru_di" bpmnElement="Flow_05347ru"> - <di:waypoint x="390" y="310" /> - <di:waypoint x="455" y="310" /> + <bpmndi:BPMNEdge id="Flow_0i7mizy_di" bpmnElement="Flow_0i7mizy"> + <di:waypoint x="530" y="310" /> + <di:waypoint x="575" y="310" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> From 1d1c1c68482159bcc4fe1b68031330301c98993c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 16:30:19 +0100 Subject: [PATCH 125/382] reference string creation streamlined --- src/main/java/dev/dsf/bpe/service/StoreResource.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/StoreResource.java b/src/main/java/dev/dsf/bpe/service/StoreResource.java index 16b44ae8..aaf9a9e9 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResource.java @@ -29,12 +29,10 @@ public StoreResource(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - String localEndpointAddress = api.getEndpointProvider().getLocalEndpoint().orElseThrow().getAddress(); - Binary downloadResource = storeBinary( variables.getByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE)); - String reference = localEndpointAddress + "/" + downloadResource.getId(); + String reference = downloadResource.getIdElement().toString(); variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID, From a81c1ec5ff6c044307336ff18a7fea851f9b9127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 17:00:33 +0100 Subject: [PATCH 126/382] Deleted BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID because it was redundant because reference can provide this information --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 - src/main/java/dev/dsf/bpe/service/Cleanup.java | 3 ++- .../java/dev/dsf/bpe/service/StoreResource.java | 15 ++++++--------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index ae399761..63da8e37 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -84,7 +84,6 @@ public interface ConstantsPing String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES = "downloadResourceSizeBytes"; String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE = "downloadResource"; String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; - String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID = "downloadResourceId"; String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 60d8a936..b518f4ac 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -24,7 +24,8 @@ public Cleanup(ProcessPluginApi api) protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { logger.info("Cleaning up..."); - String downloadResourceId = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID); + String downloadResourceId = variables + .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); if (downloadResourceId != null) { api.getFhirWebserviceClientProvider().getLocalWebserviceClient().delete(Binary.class, downloadResourceId); diff --git a/src/main/java/dev/dsf/bpe/service/StoreResource.java b/src/main/java/dev/dsf/bpe/service/StoreResource.java index aaf9a9e9..3a5bc152 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResource.java @@ -1,13 +1,11 @@ package dev.dsf.bpe.service; -import java.io.ByteArrayInputStream; import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Binary; -import org.hl7.fhir.r4.model.DocumentReference; -import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.IdType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,19 +27,17 @@ public StoreResource(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - Binary downloadResource = storeBinary( + IdType downloadResource = storeBinary( variables.getByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE)); - String reference = downloadResource.getIdElement().toString(); + String reference = downloadResource.getValueAsString(); variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); - variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_ID, - downloadResource.getIdElement().getIdPart()); logger.info("Stored binary resource for PING targets to download"); } - private Binary storeBinary(byte[] downloadResourceContent) + private IdType storeBinary(byte[] downloadResourceContent) { Binary downloadResource = new Binary(); downloadResource.setContent(downloadResourceContent); @@ -50,6 +46,7 @@ private Binary storeBinary(byte[] downloadResourceContent) downloadResource.getMeta() .addTag(ReadAccessTagGenerator.create(ConstantsPing.CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL)); - return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().create(downloadResource); + return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn() + .create(downloadResource); } } From 5a9633745ebe3368e1ff98eb388bf36cd9e39928 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 17:00:44 +0100 Subject: [PATCH 127/382] Now uses actual values --- src/main/java/dev/dsf/bpe/message/SendPong.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index c92000ef..068b5dc9 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -5,12 +5,15 @@ import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; import dev.dsf.bpe.util.PingStatusGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -47,8 +50,15 @@ public void afterPropertiesSet() throws Exception protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - return Stream.of(DownloadedBytesGenerator.create(0), DownloadedDurationMillisGenerator.create(0), - DownloadResourceReferenceGenerator.create("http://example.org/fhir/Binary/bar")); + int downloadedBytes = variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES); + long downloadedDurationMillis = variables + .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); + String downloadResourceReference = variables + .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); + + return Stream.of(DownloadedBytesGenerator.create(downloadedBytes), + DownloadedDurationMillisGenerator.create(downloadedDurationMillis), + DownloadResourceReferenceGenerator.create(downloadResourceReference)); } @Override From ccd4781e3e17b52800fa44f9d9d623b46fc85e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 17:01:13 +0100 Subject: [PATCH 128/382] Now gets webserviceUrl and resource id from IdType --- .../bpe/util/BinaryResourceDownloader.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index ebc3eb61..2c9497b9 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -3,6 +3,7 @@ import java.io.IOException; import java.io.InputStream; +import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; @@ -16,8 +17,7 @@ public class BinaryResourceDownloader { private static final Logger logger = LoggerFactory.getLogger(BinaryResourceDownloader.class); - public DownloadResult download(String webserviceUrl, Variables variables, ProcessPluginApi api, Task task, - int maxDownloadSizeBytes) + public DownloadResult download(Variables variables, ProcessPluginApi api, Task task, int maxDownloadSizeBytes) { DownloadResult downloadResult; @@ -29,16 +29,18 @@ public DownloadResult download(String webserviceUrl, Variables variables, Proces ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, Reference.class) .orElseThrow(); + IdType downloadResourceReferenceIdType = new IdType(downloadResourceReference.getReference()); + String downloadResourceReferenceId = downloadResourceReferenceIdType.getIdPart(); + String webserviceUrl = downloadResourceReferenceIdType.getBaseUrl(); + InputStream binaryResourceInputStream = api.getFhirWebserviceClientProvider().getWebserviceClient(webserviceUrl) - .readBinary(getDownloadResourceId(downloadResourceReference), - ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE); + .readBinary(downloadResourceReferenceId, ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE); try (binaryResourceInputStream) { logger.info( "Starting resource download for: '{}'. Requested resource size is {} bytes, maximum downloadable size is {} bytes", - webserviceUrl + "/" + getDownloadResourceId(downloadResourceReference), downloadResourceSizeBytes, - maxDownloadSizeBytes); + downloadResourceReference.getReference(), downloadResourceSizeBytes, maxDownloadSizeBytes); long downloadStartTime = System.currentTimeMillis(); int bufferSize = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); byte[] buffer = new byte[bufferSize]; @@ -57,12 +59,6 @@ public DownloadResult download(String webserviceUrl, Variables variables, Proces return downloadResult; } - private String getDownloadResourceId(Reference downloadResourceReference) - { - String[] split = downloadResourceReference.getReference().split("/"); - return split[1]; - } - private String toHoursMinutesSecondsMilliseconds(long millis) { long hours = (millis / 1000) / 60 / 60 % 24; From 4683fab59f9efa6ec2ba5a25cb60986af2f1ce91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 17:01:49 +0100 Subject: [PATCH 129/382] Adopted changes made to BinaryResourceDownloader API --- .../dsf/bpe/service/DownloadResourceAndMeasureSpeed.java | 7 ++----- .../DownloadResourceAndMeasureSpeedInSubProcess.java | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java index eb68f1d0..98544371 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java @@ -32,12 +32,9 @@ public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, int maxDownloadSize protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { Task task = variables.getStartTask(); - String endpointIdentifier = variables - .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER); - String webserviceUrl = api.getEndpointProvider().getEndpointAddress(endpointIdentifier).orElseThrow(); - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download(webserviceUrl, - variables, api, task, maxDownloadSizeBytes); + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download(variables, api, + task, maxDownloadSizeBytes); if (downloadResult.getErrorMessage() != null) { diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java index da6d02ea..48dfcabc 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -34,10 +34,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - String webserviceUrl = target.getEndpointUrl(); - - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download(webserviceUrl, - variables, api, task, maxDownloadSizeBytes); + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download(variables, api, + task, maxDownloadSizeBytes); if (downloadResult.getErrorMessage() != null) { From e6baaf4c7e227ae4ee3b87a96572f73d6099d7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 17:23:59 +0100 Subject: [PATCH 130/382] Fixed logic error --- .../dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java | 2 +- .../service/DownloadResourceAndMeasureSpeedInSubProcess.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java index 98544371..30a6dad5 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java @@ -36,7 +36,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download(variables, api, task, maxDownloadSizeBytes); - if (downloadResult.getErrorMessage() != null) + if (downloadResult.getErrorMessage() == null) { variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, downloadResult.getDownloadedBytes()); diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java index 48dfcabc..6826d960 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -37,7 +37,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download(variables, api, task, maxDownloadSizeBytes); - if (downloadResult.getErrorMessage() != null) + if (downloadResult.getErrorMessage() == null) { variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, downloadResult.getDownloadedBytes()); From 49cd176f2266985f2546b0d7f3de8f6964547ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 17:24:07 +0100 Subject: [PATCH 131/382] Added logging --- src/main/java/dev/dsf/bpe/service/SavePong.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/service/SavePong.java b/src/main/java/dev/dsf/bpe/service/SavePong.java index 7628cb06..c0159c6a 100644 --- a/src/main/java/dev/dsf/bpe/service/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/SavePong.java @@ -2,6 +2,8 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -11,6 +13,8 @@ public class SavePong extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(SavePong.class); + public SavePong(ProcessPluginApi api) { super(api); @@ -24,6 +28,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable delegateExecution.removeVariable("statusCode"); variables.setString("statusCode_" + correlationKey, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED); + logger.info("Pong received from {}, saving pong information", target.getEndpointUrl()); // TODO: add other information: downloaded-bytes, downloaded-duration-millis, error-message } From 54c229895d6a4227561a1ab25ef488669f20de9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 17:25:38 +0100 Subject: [PATCH 132/382] Target was null after super.doExecute. Moved target acquisition to before super.doExecute --- src/main/java/dev/dsf/bpe/message/SendPong.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 068b5dc9..56b1bb7c 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -64,9 +64,9 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE @Override protected void doExecute(DelegateExecution execution, Variables variables) throws Exception { + Target target = variables.getTarget(); super.doExecute(execution, variables); - Target target = variables.getTarget(); Task mainTask = variables.getStartTask(); mainTask.addOutput(statusGenerator.createPongStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); From 5df6f3e95cf1b6b0ad7bc85d3ba7c3b943f6b678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 17:40:33 +0100 Subject: [PATCH 133/382] Fixed wording because it is used by both ping and pong processes --- src/main/java/dev/dsf/bpe/service/StoreResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/StoreResource.java b/src/main/java/dev/dsf/bpe/service/StoreResource.java index 3a5bc152..3dd20db7 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResource.java @@ -34,7 +34,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); - logger.info("Stored binary resource for PING targets to download"); + logger.info("Stored binary resource for download"); } private IdType storeBinary(byte[] downloadResourceContent) From 99ca7472b947e5a428400af7d986ed74368cadd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 28 Feb 2025 17:46:27 +0100 Subject: [PATCH 134/382] Resource deletion only requires the id value --- src/main/java/dev/dsf/bpe/service/Cleanup.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index b518f4ac..1864a7ee 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -3,6 +3,7 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Binary; +import org.hl7.fhir.r4.model.IdType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,8 +25,8 @@ public Cleanup(ProcessPluginApi api) protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { logger.info("Cleaning up..."); - String downloadResourceId = variables - .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); + String downloadResourceId = new IdType( + variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE)).getIdPart(); if (downloadResourceId != null) { api.getFhirWebserviceClientProvider().getLocalWebserviceClient().delete(Binary.class, downloadResourceId); From 984ff22d5c49a8a4459522a0f9f7bfa3a096e87b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 09:21:41 +0100 Subject: [PATCH 135/382] Execution variable for downloaded bytes was missing correlationKey in name. This should fix camunda db error complaining that the variable was modified concurrently by another transaction --- .../service/DownloadResourceAndMeasureSpeedInSubProcess.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java index 6826d960..8afdf0a0 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -39,7 +39,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable if (downloadResult.getErrorMessage() == null) { - variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, + variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES + "_" + correlationKey, downloadResult.getDownloadedBytes()); variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS + "_" + correlationKey, downloadResult.getDownloadedDurationMillis()); From 73cc7b584210ee39355b032cc90f71d9a19e2349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 09:43:54 +0100 Subject: [PATCH 136/382] Now checks whether a resource download was made and if not, returns an empty stream as the execution variables are only populated when a download took place --- .../java/dev/dsf/bpe/message/SendPong.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 56b1bb7c..4f62a74a 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -50,15 +50,24 @@ public void afterPropertiesSet() throws Exception protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - int downloadedBytes = variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES); - long downloadedDurationMillis = variables - .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); - String downloadResourceReference = variables - .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); - - return Stream.of(DownloadedBytesGenerator.create(downloadedBytes), - DownloadedDurationMillisGenerator.create(downloadedDurationMillis), - DownloadResourceReferenceGenerator.create(downloadResourceReference)); + int downloadResourceSizeBytes = variables + .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + if (downloadResourceSizeBytes >= 0) + { + int downloadedBytes = variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES); + long downloadedDurationMillis = variables + .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); + String downloadResourceReference = variables + .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); + + return Stream.of(DownloadedBytesGenerator.create(downloadedBytes), + DownloadedDurationMillisGenerator.create(downloadedDurationMillis), + DownloadResourceReferenceGenerator.create(downloadResourceReference)); + } + else + { + return Stream.empty(); + } } @Override From e9370a6081cf7f06a2c5d239efcae77e4d554987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 13:33:04 +0100 Subject: [PATCH 137/382] Added additional information to resource generation log output to inform why there is a difference between requested and generated size --- src/main/java/dev/dsf/bpe/service/GenerateResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/GenerateResource.java b/src/main/java/dev/dsf/bpe/service/GenerateResource.java index 0fedf575..5e8e881d 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateResource.java @@ -43,7 +43,7 @@ private byte[] generateRandomBinaryContent(int desiredSizeBytes) int sizeBytes = Math.min(maxUploadSizeBytes, desiredSizeBytes); byte[] bytes = base64Encode(generateRandomByteArray((sizeBytes / 4) * 3)); logger.info( - "Generated binary content for network speed measurement. Requested size was: {} bytes, generated size was : {}", + "Generated binary content for network speed measurement. Requested size was: {} bytes, generated size (base64 encoded) was : {}", desiredSizeBytes, bytes.length); return bytes; } From fa0dda48e1a016414ebdd01bd9f2491ca026a70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 13:59:22 +0100 Subject: [PATCH 138/382] Now uses skipNBytes instead of readNBytes because skipNBytes uses skip() which also reads the data from the InputStream but does so in 2024 byte chunks which does not run into the risk of running out of memory. Also improved formatting of download time --- .../dev/dsf/bpe/util/BinaryResourceDownloader.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 2c9497b9..f346e260 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -1,5 +1,6 @@ package dev.dsf.bpe.util; +import java.io.EOFException; import java.io.IOException; import java.io.InputStream; @@ -42,13 +43,12 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t "Starting resource download for: '{}'. Requested resource size is {} bytes, maximum downloadable size is {} bytes", downloadResourceReference.getReference(), downloadResourceSizeBytes, maxDownloadSizeBytes); long downloadStartTime = System.currentTimeMillis(); - int bufferSize = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); - byte[] buffer = new byte[bufferSize]; - int bytesRead = binaryResourceInputStream.read(buffer); + int numBytes = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); + binaryResourceInputStream.skipNBytes(numBytes); long downloadEndTime = System.currentTimeMillis(); long downloadedDurationMillis = downloadEndTime - downloadStartTime; - downloadResult = new DownloadResult(bytesRead, downloadedDurationMillis); - logger.info("Finished downloading {} bytes. Took {}", bytesRead, + downloadResult = new DownloadResult(numBytes, downloadedDurationMillis); + logger.info("Finished downloading {} bytes. Took {}", numBytes, toHoursMinutesSecondsMilliseconds(downloadedDurationMillis)); } @@ -65,7 +65,7 @@ private String toHoursMinutesSecondsMilliseconds(long millis) long minutes = (millis / 1000) / 60 % 60; long seconds = (millis / 1000) % 60; long milliSeconds = millis % 1000; - return String.format("%02d:%02d:%02d:%02dms", hours, minutes, seconds, milliSeconds); + return String.format("%02d:%02d:%02d:%03d (h:m:s:ms)", hours, minutes, seconds, milliSeconds); } public static class DownloadResult From c5bfb32d6b5932e0a469e2ec774cedef31fc362c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 13:59:28 +0100 Subject: [PATCH 139/382] Added --- .../java/dev/dsf/library/InputStreamTest.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/test/java/dev/dsf/library/InputStreamTest.java diff --git a/src/test/java/dev/dsf/library/InputStreamTest.java b/src/test/java/dev/dsf/library/InputStreamTest.java new file mode 100644 index 00000000..8ca977ac --- /dev/null +++ b/src/test/java/dev/dsf/library/InputStreamTest.java @@ -0,0 +1,51 @@ +package dev.dsf.library; + +import static org.junit.Assert.assertThrows; + +import java.io.ByteArrayInputStream; +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Random; + +import org.junit.Test; + +public class InputStreamTest +{ + @Test + public void testSkipNBytesSuccessWhenAllSkipped() throws IOException + { + int length = 1000; + int toSkip = length; + byte[] data = randomData(length); + InputStream in = new ByteArrayInputStream(data); + in.skipNBytes(toSkip); + } + + @Test + public void testSkipNBytesSuccessWhenSomeSkipped() throws IOException + { + int length = 1000; + int toSkip = length / 2; + byte[] data = randomData(length); + InputStream in = new ByteArrayInputStream(data); + in.skipNBytes(toSkip); + } + + @Test + public void testSkipNBytesFailOnSkipTooMany() throws IOException + { + int length = 1000; + int toSkip = length + 1; + byte[] data = randomData(length); + InputStream in = new ByteArrayInputStream(data); + assertThrows(EOFException.class, () -> in.skipNBytes(toSkip)); + } + + private byte[] randomData(int length) + { + byte[] data = new byte[length]; + new Random().nextBytes(data); + return data; + } +} From e9f59a4f674744861adf47f7cb58e21637516531 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 14:11:09 +0100 Subject: [PATCH 140/382] Added estimation based on 10x the download duration --- .../dsf/bpe/service/EstimateCleanupTimerDuration.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java index eed8cbfe..3b8fe557 100644 --- a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java @@ -1,10 +1,13 @@ package dev.dsf.bpe.service; +import java.time.Duration; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -21,7 +24,12 @@ public EstimateCleanupTimerDuration(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + long downloadedDurationMillis = variables.getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); + long timerDurationMillis = downloadedDurationMillis > Long.MAX_VALUE / 10 ? Long.MAX_VALUE : downloadedDurationMillis * 10; + + String cleanUpTimerDuration = Duration.ofMillis(timerDurationMillis).toString(); + variables.setString("cleanupTimerDuration", cleanUpTimerDuration); + logger.info("Estimated cleanup timer duration"); - variables.setString("cleanupTimerDuration", "PT20S"); } } From f18db2b6e19b9cea2bbced6ec79b83ca3bcf5ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 17:31:35 +0100 Subject: [PATCH 141/382] Added new error message constant for error messages set in subprocesses --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 63da8e37..f4beafb2 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -85,6 +85,7 @@ public interface ConstantsPing String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE = "downloadResource"; String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; + String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE = "errorMessage"; String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; From d02d98d5154654429cc807d505f5a0999504ab4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 17:33:16 +0100 Subject: [PATCH 142/382] Removed RemoveCorrelationKeyListener and replaced its functionality by overwriting sendTask is CleanupPong --- .../RemoveCorrelationKeyListener.java | 27 -------------- .../java/dev/dsf/bpe/message/CleanupPong.java | 37 +++++++++++++++++++ .../dev/dsf/bpe/spring/config/PingConfig.java | 8 ---- src/main/resources/bpe/ping.bpmn | 3 +- 4 files changed, 38 insertions(+), 37 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/listener/RemoveCorrelationKeyListener.java diff --git a/src/main/java/dev/dsf/bpe/listener/RemoveCorrelationKeyListener.java b/src/main/java/dev/dsf/bpe/listener/RemoveCorrelationKeyListener.java deleted file mode 100644 index e50b6ae1..00000000 --- a/src/main/java/dev/dsf/bpe/listener/RemoveCorrelationKeyListener.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.dsf.bpe.listener; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.ExecutionListener; - -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.variables.Target; -import dev.dsf.bpe.v1.variables.Variables; - -public class RemoveCorrelationKeyListener implements ExecutionListener -{ - private final ProcessPluginApi api; - - public RemoveCorrelationKeyListener(ProcessPluginApi api) - { - this.api = api; - } - - @Override - public void notify(DelegateExecution delegateExecution) throws Exception - { - Variables variables = api.getVariables(delegateExecution); - Target oldTarget = variables.getTarget(); - variables.setTarget(variables.createTarget(oldTarget.getOrganizationIdentifierValue(), - oldTarget.getEndpointIdentifierValue(), oldTarget.getEndpointUrl())); - } -} diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPong.java b/src/main/java/dev/dsf/bpe/message/CleanupPong.java index b21531b4..98c86656 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPong.java @@ -8,6 +8,7 @@ import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class CleanupPong extends AbstractTaskMessageSend @@ -24,4 +25,40 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE return Stream.of(NetworkSpeedMetricGenerator.createDownloadedBytes(0), NetworkSpeedMetricGenerator.createDownloadedDurationMillis(0)); } + + @Override + protected void sendTask(DelegateExecution execution, Variables variables, Target target, + String instantiatesCanonical, String messageName, String businessKey, String profile, + Stream<Task.ParameterComponent> additionalInputParameters) + { + Target newTarget = new Target() + { + @Override + public String getOrganizationIdentifierValue() + { + return target.getOrganizationIdentifierValue(); + } + + @Override + public String getEndpointIdentifierValue() + { + return target.getEndpointIdentifierValue(); + } + + @Override + public String getEndpointUrl() + { + return target.getEndpointUrl(); + } + + @Override + public String getCorrelationKey() + { + return null; + } + }; + + super.sendTask(execution, variables, newTarget, instantiatesCanonical, messageName, businessKey, profile, + additionalInputParameters); + } } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 50420b58..c43b375f 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -7,7 +7,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; -import dev.dsf.bpe.listener.RemoveCorrelationKeyListener; import dev.dsf.bpe.listener.SetCorrelationKeyListener; import dev.dsf.bpe.mail.ErrorMailService; import dev.dsf.bpe.message.CleanupPong; @@ -266,13 +265,6 @@ public SavePong savePong() return new SavePong(api); } - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public RemoveCorrelationKeyListener removeCorrelationKeyListener() - { - return new RemoveCorrelationKeyListener(api); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SetEndpointIdentifier setEndpointIdentifier() diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index eefbdfe1..ca03234f 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -94,7 +94,6 @@ <camunda:field name="instantiatesCanonical"> <camunda:string>http://dsf.dev/bpe/Process/pong|#{version}</camunda:string> </camunda:field> - <camunda:executionListener class="dev.dsf.bpe.listener.RemoveCorrelationKeyListener" event="start" /> </bpmn:extensionElements> <bpmn:incoming>Flow_1v37fff</bpmn:incoming> <bpmn:incoming>Flow_0jcfur3</bpmn:incoming> @@ -325,7 +324,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> - <dc:Bounds x="2660" y="612" width="239.98257839721254" height="54.98693379790941" /> + <dc:Bounds x="2660" y="612" width="240" height="55" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> From bb6ea95b54509814e20d2a96d4c214a66eb181cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 17:34:11 +0100 Subject: [PATCH 143/382] Replaced strings with constant values --- src/main/java/dev/dsf/bpe/message/SendPing.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index e7e18d26..188dfe74 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -54,10 +54,10 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; - execution.setVariableLocal("statusCode", statusCode); + execution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_STATUS_CODE, statusCode); String specialErrorMessage = createErrorMessage(exception); - execution.setVariableLocal("errorMessage", specialErrorMessage); + execution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE, specialErrorMessage); } @Override From 61866eb1381d730e17eb1533774af6a97697f52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 17:35:34 +0100 Subject: [PATCH 144/382] Error needs to be handled on intermediate throw event instead as SendPong is not a Message End Event anymore. This was a copy-paste error --- .../java/dev/dsf/bpe/message/SendPong.java | 35 ++++++------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 4f62a74a..7d48fe14 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -83,32 +83,17 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw } @Override - protected void handleEndEventError(DelegateExecution execution, Variables variables, Exception exception, - String errorMessage) + protected void handleIntermediateThrowEventError(DelegateExecution execution, Variables variables, + Exception exception, String errorMessage) { - Target target = variables.getTarget(); - Task mainTask = variables.getStartTask(); - - if (mainTask != null) - { - String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null - && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() - ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED - : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; - - String specialErrorMessage = createErrorMessage(exception); - - mainTask.addOutput( - statusGenerator.createPongStatusOutput(target, statusCode, List.of(specialErrorMessage))); - variables.updateTask(mainTask); - - if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode)) - errorMailService.endpointNotReachableForPong(mainTask.getIdElement(), target, specialErrorMessage); - else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statusCode)) - errorMailService.endpointReachablePongForbidden(mainTask.getIdElement(), target, specialErrorMessage); - } - - super.handleEndEventError(execution, variables, exception, errorMessage); + String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null + && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() + ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED + : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; + execution.setVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_STATUS_CODE, statusCode); + + String specialErrorMessage = createErrorMessage(exception); + execution.setVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE, specialErrorMessage); } private String createErrorMessage(Exception exception) From 2cc1a052da0f7d40a2f09163db4c1daee42a479d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 11 Mar 2025 17:37:33 +0100 Subject: [PATCH 145/382] Ran format-and-sort --- .../dev/dsf/bpe/service/EstimateCleanupTimerDuration.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java index 3b8fe557..c4c312d1 100644 --- a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java @@ -24,8 +24,10 @@ public EstimateCleanupTimerDuration(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - long downloadedDurationMillis = variables.getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); - long timerDurationMillis = downloadedDurationMillis > Long.MAX_VALUE / 10 ? Long.MAX_VALUE : downloadedDurationMillis * 10; + long downloadedDurationMillis = variables + .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); + long timerDurationMillis = downloadedDurationMillis > Long.MAX_VALUE / 10 ? Long.MAX_VALUE + : downloadedDurationMillis * 10; String cleanUpTimerDuration = Duration.ofMillis(timerDurationMillis).toString(); variables.setString("cleanupTimerDuration", cleanUpTimerDuration); From c6c1e07dace7e76fa4cdb2cc5974c3d6bb748c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 10:23:13 +0100 Subject: [PATCH 146/382] Made PingStatusGenerator provide static utility methods to be in line with other generators --- .../java/dev/dsf/bpe/message/SendPong.java | 13 +++--------- .../dev/dsf/bpe/service/StoreResults.java | 11 ++++------ .../dev/dsf/bpe/spring/config/PingConfig.java | 12 +++-------- .../generator}/PingStatusGenerator.java | 20 +++++++++---------- .../dsf/fhir/profiles/TaskProfileTest.java | 2 +- 5 files changed, 21 insertions(+), 37 deletions(-) rename src/main/java/dev/dsf/bpe/util/{ => task/output/generator}/PingStatusGenerator.java (78%) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 7d48fe14..ccc24984 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -1,19 +1,15 @@ package dev.dsf.bpe.message; -import java.util.List; import java.util.Objects; import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; -import dev.dsf.bpe.util.PingStatusGenerator; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; -import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -26,14 +22,12 @@ public class SendPong extends AbstractTaskMessageSend { - private final PingStatusGenerator statusGenerator; private final ErrorMailService errorMailService; - public SendPong(ProcessPluginApi api, PingStatusGenerator statusGenerator, ErrorMailService errorMailService) + public SendPong(ProcessPluginApi api, ErrorMailService errorMailService) { super(api); - this.statusGenerator = statusGenerator; this.errorMailService = errorMailService; } @@ -42,7 +36,6 @@ public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); - Objects.requireNonNull(statusGenerator, "statusGenerator"); Objects.requireNonNull(errorMailService, "errorMailService"); } @@ -77,7 +70,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw super.doExecute(execution, variables); Task mainTask = variables.getStartTask(); - mainTask.addOutput(statusGenerator.createPongStatusOutput(target, + mainTask.addOutput(PingStatusGenerator.createPongStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); variables.updateTask(mainTask); } diff --git a/src/main/java/dev/dsf/bpe/service/StoreResults.java b/src/main/java/dev/dsf/bpe/service/StoreResults.java index 00c5a20f..81f10891 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResults.java @@ -11,7 +11,7 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; -import dev.dsf.bpe.util.PingStatusGenerator; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -20,14 +20,12 @@ public class StoreResults extends AbstractServiceDelegate implements InitializingBean { - private final PingStatusGenerator statusGenerator; private final ErrorMailService errorMailService; - public StoreResults(ProcessPluginApi api, PingStatusGenerator statusGenerator, ErrorMailService errorMailService) + public StoreResults(ProcessPluginApi api, ErrorMailService errorMailService) { super(api); - this.statusGenerator = statusGenerator; this.errorMailService = errorMailService; } @@ -36,7 +34,6 @@ public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); - Objects.requireNonNull(statusGenerator, "statusGenerator"); Objects.requireNonNull(errorMailService, "errorMailService"); } @@ -55,7 +52,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw || ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statusCode)) { String errorMessage = variables.getString("errorMessage_" + correlationKey); - task.addOutput(statusGenerator.createPingStatusOutput(target, statusCode, List.of(errorMessage))); + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, List.of(errorMessage))); if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode)) errorMailService.endpointNotReachableForPing(task.getIdElement(), target, errorMessage); @@ -64,7 +61,7 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statu } else { - task.addOutput(statusGenerator.createPingStatusOutput(target, statusCode)); + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode)); if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(statusCode)) errorMailService.pongMessageNotReceived(task.getIdElement(), target); diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index c43b375f..8f980779 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -36,7 +36,7 @@ import dev.dsf.bpe.service.StoreDownloadSpeeds; import dev.dsf.bpe.service.StoreResource; import dev.dsf.bpe.service.StoreResults; -import dev.dsf.bpe.util.PingStatusGenerator; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; @@ -76,12 +76,6 @@ public SendStartPing sendStartPing() return new SendStartPing(api); } - @Bean - public PingStatusGenerator responseGenerator() - { - return new PingStatusGenerator(); - } - @Bean public ErrorMailService errorLogger() { @@ -128,7 +122,7 @@ public LogSendError logSendError() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public StoreResults savePingResults() { - return new StoreResults(api, responseGenerator(), errorLogger()); + return new StoreResults(api, errorLogger()); } @Bean @@ -149,7 +143,7 @@ public SelectPongTarget selectPongTarget() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SendPong sendPong() { - return new SendPong(api, responseGenerator(), errorLogger()); + return new SendPong(api, errorLogger()); } @Bean diff --git a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java similarity index 78% rename from src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java rename to src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index ef3c3d95..5e5036a3 100644 --- a/src/main/java/dev/dsf/bpe/util/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.util; +package dev.dsf.bpe.util.task.output.generator; import java.util.List; @@ -15,55 +15,55 @@ public class PingStatusGenerator { - public TaskOutputComponent createPingStatusOutput(Target target, String statusCode) + public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode) { return createPingStatusOutput(target, statusCode, null); } - public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, int downloadSpeed, + public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, int downloadSpeed, int uploadSpeed, String unit) { return createPingStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } - public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, List<String> errorMessages) + public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, List<String> errorMessages) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessages, -1, -1, null); } - public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, List<String> errorMessages, + public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessages, downloadSpeed, uploadSpeed, unit); } - public TaskOutputComponent createPongStatusOutput(Target target, String statusCode) + public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode) { return createPongStatusOutput(target, statusCode, null); } - public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, int downloadSpeed, + public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, int downloadSpeed, int uploadSpeed, String unit) { return createPongStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } - public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<String> errorMessages) + public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<String> errorMessages) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessages, -1, -1, null); } - public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<String> errorMessages, + public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessages, downloadSpeed, uploadSpeed, unit); } - private TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, + private static TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) { TaskOutputComponent output = new TaskOutputComponent(); diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index ba186faf..0f1a8683 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -23,7 +23,7 @@ import ca.uhn.fhir.validation.ValidationResult; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; -import dev.dsf.bpe.util.PingStatusGenerator; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; From 3bcecfc693b644ce7e8cbd4d16c278b79482638c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 10:27:15 +0100 Subject: [PATCH 147/382] Uses more fitting ErrorMessageListUtils method --- .../dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java index 30a6dad5..2620decf 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java @@ -45,7 +45,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } else { - ErrorMessageListUtils.add(downloadResult.getErrorMessage(), BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, + ErrorMessageListUtils.add(downloadResult.getErrorMessage(), delegateExecution); } } From eb4d700a64237f3dd883a330b789a47cb7ef00d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 10:46:40 +0100 Subject: [PATCH 148/382] Is now a final class with private constructor because constant collection should not be implementable --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 183 ++++++++++--------- 1 file changed, 92 insertions(+), 91 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index f4beafb2..bfef117f 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -1,97 +1,98 @@ package dev.dsf.bpe; -import java.util.regex.Pattern; - import jakarta.ws.rs.core.MediaType; -public interface ConstantsPing +public final class ConstantsPing { - String PROCESS_NAME_PING_AUTOSTART = "pingAutostart"; - String PROCESS_NAME_PING = "ping"; - String PROCESS_NAME_PONG = "pong"; - - String PROCESS_NAME_FULL_PING_AUTOSTART = "dsfdev_" + PROCESS_NAME_PING_AUTOSTART; - String PROCESS_NAME_FULL_PING = "dsfdev_" + PROCESS_NAME_PING; - String PROCESS_NAME_FULL_PONG = "dsfdev_" + PROCESS_NAME_PONG; - - String PROCESS_DSF_URI_BASE = "http://dsf.dev/bpe/Process/"; - - String PROFILE_DSF_TASK_START_PING_AUTOSTART = "http://dsf.dev/fhir/StructureDefinition/task-start-ping-autostart"; - String PROFILE_DSF_TASK_START_PING_AUTOSTART_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PING_AUTOSTART; - String PROFILE_DSF_TASK_START_PING_AUTOSTART_MESSAGE_NAME = "startPingAutostart"; - - String PROFILE_DSF_TASK_STOP_PING_AUTOSTART = "http://dsf.dev/fhir/StructureDefinition/task-stop-ping-autostart"; - String PROFILE_DSF_TASK_STOP_PING_AUTOSTART_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PING_AUTOSTART; - String PROFILE_DSF_TASK_STOP_PING_AUTOSTART_MESSAGE_NAME = "stopPingAutostart"; - - String PROFILE_DSF_TASK_START_PING = "http://dsf.dev/fhir/StructureDefinition/task-start-ping"; - String PROFILE_DSF_TASK_START_PING_MESSAGE_NAME = "startPing"; - - String PROFILE_DSF_TASK_PING = "http://dsf.dev/fhir/StructureDefinition/task-ping"; - String PROFILE_DSF_TASK_PING_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PING; - String PROFILE_DSF_TASK_PING_MESSAGE_NAME = "ping"; - - String PROFILE_DSF_TASK_PONG_TASK = "http://dsf.dev/fhir/StructureDefinition/task-pong"; - String PROFILE_DSF_TASK_PONG_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PONG; - String PROFILE_DSF_TASK_PONG_MESSAGE_NAME = "pong"; - - String PROFILE_DSF_TASK_CLEANUP_PONG = "http://dsf.dev/fhir/StructureDefinition/task-cleanup-pong"; - String PROFILE_DSF_TASK_CLEANUP_PONG_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PONG; - String PROFILE_DSF_TASK_CLEANUP_PONG_MESSAGE_NAME = "cleanupPong"; - - String CODESYSTEM_DSF_PING = "http://dsf.dev/fhir/CodeSystem/ping"; - String CODESYSTEM_DSF_PING_VALUE_PING_STATUS = "ping-status"; - String CODESYSTEM_DSF_PING_VALUE_PONG_STATUS = "pong-status"; - String CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER = "endpoint-identifier"; - String CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS = "target-endpoints"; - String CODESYSTEM_DSF_PING_VALUE_TIMER_INTERVAL = "timer-interval"; - String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES = "download-resource-size-bytes"; - String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS = "downloaded-duration-millis"; - String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES = "downloaded-bytes"; - String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE = "download-resource-reference"; - - String CODESYSTEM_DSF_PING_STATUS = "http://dsf.dev/fhir/CodeSystem/ping-status"; - String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED = "not-allowed"; - String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE = "not-reachable"; - String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING = "pong-missing"; - String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED = "pong-received"; - String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT = "pong-sent"; - String CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE = "error-message"; - - String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units"; - String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; - String CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND = "bytes-per-second"; - String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND = "megabits-per-second"; - String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND = "megabytes-per-second"; - - - String CODESYSTEM_READ_ACCESS_TAG = "http://dsf.dev/fhir/CodeSystem/read-access-tag"; - String CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL = "ALL"; - - String EXTENSION_URL_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status"; - String EXTENSION_URL_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; - String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; - String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; - String EXTENSION_URL_ENDPOINT_IDENTIFIER = "endpoint-identifier"; - String EXTENSION_URL_ERROR_MESSAGE = "error-message"; - String EXTENSION_URL_DOWNLOAD_SPEED = "download-speed"; - String EXTENSION_URL_UPLOAD_SPEED = "upload-speed"; - String EXTENSION_URL_NETWORK_SPEED_UNIT = "unit"; - String EXTENSION_URL_NETWORK_SPEED_VALUE = "network-speed"; - - String BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL = "timerInterval"; - String BPMN_EXECUTION_VARIABLE_STOP_TIMER = "stopTimer"; - String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES = "downloadResourceSizeBytes"; - String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE = "downloadResource"; - String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; - String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; - String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE = "errorMessage"; - String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; - String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; - String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; - String BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER = "targetEndpointIdentifier"; - - MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; - - String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; + private ConstantsPing() + { + } + + public static final String PROCESS_NAME_PING_AUTOSTART = "pingAutostart"; + public static final String PROCESS_NAME_PING = "ping"; + public static final String PROCESS_NAME_PONG = "pong"; + + public static final String PROCESS_NAME_FULL_PING_AUTOSTART = "dsfdev_" + PROCESS_NAME_PING_AUTOSTART; + public static final String PROCESS_NAME_FULL_PING = "dsfdev_" + PROCESS_NAME_PING; + public static final String PROCESS_NAME_FULL_PONG = "dsfdev_" + PROCESS_NAME_PONG; + + public static final String PROCESS_DSF_URI_BASE = "http://dsf.dev/bpe/Process/"; + + public static final String PROFILE_DSF_TASK_START_PING_AUTOSTART = "http://dsf.dev/fhir/StructureDefinition/task-start-ping-autostart"; + public static final String PROFILE_DSF_TASK_START_PING_AUTOSTART_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PING_AUTOSTART; + public static final String PROFILE_DSF_TASK_START_PING_AUTOSTART_MESSAGE_NAME = "startPingAutostart"; + + public static final String PROFILE_DSF_TASK_STOP_PING_AUTOSTART = "http://dsf.dev/fhir/StructureDefinition/task-stop-ping-autostart"; + public static final String PROFILE_DSF_TASK_STOP_PING_AUTOSTART_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PING_AUTOSTART; + public static final String PROFILE_DSF_TASK_STOP_PING_AUTOSTART_MESSAGE_NAME = "stopPingAutostart"; + + public static final String PROFILE_DSF_TASK_START_PING = "http://dsf.dev/fhir/StructureDefinition/task-start-ping"; + public static final String PROFILE_DSF_TASK_START_PING_MESSAGE_NAME = "startPing"; + + public static final String PROFILE_DSF_TASK_PING = "http://dsf.dev/fhir/StructureDefinition/task-ping"; + public static final String PROFILE_DSF_TASK_PING_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PING; + public static final String PROFILE_DSF_TASK_PING_MESSAGE_NAME = "ping"; + + public static final String PROFILE_DSF_TASK_PONG_TASK = "http://dsf.dev/fhir/StructureDefinition/task-pong"; + public static final String PROFILE_DSF_TASK_PONG_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PONG; + public static final String PROFILE_DSF_TASK_PONG_MESSAGE_NAME = "pong"; + + public static final String PROFILE_DSF_TASK_CLEANUP_PONG = "http://dsf.dev/fhir/StructureDefinition/task-cleanup-pong"; + public static final String PROFILE_DSF_TASK_CLEANUP_PONG_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PONG; + public static final String PROFILE_DSF_TASK_CLEANUP_PONG_MESSAGE_NAME = "cleanupPong"; + + public static final String CODESYSTEM_DSF_PING = "http://dsf.dev/fhir/CodeSystem/ping"; + public static final String CODESYSTEM_DSF_PING_VALUE_PING_STATUS = "ping-status"; + public static final String CODESYSTEM_DSF_PING_VALUE_PONG_STATUS = "pong-status"; + public static final String CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER = "endpoint-identifier"; + public static final String CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS = "target-endpoints"; + public static final String CODESYSTEM_DSF_PING_VALUE_TIMER_INTERVAL = "timer-interval"; + public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES = "download-resource-size-bytes"; + public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS = "downloaded-duration-millis"; + public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES = "downloaded-bytes"; + public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE = "download-resource-reference"; + + public static final String CODESYSTEM_DSF_PING_STATUS = "http://dsf.dev/fhir/CodeSystem/ping-status"; + public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED = "not-allowed"; + public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE = "not-reachable"; + public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING = "pong-missing"; + public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED = "pong-received"; + public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT = "pong-sent"; + public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE = "error-message"; + + public static final String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units"; + public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; + public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND = "bytes-per-second"; + public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND = "megabits-per-second"; + public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND = "megabytes-per-second"; + + public static final String CODESYSTEM_READ_ACCESS_TAG = "http://dsf.dev/fhir/CodeSystem/read-access-tag"; + public static final String CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL = "ALL"; + + public static final String EXTENSION_URL_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status"; + public static final String EXTENSION_URL_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; + public static final String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; + public static final String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; + public static final String EXTENSION_URL_ENDPOINT_IDENTIFIER = "endpoint-identifier"; + public static final String EXTENSION_URL_ERROR_MESSAGE = "error-message"; + public static final String EXTENSION_URL_DOWNLOAD_SPEED = "download-speed"; + public static final String EXTENSION_URL_UPLOAD_SPEED = "upload-speed"; + public static final String EXTENSION_URL_NETWORK_SPEED_UNIT = "unit"; + public static final String EXTENSION_URL_NETWORK_SPEED_VALUE = "network-speed"; + + public static final String BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL = "timerInterval"; + public static final String BPMN_EXECUTION_VARIABLE_STOP_TIMER = "stopTimer"; + public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES = "downloadResourceSizeBytes"; + public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE = "downloadResource"; + public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; + public static final String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; + public static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE = "errorMessage"; + public static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; + public static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; + public static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; + public static final String BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER = "targetEndpointIdentifier"; + + public static final MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; + + public static final String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; } From 728ee8da6accdf214c022e09fa46ec3dd46a7bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 11:05:36 +0100 Subject: [PATCH 149/382] Added utility method to retrieve error list --- src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java index 39a3b314..7bf680ca 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java @@ -15,6 +15,12 @@ public static List<String> add(String error, DelegateExecution execution) return add(error, ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, execution); } + @SuppressWarnings("unchecked") + public static List<String> getErrorMessageList(DelegateExecution execution) + { + return (List<String>) execution.getVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST); + } + @SuppressWarnings("unchecked") public static List<String> add(String error, String variableName, DelegateExecution execution) { From 23da0a626af2b58d7f7e83b8faa056bf7fea6d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 11:13:27 +0100 Subject: [PATCH 150/382] SendPong now includes error messages that occurred before sending the pong message like failing to download the resource from the ping instance --- .../java/dev/dsf/bpe/message/SendPong.java | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index ccc24984..fa8dd1f4 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -1,5 +1,6 @@ package dev.dsf.bpe.message; +import java.util.List; import java.util.Objects; import java.util.stream.Stream; @@ -8,6 +9,8 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; +import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; @@ -43,23 +46,25 @@ public void afterPropertiesSet() throws Exception protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - int downloadResourceSizeBytes = variables - .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + List<String> errorList = ErrorMessageListUtils.getErrorMessageList(execution); + int downloadResourceSizeBytes = variables.getInteger( + ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); if (downloadResourceSizeBytes >= 0) { int downloadedBytes = variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES); - long downloadedDurationMillis = variables - .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); - String downloadResourceReference = variables - .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); + long downloadedDurationMillis = variables.getLong( + ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); + String downloadResourceReference = variables.getString( + ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); - return Stream.of(DownloadedBytesGenerator.create(downloadedBytes), - DownloadedDurationMillisGenerator.create(downloadedDurationMillis), - DownloadResourceReferenceGenerator.create(downloadResourceReference)); + return Stream.concat(Stream.of(DownloadedBytesGenerator.create(downloadedBytes), + DownloadedDurationMillisGenerator.create(downloadedDurationMillis), + DownloadResourceReferenceGenerator.create(downloadResourceReference)), + ErrorMessageGenerator.create(errorList).stream()); } else { - return Stream.empty(); + return ErrorMessageGenerator.create(errorList).stream(); } } @@ -80,9 +85,9 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va Exception exception, String errorMessage) { String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null - && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() - ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED - : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; + && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() ? + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED : + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; execution.setVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_STATUS_CODE, statusCode); String specialErrorMessage = createErrorMessage(exception); @@ -91,8 +96,8 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va private String createErrorMessage(Exception exception) { - if (exception instanceof WebApplicationException w - && (exception.getMessage() == null || exception.getMessage().isBlank())) + if (exception instanceof WebApplicationException w && (exception.getMessage() == null || exception.getMessage() + .isBlank())) { StatusType statusInfo = w.getResponse().getStatusInfo(); return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); From 856eb62848644a756a26a022bb9ebb24b3b71aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 13:21:48 +0100 Subject: [PATCH 151/382] Accessing BPMN_EXECUTION_VARIABLE_STATUS_CODE and BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE is now only possible via getters. They also come overloaded with a correlation key parameter to make addressing versions of the execution variables in parallel processes consistent --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 24 +++++++++++++++++-- .../dsf/bpe/service/LogAndSaveSendError.java | 4 +--- .../dev/dsf/bpe/service/StoreResults.java | 5 ++-- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index bfef117f..21899d71 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -85,8 +85,8 @@ private ConstantsPing() public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES = "downloadResourceSizeBytes"; public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE = "downloadResource"; public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; - public static final String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; - public static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE = "errorMessage"; + private static final String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; + private static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE = "errorMessage"; public static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; public static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; public static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; @@ -95,4 +95,24 @@ private ConstantsPing() public static final MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; public static final String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; + + public static String getBpmnExecutionVariableStatusCode() + { + return BPMN_EXECUTION_VARIABLE_STATUS_CODE; + } + + public static String getBpmnExecutionVariableStatusCode(String correlationKey) + { + return BPMN_EXECUTION_VARIABLE_STATUS_CODE + "_" + correlationKey; + } + + public static String getBpmnExecutionVariableErrorMessage() + { + return BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE; + } + + public static String getBpmnExecutionVariableErrorMessage(String correlationKey) + { + return BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE + "_" + correlationKey; + } } diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java index 6c97522e..5a4ed17f 100644 --- a/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java @@ -6,8 +6,6 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; -import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -28,7 +26,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable String statusCode = (String) delegateExecution.getVariableLocal("statusCode"); Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_STATUS_CODE + "_" + correlationKey, statusCode); + variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); } } diff --git a/src/main/java/dev/dsf/bpe/service/StoreResults.java b/src/main/java/dev/dsf/bpe/service/StoreResults.java index 81f10891..ad2361c8 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResults.java @@ -47,11 +47,12 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw { String correlationKey = target.getCorrelationKey(); - String statusCode = variables.getString("statusCode_" + correlationKey); + String statusCode = variables.getString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey)); if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode) || ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statusCode)) { - String errorMessage = variables.getString("errorMessage_" + correlationKey); + String errorMessage = variables + .getString(ConstantsPing.getBpmnExecutionVariableErrorMessage(correlationKey)); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, List.of(errorMessage))); if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode)) From 425b84bfc2eed90e78b5742b7d972468f0cb9993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 14:22:12 +0100 Subject: [PATCH 152/382] Ran format-and-sort and removed unnecessary imports --- .../dsf/bpe/service/DownloadResourceAndMeasureSpeed.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java index 2620decf..43f893a6 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java @@ -1,11 +1,7 @@ package dev.dsf.bpe.service; -import static dev.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Identifier; -import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -45,8 +41,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } else { - ErrorMessageListUtils.add(downloadResult.getErrorMessage(), - delegateExecution); + ErrorMessageListUtils.add(downloadResult.getErrorMessage(), delegateExecution); } } } From 7e46d49c3fdea5d32060ec8e6fbae53339907ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 14:22:22 +0100 Subject: [PATCH 153/382] Added null check --- .../bpe/util/task/input/generator/ErrorMessageGenerator.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java index 216373eb..d7c62b67 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java @@ -12,6 +12,8 @@ public class ErrorMessageGenerator { public static List<Task.ParameterComponent> create(List<String> errorMessages) { + if (errorMessages == null || errorMessages.isEmpty()) + return List.of(); return errorMessages.stream().map(ErrorMessageGenerator::create).collect(Collectors.toList()); } From d8f7e41541732f52eb2b97de4984540723306d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 14:23:10 +0100 Subject: [PATCH 154/382] Ran format-and-sort --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 6 ++++-- .../task/output/generator/PingStatusGenerator.java | 14 ++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 21899d71..0d87b234 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -19,11 +19,13 @@ private ConstantsPing() public static final String PROCESS_DSF_URI_BASE = "http://dsf.dev/bpe/Process/"; public static final String PROFILE_DSF_TASK_START_PING_AUTOSTART = "http://dsf.dev/fhir/StructureDefinition/task-start-ping-autostart"; - public static final String PROFILE_DSF_TASK_START_PING_AUTOSTART_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PING_AUTOSTART; + public static final String PROFILE_DSF_TASK_START_PING_AUTOSTART_PROCESS_URI = PROCESS_DSF_URI_BASE + + PROCESS_NAME_PING_AUTOSTART; public static final String PROFILE_DSF_TASK_START_PING_AUTOSTART_MESSAGE_NAME = "startPingAutostart"; public static final String PROFILE_DSF_TASK_STOP_PING_AUTOSTART = "http://dsf.dev/fhir/StructureDefinition/task-stop-ping-autostart"; - public static final String PROFILE_DSF_TASK_STOP_PING_AUTOSTART_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PING_AUTOSTART; + public static final String PROFILE_DSF_TASK_STOP_PING_AUTOSTART_PROCESS_URI = PROCESS_DSF_URI_BASE + + PROCESS_NAME_PING_AUTOSTART; public static final String PROFILE_DSF_TASK_STOP_PING_AUTOSTART_MESSAGE_NAME = "stopPingAutostart"; public static final String PROFILE_DSF_TASK_START_PING = "http://dsf.dev/fhir/StructureDefinition/task-start-ping"; diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 5e5036a3..d23ff217 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -26,14 +26,15 @@ public static TaskOutputComponent createPingStatusOutput(Target target, String s return createPingStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } - public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, List<String> errorMessages) + public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, + List<String> errorMessages) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessages, -1, -1, null); } - public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, List<String> errorMessages, - int downloadSpeed, int uploadSpeed, String unit) + public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, + List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessages, downloadSpeed, uploadSpeed, unit); @@ -50,14 +51,15 @@ public static TaskOutputComponent createPongStatusOutput(Target target, String s return createPongStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } - public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<String> errorMessages) + public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, + List<String> errorMessages) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessages, -1, -1, null); } - public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<String> errorMessages, - int downloadSpeed, int uploadSpeed, String unit) + public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, + List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessages, downloadSpeed, uploadSpeed, unit); From 9914cb155729d75fb3aee35ce3fc137bd50177f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 14:23:38 +0100 Subject: [PATCH 155/382] Ran format-and-sort and replaced access BPMN_EXECUTION_VARIABLE_STATUS_CODE and BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE constants with getters --- .../java/dev/dsf/bpe/message/SendPong.java | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index fa8dd1f4..2e4ae1de 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -10,11 +10,11 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; import dev.dsf.bpe.util.ErrorMessageListUtils; -import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; -import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; +import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; @@ -47,17 +47,18 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE Variables variables) { List<String> errorList = ErrorMessageListUtils.getErrorMessageList(execution); - int downloadResourceSizeBytes = variables.getInteger( - ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + int downloadResourceSizeBytes = variables + .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); if (downloadResourceSizeBytes >= 0) { int downloadedBytes = variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES); - long downloadedDurationMillis = variables.getLong( - ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); - String downloadResourceReference = variables.getString( - ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); + long downloadedDurationMillis = variables + .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); + String downloadResourceReference = variables + .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); - return Stream.concat(Stream.of(DownloadedBytesGenerator.create(downloadedBytes), + return Stream.concat( + Stream.of(DownloadedBytesGenerator.create(downloadedBytes), DownloadedDurationMillisGenerator.create(downloadedDurationMillis), DownloadResourceReferenceGenerator.create(downloadResourceReference)), ErrorMessageGenerator.create(errorList).stream()); @@ -85,19 +86,19 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va Exception exception, String errorMessage) { String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null - && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() ? - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED : - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; - execution.setVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_STATUS_CODE, statusCode); + && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() + ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED + : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; + execution.setVariable(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); String specialErrorMessage = createErrorMessage(exception); - execution.setVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE, specialErrorMessage); + execution.setVariable(ConstantsPing.getBpmnExecutionVariableErrorMessage(), specialErrorMessage); } private String createErrorMessage(Exception exception) { - if (exception instanceof WebApplicationException w && (exception.getMessage() == null || exception.getMessage() - .isBlank())) + if (exception instanceof WebApplicationException w + && (exception.getMessage() == null || exception.getMessage().isBlank())) { StatusType statusInfo = w.getResponse().getStatusInfo(); return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); From cb01cc4bb9b349e41bfbd95ff7e34af35b4882cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 14:23:56 +0100 Subject: [PATCH 156/382] Ran format-and-sort --- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 0f1a8683..b7acac7c 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -23,11 +23,11 @@ import ca.uhn.fhir.validation.ValidationResult; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; -import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; import dev.dsf.bpe.v1.constants.NamingSystems.OrganizationIdentifier; From aaf21ec6c2a0e12b96f96b5fbe1c33385a773f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 14:32:14 +0100 Subject: [PATCH 157/382] Accessing BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES and BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS is now only possible via getters. They also come overloaded with a correlation key parameter to make addressing versions of the execution variables in parallel processes consistent --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 24 +++++++++++++++++-- .../java/dev/dsf/bpe/message/SendPong.java | 4 ++-- .../DownloadResourceAndMeasureSpeed.java | 4 ++-- ...adResourceAndMeasureSpeedInSubProcess.java | 4 ++-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 0d87b234..9fcad997 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -90,8 +90,8 @@ private ConstantsPing() private static final String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; private static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE = "errorMessage"; public static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; - public static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; - public static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; + private static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; + private static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; public static final String BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER = "targetEndpointIdentifier"; public static final MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; @@ -117,4 +117,24 @@ public static String getBpmnExecutionVariableErrorMessage(String correlationKey) { return BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE + "_" + correlationKey; } + + public static String getBpmnExecutionVariableDownloadedBytes() + { + return BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES; + } + + public static String getBpmnExecutionVariableDownloadedBytes(String correlationKey) + { + return BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES + "_" + correlationKey; + } + + public static String getBpmnExecutionVariableDownloadedDurationMillis() + { + return BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS; + } + + public static String getBpmnExecutionVariableDownloadedDurationMillis(String correlationKey) + { + return BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS + "_" + correlationKey; + } } diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 2e4ae1de..59a3d623 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -51,9 +51,9 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); if (downloadResourceSizeBytes >= 0) { - int downloadedBytes = variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES); + int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); long downloadedDurationMillis = variables - .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); + .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); String downloadResourceReference = variables .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java index 43f893a6..b14ff7b5 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java @@ -34,9 +34,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable if (downloadResult.getErrorMessage() == null) { - variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES, + variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(), downloadResult.getDownloadedBytes()); - variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS, + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(), downloadResult.getDownloadedDurationMillis()); } else diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java index 8afdf0a0..ec04b993 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -39,9 +39,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable if (downloadResult.getErrorMessage() == null) { - variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES + "_" + correlationKey, + variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey), downloadResult.getDownloadedBytes()); - variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS + "_" + correlationKey, + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), downloadResult.getDownloadedDurationMillis()); } else From 4edbc278e8d61fcce085cb3228e1e5cccd41fe53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 14:39:40 +0100 Subject: [PATCH 158/382] Replaced string with constant --- src/main/java/dev/dsf/bpe/service/SavePong.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/SavePong.java b/src/main/java/dev/dsf/bpe/service/SavePong.java index c0159c6a..52101dc1 100644 --- a/src/main/java/dev/dsf/bpe/service/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/SavePong.java @@ -26,7 +26,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); delegateExecution.removeVariable("statusCode"); - variables.setString("statusCode_" + correlationKey, + variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED); logger.info("Pong received from {}, saving pong information", target.getEndpointUrl()); From 6131674db00662c89f71a5e2c13d88a356f04c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 14:43:20 +0100 Subject: [PATCH 159/382] Removed logging statement as generateRandomBinaryContent() already logs this information --- src/main/java/dev/dsf/bpe/service/GenerateResource.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/GenerateResource.java b/src/main/java/dev/dsf/bpe/service/GenerateResource.java index 5e8e881d..c9aff2e8 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateResource.java @@ -34,8 +34,6 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable variables.setByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE, generateRandomBinaryContent(downloadResourceSizeBytes)); - - logger.info("Generated binary resource content for network speed measurement"); } private byte[] generateRandomBinaryContent(int desiredSizeBytes) From b8e5c3eefb0d7a0a544cf82954aaf81f8fb02c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 15:01:28 +0100 Subject: [PATCH 160/382] Replaced array list with vector as a thread-safe list implementation might reduce errors given that the error list will be modified concurrently --- src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java index 7bf680ca..9a6d7385 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Vector; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -27,7 +28,7 @@ public static List<String> add(String error, String variableName, DelegateExecut List<String> errorMessages = (List<String>) execution.getVariable(variableName); if (errorMessages == null) { - errorMessages = new ArrayList<>(); + errorMessages = new Vector<>(); execution.setVariable(variableName, errorMessages); } errorMessages.add(error); From db79dc246fcec7afed1928321bc1c2a3c1234cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 15:02:09 +0100 Subject: [PATCH 161/382] Removed unnecessary annotation --- src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java index 9a6d7385..f57d7bb6 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java @@ -10,7 +10,6 @@ public class ErrorMessageListUtils { - @SuppressWarnings("unchecked") public static List<String> add(String error, DelegateExecution execution) { return add(error, ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, execution); From 0c9f335d3290b725ea96e4f6c8d4754c76fe3ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 15:02:57 +0100 Subject: [PATCH 162/382] Constant access is now getter call --- .../java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java index c4c312d1..4dd63505 100644 --- a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java @@ -25,7 +25,7 @@ public EstimateCleanupTimerDuration(ProcessPluginApi api) protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { long downloadedDurationMillis = variables - .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS); + .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); long timerDurationMillis = downloadedDurationMillis > Long.MAX_VALUE / 10 ? Long.MAX_VALUE : downloadedDurationMillis * 10; From b436a5698a0983f8c1ca5b24dc38c239aed4016b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 15:07:34 +0100 Subject: [PATCH 163/382] Added a minimum timer duration of 20s --- .../dev/dsf/bpe/service/EstimateCleanupTimerDuration.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java index 4dd63505..080877dd 100644 --- a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java @@ -24,14 +24,16 @@ public EstimateCleanupTimerDuration(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + final long minTimerDurationMillis = 20000; long downloadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); - long timerDurationMillis = downloadedDurationMillis > Long.MAX_VALUE / 10 ? Long.MAX_VALUE - : downloadedDurationMillis * 10; + long timerDurationMillis = downloadedDurationMillis > Long.MAX_VALUE / 10 - minTimerDurationMillis + ? Long.MAX_VALUE + : downloadedDurationMillis * 10 + minTimerDurationMillis; String cleanUpTimerDuration = Duration.ofMillis(timerDurationMillis).toString(); variables.setString("cleanupTimerDuration", cleanUpTimerDuration); - logger.info("Estimated cleanup timer duration"); + logger.info("Estimated cleanup timer duration as {}", cleanUpTimerDuration); } } From a8cb6c6daa4ee4c7e87debb1bfaea383ffd341e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 15:41:01 +0100 Subject: [PATCH 164/382] Added utility method to add a list of strings as error messages --- src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java index f57d7bb6..cb36ec6a 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java @@ -10,6 +10,13 @@ public class ErrorMessageListUtils { + public static List<String> addAll(List<String> errors, DelegateExecution execution) + { + List<String> errorList = getErrorMessageList(execution); + errorList.addAll(errors); + return errorList; + } + public static List<String> add(String error, DelegateExecution execution) { return add(error, ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, execution); From 59e16ff25a70a6f62de7b7ba81ccc78cdd0570dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 15:55:37 +0100 Subject: [PATCH 165/382] Added process names to process documentation for maxDownloadSizeBytes and maxUploadSizeBytes --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 8f980779..716d36e3 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -36,7 +36,6 @@ import dev.dsf.bpe.service.StoreDownloadSpeeds; import dev.dsf.bpe.service.StoreResource; import dev.dsf.bpe.service.StoreResults; -import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; @@ -54,11 +53,11 @@ public class PingConfig @Value("${dev.dsf.dsf.bpe.ping.mail.onPongProcessFailed:false}") private boolean sendPongProcessFailedMail; - @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.") + @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.", processNames = "dsfdev_ping, dsfdev_pong") @Value("${dev.dsf.bpe.ping.maxDownloadSize:10000000}") private long maxDownloadSizeBytes; - @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.") + @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.", processNames = "dsfdev_ping, dsfdev_pong") @Value("${dev.dsf.bpe.ping.maxUploadSize:10000000}") private long maxUploadSizeBytes; From ad2674dd4214c39c6c6d83ee47f850984e6f00ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 18:01:31 +0100 Subject: [PATCH 166/382] Renamed SaveDownloadSpeeds to SaveDownloadSpeedsPing to indicate that SaveDownloadSpeeds is called in Ping process --- ...{SaveDownloadSpeeds.java => SaveDownloadSpeedsPing.java} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename src/main/java/dev/dsf/bpe/service/{SaveDownloadSpeeds.java => SaveDownloadSpeedsPing.java} (80%) diff --git a/src/main/java/dev/dsf/bpe/service/SaveDownloadSpeeds.java b/src/main/java/dev/dsf/bpe/service/SaveDownloadSpeedsPing.java similarity index 80% rename from src/main/java/dev/dsf/bpe/service/SaveDownloadSpeeds.java rename to src/main/java/dev/dsf/bpe/service/SaveDownloadSpeedsPing.java index 5c3844f1..9a2b4f02 100644 --- a/src/main/java/dev/dsf/bpe/service/SaveDownloadSpeeds.java +++ b/src/main/java/dev/dsf/bpe/service/SaveDownloadSpeedsPing.java @@ -9,11 +9,11 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; -public class SaveDownloadSpeeds extends AbstractServiceDelegate +public class SaveDownloadSpeedsPing extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(SaveDownloadSpeeds.class); + private static final Logger logger = LoggerFactory.getLogger(SaveDownloadSpeedsPing.class); - public SaveDownloadSpeeds(ProcessPluginApi api) + public SaveDownloadSpeedsPing(ProcessPluginApi api) { super(api); } From 725c6fc93884ffbc3c94ccd84e4b5d4fa7092378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 18:02:17 +0100 Subject: [PATCH 167/382] Now saves download information and error messages --- .../java/dev/dsf/bpe/service/SavePong.java | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/SavePong.java b/src/main/java/dev/dsf/bpe/service/SavePong.java index 52101dc1..7adbb4ca 100644 --- a/src/main/java/dev/dsf/bpe/service/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/SavePong.java @@ -1,11 +1,23 @@ package dev.dsf.bpe.service; +import java.util.Collection; +import java.util.List; +import java.util.Vector; +import java.util.function.Supplier; +import java.util.stream.Collectors; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.DecimalType; +import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.PrimitiveType; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -28,8 +40,26 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable delegateExecution.removeVariable("statusCode"); variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED); - logger.info("Pong received from {}, saving pong information", target.getEndpointUrl()); - // TODO: add other information: downloaded-bytes, downloaded-duration-millis, error-message + Task pong = variables.getLatestTask(); + + long downloadedDurationMillis = api.getTaskHelper() + .getFirstInputParameterValue(pong, ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, DecimalType.class).get() + .getValue().longValue(); + variables.setLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey), + downloadedDurationMillis); + + int downloadedBytes = api.getTaskHelper().getFirstInputParameterValue(pong, ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, IntegerType.class).get().getValue(); + variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), downloadedBytes); + + List<String> errorList = api.getTaskHelper().getInputParameterValues(pong, ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE, StringType.class) + .map(PrimitiveType::getValue) + .toList(); + ErrorMessageListUtils.addAll(errorList, delegateExecution); + + logger.info("Pong received from {}, saved pong information", target.getEndpointUrl()); } } From b4f0ae50b93e54e03de1f7c0efc08e7b64ec0ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 18:15:55 +0100 Subject: [PATCH 168/382] Removed LogSendError task as Ping now logs errors itself --- .../java/dev/dsf/bpe/message/SendPing.java | 13 ++++++-- src/main/resources/bpe/ping.bpmn | 33 ++++++------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index 188dfe74..e65dd730 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -8,12 +8,15 @@ import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.ParameterComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.Response; @@ -21,6 +24,8 @@ public class SendPing extends AbstractTaskMessageSend { + private static final Logger logger = LoggerFactory.getLogger(SendPing.class); + public SendPing(ProcessPluginApi api) { super(api); @@ -50,14 +55,18 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut protected void handleIntermediateThrowEventError(DelegateExecution execution, Variables variables, Exception exception, String errorMessage) { + Target target = variables.getTarget(); + String correlationKey = target.getCorrelationKey(); + String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; - execution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_STATUS_CODE, statusCode); + variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); String specialErrorMessage = createErrorMessage(exception); - execution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE, specialErrorMessage); + variables.setString(ConstantsPing.getBpmnExecutionVariableErrorMessage(correlationKey), specialErrorMessage); + logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); } @Override diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index ca03234f..ca0796fa 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -44,13 +44,9 @@ <bpmn:outgoing>Flow_1j54c2s</bpmn:outgoing> <bpmn:outgoing>Flow_101sqed</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="LogSendError" name="Log and Save Send Error" camunda:class="dev.dsf.bpe.service.LogAndSaveSendError"> - <bpmn:incoming>Flow_101sqed</bpmn:incoming> - <bpmn:outgoing>Flow_16ssf4a</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:exclusiveGateway id="Gateway_09z7b0z"> <bpmn:incoming>Flow_136htek</bpmn:incoming> - <bpmn:incoming>Flow_16ssf4a</bpmn:incoming> + <bpmn:incoming>Flow_101sqed</bpmn:incoming> <bpmn:outgoing>Flow_1ho1hys</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:endEvent id="SubProcessEndEvent" camunda:asyncAfter="true"> @@ -125,10 +121,9 @@ <bpmn:sequenceFlow id="Flow_1j54c2s" sourceRef="Gateway_0z5gz96" targetRef="EventBasedGateway" /> <bpmn:sequenceFlow id="Flow_136htek" sourceRef="LogNoResponse" targetRef="Gateway_09z7b0z" /> <bpmn:sequenceFlow id="Flow_08vgmf6" sourceRef="Activity_0ri6fnv" targetRef="Gateway_0z5gz96" /> - <bpmn:sequenceFlow id="Flow_101sqed" name="not-allowed or not-reachable" sourceRef="Gateway_0z5gz96" targetRef="LogSendError"> + <bpmn:sequenceFlow id="Flow_101sqed" name="not-allowed or not-reachable" sourceRef="Gateway_0z5gz96" targetRef="Gateway_09z7b0z"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && (statusCode == 'not-allowed' || statusCode == 'not-reachable')}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_16ssf4a" sourceRef="LogSendError" targetRef="Gateway_09z7b0z" /> <bpmn:sequenceFlow id="Flow_1ho1hys" sourceRef="Gateway_09z7b0z" targetRef="SubProcessEndEvent" /> <bpmn:sequenceFlow id="Flow_13u1nzy" sourceRef="Gateway_0p0be0a" targetRef="Gateway_02orad4"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> @@ -137,8 +132,7 @@ <bpmn:sequenceFlow id="Flow_1v37fff" sourceRef="Activity_0h9o9u7" targetRef="Activity_0vw65a2" /> <bpmn:sequenceFlow id="Flow_0jcfur3" sourceRef="Activity_0akr23c" targetRef="Activity_0vw65a2" /> <bpmn:sequenceFlow id="Flow_10h6pqh" sourceRef="Event_0i4slcz" targetRef="Activity_0akr23c" /> - <bpmn:sequenceFlow id="Flow_03nx6rk" sourceRef="Gateway_02orad4" targetRef="Event_1foycg9" /> - <bpmn:serviceTask id="Activity_0i9uqk0" name="Save Download Speeds" camunda:class="dev.dsf.bpe.service.SaveDownloadSpeeds"> + <bpmn:serviceTask id="Activity_0i9uqk0" name="Save Download Speeds" camunda:class="dev.dsf.bpe.service.SaveDownloadSpeedsPing"> <bpmn:incoming>Flow_0klalf8</bpmn:incoming> <bpmn:outgoing>Flow_0n0yrky</bpmn:outgoing> </bpmn:serviceTask> @@ -150,6 +144,7 @@ <bpmn:outgoing>Flow_1jwekqw</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1jwekqw" sourceRef="Activity_081me01" targetRef="Gateway_0p0be0a" /> + <bpmn:sequenceFlow id="Flow_03nx6rk" sourceRef="Gateway_02orad4" targetRef="Event_1foycg9" /> <bpmn:textAnnotation id="TextAnnotation_0uc8utt"> <bpmn:text>Information in message: - dowloadResourceSize: long @@ -215,12 +210,12 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1c15ef2" sourceRef="Gateway_0bifi5h" targetRef="SelectPingTargets" /> - <bpmn:sequenceFlow id="Flow_0e35w2m" sourceRef="StartPingMessageStartEvent" targetRef="Activity_1wdftvk" /> <bpmn:sequenceFlow id="Flow_0fxlsv3" sourceRef="Activity_1wdftvk" targetRef="Gateway_0xw5i5v" /> <bpmn:serviceTask id="Activity_1wdftvk" name="Set Download Resource Size" camunda:class="dev.dsf.bpe.service.SetDownloadResourceSize"> <bpmn:incoming>Flow_0e35w2m</bpmn:incoming> <bpmn:outgoing>Flow_0fxlsv3</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_0e35w2m" sourceRef="StartPingMessageStartEvent" targetRef="Activity_1wdftvk" /> <bpmn:textAnnotation id="TextAnnotation_1ig0151"> <bpmn:text>Includes download speeds and errors of all pongs</bpmn:text> </bpmn:textAnnotation> @@ -276,10 +271,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="BPMNShape_1ipvtcp" bpmnElement="Gateway_0z5gz96" isMarkerVisible="true"> <dc:Bounds x="1315" y="335" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_06ufst4" bpmnElement="LogSendError"> - <dc:Bounds x="1600" y="500" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0zk1xt7" bpmnElement="Gateway_09z7b0z" isMarkerVisible="true"> <dc:Bounds x="1755" y="425" width="50" height="50" /> </bpmndi:BPMNShape> @@ -368,17 +359,13 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0ffsn0i" bpmnElement="Flow_101sqed"> <di:waypoint x="1340" y="385" /> - <di:waypoint x="1340" y="540" /> - <di:waypoint x="1600" y="540" /> + <di:waypoint x="1340" y="560" /> + <di:waypoint x="1780" y="560" /> + <di:waypoint x="1780" y="475" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1265" y="506" width="70" height="27" /> + <dc:Bounds x="1265" y="524" width="70" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1va7dmx" bpmnElement="Flow_16ssf4a"> - <di:waypoint x="1700" y="540" /> - <di:waypoint x="1780" y="540" /> - <di:waypoint x="1780" y="475" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1ce9w6g" bpmnElement="Flow_1ho1hys"> <di:waypoint x="1805" y="450" /> <di:waypoint x="1862" y="450" /> @@ -486,7 +473,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0ne04k7" bpmnElement="TextAnnotation_0dhecha"> - <dc:Bounds x="400" y="220" width="419.98765969802554" height="69.68641114982579" /> + <dc:Bounds x="400" y="220" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> From 4d72e2b4dcf70dbec4f37bf3cecc8aa9f42041f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 18:20:19 +0100 Subject: [PATCH 169/382] Added NetworkSpeedCalculator. Changed PingStatusGenerator and TaskProfileTest to use BigDecimal instead of integer for download speeds as this was intended by the FHIR resources in the first place --- .../bpe/util/task/NetworkSpeedCalculator.java | 27 +++++++++++++++++++ .../output/generator/PingStatusGenerator.java | 23 ++++++++-------- .../dsf/fhir/profiles/TaskProfileTest.java | 7 ++--- 3 files changed, 43 insertions(+), 14 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java new file mode 100644 index 00000000..fc449e68 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -0,0 +1,27 @@ +package dev.dsf.bpe.util.task; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +import dev.dsf.bpe.ConstantsPing; + +public class NetworkSpeedCalculator +{ + public static BigDecimal calculate(int bytes, long duration, String unit) + { + return switch (unit) + { + case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND -> + new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); + case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND -> + new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(1000000), RoundingMode.UNNECESSARY) + .divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); + case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND -> + new BigDecimal(bytes).divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); + case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND -> + new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), RoundingMode.UNNECESSARY) + .divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); + default -> new BigDecimal(0); + }; + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index d23ff217..e9f8c50d 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -1,5 +1,6 @@ package dev.dsf.bpe.util.task.output.generator; +import java.math.BigDecimal; import java.util.List; import org.hl7.fhir.r4.model.Coding; @@ -20,8 +21,8 @@ public static TaskOutputComponent createPingStatusOutput(Target target, String s return createPingStatusOutput(target, statusCode, null); } - public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, int downloadSpeed, - int uploadSpeed, String unit) + public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, BigDecimal downloadSpeed, + BigDecimal uploadSpeed, String unit) { return createPingStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } @@ -30,11 +31,11 @@ public static TaskOutputComponent createPingStatusOutput(Target target, String s List<String> errorMessages) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, - errorMessages, -1, -1, null); + errorMessages, null, null, null); } public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, - List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) + List<String> errorMessages, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errorMessages, downloadSpeed, uploadSpeed, unit); @@ -45,8 +46,8 @@ public static TaskOutputComponent createPongStatusOutput(Target target, String s return createPongStatusOutput(target, statusCode, null); } - public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, int downloadSpeed, - int uploadSpeed, String unit) + public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, BigDecimal downloadSpeed, + BigDecimal uploadSpeed, String unit) { return createPongStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } @@ -55,18 +56,18 @@ public static TaskOutputComponent createPongStatusOutput(Target target, String s List<String> errorMessages) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, - errorMessages, -1, -1, null); + errorMessages, null, null, null); } public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, - List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) + List<String> errorMessages, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) { return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errorMessages, downloadSpeed, uploadSpeed, unit); } private static TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, - List<String> errorMessages, int downloadSpeed, int uploadSpeed, String unit) + List<String> errorMessages, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) { TaskOutputComponent output = new TaskOutputComponent(); output.setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); @@ -86,7 +87,7 @@ private static TaskOutputComponent createStatusOutput(Target target, String outp .setValue(new StringType(errorMessage)); } - if (downloadSpeed >= 0 && unit != null) + if (downloadSpeed != null && unit != null) { Extension downloadSpeedExtension = extension.addExtension() .setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); @@ -98,7 +99,7 @@ private static TaskOutputComponent createStatusOutput(Target target, String outp .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } - if (uploadSpeed >= 0 && unit != null) + if (uploadSpeed != null && unit != null) { Extension uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); Extension networkSpeed = uploadSpeedExtension.addExtension() diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index b7acac7c..d5856ee3 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -2,6 +2,7 @@ import static org.junit.Assert.assertEquals; +import java.math.BigDecimal; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -246,7 +247,7 @@ public String getCorrelationKey() Task task = createValidTaskStartPingProcess(); task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); - task.addOutput(new PingStatusGenerator().createPingStatusOutput(target, + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE, List.of("some error message"))); ValidationResult result = resourceValidator.validate(task); @@ -290,8 +291,8 @@ public String getCorrelationKey() Task task = createValidTaskStartPingProcess(); task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); - task.addOutput(new PingStatusGenerator().createPingStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED, 0, 0, + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED, BigDecimal.ZERO, BigDecimal.ZERO, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND)); ValidationResult result = resourceValidator.validate(task); From 0539831cf3c07697ffb1c53d5b8a297a1a1144d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 18:22:33 +0100 Subject: [PATCH 170/382] Added PingPongDeploymentStateListener to validate networkSpeedUnit environment variable and removed the service delegate LogSendError which was forgotten in a previous commit --- .../PingPongDeploymentStateListener.java | 45 +++++++++++++++++++ .../dev/dsf/bpe/service/LogSendError.java | 35 --------------- 2 files changed, 45 insertions(+), 35 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java delete mode 100644 src/main/java/dev/dsf/bpe/service/LogSendError.java diff --git a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java new file mode 100644 index 00000000..c79ff9a2 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java @@ -0,0 +1,45 @@ +package dev.dsf.bpe.listener; + +import java.util.List; +import java.util.Objects; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.spring.config.PingConfig; +import dev.dsf.bpe.v1.ProcessPluginDeploymentStateListener; + +public class PingPongDeploymentStateListener implements ProcessPluginDeploymentStateListener, InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(PingPongDeploymentStateListener.class); + + private final PingConfig pingConfig; + private final String networkSpeedUnit; + + public PingPongDeploymentStateListener(PingConfig pingConfig) + { + this.pingConfig = pingConfig; + this.networkSpeedUnit = pingConfig.getNetworkSpeedUnit(); + } + + @Override + public void onProcessesDeployed(List<String> processes) + { + if (ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES.contains(networkSpeedUnit)) + { + logger.info("Network speed unit is valid: {}", networkSpeedUnit); + } else + { + pingConfig.setNetworkSpeedUnit(ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); + logger.info("Network speed unit \"{}\" is not valid. Valid values are: {}. Defaulting to \"{}\"", networkSpeedUnit, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); + } + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(networkSpeedUnit); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/LogSendError.java b/src/main/java/dev/dsf/bpe/service/LogSendError.java deleted file mode 100644 index ed06bfcc..00000000 --- a/src/main/java/dev/dsf/bpe/service/LogSendError.java +++ /dev/null @@ -1,35 +0,0 @@ -package dev.dsf.bpe.service; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; -import dev.dsf.bpe.v1.variables.Variables; - -public class LogSendError extends AbstractServiceDelegate -{ - private static final Logger logger = LoggerFactory.getLogger(LogSendError.class); - - public LogSendError(ProcessPluginApi api) - { - super(api); - } - - @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception - { - Target target = variables.getTarget(); - String statusCode = (String) execution.getVariableLocal("statusCode"); - String errorMessage = (String) execution.getVariableLocal("errorMessage"); - - logger.warn("Unable to send PING to {} (endpoint: {}): {}", target.getOrganizationIdentifierValue(), - target.getEndpointIdentifierValue(), errorMessage); - - variables.setString("statusCode_" + target.getCorrelationKey(), statusCode); - variables.setString("errorMessage_" + target.getCorrelationKey(), errorMessage); - } -} From 2fead533b5924f29ae9e2f0d77cdff351161c73b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 18:24:11 +0100 Subject: [PATCH 171/382] Added list of dsf ping unit codesystem values to easily validate them. Added missing upload versions of the network transfer information --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 9fcad997..ad574e2a 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -1,5 +1,7 @@ package dev.dsf.bpe; +import java.util.List; + import jakarta.ws.rs.core.MediaType; public final class ConstantsPing @@ -68,6 +70,8 @@ private ConstantsPing() public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND = "megabits-per-second"; public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND = "megabytes-per-second"; + public static final List<String> CODESYSTEM_DSF_PING_UNITS_VALUES = List.of(CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND, CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND, CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND, CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); + public static final String CODESYSTEM_READ_ACCESS_TAG = "http://dsf.dev/fhir/CodeSystem/read-access-tag"; public static final String CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL = "ALL"; @@ -93,6 +97,8 @@ private ConstantsPing() private static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; private static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; public static final String BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER = "targetEndpointIdentifier"; + private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_BYTES = "uploadedBytes"; + private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS = "uploadedDurationMillis"; public static final MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; @@ -137,4 +143,24 @@ public static String getBpmnExecutionVariableDownloadedDurationMillis(String cor { return BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS + "_" + correlationKey; } + + public static String getBpmnExecutionVariableUploadedBytes() + { + return BPMN_EXECUTION_VARIABLE_UPLOADED_BYTES; + } + + public static String getBpmnExecutionVariableUploadedBytes(String correlationKey) + { + return BPMN_EXECUTION_VARIABLE_UPLOADED_BYTES + "_" + correlationKey; + } + + public static String getBpmnExecutionVariableUploadedDurationMillis() + { + return BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS; + } + + public static String getBpmnExecutionVariableUploadedDurationMillis(String correlationKey) + { + return BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS + "_" + correlationKey; + } } From 4ac4c29c76f1027f7e4f57021982235e2f1a7488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 18:26:45 +0100 Subject: [PATCH 172/382] Added networkSpeedUnit environment variable and deployment listener to validate its value. Also changed SaveDownloadSpeeds to SaveDownloadSpeedsPing which was renamed in a previous commit --- .../dev/dsf/bpe/spring/config/PingConfig.java | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 716d36e3..ad000095 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -7,6 +7,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; +import dev.dsf.bpe.listener.PingPongDeploymentStateListener; import dev.dsf.bpe.listener.SetCorrelationKeyListener; import dev.dsf.bpe.mail.ErrorMailService; import dev.dsf.bpe.message.CleanupPong; @@ -25,8 +26,7 @@ import dev.dsf.bpe.service.LogAndStoreSendError; import dev.dsf.bpe.service.LogNoResponse; import dev.dsf.bpe.service.LogPing; -import dev.dsf.bpe.service.LogSendError; -import dev.dsf.bpe.service.SaveDownloadSpeeds; +import dev.dsf.bpe.service.SaveDownloadSpeedsPing; import dev.dsf.bpe.service.SavePong; import dev.dsf.bpe.service.SelectPingTargets; import dev.dsf.bpe.service.SelectPongTarget; @@ -57,10 +57,24 @@ public class PingConfig @Value("${dev.dsf.bpe.ping.maxDownloadSize:10000000}") private long maxDownloadSizeBytes; - @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.", processNames = "dsfdev_ping, dsfdev_pong") + @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.", processNames = {"dsfdev_ping", "dsfdev_pong"}) @Value("${dev.dsf.bpe.ping.maxUploadSize:10000000}") private long maxUploadSizeBytes; + @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values be: \"bits-per-second\", \"bytes-per-second\", \"megabits-per-second\", \"megabytes-per-second\". Default is \"megabytes-per-second\".", processNames = {"dsfdev_ping", "dsfdev_pong"}) + @Value("${dev.dsf.bpe.ping.networkSpeedUnit:megabytes-per-second}") + private String networkSpeedUnit; + + public String getNetworkSpeedUnit() + { + return networkSpeedUnit; + } + + public void setNetworkSpeedUnit(String networkSpeedUnit) + { + this.networkSpeedUnit = networkSpeedUnit; + } + @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SetTargetAndConfigureTimer setTargetAndConfigureTimer() @@ -110,18 +124,11 @@ public LogNoResponse logNoResponse() return new LogNoResponse(api); } - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public LogSendError logSendError() - { - return new LogSendError(api); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public StoreResults savePingResults() { - return new StoreResults(api, errorLogger()); + return new StoreResults(api, errorLogger(), networkSpeedUnit); } @Bean @@ -225,9 +232,9 @@ public LogAndSaveError logAndSaveError() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public SaveDownloadSpeeds saveDownloadSpeeds() + public SaveDownloadSpeedsPing saveDownloadSpeeds() { - return new SaveDownloadSpeeds(api); + return new SaveDownloadSpeedsPing(api); } @Bean @@ -264,4 +271,11 @@ public SetEndpointIdentifier setEndpointIdentifier() { return new SetEndpointIdentifier(api); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public PingPongDeploymentStateListener pingPongDeploymentStateListener() + { + return new PingPongDeploymentStateListener( this); + } } From 1fef2e0b022f44e1f24aacb0082004029de991be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 18:27:07 +0100 Subject: [PATCH 173/382] Added storage logic --- .../dsf/bpe/service/LogAndStoreSendError.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java b/src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java index e66d27ac..22afdd53 100644 --- a/src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java +++ b/src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java @@ -1,12 +1,18 @@ package dev.dsf.bpe.service; +import java.util.List; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class LogAndStoreSendError extends AbstractServiceDelegate @@ -21,6 +27,16 @@ public LogAndStoreSendError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + String statusCode = variables.getString(ConstantsPing.getBpmnExecutionVariableStatusCode()); + String errorMessage = variables.getString(ConstantsPing.getBpmnExecutionVariableErrorMessage()); + Target target = variables.getTarget(); + Task startTask = variables.getStartTask(); + Task.TaskOutputComponent pongStatus = PingStatusGenerator.createPongStatusOutput(variables.getTarget(), + statusCode, List.of(errorMessage)); + startTask.addOutput(pongStatus); + variables.updateTask(startTask); + logger.error("Error {} when trying to download resource from {}: {}", statusCode, + target.getEndpointIdentifierValue(), errorMessage); } } From c0886a3bbaa690bdd5d23a017ea97deb4ed398b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 12 Mar 2025 18:45:08 +0100 Subject: [PATCH 174/382] Now adds information on network speeds to task output --- .../dev/dsf/bpe/service/StoreResults.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/StoreResults.java b/src/main/java/dev/dsf/bpe/service/StoreResults.java index ad2361c8..d6e75dc3 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResults.java @@ -1,5 +1,6 @@ package dev.dsf.bpe.service; +import java.math.BigDecimal; import java.util.Comparator; import java.util.List; import java.util.Objects; @@ -11,6 +12,8 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; +import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -21,11 +24,12 @@ public class StoreResults extends AbstractServiceDelegate implements InitializingBean { private final ErrorMailService errorMailService; + private final String networkSpeedUnit; - public StoreResults(ProcessPluginApi api, ErrorMailService errorMailService) + public StoreResults(ProcessPluginApi api, ErrorMailService errorMailService, String networkSpeedUnit) { super(api); - + this.networkSpeedUnit = networkSpeedUnit; this.errorMailService = errorMailService; } @@ -62,6 +66,23 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statu } else { + int downloadResourceSizeBytes = variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + List<String> errorMessageList = ErrorMessageListUtils.getErrorMessageList(execution); + if (downloadResourceSizeBytes >= 0) + { + int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); + long downloadedDurationMillis = variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); + + BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit); + + int uploadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey)); + long uploadedDurationMillis = variables.getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey)); + + BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit); + + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList, downloadSpeed, uploadSpeed, networkSpeedUnit)); + } + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode)); if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(statusCode)) From c16cd1f026a41f4aa3983328a4e0c2a28de44891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 09:43:32 +0100 Subject: [PATCH 175/382] Rearranged the end of the process. Previously, download speeds only got stored if cleanup pong got received or timed out. This did not cover the case where pong is able to download a resource from ping but Send Pong runs e.g. into a network error. In this case, the download speed of the download from ping should still be stored. --- src/main/resources/bpe/pong.bpmn | 204 ++++++++++++++++--------------- 1 file changed, 108 insertions(+), 96 deletions(-) diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 04d7095b..0a076baa 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -50,7 +50,7 @@ </bpmn:exclusiveGateway> <bpmn:serviceTask id="Activity_0t0ex36" name="Log And Store Send Error" camunda:class="dev.dsf.bpe.service.LogAndStoreSendError"> <bpmn:incoming>Flow_0h8flp6</bpmn:incoming> - <bpmn:outgoing>Flow_05ucfds</bpmn:outgoing> + <bpmn:outgoing>Flow_0n07rwm</bpmn:outgoing> </bpmn:serviceTask> <bpmn:eventBasedGateway id="Gateway_1l5dkpz"> <bpmn:incoming>Flow_1bzjspe</bpmn:incoming> @@ -59,25 +59,16 @@ </bpmn:eventBasedGateway> <bpmn:intermediateCatchEvent id="Event_1xvd4tr" name="Cleanup"> <bpmn:incoming>Flow_0rj915n</bpmn:incoming> - <bpmn:outgoing>Flow_0cl2bet</bpmn:outgoing> + <bpmn:outgoing>Flow_1ttsk1o</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_1o3wlnx" messageRef="Message_2m36ftq" /> </bpmn:intermediateCatchEvent> <bpmn:intermediateCatchEvent id="Event_0o4l2t4"> <bpmn:incoming>Flow_17x98wg</bpmn:incoming> - <bpmn:outgoing>Flow_0wy02qe</bpmn:outgoing> + <bpmn:outgoing>Flow_1xfk4ds</bpmn:outgoing> <bpmn:timerEventDefinition id="TimerEventDefinition_0a3j29a"> <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">${cleanupTimerDuration}</bpmn:timeDuration> </bpmn:timerEventDefinition> </bpmn:intermediateCatchEvent> - <bpmn:exclusiveGateway id="Gateway_1uvkqh3"> - <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> - <bpmn:incoming>Flow_05ucfds</bpmn:incoming> - <bpmn:outgoing>Flow_1qzb40k</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:endEvent id="Event_0i1din5"> - <bpmn:incoming>Flow_1qzb40k</bpmn:incoming> - <bpmn:incoming>Flow_1qg0rto</bpmn:incoming> - </bpmn:endEvent> <bpmn:exclusiveGateway id="Gateway_0fvmtve"> <bpmn:incoming>Flow_0zphif7</bpmn:incoming> <bpmn:incoming>Flow_1jehvly</bpmn:incoming> @@ -91,12 +82,13 @@ <bpmn:incoming>Flow_0yr2pmf</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="Activity_0otptjn" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> - <bpmn:incoming>Flow_0wy02qe</bpmn:incoming> <bpmn:incoming>Flow_165e73u</bpmn:incoming> - <bpmn:outgoing>Flow_1qg0rto</bpmn:outgoing> + <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> + <bpmn:outgoing>Flow_0zib7wr</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Activity_0mwyelp" name="Store Download Speeds" camunda:class="dev.dsf.bpe.service.StoreDownloadSpeeds"> - <bpmn:incoming>Flow_0cl2bet</bpmn:incoming> + <bpmn:incoming>Flow_0n07rwm</bpmn:incoming> + <bpmn:incoming>Flow_1i7f29l</bpmn:incoming> <bpmn:outgoing>Flow_165e73u</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Activity_04mv5cn" name="Store Resource" camunda:class="dev.dsf.bpe.service.StoreResource"> @@ -133,16 +125,11 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'not-reachable'}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1bzjspe" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1l5dkpz" /> - <bpmn:sequenceFlow id="Flow_00t1ck1" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1uvkqh3"> + <bpmn:sequenceFlow id="Flow_00t1ck1" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0otptjn"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_05ucfds" sourceRef="Activity_0t0ex36" targetRef="Gateway_1uvkqh3" /> <bpmn:sequenceFlow id="Flow_0rj915n" sourceRef="Gateway_1l5dkpz" targetRef="Event_1xvd4tr" /> <bpmn:sequenceFlow id="Flow_17x98wg" sourceRef="Gateway_1l5dkpz" targetRef="Event_0o4l2t4" /> - <bpmn:sequenceFlow id="Flow_0cl2bet" sourceRef="Event_1xvd4tr" targetRef="Activity_0mwyelp" /> - <bpmn:sequenceFlow id="Flow_0wy02qe" sourceRef="Event_0o4l2t4" targetRef="Activity_0otptjn" /> - <bpmn:sequenceFlow id="Flow_1qzb40k" sourceRef="Gateway_1uvkqh3" targetRef="Event_0i1din5" /> - <bpmn:sequenceFlow id="Flow_1qg0rto" sourceRef="Activity_0otptjn" targetRef="Event_0i1din5" /> <bpmn:sequenceFlow id="Flow_1jehvly" sourceRef="Activity_1umihbr" targetRef="Gateway_0fvmtve" /> <bpmn:sequenceFlow id="Flow_0x7t1ii" sourceRef="Gateway_0fvmtve" targetRef="Activity_1m4wavi" /> <bpmn:sequenceFlow id="Flow_0uj7rm3" sourceRef="Event_0olr5yw" targetRef="Activity_1umihbr" /> @@ -154,13 +141,31 @@ <bpmn:incoming>Flow_19b3cp4</bpmn:incoming> <bpmn:outgoing>Flow_1oo1n55</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_19b3cp4" sourceRef="PingMessageStartEvent" targetRef="Activity_1wdftvk" /> <bpmn:serviceTask id="Activity_13ypt7i" name="Set Endpoint Identifier" camunda:class="dev.dsf.bpe.service.SetEndpointIdentifier"> <bpmn:incoming>Flow_1oo1n55</bpmn:incoming> <bpmn:outgoing>Flow_0i7mizy</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1oo1n55" sourceRef="Activity_1wdftvk" targetRef="Activity_13ypt7i" /> <bpmn:sequenceFlow id="Flow_0i7mizy" sourceRef="Activity_13ypt7i" targetRef="Gateway_1jwjxzn" /> + <bpmn:endEvent id="Event_0i1din5"> + <bpmn:incoming>Flow_0zib7wr</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="Flow_19b3cp4" sourceRef="PingMessageStartEvent" targetRef="Activity_1wdftvk" /> + <bpmn:sequenceFlow id="Flow_0zib7wr" sourceRef="Activity_0otptjn" targetRef="Event_0i1din5" /> + <bpmn:sequenceFlow id="Flow_0n07rwm" sourceRef="Activity_0t0ex36" targetRef="Activity_0mwyelp" /> + <bpmn:exclusiveGateway id="Gateway_1wktaap"> + <bpmn:incoming>Flow_1xfk4ds</bpmn:incoming> + <bpmn:incoming>Flow_1eh8lho</bpmn:incoming> + <bpmn:outgoing>Flow_1i7f29l</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_1xfk4ds" sourceRef="Event_0o4l2t4" targetRef="Gateway_1wktaap" /> + <bpmn:sequenceFlow id="Flow_1i7f29l" sourceRef="Gateway_1wktaap" targetRef="Activity_0mwyelp" /> + <bpmn:sequenceFlow id="Flow_1ttsk1o" sourceRef="Event_1xvd4tr" targetRef="Activity_1gd1tfz" /> + <bpmn:serviceTask id="Activity_1gd1tfz" name="Save Download Speeds" camunda:class="dev.dsf.bpe.service.SaveDownloadSpeedsPong"> + <bpmn:incoming>Flow_1ttsk1o</bpmn:incoming> + <bpmn:outgoing>Flow_1eh8lho</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1eh8lho" sourceRef="Activity_1gd1tfz" targetRef="Gateway_1wktaap" /> <bpmn:textAnnotation id="TextAnnotation_02e4h2c"> <bpmn:text>Log = logger Save = save as execution variable @@ -204,6 +209,16 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> + <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> + <dc:Bounds x="2818" y="439" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> + <dc:Bounds x="152" y="292" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="335" width="21" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1jwjxzn_di" bpmnElement="Gateway_1jwjxzn" isMarkerVisible="true"> <dc:Bounds x="575" y="285" width="50" height="50" /> </bpmndi:BPMNShape> @@ -229,10 +244,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Gateway_0eiy9fm_di" bpmnElement="Gateway_0eiy9fm" isMarkerVisible="true"> <dc:Bounds x="2145" y="285" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_02b3m47_di" bpmnElement="Activity_0t0ex36"> - <dc:Bounds x="2260" y="270" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_12p2jrx_di" bpmnElement="Gateway_1l5dkpz"> <dc:Bounds x="2145" y="385" width="50" height="50" /> </bpmndi:BPMNShape> @@ -245,12 +256,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Event_0o4l2t4_di" bpmnElement="Event_0o4l2t4"> <dc:Bounds x="2392" y="482" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_1uvkqh3_di" bpmnElement="Gateway_1uvkqh3" isMarkerVisible="true"> - <dc:Bounds x="2455" y="285" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> - <dc:Bounds x="2752" y="292" width="36" height="36" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> <dc:Bounds x="955" y="435" width="50" height="50" /> </bpmndi:BPMNShape> @@ -261,13 +266,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Event_05zzvx3_di" bpmnElement="Event_1qh25on"> <dc:Bounds x="1862" y="595" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> - <dc:Bounds x="2640" y="370" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1xbj20p_di" bpmnElement="Activity_0mwyelp"> - <dc:Bounds x="2480" y="370" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1ouj7x3_di" bpmnElement="Activity_04mv5cn"> <dc:Bounds x="1250" y="420" width="100" height="80" /> </bpmndi:BPMNShape> @@ -278,6 +276,13 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Activity_06klx97_di" bpmnElement="Activity_0xcqxjs"> <dc:Bounds x="1410" y="420" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> + <dc:Bounds x="270" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> + <dc:Bounds x="430" y="270" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> <dc:Bounds x="280" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> @@ -290,10 +295,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1910" y="439" width="250" height="84" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> - <dc:Bounds x="2680" y="533" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> <dc:Bounds x="1420" y="543" width="275" height="41" /> <bpmndi:BPMNLabel /> @@ -306,29 +307,41 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="400" y="183" width="585" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> - <dc:Bounds x="152" y="292" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="160" y="335" width="21" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> + <dc:Bounds x="2820" y="270" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> - <dc:Bounds x="270" y="270" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_1xbj20p_di" bpmnElement="Activity_0mwyelp"> + <dc:Bounds x="2660" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> - <dc:Bounds x="430" y="270" width="100" height="80" /> + <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> + <dc:Bounds x="2962" y="292" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_02b3m47_di" bpmnElement="Activity_0t0ex36"> + <dc:Bounds x="2370" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1wktaap_di" bpmnElement="Gateway_1wktaap" isMarkerVisible="true"> + <dc:Bounds x="2685" y="385" width="50" height="50" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0ntyg74_di" bpmnElement="Activity_1gd1tfz"> + <dc:Bounds x="2510" y="370" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> + <di:waypoint x="2870" y="350" /> + <di:waypoint x="2870" y="439" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> <dc:Bounds x="1862" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1900" y="363" width="86" height="14" /> + <dc:Bounds x="1900" y="363" width="87" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_14ee8kb" bpmnElement="Event_0olr5yw"> <dc:Bounds x="732" y="482" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="770" y="516" width="82" height="27" /> + <dc:Bounds x="770" y="516" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> @@ -367,7 +380,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0h8flp6_di" bpmnElement="Flow_0h8flp6"> <di:waypoint x="2195" y="310" /> - <di:waypoint x="2260" y="310" /> + <di:waypoint x="2370" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1bzjspe_di" bpmnElement="Flow_1bzjspe"> <di:waypoint x="2170" y="335" /> @@ -376,12 +389,8 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNEdge id="Flow_00t1ck1_di" bpmnElement="Flow_00t1ck1"> <di:waypoint x="2170" y="285" /> <di:waypoint x="2170" y="250" /> - <di:waypoint x="2480" y="250" /> - <di:waypoint x="2480" y="285" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_05ucfds_di" bpmnElement="Flow_05ucfds"> - <di:waypoint x="2360" y="310" /> - <di:waypoint x="2455" y="310" /> + <di:waypoint x="2870" y="250" /> + <di:waypoint x="2870" y="270" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0rj915n_di" bpmnElement="Flow_0rj915n"> <di:waypoint x="2195" y="410" /> @@ -392,24 +401,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2170" y="500" /> <di:waypoint x="2392" y="500" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0cl2bet_di" bpmnElement="Flow_0cl2bet"> - <di:waypoint x="2428" y="410" /> - <di:waypoint x="2480" y="410" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0wy02qe_di" bpmnElement="Flow_0wy02qe"> - <di:waypoint x="2428" y="500" /> - <di:waypoint x="2690" y="500" /> - <di:waypoint x="2690" y="450" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1qzb40k_di" bpmnElement="Flow_1qzb40k"> - <di:waypoint x="2505" y="310" /> - <di:waypoint x="2752" y="310" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1qg0rto_di" bpmnElement="Flow_1qg0rto"> - <di:waypoint x="2740" y="410" /> - <di:waypoint x="2770" y="410" /> - <di:waypoint x="2770" y="328" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> <di:waypoint x="940" y="580" /> <di:waypoint x="980" y="580" /> @@ -428,10 +419,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1880" y="368" /> <di:waypoint x="1880" y="595" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_165e73u_di" bpmnElement="Flow_165e73u"> - <di:waypoint x="2580" y="410" /> - <di:waypoint x="2640" y="410" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> <di:waypoint x="1190" y="460" /> <di:waypoint x="1250" y="460" /> @@ -440,6 +427,18 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1350" y="460" /> <di:waypoint x="1410" y="460" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> + <di:waypoint x="188" y="310" /> + <di:waypoint x="270" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> + <di:waypoint x="370" y="310" /> + <di:waypoint x="430" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0i7mizy_di" bpmnElement="Flow_0i7mizy"> + <di:waypoint x="530" y="310" /> + <di:waypoint x="575" y="310" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> <di:waypoint x="722" y="420" /> <di:waypoint x="738" y="390" /> @@ -448,10 +447,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1996" y="350" /> <di:waypoint x="1965" y="439" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2702" y="450" /> - <di:waypoint x="2726" y="533" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> <di:waypoint x="1128" y="544" /> <di:waypoint x="1134" y="500" /> @@ -460,17 +455,34 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1464" y="500" /> <di:waypoint x="1469" y="543" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> - <di:waypoint x="188" y="310" /> - <di:waypoint x="270" y="310" /> + <bpmndi:BPMNEdge id="Flow_165e73u_di" bpmnElement="Flow_165e73u"> + <di:waypoint x="2760" y="310" /> + <di:waypoint x="2820" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> - <di:waypoint x="370" y="310" /> - <di:waypoint x="430" y="310" /> + <bpmndi:BPMNEdge id="Flow_0zib7wr_di" bpmnElement="Flow_0zib7wr"> + <di:waypoint x="2920" y="310" /> + <di:waypoint x="2962" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0i7mizy_di" bpmnElement="Flow_0i7mizy"> - <di:waypoint x="530" y="310" /> - <di:waypoint x="575" y="310" /> + <bpmndi:BPMNEdge id="Flow_0n07rwm_di" bpmnElement="Flow_0n07rwm"> + <di:waypoint x="2470" y="310" /> + <di:waypoint x="2660" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1xfk4ds_di" bpmnElement="Flow_1xfk4ds"> + <di:waypoint x="2428" y="500" /> + <di:waypoint x="2710" y="500" /> + <di:waypoint x="2710" y="435" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1i7f29l_di" bpmnElement="Flow_1i7f29l"> + <di:waypoint x="2710" y="385" /> + <di:waypoint x="2710" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1ttsk1o_di" bpmnElement="Flow_1ttsk1o"> + <di:waypoint x="2428" y="410" /> + <di:waypoint x="2510" y="410" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1eh8lho_di" bpmnElement="Flow_1eh8lho"> + <di:waypoint x="2610" y="410" /> + <di:waypoint x="2685" y="410" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> From 5c55e9fd89eda044bf83664b76ce925304f6cde2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 09:50:08 +0100 Subject: [PATCH 176/382] Renamed "Save Download Speeds" in pong.bpmn to "Save Upload Speeds" because actual download speeds get saved by "Download Resource and Measure Speed". Also added a service delegate for "Save Upload Speeds" --- .../dev/dsf/bpe/service/SaveUploadSpeeds.java | 22 +++++++++++++++++++ src/main/resources/bpe/pong.bpmn | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/main/java/dev/dsf/bpe/service/SaveUploadSpeeds.java diff --git a/src/main/java/dev/dsf/bpe/service/SaveUploadSpeeds.java b/src/main/java/dev/dsf/bpe/service/SaveUploadSpeeds.java new file mode 100644 index 00000000..d8f9be8e --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/SaveUploadSpeeds.java @@ -0,0 +1,22 @@ +package dev.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class SaveUploadSpeeds extends AbstractServiceDelegate +{ + public SaveUploadSpeeds(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + { + + } +} diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 0a076baa..bcf10280 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -161,7 +161,7 @@ <bpmn:sequenceFlow id="Flow_1xfk4ds" sourceRef="Event_0o4l2t4" targetRef="Gateway_1wktaap" /> <bpmn:sequenceFlow id="Flow_1i7f29l" sourceRef="Gateway_1wktaap" targetRef="Activity_0mwyelp" /> <bpmn:sequenceFlow id="Flow_1ttsk1o" sourceRef="Event_1xvd4tr" targetRef="Activity_1gd1tfz" /> - <bpmn:serviceTask id="Activity_1gd1tfz" name="Save Download Speeds" camunda:class="dev.dsf.bpe.service.SaveDownloadSpeedsPong"> + <bpmn:serviceTask id="Activity_1gd1tfz" name="Save Upload Speeds" camunda:class="dev.dsf.bpe.service.SaveUploadSpeeds"> <bpmn:incoming>Flow_1ttsk1o</bpmn:incoming> <bpmn:outgoing>Flow_1eh8lho</bpmn:outgoing> </bpmn:serviceTask> From 033da5fe615612b9a491c4ca38911de4f75961bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 09:50:57 +0100 Subject: [PATCH 177/382] Removed "Save Download Speeds" because this is already done in "Download Resource And Measure Speed" --- .../bpe/service/SaveDownloadSpeedsPing.java | 26 ---- .../dev/dsf/bpe/spring/config/PingConfig.java | 8 -- src/main/resources/bpe/ping.bpmn | 125 ++++++++---------- 3 files changed, 56 insertions(+), 103 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/service/SaveDownloadSpeedsPing.java diff --git a/src/main/java/dev/dsf/bpe/service/SaveDownloadSpeedsPing.java b/src/main/java/dev/dsf/bpe/service/SaveDownloadSpeedsPing.java deleted file mode 100644 index 9a2b4f02..00000000 --- a/src/main/java/dev/dsf/bpe/service/SaveDownloadSpeedsPing.java +++ /dev/null @@ -1,26 +0,0 @@ -package dev.dsf.bpe.service; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Variables; - -public class SaveDownloadSpeedsPing extends AbstractServiceDelegate -{ - private static final Logger logger = LoggerFactory.getLogger(SaveDownloadSpeedsPing.class); - - public SaveDownloadSpeedsPing(ProcessPluginApi api) - { - super(api); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception - { - logger.info("Saving download speeds as execution variable"); - } -} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index ad000095..d2dae86f 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -26,7 +26,6 @@ import dev.dsf.bpe.service.LogAndStoreSendError; import dev.dsf.bpe.service.LogNoResponse; import dev.dsf.bpe.service.LogPing; -import dev.dsf.bpe.service.SaveDownloadSpeedsPing; import dev.dsf.bpe.service.SavePong; import dev.dsf.bpe.service.SelectPingTargets; import dev.dsf.bpe.service.SelectPongTarget; @@ -230,13 +229,6 @@ public LogAndSaveError logAndSaveError() return new LogAndSaveError(api); } - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public SaveDownloadSpeedsPing saveDownloadSpeeds() - { - return new SaveDownloadSpeedsPing(api); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public StoreDownloadSpeeds storeDownloadSpeeds() diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index ca0796fa..ce9e5b59 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -101,7 +101,7 @@ </bpmn:serviceTask> <bpmn:exclusiveGateway id="Gateway_02orad4"> <bpmn:incoming>Flow_13u1nzy</bpmn:incoming> - <bpmn:incoming>Flow_0n0yrky</bpmn:incoming> + <bpmn:incoming>Flow_0klalf8</bpmn:incoming> <bpmn:outgoing>Flow_03nx6rk</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:endEvent id="Event_1foycg9" camunda:asyncAfter="true"> @@ -132,12 +132,7 @@ <bpmn:sequenceFlow id="Flow_1v37fff" sourceRef="Activity_0h9o9u7" targetRef="Activity_0vw65a2" /> <bpmn:sequenceFlow id="Flow_0jcfur3" sourceRef="Activity_0akr23c" targetRef="Activity_0vw65a2" /> <bpmn:sequenceFlow id="Flow_10h6pqh" sourceRef="Event_0i4slcz" targetRef="Activity_0akr23c" /> - <bpmn:serviceTask id="Activity_0i9uqk0" name="Save Download Speeds" camunda:class="dev.dsf.bpe.service.SaveDownloadSpeedsPing"> - <bpmn:incoming>Flow_0klalf8</bpmn:incoming> - <bpmn:outgoing>Flow_0n0yrky</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0klalf8" sourceRef="Activity_0vw65a2" targetRef="Activity_0i9uqk0" /> - <bpmn:sequenceFlow id="Flow_0n0yrky" sourceRef="Activity_0i9uqk0" targetRef="Gateway_02orad4" /> + <bpmn:sequenceFlow id="Flow_0klalf8" sourceRef="Activity_0vw65a2" targetRef="Gateway_02orad4" /> <bpmn:sequenceFlow id="Flow_1ewmc79" sourceRef="PongCatchEvent" targetRef="Activity_081me01" /> <bpmn:serviceTask id="Activity_081me01" name="Save Pong" camunda:class="dev.dsf.bpe.service.SavePong"> <bpmn:incoming>Flow_1ewmc79</bpmn:incoming> @@ -243,8 +238,30 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> + <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> + <dc:Bounds x="2990" y="239" width="160" height="49" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> + <dc:Bounds x="2920" y="490" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> + <dc:Bounds x="2920" y="330" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> + <dc:Bounds x="3050" y="330" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> + <dc:Bounds x="3172" y="352" width="36" height="36" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> - <dc:Bounds x="1040" y="180" width="1930" height="560" /> + <dc:Bounds x="1040" y="180" width="1820" height="560" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> + <dc:Bounds x="2580" y="612" width="240" height="55" /> + <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0qz7nye" bpmnElement="SubProcessStartEvent"> <dc:Bounds x="1062" y="342" width="36" height="36" /> @@ -296,16 +313,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2210" y="600" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> - <dc:Bounds x="2815" y="335" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> - <dc:Bounds x="2912" y="342" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1p3zvup" bpmnElement="Activity_0i9uqk0"> - <dc:Bounds x="2700" y="480" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_187dy31_di" bpmnElement="Activity_081me01"> <dc:Bounds x="1820" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -314,14 +321,20 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1270" y="220" width="250" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> - <dc:Bounds x="2660" y="612" width="240" height="55" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> <dc:Bounds x="1980" y="622" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> + <dc:Bounds x="2685" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> + <dc:Bounds x="2772" y="342" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> + <di:waypoint x="2602" y="559" /> + <di:waypoint x="2660" y="612" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_0968qvb" bpmnElement="Event_0i4slcz"> <dc:Bounds x="2152" y="542" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -372,7 +385,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1iq5cwe" bpmnElement="Flow_13u1nzy"> <di:waypoint x="2015" y="360" /> - <di:waypoint x="2815" y="360" /> + <di:waypoint x="2685" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1skpxus" bpmnElement="Flow_1yt9547"> <di:waypoint x="1990" y="385" /> @@ -395,17 +408,13 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2210" y="640" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0v8dcpi" bpmnElement="Flow_03nx6rk"> - <di:waypoint x="2865" y="360" /> - <di:waypoint x="2912" y="360" /> + <di:waypoint x="2735" y="360" /> + <di:waypoint x="2772" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0klalf8_di" bpmnElement="Flow_0klalf8"> <di:waypoint x="2610" y="520" /> - <di:waypoint x="2700" y="520" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0n0yrky_di" bpmnElement="Flow_0n0yrky"> - <di:waypoint x="2800" y="520" /> - <di:waypoint x="2840" y="520" /> - <di:waypoint x="2840" y="385" /> + <di:waypoint x="2710" y="520" /> + <di:waypoint x="2710" y="385" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ewmc79_di" bpmnElement="Flow_1ewmc79"> <di:waypoint x="1748" y="360" /> @@ -419,10 +428,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1252" y="320" /> <di:waypoint x="1276" y="290" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> - <di:waypoint x="2610" y="550" /> - <di:waypoint x="2716" y="612" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> <di:waypoint x="2074" y="622" /> <di:waypoint x="2102" y="560" /> @@ -434,16 +439,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="530" y="460" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> - <dc:Bounds x="3030" y="330" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> - <dc:Bounds x="3160" y="330" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> - <dc:Bounds x="3282" y="352" width="36" height="36" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0ob9la3" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> <dc:Bounds x="815" y="335" width="50" height="50" /> </bpmndi:BPMNShape> @@ -464,10 +459,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="260" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> - <dc:Bounds x="3100" y="239" width="160" height="49" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0o5toqz" bpmnElement="TextAnnotation_1j1ytqy"> <dc:Bounds x="430" y="580" width="170" height="40" /> <bpmndi:BPMNLabel /> @@ -476,21 +467,25 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="400" y="220" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> - <dc:Bounds x="3030" y="490" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> <dc:Bounds x="230" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> + <di:waypoint x="3013" y="490" /> + <di:waypoint x="2984" y="410" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> + <di:waypoint x="3079" y="330" /> + <di:waypoint x="3058" y="288" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_09zmq8d" bpmnElement="Flow_0j92st0"> <di:waypoint x="1000" y="360" /> <di:waypoint x="1040" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_036wiw0" bpmnElement="Flow_1bfs68o"> - <di:waypoint x="2970" y="370" /> - <di:waypoint x="3030" y="370" /> + <di:waypoint x="2860" y="370" /> + <di:waypoint x="2920" y="370" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1ttfs4u" bpmnElement="Flow_1qz7z39"> <di:waypoint x="630" y="500" /> @@ -506,14 +501,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="460" y="500" /> <di:waypoint x="530" y="500" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1fbz0br" bpmnElement="Flow_0gubpgz"> - <di:waypoint x="3130" y="370" /> - <di:waypoint x="3160" y="370" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_00ieeud" bpmnElement="Flow_1du5wys"> - <di:waypoint x="3260" y="370" /> - <di:waypoint x="3282" y="370" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0t4fqb7" bpmnElement="Flow_0iuuyo1"> <di:waypoint x="485" y="360" /> <di:waypoint x="815" y="360" /> @@ -534,13 +521,13 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="539" y="540" /> <di:waypoint x="498" y="580" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> - <di:waypoint x="3123" y="490" /> - <di:waypoint x="3094" y="410" /> + <bpmndi:BPMNEdge id="BPMNEdge_1fbz0br" bpmnElement="Flow_0gubpgz"> + <di:waypoint x="3020" y="370" /> + <di:waypoint x="3050" y="370" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> - <di:waypoint x="3189" y="330" /> - <di:waypoint x="3168" y="288" /> + <bpmndi:BPMNEdge id="BPMNEdge_00ieeud" bpmnElement="Flow_1du5wys"> + <di:waypoint x="3150" y="370" /> + <di:waypoint x="3172" y="370" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> From f63554d7174aacedbe90bb26725b612c7dc25940 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 10:31:03 +0100 Subject: [PATCH 178/382] Moved service delegates into more appropriate packages --- .../SetTargetAndConfigureTimer.java | 2 +- ...adResourceAndMeasureSpeedInSubProcess.java | 2 +- .../service/{ => ping}/LogAndSaveError.java | 2 +- .../{ => ping}/LogAndSaveNoResponse.java | 3 +- .../bpe/service/{ => ping}/LogNoResponse.java | 2 +- .../dsf/bpe/service/{ => ping}/LogPing.java | 2 +- .../dsf/bpe/service/{ => ping}/SavePong.java | 6 +--- .../service/{ => ping}/SelectPingTargets.java | 2 +- .../bpe/service/{ => ping}/StoreResults.java | 2 +- .../DownloadResourceAndMeasureSpeed.java | 2 +- .../EstimateCleanupTimerDuration.java | 2 +- .../{ => pong}/LogAndSaveAndStoreError.java | 2 +- .../{ => pong}/LogAndStoreSendError.java | 2 +- .../service/{ => pong}/SaveUploadSpeeds.java | 2 +- .../service/{ => pong}/SelectPongTarget.java | 4 +-- .../{ => pong}/SetEndpointIdentifier.java | 2 +- .../{ => pong}/StoreDownloadSpeeds.java | 2 +- .../dev/dsf/bpe/spring/config/PingConfig.java | 32 +++++++++---------- src/main/resources/bpe/ping-autostart.bpmn | 2 +- src/main/resources/bpe/ping.bpmn | 12 +++---- src/main/resources/bpe/pong.bpmn | 18 +++++------ 21 files changed, 49 insertions(+), 56 deletions(-) rename src/main/java/dev/dsf/bpe/service/{ => autostart}/SetTargetAndConfigureTimer.java (97%) rename src/main/java/dev/dsf/bpe/service/{ => ping}/DownloadResourceAndMeasureSpeedInSubProcess.java (98%) rename src/main/java/dev/dsf/bpe/service/{ => ping}/LogAndSaveError.java (95%) rename src/main/java/dev/dsf/bpe/service/{ => ping}/LogAndSaveNoResponse.java (94%) rename src/main/java/dev/dsf/bpe/service/{ => ping}/LogNoResponse.java (96%) rename src/main/java/dev/dsf/bpe/service/{ => ping}/LogPing.java (97%) rename src/main/java/dev/dsf/bpe/service/{ => ping}/SavePong.java (94%) rename src/main/java/dev/dsf/bpe/service/{ => ping}/SelectPingTargets.java (99%) rename src/main/java/dev/dsf/bpe/service/{ => ping}/StoreResults.java (99%) rename src/main/java/dev/dsf/bpe/service/{ => pong}/DownloadResourceAndMeasureSpeed.java (97%) rename src/main/java/dev/dsf/bpe/service/{ => pong}/EstimateCleanupTimerDuration.java (97%) rename src/main/java/dev/dsf/bpe/service/{ => pong}/LogAndSaveAndStoreError.java (95%) rename src/main/java/dev/dsf/bpe/service/{ => pong}/LogAndStoreSendError.java (97%) rename src/main/java/dev/dsf/bpe/service/{ => pong}/SaveUploadSpeeds.java (93%) rename src/main/java/dev/dsf/bpe/service/{ => pong}/SelectPongTarget.java (94%) rename src/main/java/dev/dsf/bpe/service/{ => pong}/SetEndpointIdentifier.java (97%) rename src/main/java/dev/dsf/bpe/service/{ => pong}/StoreDownloadSpeeds.java (95%) diff --git a/src/main/java/dev/dsf/bpe/service/SetTargetAndConfigureTimer.java b/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java similarity index 97% rename from src/main/java/dev/dsf/bpe/service/SetTargetAndConfigureTimer.java rename to src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java index 4df0f1a4..a594a7e1 100644 --- a/src/main/java/dev/dsf/bpe/service/SetTargetAndConfigureTimer.java +++ b/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.autostart; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java similarity index 98% rename from src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java rename to src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index ec04b993..7fffe2fe 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.ping; import static dev.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST; diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java similarity index 95% rename from src/main/java/dev/dsf/bpe/service/LogAndSaveError.java rename to src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index 5df5bb70..bdc2b485 100644 --- a/src/main/java/dev/dsf/bpe/service/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.ping; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java similarity index 94% rename from src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java rename to src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java index 614e94ea..52b3cea8 100644 --- a/src/main/java/dev/dsf/bpe/service/LogAndSaveNoResponse.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java @@ -1,8 +1,7 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.ping; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/dev/dsf/bpe/service/LogNoResponse.java b/src/main/java/dev/dsf/bpe/service/ping/LogNoResponse.java similarity index 96% rename from src/main/java/dev/dsf/bpe/service/LogNoResponse.java rename to src/main/java/dev/dsf/bpe/service/ping/LogNoResponse.java index b8ec0cc3..0ac38022 100644 --- a/src/main/java/dev/dsf/bpe/service/LogNoResponse.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogNoResponse.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.ping; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/service/LogPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogPing.java similarity index 97% rename from src/main/java/dev/dsf/bpe/service/LogPing.java rename to src/main/java/dev/dsf/bpe/service/ping/LogPing.java index cbfc2867..98fc5450 100644 --- a/src/main/java/dev/dsf/bpe/service/LogPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogPing.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.ping; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/service/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java similarity index 94% rename from src/main/java/dev/dsf/bpe/service/SavePong.java rename to src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 7adbb4ca..9e9cf355 100644 --- a/src/main/java/dev/dsf/bpe/service/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -1,10 +1,6 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.ping; -import java.util.Collection; import java.util.List; -import java.util.Vector; -import java.util.function.Supplier; -import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/service/SelectPingTargets.java b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java similarity index 99% rename from src/main/java/dev/dsf/bpe/service/SelectPingTargets.java rename to src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java index ff52d009..0e9dd3a6 100644 --- a/src/main/java/dev/dsf/bpe/service/SelectPingTargets.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.ping; import java.util.Collections; import java.util.HashMap; diff --git a/src/main/java/dev/dsf/bpe/service/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java similarity index 99% rename from src/main/java/dev/dsf/bpe/service/StoreResults.java rename to src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index d6e75dc3..0658c484 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.ping; import java.math.BigDecimal; import java.util.Comparator; diff --git a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java similarity index 97% rename from src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java rename to src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index b14ff7b5..b8adb3b4 100644 --- a/src/main/java/dev/dsf/bpe/service/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.pong; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java similarity index 97% rename from src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java rename to src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java index 080877dd..59bd15af 100644 --- a/src/main/java/dev/dsf/bpe/service/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.pong; import java.time.Duration; diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java similarity index 95% rename from src/main/java/dev/dsf/bpe/service/LogAndSaveAndStoreError.java rename to src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 71bd39ae..2be9744b 100644 --- a/src/main/java/dev/dsf/bpe/service/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.pong; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java similarity index 97% rename from src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java rename to src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java index 22afdd53..9a4a3e23 100644 --- a/src/main/java/dev/dsf/bpe/service/LogAndStoreSendError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.pong; import java.util.List; diff --git a/src/main/java/dev/dsf/bpe/service/SaveUploadSpeeds.java b/src/main/java/dev/dsf/bpe/service/pong/SaveUploadSpeeds.java similarity index 93% rename from src/main/java/dev/dsf/bpe/service/SaveUploadSpeeds.java rename to src/main/java/dev/dsf/bpe/service/pong/SaveUploadSpeeds.java index d8f9be8e..d5f2b523 100644 --- a/src/main/java/dev/dsf/bpe/service/SaveUploadSpeeds.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SaveUploadSpeeds.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.pong; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/service/SelectPongTarget.java b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java similarity index 94% rename from src/main/java/dev/dsf/bpe/service/SelectPongTarget.java rename to src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java index b893bc81..76e50506 100644 --- a/src/main/java/dev/dsf/bpe/service/SelectPongTarget.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java @@ -1,9 +1,7 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.pong; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Identifier; -import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/dev/dsf/bpe/service/SetEndpointIdentifier.java b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java similarity index 97% rename from src/main/java/dev/dsf/bpe/service/SetEndpointIdentifier.java rename to src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java index 52c30cd9..0d9609cf 100644 --- a/src/main/java/dev/dsf/bpe/service/SetEndpointIdentifier.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.pong; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/service/StoreDownloadSpeeds.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeeds.java similarity index 95% rename from src/main/java/dev/dsf/bpe/service/StoreDownloadSpeeds.java rename to src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeeds.java index 7df02204..6cdf73c8 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreDownloadSpeeds.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeeds.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service; +package dev.dsf.bpe.service.pong; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index d2dae86f..0799d7c5 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -15,26 +15,26 @@ import dev.dsf.bpe.message.SendPong; import dev.dsf.bpe.message.SendStartPing; import dev.dsf.bpe.service.Cleanup; -import dev.dsf.bpe.service.DownloadResourceAndMeasureSpeed; -import dev.dsf.bpe.service.DownloadResourceAndMeasureSpeedInSubProcess; -import dev.dsf.bpe.service.EstimateCleanupTimerDuration; +import dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed; +import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; +import dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration; import dev.dsf.bpe.service.GenerateResource; -import dev.dsf.bpe.service.LogAndSaveAndStoreError; -import dev.dsf.bpe.service.LogAndSaveError; -import dev.dsf.bpe.service.LogAndSaveNoResponse; +import dev.dsf.bpe.service.pong.LogAndSaveAndStoreError; +import dev.dsf.bpe.service.ping.LogAndSaveError; +import dev.dsf.bpe.service.ping.LogAndSaveNoResponse; import dev.dsf.bpe.service.LogAndSaveSendError; -import dev.dsf.bpe.service.LogAndStoreSendError; -import dev.dsf.bpe.service.LogNoResponse; -import dev.dsf.bpe.service.LogPing; -import dev.dsf.bpe.service.SavePong; -import dev.dsf.bpe.service.SelectPingTargets; -import dev.dsf.bpe.service.SelectPongTarget; +import dev.dsf.bpe.service.pong.LogAndStoreSendError; +import dev.dsf.bpe.service.ping.LogNoResponse; +import dev.dsf.bpe.service.ping.LogPing; +import dev.dsf.bpe.service.ping.SavePong; +import dev.dsf.bpe.service.ping.SelectPingTargets; +import dev.dsf.bpe.service.pong.SelectPongTarget; import dev.dsf.bpe.service.SetDownloadResourceSize; -import dev.dsf.bpe.service.SetEndpointIdentifier; -import dev.dsf.bpe.service.SetTargetAndConfigureTimer; -import dev.dsf.bpe.service.StoreDownloadSpeeds; +import dev.dsf.bpe.service.pong.SetEndpointIdentifier; +import dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer; +import dev.dsf.bpe.service.pong.StoreDownloadSpeeds; import dev.dsf.bpe.service.StoreResource; -import dev.dsf.bpe.service.StoreResults; +import dev.dsf.bpe.service.ping.StoreResults; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; diff --git a/src/main/resources/bpe/ping-autostart.bpmn b/src/main/resources/bpe/ping-autostart.bpmn index c77a2c4d..c23a2b2f 100644 --- a/src/main/resources/bpe/ping-autostart.bpmn +++ b/src/main/resources/bpe/ping-autostart.bpmn @@ -100,7 +100,7 @@ <bpmn:sequenceFlow id="Flow_10ocr9f" sourceRef="Gateway_1ndxuiu" targetRef="StopIntermediateSignalCatchEvent" /> <bpmn:sequenceFlow id="Flow_096pj3d" name="stop" sourceRef="StopIntermediateSignalCatchEvent" targetRef="Gateway_1xqxerc" /> <bpmn:sequenceFlow id="Flow_15y3sqm" sourceRef="SetTargetAndConfigureTimer" targetRef="Gateway_1xqxerc" /> - <bpmn:serviceTask id="SetTargetAndConfigureTimer" name="set target and configure timer" camunda:class="dev.dsf.bpe.service.SetTargetAndConfigureTimer"> + <bpmn:serviceTask id="SetTargetAndConfigureTimer" name="set target and configure timer" camunda:class="dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer"> <bpmn:extensionElements> <camunda:inputOutput> <camunda:outputParameter name="stop">no</camunda:outputParameter> diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index ce9e5b59..d85e2328 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -35,7 +35,7 @@ <bpmn:outgoing>Flow_0y9usku</bpmn:outgoing> <bpmn:outgoing>Flow_1lghrxh</bpmn:outgoing> </bpmn:eventBasedGateway> - <bpmn:serviceTask id="LogNoResponse" name="Log and Save No Response" camunda:class="dev.dsf.bpe.service.LogAndSaveNoResponse"> + <bpmn:serviceTask id="LogNoResponse" name="Log and Save No Response" camunda:class="dev.dsf.bpe.service.ping.LogAndSaveNoResponse"> <bpmn:incoming>Flow_1fjeq2h</bpmn:incoming> <bpmn:outgoing>Flow_136htek</bpmn:outgoing> </bpmn:serviceTask> @@ -75,7 +75,7 @@ <bpmn:outgoing>Flow_13u1nzy</bpmn:outgoing> <bpmn:outgoing>Flow_1yt9547</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="Activity_0h9o9u7" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.DownloadResourceAndMeasureSpeedInSubProcess"> + <bpmn:serviceTask id="Activity_0h9o9u7" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess"> <bpmn:incoming>Flow_1yt9547</bpmn:incoming> <bpmn:outgoing>Flow_1v37fff</bpmn:outgoing> </bpmn:serviceTask> @@ -95,7 +95,7 @@ <bpmn:incoming>Flow_0jcfur3</bpmn:incoming> <bpmn:outgoing>Flow_0klalf8</bpmn:outgoing> </bpmn:sendTask> - <bpmn:serviceTask id="Activity_0akr23c" name="Log and Save Error" camunda:class="dev.dsf.bpe.service.LogAndSaveError"> + <bpmn:serviceTask id="Activity_0akr23c" name="Log and Save Error" camunda:class="dev.dsf.bpe.service.ping.LogAndSaveError"> <bpmn:incoming>Flow_10h6pqh</bpmn:incoming> <bpmn:outgoing>Flow_0jcfur3</bpmn:outgoing> </bpmn:serviceTask> @@ -134,7 +134,7 @@ <bpmn:sequenceFlow id="Flow_10h6pqh" sourceRef="Event_0i4slcz" targetRef="Activity_0akr23c" /> <bpmn:sequenceFlow id="Flow_0klalf8" sourceRef="Activity_0vw65a2" targetRef="Gateway_02orad4" /> <bpmn:sequenceFlow id="Flow_1ewmc79" sourceRef="PongCatchEvent" targetRef="Activity_081me01" /> - <bpmn:serviceTask id="Activity_081me01" name="Save Pong" camunda:class="dev.dsf.bpe.service.SavePong"> + <bpmn:serviceTask id="Activity_081me01" name="Save Pong" camunda:class="dev.dsf.bpe.service.ping.SavePong"> <bpmn:incoming>Flow_1ewmc79</bpmn:incoming> <bpmn:outgoing>Flow_1jwekqw</bpmn:outgoing> </bpmn:serviceTask> @@ -169,7 +169,7 @@ <bpmn:incoming>Flow_1bfs68o</bpmn:incoming> <bpmn:outgoing>Flow_0gubpgz</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="SaveResults" name="Store Results" camunda:class="dev.dsf.bpe.service.StoreResults"> + <bpmn:serviceTask id="SaveResults" name="Store Results" camunda:class="dev.dsf.bpe.service.ping.StoreResults"> <bpmn:incoming>Flow_0gubpgz</bpmn:incoming> <bpmn:outgoing>Flow_1du5wys</bpmn:outgoing> </bpmn:serviceTask> @@ -181,7 +181,7 @@ <bpmn:incoming>Flow_0iuuyo1</bpmn:incoming> <bpmn:outgoing>Flow_1c15ef2</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="SelectPingTargets" name="Select Targets" camunda:class="dev.dsf.bpe.service.SelectPingTargets"> + <bpmn:serviceTask id="SelectPingTargets" name="Select Targets" camunda:class="dev.dsf.bpe.service.ping.SelectPingTargets"> <bpmn:incoming>Flow_1c15ef2</bpmn:incoming> <bpmn:outgoing>Flow_0j92st0</bpmn:outgoing> </bpmn:serviceTask> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index bcf10280..0e24eecc 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -10,11 +10,11 @@ <bpmn:outgoing>Flow_10z0d4x</bpmn:outgoing> <bpmn:outgoing>Flow_08gidyv</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="Activity_095j2gg" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.DownloadResourceAndMeasureSpeed"> + <bpmn:serviceTask id="Activity_095j2gg" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed"> <bpmn:incoming>Flow_10z0d4x</bpmn:incoming> <bpmn:outgoing>Flow_0zphif7</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="SelectPongTarget" name="Select Pong Target" camunda:class="dev.dsf.bpe.service.SelectPongTarget"> + <bpmn:serviceTask id="SelectPongTarget" name="Select Pong Target" camunda:class="dev.dsf.bpe.service.pong.SelectPongTarget"> <bpmn:incoming>Flow_061qpt4</bpmn:incoming> <bpmn:outgoing>Flow_1eass2g</bpmn:outgoing> </bpmn:serviceTask> @@ -23,7 +23,7 @@ <bpmn:incoming>Flow_0gvrnxd</bpmn:incoming> <bpmn:outgoing>Flow_1o3n9u6</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="LogPing" name="Log Ping" camunda:class="dev.dsf.bpe.service.LogPing"> + <bpmn:serviceTask id="LogPing" name="Log Ping" camunda:class="dev.dsf.bpe.service.ping.LogPing"> <bpmn:incoming>Flow_1o3n9u6</bpmn:incoming> <bpmn:outgoing>Flow_061qpt4</bpmn:outgoing> </bpmn:serviceTask> @@ -48,7 +48,7 @@ <bpmn:outgoing>Flow_1bzjspe</bpmn:outgoing> <bpmn:outgoing>Flow_00t1ck1</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="Activity_0t0ex36" name="Log And Store Send Error" camunda:class="dev.dsf.bpe.service.LogAndStoreSendError"> + <bpmn:serviceTask id="Activity_0t0ex36" name="Log And Store Send Error" camunda:class="dev.dsf.bpe.service.pong.LogAndStoreSendError"> <bpmn:incoming>Flow_0h8flp6</bpmn:incoming> <bpmn:outgoing>Flow_0n07rwm</bpmn:outgoing> </bpmn:serviceTask> @@ -74,7 +74,7 @@ <bpmn:incoming>Flow_1jehvly</bpmn:incoming> <bpmn:outgoing>Flow_0x7t1ii</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="Activity_1umihbr" name="Log and Save And Store Error" camunda:class="dev.dsf.bpe.service.LogAndSaveAndStoreError"> + <bpmn:serviceTask id="Activity_1umihbr" name="Log and Save And Store Error" camunda:class="dev.dsf.bpe.service.pong.LogAndSaveAndStoreError"> <bpmn:incoming>Flow_0uj7rm3</bpmn:incoming> <bpmn:outgoing>Flow_1jehvly</bpmn:outgoing> </bpmn:serviceTask> @@ -86,7 +86,7 @@ <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> <bpmn:outgoing>Flow_0zib7wr</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0mwyelp" name="Store Download Speeds" camunda:class="dev.dsf.bpe.service.StoreDownloadSpeeds"> + <bpmn:serviceTask id="Activity_0mwyelp" name="Store Download Speeds" camunda:class="dev.dsf.bpe.service.pong.StoreDownloadSpeeds"> <bpmn:incoming>Flow_0n07rwm</bpmn:incoming> <bpmn:incoming>Flow_1i7f29l</bpmn:incoming> <bpmn:outgoing>Flow_165e73u</bpmn:outgoing> @@ -99,7 +99,7 @@ <bpmn:incoming>Flow_0x7t1ii</bpmn:incoming> <bpmn:outgoing>Flow_1w09zt7</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0xcqxjs" name="Estimate Cleanup Timer Duration" camunda:class="dev.dsf.bpe.service.EstimateCleanupTimerDuration"> + <bpmn:serviceTask id="Activity_0xcqxjs" name="Estimate Cleanup Timer Duration" camunda:class="dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration"> <bpmn:incoming>Flow_03hviat</bpmn:incoming> <bpmn:outgoing>Flow_0gvrnxd</bpmn:outgoing> </bpmn:serviceTask> @@ -141,7 +141,7 @@ <bpmn:incoming>Flow_19b3cp4</bpmn:incoming> <bpmn:outgoing>Flow_1oo1n55</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_13ypt7i" name="Set Endpoint Identifier" camunda:class="dev.dsf.bpe.service.SetEndpointIdentifier"> + <bpmn:serviceTask id="Activity_13ypt7i" name="Set Endpoint Identifier" camunda:class="dev.dsf.bpe.service.pong.SetEndpointIdentifier"> <bpmn:incoming>Flow_1oo1n55</bpmn:incoming> <bpmn:outgoing>Flow_0i7mizy</bpmn:outgoing> </bpmn:serviceTask> @@ -161,7 +161,7 @@ <bpmn:sequenceFlow id="Flow_1xfk4ds" sourceRef="Event_0o4l2t4" targetRef="Gateway_1wktaap" /> <bpmn:sequenceFlow id="Flow_1i7f29l" sourceRef="Gateway_1wktaap" targetRef="Activity_0mwyelp" /> <bpmn:sequenceFlow id="Flow_1ttsk1o" sourceRef="Event_1xvd4tr" targetRef="Activity_1gd1tfz" /> - <bpmn:serviceTask id="Activity_1gd1tfz" name="Save Upload Speeds" camunda:class="dev.dsf.bpe.service.SaveUploadSpeeds"> + <bpmn:serviceTask id="Activity_1gd1tfz" name="Save Upload Speeds" camunda:class="dev.dsf.bpe.service.pong.SaveUploadSpeeds"> <bpmn:incoming>Flow_1ttsk1o</bpmn:incoming> <bpmn:outgoing>Flow_1eh8lho</bpmn:outgoing> </bpmn:serviceTask> From 8f1a5d792118a4dd1219a0c3a347070dc9a61085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 10:32:26 +0100 Subject: [PATCH 179/382] Deleted LogAndSaveSendError as this is done by Ping itself in handleIntermediateThrowEventError() --- .../dsf/bpe/service/LogAndSaveSendError.java | 32 ------------------- .../dev/dsf/bpe/spring/config/PingConfig.java | 8 ----- 2 files changed, 40 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java diff --git a/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java deleted file mode 100644 index 5a4ed17f..00000000 --- a/src/main/java/dev/dsf/bpe/service/LogAndSaveSendError.java +++ /dev/null @@ -1,32 +0,0 @@ -package dev.dsf.bpe.service; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; -import dev.dsf.bpe.v1.variables.Variables; - -public class LogAndSaveSendError extends AbstractServiceDelegate -{ - private static final Logger logger = LoggerFactory.getLogger(LogAndSaveSendError.class); - - public LogAndSaveSendError(ProcessPluginApi api) - { - super(api); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception - { - String statusCode = (String) delegateExecution.getVariableLocal("statusCode"); - Target target = variables.getTarget(); - String correlationKey = target.getCorrelationKey(); - variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); - logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); - } -} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 0799d7c5..e8e646e2 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -22,7 +22,6 @@ import dev.dsf.bpe.service.pong.LogAndSaveAndStoreError; import dev.dsf.bpe.service.ping.LogAndSaveError; import dev.dsf.bpe.service.ping.LogAndSaveNoResponse; -import dev.dsf.bpe.service.LogAndSaveSendError; import dev.dsf.bpe.service.pong.LogAndStoreSendError; import dev.dsf.bpe.service.ping.LogNoResponse; import dev.dsf.bpe.service.ping.LogPing; @@ -194,13 +193,6 @@ public GenerateResource generateResource() return new GenerateResource(api, (int) maxUploadSizeBytes); } - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public LogAndSaveSendError logAndSaveSendError() - { - return new LogAndSaveSendError(api); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public LogAndStoreSendError logAndStoreSendError() From 0328cd078d7356863cb39e042d3584e8ca869730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 11:10:21 +0100 Subject: [PATCH 180/382] Renamed StoreDownloadSpeeds to StoreNetworkSpeeds as both upload and download speeds might have to be saved --- ...oadSpeeds.java => StoreNetworkSpeeds.java} | 6 +- .../dev/dsf/bpe/spring/config/PingConfig.java | 6 +- src/main/resources/bpe/pong.bpmn | 106 +++++++++--------- 3 files changed, 59 insertions(+), 59 deletions(-) rename src/main/java/dev/dsf/bpe/service/pong/{StoreDownloadSpeeds.java => StoreNetworkSpeeds.java} (81%) diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeeds.java b/src/main/java/dev/dsf/bpe/service/pong/StoreNetworkSpeeds.java similarity index 81% rename from src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeeds.java rename to src/main/java/dev/dsf/bpe/service/pong/StoreNetworkSpeeds.java index 6cdf73c8..f4c7f89f 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeeds.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreNetworkSpeeds.java @@ -9,11 +9,11 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; -public class StoreDownloadSpeeds extends AbstractServiceDelegate +public class StoreNetworkSpeeds extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(StoreDownloadSpeeds.class); + private static final Logger logger = LoggerFactory.getLogger(StoreNetworkSpeeds.class); - public StoreDownloadSpeeds(ProcessPluginApi api) + public StoreNetworkSpeeds(ProcessPluginApi api) { super(api); } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index e8e646e2..ce60ebf6 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -31,7 +31,7 @@ import dev.dsf.bpe.service.SetDownloadResourceSize; import dev.dsf.bpe.service.pong.SetEndpointIdentifier; import dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer; -import dev.dsf.bpe.service.pong.StoreDownloadSpeeds; +import dev.dsf.bpe.service.pong.StoreNetworkSpeeds; import dev.dsf.bpe.service.StoreResource; import dev.dsf.bpe.service.ping.StoreResults; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -223,9 +223,9 @@ public LogAndSaveError logAndSaveError() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public StoreDownloadSpeeds storeDownloadSpeeds() + public StoreNetworkSpeeds storeDownloadSpeeds() { - return new StoreDownloadSpeeds(api); + return new StoreNetworkSpeeds(api); } @Bean diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 0e24eecc..aebe2dac 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -86,7 +86,7 @@ <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> <bpmn:outgoing>Flow_0zib7wr</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0mwyelp" name="Store Download Speeds" camunda:class="dev.dsf.bpe.service.pong.StoreDownloadSpeeds"> + <bpmn:serviceTask id="Activity_0mwyelp" name="Store Network Speeds" camunda:class="dev.dsf.bpe.service.pong.StoreNetworkSpeeds"> <bpmn:incoming>Flow_0n07rwm</bpmn:incoming> <bpmn:incoming>Flow_1i7f29l</bpmn:incoming> <bpmn:outgoing>Flow_165e73u</bpmn:outgoing> @@ -209,10 +209,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> - <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> - <dc:Bounds x="2818" y="439" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> <dc:Bounds x="152" y="292" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -244,6 +240,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Gateway_0eiy9fm_di" bpmnElement="Gateway_0eiy9fm" isMarkerVisible="true"> <dc:Bounds x="2145" y="285" width="50" height="50" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_02b3m47_di" bpmnElement="Activity_0t0ex36"> + <dc:Bounds x="2370" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_12p2jrx_di" bpmnElement="Gateway_1l5dkpz"> <dc:Bounds x="2145" y="385" width="50" height="50" /> </bpmndi:BPMNShape> @@ -266,6 +266,13 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Event_05zzvx3_di" bpmnElement="Event_1qh25on"> <dc:Bounds x="1862" y="595" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> + <dc:Bounds x="2820" y="270" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1xbj20p_di" bpmnElement="Activity_0mwyelp"> + <dc:Bounds x="2660" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1ouj7x3_di" bpmnElement="Activity_04mv5cn"> <dc:Bounds x="1250" y="420" width="100" height="80" /> </bpmndi:BPMNShape> @@ -283,6 +290,16 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> <dc:Bounds x="430" y="270" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> + <dc:Bounds x="2962" y="292" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1wktaap_di" bpmnElement="Gateway_1wktaap" isMarkerVisible="true"> + <dc:Bounds x="2685" y="385" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0ntyg74_di" bpmnElement="Activity_1gd1tfz"> + <dc:Bounds x="2510" y="370" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> <dc:Bounds x="280" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> @@ -295,6 +312,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1910" y="439" width="250" height="84" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> + <dc:Bounds x="2818" y="439" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> <dc:Bounds x="1420" y="543" width="275" height="41" /> <bpmndi:BPMNLabel /> @@ -307,31 +328,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="400" y="183" width="585" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> - <dc:Bounds x="2820" y="270" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1xbj20p_di" bpmnElement="Activity_0mwyelp"> - <dc:Bounds x="2660" y="270" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> - <dc:Bounds x="2962" y="292" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_02b3m47_di" bpmnElement="Activity_0t0ex36"> - <dc:Bounds x="2370" y="270" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_1wktaap_di" bpmnElement="Gateway_1wktaap" isMarkerVisible="true"> - <dc:Bounds x="2685" y="385" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0ntyg74_di" bpmnElement="Activity_1gd1tfz"> - <dc:Bounds x="2510" y="370" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2870" y="350" /> - <di:waypoint x="2870" y="439" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> <dc:Bounds x="1862" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -419,6 +415,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1880" y="368" /> <di:waypoint x="1880" y="595" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_165e73u_di" bpmnElement="Flow_165e73u"> + <di:waypoint x="2760" y="310" /> + <di:waypoint x="2820" y="310" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> <di:waypoint x="1190" y="460" /> <di:waypoint x="1250" y="460" /> @@ -427,10 +427,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1350" y="460" /> <di:waypoint x="1410" y="460" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> - <di:waypoint x="188" y="310" /> - <di:waypoint x="270" y="310" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> <di:waypoint x="370" y="310" /> <di:waypoint x="430" y="310" /> @@ -439,25 +435,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="530" y="310" /> <di:waypoint x="575" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> - <di:waypoint x="722" y="420" /> - <di:waypoint x="738" y="390" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> - <di:waypoint x="1996" y="350" /> - <di:waypoint x="1965" y="439" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> - <di:waypoint x="1128" y="544" /> - <di:waypoint x="1134" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> - <di:waypoint x="1464" y="500" /> - <di:waypoint x="1469" y="543" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_165e73u_di" bpmnElement="Flow_165e73u"> - <di:waypoint x="2760" y="310" /> - <di:waypoint x="2820" y="310" /> + <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> + <di:waypoint x="188" y="310" /> + <di:waypoint x="270" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0zib7wr_di" bpmnElement="Flow_0zib7wr"> <di:waypoint x="2920" y="310" /> @@ -484,6 +464,26 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2610" y="410" /> <di:waypoint x="2685" y="410" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> + <di:waypoint x="722" y="420" /> + <di:waypoint x="738" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> + <di:waypoint x="1996" y="350" /> + <di:waypoint x="1965" y="439" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> + <di:waypoint x="2870" y="350" /> + <di:waypoint x="2870" y="439" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> + <di:waypoint x="1128" y="544" /> + <di:waypoint x="1134" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> + <di:waypoint x="1464" y="500" /> + <di:waypoint x="1469" y="543" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From 8de8d211befa1d36e6a65d1b5c6decfa4564669f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 11:53:35 +0100 Subject: [PATCH 181/382] Ran format-and-sort --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 4 +++- .../PingPongDeploymentStateListener.java | 7 ++++-- .../dev/dsf/bpe/service/ping/SavePong.java | 10 ++++---- .../dsf/bpe/service/ping/StoreResults.java | 24 ++++++++++++------- .../bpe/util/task/NetworkSpeedCalculator.java | 12 +++++----- 5 files changed, 35 insertions(+), 22 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index ad574e2a..8cdd4789 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -70,7 +70,9 @@ private ConstantsPing() public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND = "megabits-per-second"; public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND = "megabytes-per-second"; - public static final List<String> CODESYSTEM_DSF_PING_UNITS_VALUES = List.of(CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND, CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND, CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND, CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); + public static final List<String> CODESYSTEM_DSF_PING_UNITS_VALUES = List.of( + CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND, CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND, + CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND, CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); public static final String CODESYSTEM_READ_ACCESS_TAG = "http://dsf.dev/fhir/CodeSystem/read-access-tag"; public static final String CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL = "ALL"; diff --git a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java index c79ff9a2..b7db8780 100644 --- a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java +++ b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java @@ -30,10 +30,13 @@ public void onProcessesDeployed(List<String> processes) if (ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES.contains(networkSpeedUnit)) { logger.info("Network speed unit is valid: {}", networkSpeedUnit); - } else + } + else { pingConfig.setNetworkSpeedUnit(ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); - logger.info("Network speed unit \"{}\" is not valid. Valid values are: {}. Defaulting to \"{}\"", networkSpeedUnit, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); + logger.info("Network speed unit \"{}\" is not valid. Valid values are: {}. Defaulting to \"{}\"", + networkSpeedUnit, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES, + ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 9e9cf355..bd733734 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -41,8 +41,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable long downloadedDurationMillis = api.getTaskHelper() .getFirstInputParameterValue(pong, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, DecimalType.class).get() - .getValue().longValue(); + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, DecimalType.class) + .get().getValue().longValue(); variables.setLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey), downloadedDurationMillis); @@ -50,10 +50,10 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, IntegerType.class).get().getValue(); variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), downloadedBytes); - List<String> errorList = api.getTaskHelper().getInputParameterValues(pong, ConstantsPing.CODESYSTEM_DSF_PING, + List<String> errorList = api.getTaskHelper() + .getInputParameterValues(pong, ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE, StringType.class) - .map(PrimitiveType::getValue) - .toList(); + .map(PrimitiveType::getValue).toList(); ErrorMessageListUtils.addAll(errorList, delegateExecution); logger.info("Pong received from {}, saved pong information", target.getEndpointUrl()); diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 0658c484..767ba29a 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -66,21 +66,29 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statu } else { - int downloadResourceSizeBytes = variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + int downloadResourceSizeBytes = variables + .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); List<String> errorMessageList = ErrorMessageListUtils.getErrorMessageList(execution); if (downloadResourceSizeBytes >= 0) { - int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); - long downloadedDurationMillis = variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); + int downloadedBytes = variables + .getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); + long downloadedDurationMillis = variables + .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); - BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit); + BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, + downloadedDurationMillis, networkSpeedUnit); - int uploadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey)); - long uploadedDurationMillis = variables.getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey)); + int uploadedBytes = variables + .getInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey)); + long uploadedDurationMillis = variables + .getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey)); - BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit); + BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, + networkSpeedUnit); - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList, downloadSpeed, uploadSpeed, networkSpeedUnit)); + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList, + downloadSpeed, uploadSpeed, networkSpeedUnit)); } task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode)); diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index fc449e68..1e0dbb1f 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -12,15 +12,15 @@ public static BigDecimal calculate(int bytes, long duration, String unit) return switch (unit) { case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND -> - new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); + new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND -> - new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(1000000), RoundingMode.UNNECESSARY) - .divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); + new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(1000000), RoundingMode.UNNECESSARY) + .divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND -> - new BigDecimal(bytes).divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); + new BigDecimal(bytes).divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND -> - new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), RoundingMode.UNNECESSARY) - .divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); + new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), RoundingMode.UNNECESSARY) + .divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); default -> new BigDecimal(0); }; } From ff5ae9767fb37007fa67062f2b783f377caa5dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 15:39:34 +0100 Subject: [PATCH 182/382] Added more utility methods to update existing status output parameters --- .../output/generator/PingStatusGenerator.java | 371 +++++++++++++++++- 1 file changed, 365 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index e9f8c50d..2010d83c 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -1,13 +1,16 @@ package dev.dsf.bpe.util.task.output.generator; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task.TaskOutputComponent; +import org.hl7.fhir.r4.model.Type; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; @@ -16,6 +19,120 @@ public class PingStatusGenerator { + public static void updatePingStatusOutput(TaskOutputComponent outputComponent, String statusCode) + { + if(hasStatusCodeSet(outputComponent)) + { + updateStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode); + } else { + addStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode); + } + } + + public static void updatePongStatusOutput(TaskOutputComponent outputComponent, String statusCode) + { + if(hasStatusCodeSet(outputComponent)) + { + updateStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode); + } else { + addStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode); + } + } + + public static void updatePingStatusOutput(TaskOutputComponent outputComponent, Target target) + { + if (hasTargetSet(outputComponent)) + { + updateTarget(outputComponent, target); + } + else + { + addTarget(outputComponent, target); + } + } + + public static void updateStatusOutput(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, BigDecimal uploadSpeed, + String networkSpeedUnit) + { + if (hasDownloadSpeedSet(outputComponent)) + { + updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); + } else + { + addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); + } + + if(hasUploadSpeedSet(outputComponent)) + { + updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); + } else + { + addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); + } + } + + public static void updateStatusOutputDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, + String networkSpeedUnit) + { + if (hasDownloadSpeedSet(outputComponent)) + { + updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); + } else + { + addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); + } + } + + public static void updateStatusOutputUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, + String networkSpeedUnit) + { + if (hasDownloadSpeedSet(outputComponent)) + { + updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); + } else + { + addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); + } + } + + private static boolean hasTargetSet(TaskOutputComponent outputComponent) + { + List<Extension> correlationKeyExtensions = outputComponent.getExtensionsByUrl(ConstantsPing.EXTENSION_URL_CORRELATION_KEY); + List<Extension> organizationIdentifierExtensions = outputComponent.getExtensionsByUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); + List<Extension> endpointIdentifierExtensions = outputComponent.getExtensionsByUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER); + return !correlationKeyExtensions.isEmpty() || !organizationIdentifierExtensions.isEmpty() || !endpointIdentifierExtensions.isEmpty(); + } + + private static boolean hasStatusCodeSet(TaskOutputComponent outputComponent) + { + Type valueType = outputComponent.getValue(); + List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); + + return (valueType instanceof Coding coding && ConstantsPing.CODESYSTEM_DSF_PING_STATUS.equals(coding.getSystem())) + || outputTypeCodings.stream().anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); + } + + private static boolean hasNetworkSpeedSet(TaskOutputComponent outputComponent) + { + return hasDownloadSpeedSet(outputComponent) && hasUploadSpeedSet(outputComponent); + } + + private static boolean hasDownloadSpeedSet(TaskOutputComponent outputComponent) + { + Extension extension = getOrCreatePingStatusExtension(outputComponent); + Extension downloadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); + + return downloadSpeedExtension != null; + } + + private static boolean hasUploadSpeedSet(TaskOutputComponent outputComponent) + { + Extension extension = getOrCreatePingStatusExtension(outputComponent); + Extension uploadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); + + return uploadSpeedExtension != null; + } + public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode) { return createPingStatusOutput(target, statusCode, null); @@ -70,25 +187,172 @@ private static TaskOutputComponent createStatusOutput(Target target, String outp List<String> errorMessages, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) { TaskOutputComponent output = new TaskOutputComponent(); - output.setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); - output.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + addStatus(output, outputParameter, statusCode); + addTarget(output, target); + addErrorMessages(output, errorMessages); + addNetworkSpeed(output, downloadSpeed, uploadSpeed, unit); + + return output; + } + + private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent, String outputParameter, + String statusCode) + { + outputComponent.setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); + outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + + return outputComponent; + } + + private static TaskOutputComponent updateStatus(TaskOutputComponent outputComponent, String outputParameter, + String statusCode) + { + Type valueType = outputComponent.getValue(); + if (valueType instanceof Coding coding) + { + coding.setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode); + } + else + { + outputComponent.setValue( + new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); + } + + List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); + if (outputTypeCodings.isEmpty()) + { + outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + } + else + { + if (outputTypeCodings.size() == 1) + { + Coding coding = outputTypeCodings.get(0); + coding.setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + } + else + { + outputComponent.getType().setCoding(null); + outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + .setCode(outputParameter); + } + } + + return outputComponent; + } + + private static TaskOutputComponent addTarget(TaskOutputComponent outputComponent, Target target) + { + Extension extension = getOrCreatePingStatusExtension(outputComponent); - Extension extension = output.addExtension(); - extension.setUrl(ConstantsPing.EXTENSION_URL_PING_STATUS); extension.addExtension(ConstantsPing.EXTENSION_URL_CORRELATION_KEY, new StringType(target.getCorrelationKey())); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER) .setValue(OrganizationIdentifier.withValue(target.getOrganizationIdentifierValue())); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER) .setValue(EndpointIdentifier.withValue(target.getEndpointIdentifierValue())); + + return outputComponent; + } + + private static TaskOutputComponent updateTarget(TaskOutputComponent outputComponent, Target target) + { + Extension extension = getOrCreatePingStatusExtension(outputComponent); + + Extension correlationKeyExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_CORRELATION_KEY); + if (correlationKeyExtension != null) + { + correlationKeyExtension.setValue(new StringType(target.getCorrelationKey())); + } + else + { + extension.addExtension(ConstantsPing.EXTENSION_URL_CORRELATION_KEY, + new StringType(target.getCorrelationKey())); + } + + Extension organizationIdentifierExtension = extension.getExtensionByUrl( + ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); + if (organizationIdentifierExtension != null) + { + organizationIdentifierExtension.setValue(new StringType(target.getOrganizationIdentifierValue())); + } + else + { + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER) + .setValue(OrganizationIdentifier.withValue(target.getOrganizationIdentifierValue())); + } + + Extension urlEndpointIdentifier = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER); + if (urlEndpointIdentifier != null) + { + urlEndpointIdentifier.setValue(new StringType(target.getEndpointIdentifierValue())); + } + else + { + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER) + .setValue(EndpointIdentifier.withValue(target.getEndpointIdentifierValue())); + } + + return outputComponent; + } + + private static TaskOutputComponent addErrorMessages(TaskOutputComponent outputComponent, List<String> errorMessages) + { if (errorMessages != null) + { + Extension extension = getOrCreatePingStatusExtension(outputComponent); for (String errorMessage : errorMessages) { extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE) .setValue(new StringType(errorMessage)); } + } + + return outputComponent; + } + + private static TaskOutputComponent updateErrorMessages(TaskOutputComponent outputComponent, + List<String> errorMessages) + { + Extension extension = getOrCreatePingStatusExtension(outputComponent); + List<Extension> nonErrorExtensions = extension.getExtension().stream() + .filter(extension1 -> !ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension1.getUrl())) + .collect(Collectors.toCollection(ArrayList::new)); + + if (errorMessages != null) + { + List<Extension> newErrorExtensions = errorMessages.stream() + .map(errorMessage -> new Extension(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE, + new StringType(errorMessage))).collect(Collectors.toCollection(ArrayList::new)); + nonErrorExtensions.addAll(newErrorExtensions); + extension.setExtension(newErrorExtensions); + } else { + extension.setExtension(nonErrorExtensions); + } + + return outputComponent; + } + + private static TaskOutputComponent addNetworkSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, + BigDecimal uploadSpeed, String unit) + { + addDownloadSpeed(outputComponent, downloadSpeed, unit); + addUploadSpeed(outputComponent, uploadSpeed, unit); + + return outputComponent; + } + + private static TaskOutputComponent updateNetworkSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) + { + updateDownloadSpeed(outputComponent, downloadSpeed, unit); + updateUploadSpeed(outputComponent, uploadSpeed, unit); + return outputComponent; + } + private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, String unit) + { if (downloadSpeed != null && unit != null) { + Extension extension = getOrCreatePingStatusExtension(outputComponent); Extension downloadSpeedExtension = extension.addExtension() .setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); Extension networkSpeed = downloadSpeedExtension.addExtension() @@ -99,17 +363,112 @@ private static TaskOutputComponent createStatusOutput(Target target, String outp .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } + return outputComponent; + } + + private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, String unit) + { + if (downloadSpeed != null && unit != null) + { + Extension extension = getOrCreatePingStatusExtension(outputComponent); + Extension downloadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); + if (downloadSpeedExtension != null) + { + Extension networkSpeedExtension = downloadSpeedExtension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + if(networkSpeedExtension != null) + { + networkSpeedExtension.setExtension(new ArrayList<>()); + List<Extension> extensions = networkSpeedExtension.getExtension(); + extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, new DecimalType(downloadSpeed))); + extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); + } + } else + { + downloadSpeedExtension = extension.addExtension() + .setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); + Extension networkSpeed = downloadSpeedExtension.addExtension() + .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) + .setValue(new DecimalType(downloadSpeed)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + } + } + + return outputComponent; + } + + private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, String unit) + { if (uploadSpeed != null && unit != null) { + Extension extension = getOrCreatePingStatusExtension(outputComponent); Extension uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); Extension networkSpeed = uploadSpeedExtension.addExtension() .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) - .setValue(new DecimalType(downloadSpeed)); + .setValue(new DecimalType(uploadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } - return output; + return outputComponent; + } + + private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, String unit) + { + if (uploadSpeed != null && unit != null) + { + Extension extension = getOrCreatePingStatusExtension(outputComponent); + Extension uploadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); + if (uploadSpeedExtension != null) + { + Extension networkSpeedExtension = uploadSpeedExtension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + if(networkSpeedExtension != null) + { + networkSpeedExtension.setExtension(new ArrayList<>()); + List<Extension> extensions = networkSpeedExtension.getExtension(); + extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, new DecimalType(uploadSpeed))); + extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); + } + } else + { + uploadSpeedExtension = extension.addExtension() + .setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); + Extension networkSpeed = uploadSpeedExtension.addExtension() + .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) + .setValue(new DecimalType(uploadSpeed)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + } + } + + return outputComponent; + } + + private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outputComponent) + { + List<Extension> pingStatusExtensions = outputComponent.getExtension().stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_PING_STATUS.equals(extension.getUrl())).toList(); + Extension extension; + if (pingStatusExtensions.isEmpty()) + { + extension = outputComponent.addExtension(); + extension.setUrl(ConstantsPing.EXTENSION_URL_PING_STATUS); + } + else + { + if (pingStatusExtensions.size() == 1) + { + extension = pingStatusExtensions.get(0); + } + else + { + throw new RuntimeException( + "Only one ping status extension is allowed but found " + pingStatusExtensions.size()); + } + } + return extension; } } From 6766736a4a96ebb19923a049bfbd1eda5f5bed08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 16:07:31 +0100 Subject: [PATCH 183/382] StoreNetworkSpeeds replaced by StoreUploadSpeeds as network speeds can now be stored separately --- ...tworkSpeeds.java => StoreUploadSpeed.java} | 6 +- .../dev/dsf/bpe/spring/config/PingConfig.java | 6 +- src/main/resources/bpe/pong.bpmn | 106 +++++++++--------- 3 files changed, 59 insertions(+), 59 deletions(-) rename src/main/java/dev/dsf/bpe/service/pong/{StoreNetworkSpeeds.java => StoreUploadSpeed.java} (81%) diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreNetworkSpeeds.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java similarity index 81% rename from src/main/java/dev/dsf/bpe/service/pong/StoreNetworkSpeeds.java rename to src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index f4c7f89f..33da8538 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreNetworkSpeeds.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -9,11 +9,11 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; -public class StoreNetworkSpeeds extends AbstractServiceDelegate +public class StoreUploadSpeed extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(StoreNetworkSpeeds.class); + private static final Logger logger = LoggerFactory.getLogger(StoreUploadSpeed.class); - public StoreNetworkSpeeds(ProcessPluginApi api) + public StoreUploadSpeed(ProcessPluginApi api) { super(api); } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index ce60ebf6..6dd59f1c 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -31,7 +31,7 @@ import dev.dsf.bpe.service.SetDownloadResourceSize; import dev.dsf.bpe.service.pong.SetEndpointIdentifier; import dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer; -import dev.dsf.bpe.service.pong.StoreNetworkSpeeds; +import dev.dsf.bpe.service.pong.StoreUploadSpeed; import dev.dsf.bpe.service.StoreResource; import dev.dsf.bpe.service.ping.StoreResults; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -223,9 +223,9 @@ public LogAndSaveError logAndSaveError() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public StoreNetworkSpeeds storeDownloadSpeeds() + public StoreUploadSpeed storeDownloadSpeeds() { - return new StoreNetworkSpeeds(api); + return new StoreUploadSpeed(api); } @Bean diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index aebe2dac..27549416 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -12,7 +12,7 @@ </bpmn:exclusiveGateway> <bpmn:serviceTask id="Activity_095j2gg" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed"> <bpmn:incoming>Flow_10z0d4x</bpmn:incoming> - <bpmn:outgoing>Flow_0zphif7</bpmn:outgoing> + <bpmn:outgoing>Flow_0crmxc2</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="SelectPongTarget" name="Select Pong Target" camunda:class="dev.dsf.bpe.service.pong.SelectPongTarget"> <bpmn:incoming>Flow_061qpt4</bpmn:incoming> @@ -50,7 +50,7 @@ </bpmn:exclusiveGateway> <bpmn:serviceTask id="Activity_0t0ex36" name="Log And Store Send Error" camunda:class="dev.dsf.bpe.service.pong.LogAndStoreSendError"> <bpmn:incoming>Flow_0h8flp6</bpmn:incoming> - <bpmn:outgoing>Flow_0n07rwm</bpmn:outgoing> + <bpmn:outgoing>Flow_148beur</bpmn:outgoing> </bpmn:serviceTask> <bpmn:eventBasedGateway id="Gateway_1l5dkpz"> <bpmn:incoming>Flow_1bzjspe</bpmn:incoming> @@ -70,8 +70,8 @@ </bpmn:timerEventDefinition> </bpmn:intermediateCatchEvent> <bpmn:exclusiveGateway id="Gateway_0fvmtve"> - <bpmn:incoming>Flow_0zphif7</bpmn:incoming> <bpmn:incoming>Flow_1jehvly</bpmn:incoming> + <bpmn:incoming>Flow_0yujsot</bpmn:incoming> <bpmn:outgoing>Flow_0x7t1ii</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:serviceTask id="Activity_1umihbr" name="Log and Save And Store Error" camunda:class="dev.dsf.bpe.service.pong.LogAndSaveAndStoreError"> @@ -82,15 +82,11 @@ <bpmn:incoming>Flow_0yr2pmf</bpmn:incoming> </bpmn:endEvent> <bpmn:serviceTask id="Activity_0otptjn" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> - <bpmn:incoming>Flow_165e73u</bpmn:incoming> <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> + <bpmn:incoming>Flow_1lfcycx</bpmn:incoming> + <bpmn:incoming>Flow_148beur</bpmn:incoming> <bpmn:outgoing>Flow_0zib7wr</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0mwyelp" name="Store Network Speeds" camunda:class="dev.dsf.bpe.service.pong.StoreNetworkSpeeds"> - <bpmn:incoming>Flow_0n07rwm</bpmn:incoming> - <bpmn:incoming>Flow_1i7f29l</bpmn:incoming> - <bpmn:outgoing>Flow_165e73u</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:serviceTask id="Activity_04mv5cn" name="Store Resource" camunda:class="dev.dsf.bpe.service.StoreResource"> <bpmn:incoming>Flow_1w09zt7</bpmn:incoming> <bpmn:outgoing>Flow_03hviat</bpmn:outgoing> @@ -115,7 +111,6 @@ <bpmn:sequenceFlow id="Flow_08gidyv" sourceRef="Gateway_1jwjxzn" targetRef="Gateway_1ggdr8l"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_0zphif7" sourceRef="Activity_095j2gg" targetRef="Gateway_0fvmtve" /> <bpmn:sequenceFlow id="Flow_061qpt4" sourceRef="LogPing" targetRef="SelectPongTarget" /> <bpmn:sequenceFlow id="Flow_1eass2g" sourceRef="SelectPongTarget" targetRef="Activity_005ywv2" /> <bpmn:sequenceFlow id="Flow_0gvrnxd" sourceRef="Activity_0xcqxjs" targetRef="Gateway_1ggdr8l" /> @@ -134,7 +129,6 @@ <bpmn:sequenceFlow id="Flow_0x7t1ii" sourceRef="Gateway_0fvmtve" targetRef="Activity_1m4wavi" /> <bpmn:sequenceFlow id="Flow_0uj7rm3" sourceRef="Event_0olr5yw" targetRef="Activity_1umihbr" /> <bpmn:sequenceFlow id="Flow_0yr2pmf" sourceRef="SelectPongTargetErrorBoundaryEvent" targetRef="Event_1qh25on" /> - <bpmn:sequenceFlow id="Flow_165e73u" sourceRef="Activity_0mwyelp" targetRef="Activity_0otptjn" /> <bpmn:sequenceFlow id="Flow_1w09zt7" sourceRef="Activity_1m4wavi" targetRef="Activity_04mv5cn" /> <bpmn:sequenceFlow id="Flow_03hviat" sourceRef="Activity_04mv5cn" targetRef="Activity_0xcqxjs" /> <bpmn:serviceTask id="Activity_1wdftvk" name="Set Download Resource Size" camunda:class="dev.dsf.bpe.service.SetDownloadResourceSize"> @@ -152,20 +146,26 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="Flow_19b3cp4" sourceRef="PingMessageStartEvent" targetRef="Activity_1wdftvk" /> <bpmn:sequenceFlow id="Flow_0zib7wr" sourceRef="Activity_0otptjn" targetRef="Event_0i1din5" /> - <bpmn:sequenceFlow id="Flow_0n07rwm" sourceRef="Activity_0t0ex36" targetRef="Activity_0mwyelp" /> <bpmn:exclusiveGateway id="Gateway_1wktaap"> <bpmn:incoming>Flow_1xfk4ds</bpmn:incoming> <bpmn:incoming>Flow_1eh8lho</bpmn:incoming> - <bpmn:outgoing>Flow_1i7f29l</bpmn:outgoing> + <bpmn:outgoing>Flow_1lfcycx</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="Flow_1xfk4ds" sourceRef="Event_0o4l2t4" targetRef="Gateway_1wktaap" /> - <bpmn:sequenceFlow id="Flow_1i7f29l" sourceRef="Gateway_1wktaap" targetRef="Activity_0mwyelp" /> <bpmn:sequenceFlow id="Flow_1ttsk1o" sourceRef="Event_1xvd4tr" targetRef="Activity_1gd1tfz" /> - <bpmn:serviceTask id="Activity_1gd1tfz" name="Save Upload Speeds" camunda:class="dev.dsf.bpe.service.pong.SaveUploadSpeeds"> + <bpmn:serviceTask id="Activity_1gd1tfz" name="Store Upload Speed" camunda:class="dev.dsf.bpe.service.pong.StoreUploadSpeed"> <bpmn:incoming>Flow_1ttsk1o</bpmn:incoming> <bpmn:outgoing>Flow_1eh8lho</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1eh8lho" sourceRef="Activity_1gd1tfz" targetRef="Gateway_1wktaap" /> + <bpmn:sequenceFlow id="Flow_1lfcycx" sourceRef="Gateway_1wktaap" targetRef="Activity_0otptjn" /> + <bpmn:sequenceFlow id="Flow_148beur" sourceRef="Activity_0t0ex36" targetRef="Activity_0otptjn" /> + <bpmn:sequenceFlow id="Flow_0crmxc2" sourceRef="Activity_095j2gg" targetRef="Activity_0i998dm" /> + <bpmn:serviceTask id="Activity_0i998dm" name="Store Download Speed" camunda:class="dev.dsf.bpe.service.pong.StoreUploadSpeed"> + <bpmn:incoming>Flow_0crmxc2</bpmn:incoming> + <bpmn:outgoing>Flow_0yujsot</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_0yujsot" sourceRef="Activity_0i998dm" targetRef="Gateway_0fvmtve" /> <bpmn:textAnnotation id="TextAnnotation_02e4h2c"> <bpmn:text>Log = logger Save = save as execution variable @@ -209,6 +209,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> + <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> + <dc:Bounds x="2860" y="439" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> <dc:Bounds x="152" y="292" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -266,13 +270,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Event_05zzvx3_di" bpmnElement="Event_1qh25on"> <dc:Bounds x="1862" y="595" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> - <dc:Bounds x="2820" y="270" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1xbj20p_di" bpmnElement="Activity_0mwyelp"> - <dc:Bounds x="2660" y="270" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1ouj7x3_di" bpmnElement="Activity_04mv5cn"> <dc:Bounds x="1250" y="420" width="100" height="80" /> </bpmndi:BPMNShape> @@ -290,9 +287,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> <dc:Bounds x="430" y="270" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> - <dc:Bounds x="2962" y="292" width="36" height="36" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1wktaap_di" bpmnElement="Gateway_1wktaap" isMarkerVisible="true"> <dc:Bounds x="2685" y="385" width="50" height="50" /> </bpmndi:BPMNShape> @@ -312,10 +306,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1910" y="439" width="250" height="84" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> - <dc:Bounds x="2818" y="439" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> <dc:Bounds x="1420" y="543" width="275" height="41" /> <bpmndi:BPMNLabel /> @@ -328,6 +318,20 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="400" y="183" width="585" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> + <dc:Bounds x="2660" y="270" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> + <dc:Bounds x="2822" y="292" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> + <dc:Bounds x="810" y="420" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> + <di:waypoint x="2758" y="346" /> + <di:waypoint x="2884" y="439" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> <dc:Bounds x="1862" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -349,10 +353,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="625" y="310" /> <di:waypoint x="1565" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0zphif7_di" bpmnElement="Flow_0zphif7"> - <di:waypoint x="750" y="460" /> - <di:waypoint x="955" y="460" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_061qpt4_di" bpmnElement="Flow_061qpt4"> <di:waypoint x="1760" y="310" /> <di:waypoint x="1780" y="310" /> @@ -385,8 +385,8 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNEdge id="Flow_00t1ck1_di" bpmnElement="Flow_00t1ck1"> <di:waypoint x="2170" y="285" /> <di:waypoint x="2170" y="250" /> - <di:waypoint x="2870" y="250" /> - <di:waypoint x="2870" y="270" /> + <di:waypoint x="2710" y="250" /> + <di:waypoint x="2710" y="270" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0rj915n_di" bpmnElement="Flow_0rj915n"> <di:waypoint x="2195" y="410" /> @@ -415,10 +415,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1880" y="368" /> <di:waypoint x="1880" y="595" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_165e73u_di" bpmnElement="Flow_165e73u"> - <di:waypoint x="2760" y="310" /> - <di:waypoint x="2820" y="310" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> <di:waypoint x="1190" y="460" /> <di:waypoint x="1250" y="460" /> @@ -440,22 +436,14 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="270" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0zib7wr_di" bpmnElement="Flow_0zib7wr"> - <di:waypoint x="2920" y="310" /> - <di:waypoint x="2962" y="310" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0n07rwm_di" bpmnElement="Flow_0n07rwm"> - <di:waypoint x="2470" y="310" /> - <di:waypoint x="2660" y="310" /> + <di:waypoint x="2760" y="310" /> + <di:waypoint x="2822" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1xfk4ds_di" bpmnElement="Flow_1xfk4ds"> <di:waypoint x="2428" y="500" /> <di:waypoint x="2710" y="500" /> <di:waypoint x="2710" y="435" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1i7f29l_di" bpmnElement="Flow_1i7f29l"> - <di:waypoint x="2710" y="385" /> - <di:waypoint x="2710" y="350" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ttsk1o_di" bpmnElement="Flow_1ttsk1o"> <di:waypoint x="2428" y="410" /> <di:waypoint x="2510" y="410" /> @@ -472,10 +460,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1996" y="350" /> <di:waypoint x="1965" y="439" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2870" y="350" /> - <di:waypoint x="2870" y="439" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> <di:waypoint x="1128" y="544" /> <di:waypoint x="1134" y="500" /> @@ -484,6 +468,22 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1464" y="500" /> <di:waypoint x="1469" y="543" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1lfcycx_di" bpmnElement="Flow_1lfcycx"> + <di:waypoint x="2710" y="385" /> + <di:waypoint x="2710" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_148beur_di" bpmnElement="Flow_148beur"> + <di:waypoint x="2470" y="310" /> + <di:waypoint x="2660" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0crmxc2_di" bpmnElement="Flow_0crmxc2"> + <di:waypoint x="750" y="460" /> + <di:waypoint x="810" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0yujsot_di" bpmnElement="Flow_0yujsot"> + <di:waypoint x="910" y="460" /> + <di:waypoint x="955" y="460" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From cfad142c93f079e85bff38fd1a41f9abbc6c7c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 17:03:07 +0100 Subject: [PATCH 184/382] Added new constant to indicate that the binary resource was downloaded successfully --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + src/main/resources/fhir/CodeSystem/dsf-ping-status.xml | 5 +++++ src/main/resources/fhir/ValueSet/dsf-pong-status.xml | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 8cdd4789..a9e11496 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -63,6 +63,7 @@ private ConstantsPing() public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED = "pong-received"; public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT = "pong-sent"; public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE = "error-message"; + public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_RESOURCE_DOWNLOADED = "resource-downloaded"; public static final String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units"; public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml index b4343ccd..29420c34 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml @@ -46,4 +46,9 @@ <display value="Pong sent" /> <definition value="Pong successfully sent to target organization" /> </concept> + <concept> + <code value="resource-downloaded"/> + <display value="Resource downloaded"/> + <definition value="Resource was downloaded successfully"/> + </concept> </CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml index c755a284..a4bd088e 100644 --- a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml +++ b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml @@ -34,6 +34,10 @@ <code value="pong-sent" /> <display value="Pong sent" /> </concept> + <concept> + <code value="resource-downloaded"/> + <display value="Resource downloaded"/> + </concept> </include> </compose> </ValueSet> \ No newline at end of file From dbb17507245db2b7231ac42700de9cd49680c81f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 17:03:45 +0100 Subject: [PATCH 185/382] Method is not specific to ping status --- .../dsf/bpe/util/task/output/generator/PingStatusGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 2010d83c..160d928f 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -39,7 +39,7 @@ public static void updatePongStatusOutput(TaskOutputComponent outputComponent, S } } - public static void updatePingStatusOutput(TaskOutputComponent outputComponent, Target target) + public static void updateStatusOutput(TaskOutputComponent outputComponent, Target target) { if (hasTargetSet(outputComponent)) { From 24617ff1c6012496ae52dbe76f33220b19a1df11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 17:06:09 +0100 Subject: [PATCH 186/382] Ran format-and-sort --- .../dev/dsf/bpe/spring/config/PingConfig.java | 26 ++-- .../output/generator/PingStatusGenerator.java | 112 +++++++++++------- 2 files changed, 84 insertions(+), 54 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 6dd59f1c..d8fc1007 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -15,25 +15,25 @@ import dev.dsf.bpe.message.SendPong; import dev.dsf.bpe.message.SendStartPing; import dev.dsf.bpe.service.Cleanup; -import dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed; -import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; -import dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration; import dev.dsf.bpe.service.GenerateResource; -import dev.dsf.bpe.service.pong.LogAndSaveAndStoreError; +import dev.dsf.bpe.service.SetDownloadResourceSize; +import dev.dsf.bpe.service.StoreResource; +import dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer; +import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.ping.LogAndSaveError; import dev.dsf.bpe.service.ping.LogAndSaveNoResponse; -import dev.dsf.bpe.service.pong.LogAndStoreSendError; import dev.dsf.bpe.service.ping.LogNoResponse; import dev.dsf.bpe.service.ping.LogPing; import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; +import dev.dsf.bpe.service.ping.StoreResults; +import dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed; +import dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration; +import dev.dsf.bpe.service.pong.LogAndSaveAndStoreError; +import dev.dsf.bpe.service.pong.LogAndStoreSendError; import dev.dsf.bpe.service.pong.SelectPongTarget; -import dev.dsf.bpe.service.SetDownloadResourceSize; import dev.dsf.bpe.service.pong.SetEndpointIdentifier; -import dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer; import dev.dsf.bpe.service.pong.StoreUploadSpeed; -import dev.dsf.bpe.service.StoreResource; -import dev.dsf.bpe.service.ping.StoreResults; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; @@ -55,11 +55,13 @@ public class PingConfig @Value("${dev.dsf.bpe.ping.maxDownloadSize:10000000}") private long maxDownloadSizeBytes; - @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.", processNames = {"dsfdev_ping", "dsfdev_pong"}) + @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.", processNames = { + "dsfdev_ping", "dsfdev_pong" }) @Value("${dev.dsf.bpe.ping.maxUploadSize:10000000}") private long maxUploadSizeBytes; - @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values be: \"bits-per-second\", \"bytes-per-second\", \"megabits-per-second\", \"megabytes-per-second\". Default is \"megabytes-per-second\".", processNames = {"dsfdev_ping", "dsfdev_pong"}) + @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values be: \"bits-per-second\", \"bytes-per-second\", \"megabits-per-second\", \"megabytes-per-second\". Default is \"megabytes-per-second\".", processNames = { + "dsfdev_ping", "dsfdev_pong" }) @Value("${dev.dsf.bpe.ping.networkSpeedUnit:megabytes-per-second}") private String networkSpeedUnit; @@ -260,6 +262,6 @@ public SetEndpointIdentifier setEndpointIdentifier() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public PingPongDeploymentStateListener pingPongDeploymentStateListener() { - return new PingPongDeploymentStateListener( this); + return new PingPongDeploymentStateListener(this); } } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 160d928f..01812326 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -21,20 +21,24 @@ public class PingStatusGenerator { public static void updatePingStatusOutput(TaskOutputComponent outputComponent, String statusCode) { - if(hasStatusCodeSet(outputComponent)) + if (hasStatusCodeSet(outputComponent)) { updateStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode); - } else { + } + else + { addStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode); } } public static void updatePongStatusOutput(TaskOutputComponent outputComponent, String statusCode) { - if(hasStatusCodeSet(outputComponent)) + if (hasStatusCodeSet(outputComponent)) { updateStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode); - } else { + } + else + { addStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode); } } @@ -51,21 +55,23 @@ public static void updateStatusOutput(TaskOutputComponent outputComponent, Targe } } - public static void updateStatusOutput(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, BigDecimal uploadSpeed, - String networkSpeedUnit) + public static void updateStatusOutput(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, + BigDecimal uploadSpeed, String networkSpeedUnit) { if (hasDownloadSpeedSet(outputComponent)) { updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); - } else + } + else { addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); } - if(hasUploadSpeedSet(outputComponent)) + if (hasUploadSpeedSet(outputComponent)) { updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); - } else + } + else { addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); } @@ -77,7 +83,8 @@ public static void updateStatusOutputDownloadSpeed(TaskOutputComponent outputCom if (hasDownloadSpeedSet(outputComponent)) { updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); - } else + } + else { addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); } @@ -89,7 +96,8 @@ public static void updateStatusOutputUploadSpeed(TaskOutputComponent outputCompo if (hasDownloadSpeedSet(outputComponent)) { updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); - } else + } + else { addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); } @@ -97,10 +105,14 @@ public static void updateStatusOutputUploadSpeed(TaskOutputComponent outputCompo private static boolean hasTargetSet(TaskOutputComponent outputComponent) { - List<Extension> correlationKeyExtensions = outputComponent.getExtensionsByUrl(ConstantsPing.EXTENSION_URL_CORRELATION_KEY); - List<Extension> organizationIdentifierExtensions = outputComponent.getExtensionsByUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); - List<Extension> endpointIdentifierExtensions = outputComponent.getExtensionsByUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER); - return !correlationKeyExtensions.isEmpty() || !organizationIdentifierExtensions.isEmpty() || !endpointIdentifierExtensions.isEmpty(); + List<Extension> correlationKeyExtensions = outputComponent + .getExtensionsByUrl(ConstantsPing.EXTENSION_URL_CORRELATION_KEY); + List<Extension> organizationIdentifierExtensions = outputComponent + .getExtensionsByUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); + List<Extension> endpointIdentifierExtensions = outputComponent + .getExtensionsByUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER); + return !correlationKeyExtensions.isEmpty() || !organizationIdentifierExtensions.isEmpty() + || !endpointIdentifierExtensions.isEmpty(); } private static boolean hasStatusCodeSet(TaskOutputComponent outputComponent) @@ -108,8 +120,10 @@ private static boolean hasStatusCodeSet(TaskOutputComponent outputComponent) Type valueType = outputComponent.getValue(); List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); - return (valueType instanceof Coding coding && ConstantsPing.CODESYSTEM_DSF_PING_STATUS.equals(coding.getSystem())) - || outputTypeCodings.stream().anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); + return (valueType instanceof Coding coding + && ConstantsPing.CODESYSTEM_DSF_PING_STATUS.equals(coding.getSystem())) + || outputTypeCodings.stream() + .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); } private static boolean hasNetworkSpeedSet(TaskOutputComponent outputComponent) @@ -214,8 +228,8 @@ private static TaskOutputComponent updateStatus(TaskOutputComponent outputCompon } else { - outputComponent.setValue( - new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); + outputComponent + .setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); } List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); @@ -269,8 +283,8 @@ private static TaskOutputComponent updateTarget(TaskOutputComponent outputCompon new StringType(target.getCorrelationKey())); } - Extension organizationIdentifierExtension = extension.getExtensionByUrl( - ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); + Extension organizationIdentifierExtension = extension + .getExtensionByUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); if (organizationIdentifierExtension != null) { organizationIdentifierExtension.setValue(new StringType(target.getOrganizationIdentifierValue())); @@ -322,10 +336,13 @@ private static TaskOutputComponent updateErrorMessages(TaskOutputComponent outpu { List<Extension> newErrorExtensions = errorMessages.stream() .map(errorMessage -> new Extension(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE, - new StringType(errorMessage))).collect(Collectors.toCollection(ArrayList::new)); + new StringType(errorMessage))) + .collect(Collectors.toCollection(ArrayList::new)); nonErrorExtensions.addAll(newErrorExtensions); extension.setExtension(newErrorExtensions); - } else { + } + else + { extension.setExtension(nonErrorExtensions); } @@ -341,14 +358,16 @@ private static TaskOutputComponent addNetworkSpeed(TaskOutputComponent outputCom return outputComponent; } - private static TaskOutputComponent updateNetworkSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) + private static TaskOutputComponent updateNetworkSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, + BigDecimal uploadSpeed, String unit) { updateDownloadSpeed(outputComponent, downloadSpeed, unit); updateUploadSpeed(outputComponent, uploadSpeed, unit); return outputComponent; } - private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, String unit) + private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, + String unit) { if (downloadSpeed != null && unit != null) { @@ -366,7 +385,8 @@ private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputCo return outputComponent; } - private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, String unit) + private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outputComponent, + BigDecimal downloadSpeed, String unit) { if (downloadSpeed != null && unit != null) { @@ -374,18 +394,21 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu Extension downloadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); if (downloadSpeedExtension != null) { - Extension networkSpeedExtension = downloadSpeedExtension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); - if(networkSpeedExtension != null) + Extension networkSpeedExtension = downloadSpeedExtension + .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); List<Extension> extensions = networkSpeedExtension.getExtension(); - extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, new DecimalType(downloadSpeed))); - extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); + extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, + new DecimalType(downloadSpeed))); + extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, + new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); } - } else + } + else { - downloadSpeedExtension = extension.addExtension() - .setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); + downloadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); Extension networkSpeed = downloadSpeedExtension.addExtension() .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) @@ -398,7 +421,8 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu return outputComponent; } - private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, String unit) + private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, + String unit) { if (uploadSpeed != null && unit != null) { @@ -415,7 +439,8 @@ private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComp return outputComponent; } - private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, String unit) + private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, + String unit) { if (uploadSpeed != null && unit != null) { @@ -423,18 +448,21 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC Extension uploadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); if (uploadSpeedExtension != null) { - Extension networkSpeedExtension = uploadSpeedExtension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); - if(networkSpeedExtension != null) + Extension networkSpeedExtension = uploadSpeedExtension + .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); List<Extension> extensions = networkSpeedExtension.getExtension(); - extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, new DecimalType(uploadSpeed))); - extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); + extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, + new DecimalType(uploadSpeed))); + extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, + new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); } - } else + } + else { - uploadSpeedExtension = extension.addExtension() - .setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); + uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); Extension networkSpeed = uploadSpeedExtension.addExtension() .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) From 9feb3c9f5c1b228bc7071a54ac79c6bc1e71c109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 18:29:34 +0100 Subject: [PATCH 187/382] Added more utility methods to provide the same functionality but with a task instead of an input/output parameter --- .../output/generator/PingStatusGenerator.java | 196 +++++++++++++++--- 1 file changed, 170 insertions(+), 26 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 01812326..a874a10c 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -2,6 +2,7 @@ import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -9,6 +10,7 @@ import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.TaskOutputComponent; import org.hl7.fhir.r4.model.Type; @@ -19,7 +21,27 @@ public class PingStatusGenerator { - public static void updatePingStatusOutput(TaskOutputComponent outputComponent, String statusCode) + public static Task updatePingStatusOutput(Task task, String statusCode) + { + List<Task.TaskOutputComponent> pingStatusOutputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS); + if (pingStatusOutputs.isEmpty()) + { + task.addOutput(updatePingStatusOutput(new TaskOutputComponent(), statusCode)); + } else + { + if (pingStatusOutputs.size() == 1) + { + updatePingStatusOutput(pingStatusOutputs.get(0), statusCode); + } else + { + throw new RuntimeException("There is more than one ping status output for task " + task.getId()); + } + } + + return task; + } + + public static TaskOutputComponent updatePingStatusOutput(TaskOutputComponent outputComponent, String statusCode) { if (hasStatusCodeSet(outputComponent)) { @@ -29,9 +51,31 @@ public static void updatePingStatusOutput(TaskOutputComponent outputComponent, S { addStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode); } + + return outputComponent; + } + + public static Task updatePongStatusOutput(Task task, String statusCode) + { + List<Task.TaskOutputComponent> pingStatusOutputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + if (pingStatusOutputs.isEmpty()) + { + task.addOutput(updatePingStatusOutput(new TaskOutputComponent(), statusCode)); + } else + { + if (pingStatusOutputs.size() == 1) + { + updatePingStatusOutput(pingStatusOutputs.get(0), statusCode); + } else + { + throw new RuntimeException("There is more than one pong status output for task " + task.getId()); + } + } + + return task; } - public static void updatePongStatusOutput(TaskOutputComponent outputComponent, String statusCode) + public static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent outputComponent, String statusCode) { if (hasStatusCodeSet(outputComponent)) { @@ -41,9 +85,31 @@ public static void updatePongStatusOutput(TaskOutputComponent outputComponent, S { addStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode); } + + return outputComponent; + } + + public static Task updateStatusOutput(Task task, Target target) + { + List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + if (outputs.isEmpty()) + { + task.addOutput(updateStatusOutput(new TaskOutputComponent(), target)); + } else + { + if (outputs.size() == 1) + { + updateStatusOutput(outputs.get(0), target); + } else + { + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId()); + } + } + + return task; } - public static void updateStatusOutput(TaskOutputComponent outputComponent, Target target) + public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputComponent, Target target) { if (hasTargetSet(outputComponent)) { @@ -53,9 +119,33 @@ public static void updateStatusOutput(TaskOutputComponent outputComponent, Targe { addTarget(outputComponent, target); } + return outputComponent; } - public static void updateStatusOutput(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, + public static Task updateStatusOutput(Task task, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String statusCode) + { + List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + if (outputs.isEmpty()) + { + task.addOutput(updateStatusOutput(new TaskOutputComponent(), downloadSpeed, uploadSpeed, statusCode)); + } + else + { + if (outputs.size() == 1) + { + updateStatusOutput(outputs.get(0), downloadSpeed, uploadSpeed, statusCode); + } + else + { + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId()); + } + } + + return task; + } + + public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String networkSpeedUnit) { if (hasDownloadSpeedSet(outputComponent)) @@ -75,9 +165,31 @@ public static void updateStatusOutput(TaskOutputComponent outputComponent, BigDe { addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); } + + return outputComponent; } - public static void updateStatusOutputDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, + public static Task updateStatusOutputDownloadSpeed(Task task, BigDecimal downloadSpeed, String networkSpeedUnit) + { + List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + if (outputs.isEmpty()) + { + task.addOutput(updateStatusOutputDownloadSpeed(new TaskOutputComponent(), downloadSpeed, networkSpeedUnit)); + } else + { + if (outputs.size() == 1) + { + updateStatusOutputDownloadSpeed(outputs.get(0), downloadSpeed, networkSpeedUnit); + } else + { + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId()); + } + } + + return task; + } + + public static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, String networkSpeedUnit) { if (hasDownloadSpeedSet(outputComponent)) @@ -88,9 +200,31 @@ public static void updateStatusOutputDownloadSpeed(TaskOutputComponent outputCom { addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); } + + return outputComponent; } - public static void updateStatusOutputUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, + public static Task updateStatusOutputUploadSpeed(Task task, BigDecimal uploadSpeed, String networkSpeedUnit) + { + List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + if (outputs.isEmpty()) + { + task.addOutput(updateStatusOutputUploadSpeed(new TaskOutputComponent(), uploadSpeed, networkSpeedUnit)); + } else + { + if (outputs.size() == 1) + { + updateStatusOutputUploadSpeed(outputs.get(0), uploadSpeed, networkSpeedUnit); + } else + { + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId()); + } + } + + return task; + } + + public static TaskOutputComponent updateStatusOutputUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, String networkSpeedUnit) { if (hasDownloadSpeedSet(outputComponent)) @@ -101,16 +235,18 @@ public static void updateStatusOutputUploadSpeed(TaskOutputComponent outputCompo { addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); } + + return outputComponent; } private static boolean hasTargetSet(TaskOutputComponent outputComponent) { - List<Extension> correlationKeyExtensions = outputComponent - .getExtensionsByUrl(ConstantsPing.EXTENSION_URL_CORRELATION_KEY); - List<Extension> organizationIdentifierExtensions = outputComponent - .getExtensionsByUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); - List<Extension> endpointIdentifierExtensions = outputComponent - .getExtensionsByUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER); + List<Extension> correlationKeyExtensions = outputComponent.getExtensionsByUrl( + ConstantsPing.EXTENSION_URL_CORRELATION_KEY); + List<Extension> organizationIdentifierExtensions = outputComponent.getExtensionsByUrl( + ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); + List<Extension> endpointIdentifierExtensions = outputComponent.getExtensionsByUrl( + ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER); return !correlationKeyExtensions.isEmpty() || !organizationIdentifierExtensions.isEmpty() || !endpointIdentifierExtensions.isEmpty(); } @@ -120,10 +256,9 @@ private static boolean hasStatusCodeSet(TaskOutputComponent outputComponent) Type valueType = outputComponent.getValue(); List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); - return (valueType instanceof Coding coding - && ConstantsPing.CODESYSTEM_DSF_PING_STATUS.equals(coding.getSystem())) - || outputTypeCodings.stream() - .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); + return (valueType instanceof Coding coding && ConstantsPing.CODESYSTEM_DSF_PING_STATUS.equals( + coding.getSystem())) || outputTypeCodings.stream() + .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); } private static boolean hasNetworkSpeedSet(TaskOutputComponent outputComponent) @@ -228,8 +363,8 @@ private static TaskOutputComponent updateStatus(TaskOutputComponent outputCompon } else { - outputComponent - .setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); + outputComponent.setValue( + new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); } List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); @@ -283,8 +418,8 @@ private static TaskOutputComponent updateTarget(TaskOutputComponent outputCompon new StringType(target.getCorrelationKey())); } - Extension organizationIdentifierExtension = extension - .getExtensionByUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); + Extension organizationIdentifierExtension = extension.getExtensionByUrl( + ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); if (organizationIdentifierExtension != null) { organizationIdentifierExtension.setValue(new StringType(target.getOrganizationIdentifierValue())); @@ -336,8 +471,7 @@ private static TaskOutputComponent updateErrorMessages(TaskOutputComponent outpu { List<Extension> newErrorExtensions = errorMessages.stream() .map(errorMessage -> new Extension(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE, - new StringType(errorMessage))) - .collect(Collectors.toCollection(ArrayList::new)); + new StringType(errorMessage))).collect(Collectors.toCollection(ArrayList::new)); nonErrorExtensions.addAll(newErrorExtensions); extension.setExtension(newErrorExtensions); } @@ -394,8 +528,8 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu Extension downloadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); if (downloadSpeedExtension != null) { - Extension networkSpeedExtension = downloadSpeedExtension - .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + Extension networkSpeedExtension = downloadSpeedExtension.getExtensionByUrl( + ConstantsPing.EXTENSION_URL_NETWORK_SPEED); if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); @@ -448,8 +582,8 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC Extension uploadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); if (uploadSpeedExtension != null) { - Extension networkSpeedExtension = uploadSpeedExtension - .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + Extension networkSpeedExtension = uploadSpeedExtension.getExtensionByUrl( + ConstantsPing.EXTENSION_URL_NETWORK_SPEED); if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); @@ -499,4 +633,14 @@ private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outp } return extension; } + + private static List<Task.TaskOutputComponent> getOutputsByCodes(Task task, String... codes) + { + return task.getOutput().stream() + .filter(outputComponent -> !outputComponent.getType().getCoding().isEmpty()) + .filter(outputComponent -> outputComponent.getType().getCoding().stream().anyMatch( + coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem()) + && Arrays.stream(codes).anyMatch(code -> code.equals(coding.getCode())))) + .collect(Collectors.toCollection(ArrayList::new)); + } } From f980c6a57f57401af725faf433de0d5f69a85248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 18:39:10 +0100 Subject: [PATCH 188/382] Added StoreDownloadSpeed --- .../bpe/service/pong/StoreDownloadSpeed.java | 47 +++++++++++++ .../dev/dsf/bpe/spring/config/PingConfig.java | 8 +++ src/main/resources/bpe/pong.bpmn | 70 +++++++++---------- 3 files changed, 90 insertions(+), 35 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java new file mode 100644 index 00000000..6f841604 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -0,0 +1,47 @@ +package dev.dsf.bpe.service.pong; + +import java.math.BigDecimal; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.task.NetworkSpeedCalculator; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; +import dev.dsf.bpe.v1.variables.Variables; + +public class StoreDownloadSpeed extends AbstractServiceDelegate +{ + private final String networkSpeedUnit; + + public StoreDownloadSpeed(ProcessPluginApi api, String networkSpeedUnit) + { + super(api); + this.networkSpeedUnit = networkSpeedUnit; + } + + @Override + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + { + // TODO: add to spring config + + Task startTask = variables.getStartTask(); + + int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); + long downloadedDurationMillis = variables + .getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis()); + + BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, + networkSpeedUnit); + + PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_RESOURCE_DOWNLOADED); + PingStatusGenerator.updateStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); + + variables.updateTask(startTask); + } +} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index d8fc1007..6f16515b 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -33,6 +33,7 @@ import dev.dsf.bpe.service.pong.LogAndStoreSendError; import dev.dsf.bpe.service.pong.SelectPongTarget; import dev.dsf.bpe.service.pong.SetEndpointIdentifier; +import dev.dsf.bpe.service.pong.StoreDownloadSpeed; import dev.dsf.bpe.service.pong.StoreUploadSpeed; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; @@ -264,4 +265,11 @@ public PingPongDeploymentStateListener pingPongDeploymentStateListener() { return new PingPongDeploymentStateListener(this); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public StoreDownloadSpeed storeDownloadSpeed() + { + return new StoreDownloadSpeed(api, networkSpeedUnit); + } } diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 27549416..be3415ea 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -161,7 +161,7 @@ <bpmn:sequenceFlow id="Flow_1lfcycx" sourceRef="Gateway_1wktaap" targetRef="Activity_0otptjn" /> <bpmn:sequenceFlow id="Flow_148beur" sourceRef="Activity_0t0ex36" targetRef="Activity_0otptjn" /> <bpmn:sequenceFlow id="Flow_0crmxc2" sourceRef="Activity_095j2gg" targetRef="Activity_0i998dm" /> - <bpmn:serviceTask id="Activity_0i998dm" name="Store Download Speed" camunda:class="dev.dsf.bpe.service.pong.StoreUploadSpeed"> + <bpmn:serviceTask id="Activity_0i998dm" name="Store Download Speed" camunda:class="dev.dsf.bpe.service.pong.StoreDownloadSpeed"> <bpmn:incoming>Flow_0crmxc2</bpmn:incoming> <bpmn:outgoing>Flow_0yujsot</bpmn:outgoing> </bpmn:serviceTask> @@ -209,10 +209,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> - <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> - <dc:Bounds x="2860" y="439" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> <dc:Bounds x="152" y="292" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -270,6 +266,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Event_05zzvx3_di" bpmnElement="Event_1qh25on"> <dc:Bounds x="1862" y="595" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> + <dc:Bounds x="2660" y="270" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1ouj7x3_di" bpmnElement="Activity_04mv5cn"> <dc:Bounds x="1250" y="420" width="100" height="80" /> </bpmndi:BPMNShape> @@ -287,6 +286,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> <dc:Bounds x="430" y="270" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> + <dc:Bounds x="2822" y="292" width="36" height="36" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1wktaap_di" bpmnElement="Gateway_1wktaap" isMarkerVisible="true"> <dc:Bounds x="2685" y="385" width="50" height="50" /> </bpmndi:BPMNShape> @@ -294,6 +296,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2510" y="370" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> + <dc:Bounds x="810" y="420" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> <dc:Bounds x="280" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> @@ -306,6 +312,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1910" y="439" width="250" height="84" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> + <dc:Bounds x="2860" y="439" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> <dc:Bounds x="1420" y="543" width="275" height="41" /> <bpmndi:BPMNLabel /> @@ -318,20 +328,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="400" y="183" width="585" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> - <dc:Bounds x="2660" y="270" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> - <dc:Bounds x="2822" y="292" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> - <dc:Bounds x="810" y="420" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2758" y="346" /> - <di:waypoint x="2884" y="439" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> <dc:Bounds x="1862" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -452,22 +448,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2610" y="410" /> <di:waypoint x="2685" y="410" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> - <di:waypoint x="722" y="420" /> - <di:waypoint x="738" y="390" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> - <di:waypoint x="1996" y="350" /> - <di:waypoint x="1965" y="439" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> - <di:waypoint x="1128" y="544" /> - <di:waypoint x="1134" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> - <di:waypoint x="1464" y="500" /> - <di:waypoint x="1469" y="543" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1lfcycx_di" bpmnElement="Flow_1lfcycx"> <di:waypoint x="2710" y="385" /> <di:waypoint x="2710" y="350" /> @@ -484,6 +464,26 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="910" y="460" /> <di:waypoint x="955" y="460" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> + <di:waypoint x="722" y="420" /> + <di:waypoint x="738" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> + <di:waypoint x="1996" y="350" /> + <di:waypoint x="1965" y="439" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> + <di:waypoint x="2758" y="346" /> + <di:waypoint x="2884" y="439" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> + <di:waypoint x="1128" y="544" /> + <di:waypoint x="1134" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> + <di:waypoint x="1464" y="500" /> + <di:waypoint x="1469" y="543" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From 0a4b9522f0940b782ec98b00a0c5ac7a5f7c4ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 18:40:04 +0100 Subject: [PATCH 189/382] Todo done --- src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 6f841604..17465e3e 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -28,8 +28,6 @@ public StoreDownloadSpeed(ProcessPluginApi api, String networkSpeedUnit) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { - // TODO: add to spring config - Task startTask = variables.getStartTask(); int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); From e9e30495484275953ab2844e19a3f127ba0b4d49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 13 Mar 2025 18:43:25 +0100 Subject: [PATCH 190/382] Added implementation to StoreUploadSpeed --- .../bpe/service/pong/StoreUploadSpeed.java | 23 +++++++++++++++++-- .../dev/dsf/bpe/spring/config/PingConfig.java | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index 33da8538..159dc210 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -1,10 +1,16 @@ package dev.dsf.bpe.service.pong; +import java.math.BigDecimal; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.task.NetworkSpeedCalculator; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -12,15 +18,28 @@ public class StoreUploadSpeed extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(StoreUploadSpeed.class); + private final String networkSpeedUnit; - public StoreUploadSpeed(ProcessPluginApi api) + public StoreUploadSpeed(ProcessPluginApi api, String networkSpeedUnit) { super(api); + this.networkSpeedUnit = networkSpeedUnit; } @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - logger.info("Storing download speeds as input parameter"); + Task startTask = variables.getStartTask(); + + int uploadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); + long uploadedDurationMillis = variables + .getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis()); + + BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, + networkSpeedUnit); + + PingStatusGenerator.updateStatusOutputDownloadSpeed(startTask, uploadSpeed, networkSpeedUnit); + + variables.updateTask(startTask); } } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 6f16515b..a0a1bb56 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -228,7 +228,7 @@ public LogAndSaveError logAndSaveError() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public StoreUploadSpeed storeDownloadSpeeds() { - return new StoreUploadSpeed(api); + return new StoreUploadSpeed(api, networkSpeedUnit); } @Bean From 2748a5f5b9df46cdf8d5a3348074287bb11166ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 09:39:39 +0100 Subject: [PATCH 191/382] Ran format-and-sort --- .../bpe/service/pong/StoreDownloadSpeed.java | 3 +- .../bpe/service/pong/StoreUploadSpeed.java | 3 +- .../output/generator/PingStatusGenerator.java | 107 +++++++++++------- 3 files changed, 67 insertions(+), 46 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 17465e3e..b4a6e29b 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -37,7 +37,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit); - PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_RESOURCE_DOWNLOADED); + PingStatusGenerator.updatePongStatusOutput(startTask, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_RESOURCE_DOWNLOADED); PingStatusGenerator.updateStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); variables.updateTask(startTask); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index 159dc210..4ba5847f 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -32,8 +32,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task startTask = variables.getStartTask(); int uploadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); - long uploadedDurationMillis = variables - .getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis()); + long uploadedDurationMillis = variables.getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis()); BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit); diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index a874a10c..3dcb4220 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -23,16 +23,19 @@ public class PingStatusGenerator { public static Task updatePingStatusOutput(Task task, String statusCode) { - List<Task.TaskOutputComponent> pingStatusOutputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS); + List<Task.TaskOutputComponent> pingStatusOutputs = getOutputsByCodes(task, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS); if (pingStatusOutputs.isEmpty()) { task.addOutput(updatePingStatusOutput(new TaskOutputComponent(), statusCode)); - } else + } + else { if (pingStatusOutputs.size() == 1) { updatePingStatusOutput(pingStatusOutputs.get(0), statusCode); - } else + } + else { throw new RuntimeException("There is more than one ping status output for task " + task.getId()); } @@ -57,16 +60,19 @@ public static TaskOutputComponent updatePingStatusOutput(TaskOutputComponent out public static Task updatePongStatusOutput(Task task, String statusCode) { - List<Task.TaskOutputComponent> pingStatusOutputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + List<Task.TaskOutputComponent> pingStatusOutputs = getOutputsByCodes(task, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (pingStatusOutputs.isEmpty()) { task.addOutput(updatePingStatusOutput(new TaskOutputComponent(), statusCode)); - } else + } + else { if (pingStatusOutputs.size() == 1) { updatePingStatusOutput(pingStatusOutputs.get(0), statusCode); - } else + } + else { throw new RuntimeException("There is more than one pong status output for task " + task.getId()); } @@ -91,16 +97,20 @@ public static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent out public static Task updateStatusOutput(Task task, Target target) { - List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { task.addOutput(updateStatusOutput(new TaskOutputComponent(), target)); - } else + } + else { if (outputs.size() == 1) { updateStatusOutput(outputs.get(0), target); - } else + } + else { throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId()); } @@ -122,9 +132,11 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputC return outputComponent; } - public static Task updateStatusOutput(Task task, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String statusCode) + public static Task updateStatusOutput(Task task, BigDecimal downloadSpeed, BigDecimal uploadSpeed, + String statusCode) { - List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, + List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { @@ -171,16 +183,20 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputC public static Task updateStatusOutputDownloadSpeed(Task task, BigDecimal downloadSpeed, String networkSpeedUnit) { - List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { task.addOutput(updateStatusOutputDownloadSpeed(new TaskOutputComponent(), downloadSpeed, networkSpeedUnit)); - } else + } + else { if (outputs.size() == 1) { updateStatusOutputDownloadSpeed(outputs.get(0), downloadSpeed, networkSpeedUnit); - } else + } + else { throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId()); } @@ -189,8 +205,8 @@ public static Task updateStatusOutputDownloadSpeed(Task task, BigDecimal downloa return task; } - public static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, - String networkSpeedUnit) + public static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComponent outputComponent, + BigDecimal downloadSpeed, String networkSpeedUnit) { if (hasDownloadSpeedSet(outputComponent)) { @@ -206,16 +222,20 @@ public static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComp public static Task updateStatusOutputUploadSpeed(Task task, BigDecimal uploadSpeed, String networkSpeedUnit) { - List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { task.addOutput(updateStatusOutputUploadSpeed(new TaskOutputComponent(), uploadSpeed, networkSpeedUnit)); - } else + } + else { if (outputs.size() == 1) { updateStatusOutputUploadSpeed(outputs.get(0), uploadSpeed, networkSpeedUnit); - } else + } + else { throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId()); } @@ -224,8 +244,8 @@ public static Task updateStatusOutputUploadSpeed(Task task, BigDecimal uploadSpe return task; } - public static TaskOutputComponent updateStatusOutputUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, - String networkSpeedUnit) + public static TaskOutputComponent updateStatusOutputUploadSpeed(TaskOutputComponent outputComponent, + BigDecimal uploadSpeed, String networkSpeedUnit) { if (hasDownloadSpeedSet(outputComponent)) { @@ -241,12 +261,12 @@ public static TaskOutputComponent updateStatusOutputUploadSpeed(TaskOutputCompon private static boolean hasTargetSet(TaskOutputComponent outputComponent) { - List<Extension> correlationKeyExtensions = outputComponent.getExtensionsByUrl( - ConstantsPing.EXTENSION_URL_CORRELATION_KEY); - List<Extension> organizationIdentifierExtensions = outputComponent.getExtensionsByUrl( - ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); - List<Extension> endpointIdentifierExtensions = outputComponent.getExtensionsByUrl( - ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER); + List<Extension> correlationKeyExtensions = outputComponent + .getExtensionsByUrl(ConstantsPing.EXTENSION_URL_CORRELATION_KEY); + List<Extension> organizationIdentifierExtensions = outputComponent + .getExtensionsByUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); + List<Extension> endpointIdentifierExtensions = outputComponent + .getExtensionsByUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER); return !correlationKeyExtensions.isEmpty() || !organizationIdentifierExtensions.isEmpty() || !endpointIdentifierExtensions.isEmpty(); } @@ -256,9 +276,10 @@ private static boolean hasStatusCodeSet(TaskOutputComponent outputComponent) Type valueType = outputComponent.getValue(); List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); - return (valueType instanceof Coding coding && ConstantsPing.CODESYSTEM_DSF_PING_STATUS.equals( - coding.getSystem())) || outputTypeCodings.stream() - .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); + return (valueType instanceof Coding coding + && ConstantsPing.CODESYSTEM_DSF_PING_STATUS.equals(coding.getSystem())) + || outputTypeCodings.stream() + .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); } private static boolean hasNetworkSpeedSet(TaskOutputComponent outputComponent) @@ -363,8 +384,8 @@ private static TaskOutputComponent updateStatus(TaskOutputComponent outputCompon } else { - outputComponent.setValue( - new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); + outputComponent + .setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); } List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); @@ -418,8 +439,8 @@ private static TaskOutputComponent updateTarget(TaskOutputComponent outputCompon new StringType(target.getCorrelationKey())); } - Extension organizationIdentifierExtension = extension.getExtensionByUrl( - ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); + Extension organizationIdentifierExtension = extension + .getExtensionByUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER); if (organizationIdentifierExtension != null) { organizationIdentifierExtension.setValue(new StringType(target.getOrganizationIdentifierValue())); @@ -471,7 +492,8 @@ private static TaskOutputComponent updateErrorMessages(TaskOutputComponent outpu { List<Extension> newErrorExtensions = errorMessages.stream() .map(errorMessage -> new Extension(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE, - new StringType(errorMessage))).collect(Collectors.toCollection(ArrayList::new)); + new StringType(errorMessage))) + .collect(Collectors.toCollection(ArrayList::new)); nonErrorExtensions.addAll(newErrorExtensions); extension.setExtension(newErrorExtensions); } @@ -528,8 +550,8 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu Extension downloadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); if (downloadSpeedExtension != null) { - Extension networkSpeedExtension = downloadSpeedExtension.getExtensionByUrl( - ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + Extension networkSpeedExtension = downloadSpeedExtension + .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); @@ -582,8 +604,8 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC Extension uploadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); if (uploadSpeedExtension != null) { - Extension networkSpeedExtension = uploadSpeedExtension.getExtensionByUrl( - ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + Extension networkSpeedExtension = uploadSpeedExtension + .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); @@ -636,10 +658,9 @@ private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outp private static List<Task.TaskOutputComponent> getOutputsByCodes(Task task, String... codes) { - return task.getOutput().stream() - .filter(outputComponent -> !outputComponent.getType().getCoding().isEmpty()) - .filter(outputComponent -> outputComponent.getType().getCoding().stream().anyMatch( - coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem()) + return task.getOutput().stream().filter(outputComponent -> !outputComponent.getType().getCoding().isEmpty()) + .filter(outputComponent -> outputComponent.getType().getCoding().stream() + .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem()) && Arrays.stream(codes).anyMatch(code -> code.equals(coding.getCode())))) .collect(Collectors.toCollection(ArrayList::new)); } From e81437549fb305a0a657a9783871ce8b97066a4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 09:59:10 +0100 Subject: [PATCH 192/382] Should have been downloaded duration, not uploaded duration in StoreDOWNLOADSpeed --- src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index b4a6e29b..40bf5f0d 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -32,7 +32,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); long downloadedDurationMillis = variables - .getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis()); + .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit); From af822d019471a20e83b92ad8dfb019dea4824530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 10:55:38 +0100 Subject: [PATCH 193/382] Added MathContext --- .../bpe/util/task/NetworkSpeedCalculator.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 1e0dbb1f..17fe29cb 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -1,7 +1,7 @@ package dev.dsf.bpe.util.task; import java.math.BigDecimal; -import java.math.RoundingMode; +import java.math.MathContext; import dev.dsf.bpe.ConstantsPing; @@ -9,19 +9,20 @@ public class NetworkSpeedCalculator { public static BigDecimal calculate(int bytes, long duration, String unit) { + MathContext mathContext = new MathContext(4); return switch (unit) { - case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND -> - new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); + case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND -> new BigDecimal(bytes * 8L) + .divide(BigDecimal.valueOf(duration).divide(BigDecimal.valueOf(1000), mathContext), mathContext); case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND -> - new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(1000000), RoundingMode.UNNECESSARY) - .divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); - case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND -> - new BigDecimal(bytes).divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); + new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(1000000), mathContext).divide( + BigDecimal.valueOf(duration).divide(BigDecimal.valueOf(1000), mathContext), mathContext); + case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND -> new BigDecimal(bytes) + .divide(BigDecimal.valueOf(duration).divide(BigDecimal.valueOf(1000), mathContext), mathContext); case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND -> - new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), RoundingMode.UNNECESSARY) - .divide(BigDecimal.valueOf(duration / 1000), RoundingMode.HALF_DOWN); - default -> new BigDecimal(0); + new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), mathContext).divide( + BigDecimal.valueOf(duration).divide(BigDecimal.valueOf(1000), mathContext), mathContext); + default -> BigDecimal.ZERO; }; } } From 1b90fd4620251e90b656bdc0a7d6469367a57002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 10:56:08 +0100 Subject: [PATCH 194/382] Added null checks and getErrorMessageList now creates the list if it does not exist yet --- .../java/dev/dsf/bpe/util/ErrorMessageListUtils.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java index cb36ec6a..40f03805 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java @@ -13,6 +13,8 @@ public class ErrorMessageListUtils public static List<String> addAll(List<String> errors, DelegateExecution execution) { List<String> errorList = getErrorMessageList(execution); + if (errors == null) + return errorList; errorList.addAll(errors); return errorList; } @@ -25,7 +27,14 @@ public static List<String> add(String error, DelegateExecution execution) @SuppressWarnings("unchecked") public static List<String> getErrorMessageList(DelegateExecution execution) { - return (List<String>) execution.getVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST); + List<String> errorMessages = (List<String>) execution + .getVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST); + if (errorMessages == null) + { + errorMessages = new Vector<>(); + execution.setVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, errorMessages); + } + return errorMessages; } @SuppressWarnings("unchecked") From 6823d3ff3f6b550f6ac4d8e98450f10eb86e5c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 10:56:45 +0100 Subject: [PATCH 195/382] Error message is now added to error message list instead of being a separate error message in execution variables --- src/main/java/dev/dsf/bpe/message/SendPing.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index e65dd730..9f46f11e 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -12,6 +12,7 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -65,7 +66,7 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); String specialErrorMessage = createErrorMessage(exception); - variables.setString(ConstantsPing.getBpmnExecutionVariableErrorMessage(correlationKey), specialErrorMessage); + ErrorMessageListUtils.add(specialErrorMessage, execution); logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); } From bf85a6916b54352e8ccebd73dde99356fd75e62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 11:18:05 +0100 Subject: [PATCH 196/382] Added handling for 0 bytes downloaded and 0 download duration --- .../java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 17fe29cb..8ad009c5 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -9,6 +9,9 @@ public class NetworkSpeedCalculator { public static BigDecimal calculate(int bytes, long duration, String unit) { + if (bytes == 0) return BigDecimal.ZERO; + if (duration == 0) return BigDecimal.valueOf(Long.MAX_VALUE); + MathContext mathContext = new MathContext(4); return switch (unit) { From 66b221771f6a008949b6a529f80b5ae809cbfd74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 11:23:02 +0100 Subject: [PATCH 197/382] Added handling for 0 bytes downloaded and 0 download duration --- .../java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 8ad009c5..75a567c2 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -9,8 +9,10 @@ public class NetworkSpeedCalculator { public static BigDecimal calculate(int bytes, long duration, String unit) { - if (bytes == 0) return BigDecimal.ZERO; - if (duration == 0) return BigDecimal.valueOf(Long.MAX_VALUE); + if (bytes == 0) + return BigDecimal.ZERO; + if (duration == 0) + return BigDecimal.valueOf(Long.MAX_VALUE); MathContext mathContext = new MathContext(4); return switch (unit) From 9430bc826601b382c50f3f48ee4c1fbe3c9ca689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 11:31:08 +0100 Subject: [PATCH 198/382] Fixed wrong method being called --- .../bpe/util/task/output/generator/PingStatusGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 3dcb4220..3a335f5a 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -64,13 +64,13 @@ public static Task updatePongStatusOutput(Task task, String statusCode) ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (pingStatusOutputs.isEmpty()) { - task.addOutput(updatePingStatusOutput(new TaskOutputComponent(), statusCode)); + task.addOutput(updatePongStatusOutput(new TaskOutputComponent(), statusCode)); } else { if (pingStatusOutputs.size() == 1) { - updatePingStatusOutput(pingStatusOutputs.get(0), statusCode); + updatePongStatusOutput(pingStatusOutputs.get(0), statusCode); } else { From 007da00ff1fdc9d8e969fa54e82d3250907c9b76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 11:32:27 +0100 Subject: [PATCH 199/382] Fixed naming --- .../util/task/output/generator/PingStatusGenerator.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 3a335f5a..2535ff4d 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -60,17 +60,17 @@ public static TaskOutputComponent updatePingStatusOutput(TaskOutputComponent out public static Task updatePongStatusOutput(Task task, String statusCode) { - List<Task.TaskOutputComponent> pingStatusOutputs = getOutputsByCodes(task, + List<Task.TaskOutputComponent> pongStatusOutputs = getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); - if (pingStatusOutputs.isEmpty()) + if (pongStatusOutputs.isEmpty()) { task.addOutput(updatePongStatusOutput(new TaskOutputComponent(), statusCode)); } else { - if (pingStatusOutputs.size() == 1) + if (pongStatusOutputs.size() == 1) { - updatePongStatusOutput(pingStatusOutputs.get(0), statusCode); + updatePongStatusOutput(pongStatusOutputs.get(0), statusCode); } else { From 91cc44a5e18e4ea15dbbb47e3fc3ee61d08eed1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 13:20:16 +0100 Subject: [PATCH 200/382] Added missing fhir resource --- .../java/dev/dsf/bpe/PingProcessPluginDefinition.java | 9 +++++---- .../dev/dsf/bpe/PingProcessPluginDefinitionTest.java | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index ed1eecb3..0a1b65b8 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -61,6 +61,7 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var sStartPingAutostart = "fhir/StructureDefinition/dsf-task-start-ping-autostart.xml"; var sStopPingAutostart = "fhir/StructureDefinition/dsf-task-stop-ping-autostart.xml"; var sCleanupPong = "fhir/StructureDefinition/dsf-task-cleanup-pong.xml"; + var sNetworkSpeedExtension = "fhir/StructureDefinition/dsf-extension-network-speed.xml"; var tStartPing = "fhir/Task/dsf-task-start-ping.xml"; var tStartPingAutoStart = "fhir/Task/dsf-task-start-ping-autostart.xml"; @@ -71,13 +72,13 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var vPingStatus = "fhir/ValueSet/dsf-ping-status.xml"; var vPongStatus = "fhir/ValueSet/dsf-pong-status.xml"; - return Map.of( - ConstantsPing.PROCESS_NAME_FULL_PING, Arrays.asList(aPing, cPing, cPingStatus, cPingUnits, sPingStatus, - sStartPing, sPong, sCleanupPong, tStartPing, vPing, vPingStatus, vPingUnits), + return Map.of(ConstantsPing.PROCESS_NAME_FULL_PING, + Arrays.asList(aPing, cPing, cPingStatus, cPingUnits, sPingStatus, sStartPing, sPong, sCleanupPong, + sNetworkSpeedExtension, tStartPing, vPing, vPingStatus, vPingUnits), ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, tStopPingAutoStart, vPing), ConstantsPing.PROCESS_NAME_FULL_PONG, Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, sPingStatus, - sPing, vPing, vPongStatus, vPingUnits)); + sPing, sNetworkSpeedExtension, vPing, vPongStatus, vPingUnits)); } } diff --git a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java index 4517171f..55e289ab 100644 --- a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java +++ b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java @@ -20,7 +20,7 @@ public void testResourceLoading() throws Exception var ping = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING); assertNotNull(ping); - assertEquals(12, ping.stream().filter(this::exists).count()); + assertEquals(13, ping.stream().filter(this::exists).count()); var pingAutostart = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART); assertNotNull(pingAutostart); @@ -28,7 +28,7 @@ public void testResourceLoading() throws Exception var pong = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PONG); assertNotNull(pong); - assertEquals(9, pong.stream().filter(this::exists).count()); + assertEquals(10, pong.stream().filter(this::exists).count()); } private boolean exists(String file) From d317f3a41b3ffbe26b2b2299d30ef481b0bc5e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 13:21:07 +0100 Subject: [PATCH 201/382] Now uses update instead of create because there is already an output parameter present (created in StoreDownloadSpeed) that needs to be updated instead --- src/main/java/dev/dsf/bpe/message/SendPong.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 59a3d623..a2caea61 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -76,8 +76,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw super.doExecute(execution, variables); Task mainTask = variables.getStartTask(); - mainTask.addOutput(PingStatusGenerator.createPongStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); + PingStatusGenerator.updateStatusOutput(mainTask, target); + PingStatusGenerator.updatePongStatusOutput(mainTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT); variables.updateTask(mainTask); } From 9ed995163f47eca8bbf6093e25a5a63d1a6c947b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 13:26:02 +0100 Subject: [PATCH 202/382] Upload speed is read from cleanup task, not from execution variables --- .../bpe/service/pong/StoreUploadSpeed.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index 4ba5847f..04b9af0e 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -1,9 +1,13 @@ package dev.dsf.bpe.service.pong; import java.math.BigDecimal; +import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.DecimalType; +import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.PrimitiveType; import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,15 +34,31 @@ public StoreUploadSpeed(ProcessPluginApi api, String networkSpeedUnit) protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { Task startTask = variables.getStartTask(); + Task cleanup = variables.getLatestTask(); - int uploadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); - long uploadedDurationMillis = variables.getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis()); + Optional<IntegerType> uploadedBytesTaskInput = getUploadedBytes(cleanup); + Optional<DecimalType> uploadedDurationMillisTaskInput = getUploadedDurationMillis(cleanup); + int uploadedBytes = uploadedBytesTaskInput.map(PrimitiveType::getValue).orElse(0); + long uploadedDurationMillis = uploadedDurationMillisTaskInput + .map(decimalType -> decimalType.getValue().longValue()).orElse(0L); BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit); - PingStatusGenerator.updateStatusOutputDownloadSpeed(startTask, uploadSpeed, networkSpeedUnit); + PingStatusGenerator.updateStatusOutputUploadSpeed(startTask, uploadSpeed, networkSpeedUnit); variables.updateTask(startTask); } + + private Optional<IntegerType> getUploadedBytes(Task task) + { + return api.getTaskHelper().getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, IntegerType.class); + } + + private Optional<DecimalType> getUploadedDurationMillis(Task task) + { + return api.getTaskHelper().getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, DecimalType.class); + } } From 1472d589d43f8e656b80dfce1b17c47c60db60ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 13:37:21 +0100 Subject: [PATCH 203/382] Now uses actual download results --- src/main/java/dev/dsf/bpe/message/CleanupPong.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPong.java b/src/main/java/dev/dsf/bpe/message/CleanupPong.java index 98c86656..9a96438a 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPong.java @@ -5,6 +5,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; @@ -22,8 +23,13 @@ public CleanupPong(ProcessPluginApi api) protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - return Stream.of(NetworkSpeedMetricGenerator.createDownloadedBytes(0), - NetworkSpeedMetricGenerator.createDownloadedDurationMillis(0)); + Target target = variables.getTarget(); + String correlationKey = target.getCorrelationKey(); + int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); + long downloadedDurationMillis = variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); + + return Stream.of(NetworkSpeedMetricGenerator.createDownloadedBytes(downloadedBytes), + NetworkSpeedMetricGenerator.createDownloadedDurationMillis(downloadedDurationMillis)); } @Override From da3a3319e002695aca899523fa56cf0374451d6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 14:21:37 +0100 Subject: [PATCH 204/382] Ran format-and-sort --- src/main/java/dev/dsf/bpe/message/CleanupPong.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPong.java b/src/main/java/dev/dsf/bpe/message/CleanupPong.java index 9a96438a..86d646e7 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPong.java @@ -25,8 +25,10 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE { Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); - long downloadedDurationMillis = variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); + int downloadedBytes = variables + .getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); + long downloadedDurationMillis = variables + .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); return Stream.of(NetworkSpeedMetricGenerator.createDownloadedBytes(downloadedBytes), NetworkSpeedMetricGenerator.createDownloadedDurationMillis(downloadedDurationMillis)); From 054056d5abd2cb0b497c5848feb4adb45d521196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 15:06:16 +0100 Subject: [PATCH 205/382] Now adds upload and download data with 0 as values if an error occurred because StoreResults expects those values to be set even if an error occurred --- src/main/java/dev/dsf/bpe/message/SendPing.java | 2 ++ src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index 9f46f11e..c5cd3c75 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -67,6 +67,8 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); String specialErrorMessage = createErrorMessage(exception); ErrorMessageListUtils.add(specialErrorMessage, execution); + variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0); + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index bdc2b485..49f56411 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -5,8 +5,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveError extends AbstractServiceDelegate @@ -21,6 +23,8 @@ public LogAndSaveError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - logger.info("Logging and saving error"); + String correlationKey = variables.getTarget().getCorrelationKey(); + variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey), 0); + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); } } From b2516daa2584fe558d7b005b039d67196f97fc28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 15:46:20 +0100 Subject: [PATCH 206/382] Replaced MathContext with BigDecimal.scale because MathContext describes the total amount of digits, not just decimal places --- .../bpe/util/task/NetworkSpeedCalculator.java | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 75a567c2..4ec62cad 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -2,6 +2,7 @@ import java.math.BigDecimal; import java.math.MathContext; +import java.math.RoundingMode; import dev.dsf.bpe.ConstantsPing; @@ -14,19 +15,32 @@ public static BigDecimal calculate(int bytes, long duration, String unit) if (duration == 0) return BigDecimal.valueOf(Long.MAX_VALUE); - MathContext mathContext = new MathContext(4); + BigDecimal seconds = BigDecimal.valueOf(duration).setScale(3, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); + return switch (unit) { - case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND -> new BigDecimal(bytes * 8L) - .divide(BigDecimal.valueOf(duration).divide(BigDecimal.valueOf(1000), mathContext), mathContext); + case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND -> + { + BigDecimal bits = new BigDecimal(bytes * 8L).setScale(3, RoundingMode.HALF_UP); + yield bits.divide(seconds, 3, RoundingMode.HALF_UP); + } case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND -> - new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(1000000), mathContext).divide( - BigDecimal.valueOf(duration).divide(BigDecimal.valueOf(1000), mathContext), mathContext); - case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND -> new BigDecimal(bytes) - .divide(BigDecimal.valueOf(duration).divide(BigDecimal.valueOf(1000), mathContext), mathContext); + { + BigDecimal megabits = new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(1000000), + RoundingMode.HALF_UP); + yield megabits.divide(seconds, 3, RoundingMode.HALF_UP); + } + case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND -> + { + BigDecimal bytesLocal = new BigDecimal(bytes).setScale(3, RoundingMode.HALF_UP); + yield bytesLocal.divide(seconds, 3, RoundingMode.HALF_UP); + } case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND -> - new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), mathContext).divide( - BigDecimal.valueOf(duration).divide(BigDecimal.valueOf(1000), mathContext), mathContext); + { + BigDecimal megabytes = new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); + yield megabytes.divide(seconds, 3, RoundingMode.HALF_UP); + } default -> BigDecimal.ZERO; }; } From 16c1a7c55f6674ff2f1cd6d4cf857a54416bfd0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 15:47:08 +0100 Subject: [PATCH 207/382] Added case for pong-missing status and now reads error message list instead of specific error message that does not get set anymore --- .../java/dev/dsf/bpe/service/ping/StoreResults.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 767ba29a..df0f15b8 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -55,15 +55,20 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode) || ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statusCode)) { - String errorMessage = variables - .getString(ConstantsPing.getBpmnExecutionVariableErrorMessage(correlationKey)); - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, List.of(errorMessage))); + List<String> errorMessages = ErrorMessageListUtils.getErrorMessageList(execution); + String errorMessage = errorMessages.get(0); + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessages)); if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode)) errorMailService.endpointNotReachableForPing(task.getIdElement(), target, errorMessage); else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statusCode)) errorMailService.endpointReachablePingForbidden(task.getIdElement(), target, errorMessage); } + else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(statusCode)) + { + List<String> errorMessages = ErrorMessageListUtils.getErrorMessageList(execution); + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessages)); + } else { int downloadResourceSizeBytes = variables From d491e17b62091a18bde8fdd9dcbfaa1ca1a13199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 15:51:25 +0100 Subject: [PATCH 208/382] Error message gets added to global error message list instead --- .../ping/DownloadResourceAndMeasureSpeedInSubProcess.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 7fffe2fe..0b565490 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -46,8 +46,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } else { - ErrorMessageListUtils.add(downloadResult.getErrorMessage(), - BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST + "_" + correlationKey, delegateExecution); + ErrorMessageListUtils.add(downloadResult.getErrorMessage(), delegateExecution); } } } From bd0524417339208be4fd7a4f5ceaaaa2b31736ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 15:55:06 +0100 Subject: [PATCH 209/382] Now uses ConstantsPing api to get consistent variable name --- .../java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java index 52b3cea8..cff591b6 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java @@ -28,7 +28,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable String correlationKey = target.getCorrelationKey(); delegateExecution.removeVariable("statusCode"); - variables.setString("statusCode_" + correlationKey, + variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING); } } From b8eb7980e8f197b0db77d5edcf4b2db8c5754815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 15:57:31 +0100 Subject: [PATCH 210/382] Removed LogNoResponse as it was replaced by LogAndSaveNoResponse --- .../dsf/bpe/service/ping/LogNoResponse.java | 34 ------------------- .../dev/dsf/bpe/spring/config/PingConfig.java | 1 - 2 files changed, 35 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/service/ping/LogNoResponse.java diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogNoResponse.java b/src/main/java/dev/dsf/bpe/service/ping/LogNoResponse.java deleted file mode 100644 index 0ac38022..00000000 --- a/src/main/java/dev/dsf/bpe/service/ping/LogNoResponse.java +++ /dev/null @@ -1,34 +0,0 @@ -package dev.dsf.bpe.service.ping; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; -import dev.dsf.bpe.v1.variables.Variables; - -public class LogNoResponse extends AbstractServiceDelegate -{ - private static final Logger logger = LoggerFactory.getLogger(LogNoResponse.class); - - public LogNoResponse(ProcessPluginApi api) - { - super(api); - } - - @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception - { - Target target = variables.getTarget(); - - logger.warn("PONG from organization {} (endpoint {}) missing", target.getOrganizationIdentifierValue(), - target.getEndpointIdentifierValue()); - - variables.setString("statusCode_" + target.getCorrelationKey(), - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING); - } -} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index a0a1bb56..119cd56d 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -22,7 +22,6 @@ import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.ping.LogAndSaveError; import dev.dsf.bpe.service.ping.LogAndSaveNoResponse; -import dev.dsf.bpe.service.ping.LogNoResponse; import dev.dsf.bpe.service.ping.LogPing; import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; From 055a32f41897ebc8c322a206a0a3a07430270fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 15:58:22 +0100 Subject: [PATCH 211/382] LogPing belongs to pong process --- src/main/java/dev/dsf/bpe/service/{ping => pong}/LogPing.java | 2 +- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 2 +- src/main/resources/bpe/pong.bpmn | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/main/java/dev/dsf/bpe/service/{ping => pong}/LogPing.java (97%) diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogPing.java b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java similarity index 97% rename from src/main/java/dev/dsf/bpe/service/ping/LogPing.java rename to src/main/java/dev/dsf/bpe/service/pong/LogPing.java index 98fc5450..cc712063 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogPing.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.service.ping; +package dev.dsf.bpe.service.pong; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 119cd56d..5a185d76 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -22,7 +22,7 @@ import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.ping.LogAndSaveError; import dev.dsf.bpe.service.ping.LogAndSaveNoResponse; -import dev.dsf.bpe.service.ping.LogPing; +import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; import dev.dsf.bpe.service.ping.StoreResults; diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index be3415ea..b1c137e8 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -23,7 +23,7 @@ <bpmn:incoming>Flow_0gvrnxd</bpmn:incoming> <bpmn:outgoing>Flow_1o3n9u6</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="LogPing" name="Log Ping" camunda:class="dev.dsf.bpe.service.ping.LogPing"> + <bpmn:serviceTask id="LogPing" name="Log Ping" camunda:class="dev.dsf.bpe.service.pong.LogPing"> <bpmn:incoming>Flow_1o3n9u6</bpmn:incoming> <bpmn:outgoing>Flow_061qpt4</bpmn:outgoing> </bpmn:serviceTask> From 85c906779c6a1f728d512e2ced822fea9ededeb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 15:59:12 +0100 Subject: [PATCH 212/382] This wasn't caught by IDE refactor when the class was deleted --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 5a185d76..3b4a09d7 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -117,13 +117,6 @@ public SetCorrelationKeyListener setCorrelationKeyListener() return new SetCorrelationKeyListener(api); } - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public LogNoResponse logNoResponse() - { - return new LogNoResponse(api); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public StoreResults savePingResults() @@ -187,7 +180,6 @@ public DownloadResourceAndMeasureSpeedInSubProcess downloadResourceAndMeasureSpe return new DownloadResourceAndMeasureSpeedInSubProcess(api, (int) maxDownloadSizeBytes); } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public GenerateResource generateResource() From 4c671709aef918cecddd657662effaf8dc2a055e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 16:02:07 +0100 Subject: [PATCH 213/382] Moved mail service call to appropriate spot --- src/main/java/dev/dsf/bpe/service/ping/StoreResults.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index df0f15b8..c18991d3 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -68,6 +68,8 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(stat { List<String> errorMessages = ErrorMessageListUtils.getErrorMessageList(execution); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessages)); + + errorMailService.pongMessageNotReceived(task.getIdElement(), target); } else { @@ -97,9 +99,6 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(stat } task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode)); - - if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(statusCode)) - errorMailService.pongMessageNotReceived(task.getIdElement(), target); } }); From 01a2508352c84d22e3c43446a77a8eae4cd21f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 16:31:59 +0100 Subject: [PATCH 214/382] Removed unnecessary import --- .../ping/DownloadResourceAndMeasureSpeedInSubProcess.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 0b565490..9ec4e251 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -1,7 +1,5 @@ package dev.dsf.bpe.service.ping; -import static dev.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; From 5ac2ea84d22d55cc27e8e12a97806447bdee3fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 16:49:39 +0100 Subject: [PATCH 215/382] Ran format-and-sort --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 3b4a09d7..1e15a00b 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -22,7 +22,6 @@ import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.ping.LogAndSaveError; import dev.dsf.bpe.service.ping.LogAndSaveNoResponse; -import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; import dev.dsf.bpe.service.ping.StoreResults; @@ -30,6 +29,7 @@ import dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration; import dev.dsf.bpe.service.pong.LogAndSaveAndStoreError; import dev.dsf.bpe.service.pong.LogAndStoreSendError; +import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.service.pong.SelectPongTarget; import dev.dsf.bpe.service.pong.SetEndpointIdentifier; import dev.dsf.bpe.service.pong.StoreDownloadSpeed; From 44131fab241a067b28986c0fcdf889ad0fc4d77a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 17:00:16 +0100 Subject: [PATCH 216/382] Final results are now rounded to 2 decimal places --- .../dev/dsf/bpe/util/task/NetworkSpeedCalculator.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 4ec62cad..fe8389be 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -1,7 +1,6 @@ package dev.dsf.bpe.util.task; import java.math.BigDecimal; -import java.math.MathContext; import java.math.RoundingMode; import dev.dsf.bpe.ConstantsPing; @@ -23,23 +22,23 @@ public static BigDecimal calculate(int bytes, long duration, String unit) case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND -> { BigDecimal bits = new BigDecimal(bytes * 8L).setScale(3, RoundingMode.HALF_UP); - yield bits.divide(seconds, 3, RoundingMode.HALF_UP); + yield bits.divide(seconds, 2, RoundingMode.HALF_UP); } case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND -> { BigDecimal megabits = new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); - yield megabits.divide(seconds, 3, RoundingMode.HALF_UP); + yield megabits.divide(seconds, 2, RoundingMode.HALF_UP); } case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND -> { BigDecimal bytesLocal = new BigDecimal(bytes).setScale(3, RoundingMode.HALF_UP); - yield bytesLocal.divide(seconds, 3, RoundingMode.HALF_UP); + yield bytesLocal.divide(seconds, 2, RoundingMode.HALF_UP); } case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND -> { BigDecimal megabytes = new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); - yield megabytes.divide(seconds, 3, RoundingMode.HALF_UP); + yield megabytes.divide(seconds, 2, RoundingMode.HALF_UP); } default -> BigDecimal.ZERO; }; From d249afccf055dbae244ad1bb0621c32f9853edd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 17:00:38 +0100 Subject: [PATCH 217/382] Fixed two outputs being generated for each target --- src/main/java/dev/dsf/bpe/service/ping/StoreResults.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index c18991d3..78c56a66 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -76,7 +76,7 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(stat int downloadResourceSizeBytes = variables .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); List<String> errorMessageList = ErrorMessageListUtils.getErrorMessageList(execution); - if (downloadResourceSizeBytes >= 0) + if (downloadResourceSizeBytes >= 0) // if fat-ping { int downloadedBytes = variables .getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); @@ -97,8 +97,10 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(stat task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList, downloadSpeed, uploadSpeed, networkSpeedUnit)); } - - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode)); + else // if slim-ping + { + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode)); + } } }); From f2ef58eabf80476cde9a014d4cedf341fad809a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 17:01:30 +0100 Subject: [PATCH 218/382] "Fixed" race condition by adding asynchronous continuation with retry time cycle --- src/main/resources/bpe/ping.bpmn | 113 ++++++++++++++++--------------- 1 file changed, 58 insertions(+), 55 deletions(-) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index d85e2328..e27eef0b 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -22,7 +22,10 @@ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT20S</bpmn:timeDuration> </bpmn:timerEventDefinition> </bpmn:intermediateCatchEvent> - <bpmn:intermediateCatchEvent id="PongCatchEvent" name="Pong"> + <bpmn:intermediateCatchEvent id="PongCatchEvent" name="Pong" camunda:asyncAfter="true"> + <bpmn:extensionElements> + <camunda:failedJobRetryTimeCycle>R3/PT5S</camunda:failedJobRetryTimeCycle> + </bpmn:extensionElements> <bpmn:incoming>Flow_1lghrxh</bpmn:incoming> <bpmn:outgoing>Flow_1ewmc79</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_0ismjkr" messageRef="Message_10o3b8y" /> @@ -238,31 +241,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> - <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> - <dc:Bounds x="2990" y="239" width="160" height="49" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> - <dc:Bounds x="2920" y="490" width="200" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> - <dc:Bounds x="2920" y="330" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> - <dc:Bounds x="3050" y="330" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> - <dc:Bounds x="3172" y="352" width="36" height="36" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> <dc:Bounds x="1040" y="180" width="1820" height="560" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> - <dc:Bounds x="2580" y="612" width="240" height="55" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0qz7nye" bpmnElement="SubProcessStartEvent"> <dc:Bounds x="1062" y="342" width="36" height="36" /> </bpmndi:BPMNShape> @@ -313,6 +294,12 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2210" y="600" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> + <dc:Bounds x="2685" y="335" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> + <dc:Bounds x="2772" y="342" width="36" height="36" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_187dy31_di" bpmnElement="Activity_081me01"> <dc:Bounds x="1820" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -321,20 +308,14 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1270" y="220" width="250" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> + <dc:Bounds x="2580" y="612" width="240" height="55" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> <dc:Bounds x="1980" y="622" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> - <dc:Bounds x="2685" y="335" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> - <dc:Bounds x="2772" y="342" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> - <di:waypoint x="2602" y="559" /> - <di:waypoint x="2660" y="612" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_0968qvb" bpmnElement="Event_0i4slcz"> <dc:Bounds x="2152" y="542" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -407,10 +388,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2170" y="640" /> <di:waypoint x="2210" y="640" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_0v8dcpi" bpmnElement="Flow_03nx6rk"> - <di:waypoint x="2735" y="360" /> - <di:waypoint x="2772" y="360" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0klalf8_di" bpmnElement="Flow_0klalf8"> <di:waypoint x="2610" y="520" /> <di:waypoint x="2710" y="520" /> @@ -424,10 +401,18 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1920" y="360" /> <di:waypoint x="1965" y="360" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0v8dcpi" bpmnElement="Flow_03nx6rk"> + <di:waypoint x="2735" y="360" /> + <di:waypoint x="2772" y="360" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> <di:waypoint x="1252" y="320" /> <di:waypoint x="1276" y="290" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> + <di:waypoint x="2602" y="559" /> + <di:waypoint x="2660" y="612" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> <di:waypoint x="2074" y="622" /> <di:waypoint x="2102" y="560" /> @@ -439,6 +424,16 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="530" y="460" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> + <dc:Bounds x="2920" y="330" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> + <dc:Bounds x="3050" y="330" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> + <dc:Bounds x="3172" y="352" width="36" height="36" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0ob9la3" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> <dc:Bounds x="815" y="335" width="50" height="50" /> </bpmndi:BPMNShape> @@ -459,6 +454,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="260" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> + <dc:Bounds x="2990" y="239" width="160" height="49" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0o5toqz" bpmnElement="TextAnnotation_1j1ytqy"> <dc:Bounds x="430" y="580" width="170" height="40" /> <bpmndi:BPMNLabel /> @@ -467,18 +466,14 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="400" y="220" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> + <dc:Bounds x="2920" y="490" width="200" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> <dc:Bounds x="230" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> - <di:waypoint x="3013" y="490" /> - <di:waypoint x="2984" y="410" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> - <di:waypoint x="3079" y="330" /> - <di:waypoint x="3058" y="288" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_09zmq8d" bpmnElement="Flow_0j92st0"> <di:waypoint x="1000" y="360" /> <di:waypoint x="1040" y="360" /> @@ -501,6 +496,14 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="460" y="500" /> <di:waypoint x="530" y="500" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_1fbz0br" bpmnElement="Flow_0gubpgz"> + <di:waypoint x="3020" y="370" /> + <di:waypoint x="3050" y="370" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_00ieeud" bpmnElement="Flow_1du5wys"> + <di:waypoint x="3150" y="370" /> + <di:waypoint x="3172" y="370" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0t4fqb7" bpmnElement="Flow_0iuuyo1"> <di:waypoint x="485" y="360" /> <di:waypoint x="815" y="360" /> @@ -509,25 +512,25 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="865" y="360" /> <di:waypoint x="900" y="360" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0e35w2m_di" bpmnElement="Flow_0e35w2m"> - <di:waypoint x="188" y="360" /> - <di:waypoint x="260" y="360" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fxlsv3_di" bpmnElement="Flow_0fxlsv3"> <di:waypoint x="360" y="360" /> <di:waypoint x="435" y="360" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0e35w2m_di" bpmnElement="Flow_0e35w2m"> + <di:waypoint x="188" y="360" /> + <di:waypoint x="260" y="360" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> <di:waypoint x="539" y="540" /> <di:waypoint x="498" y="580" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1fbz0br" bpmnElement="Flow_0gubpgz"> - <di:waypoint x="3020" y="370" /> - <di:waypoint x="3050" y="370" /> + <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> + <di:waypoint x="3013" y="490" /> + <di:waypoint x="2984" y="410" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_00ieeud" bpmnElement="Flow_1du5wys"> - <di:waypoint x="3150" y="370" /> - <di:waypoint x="3172" y="370" /> + <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> + <di:waypoint x="3079" y="330" /> + <di:waypoint x="3058" y="288" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> From a9081132f8e11d1eeb77af15f4a77b60dec07cf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 17:06:03 +0100 Subject: [PATCH 219/382] Fixed env variable names to be consistent --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 1e15a00b..b945d73b 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -52,12 +52,12 @@ public class PingConfig private boolean sendPongProcessFailedMail; @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.", processNames = "dsfdev_ping, dsfdev_pong") - @Value("${dev.dsf.bpe.ping.maxDownloadSize:10000000}") + @Value("${dev.dsf.bpe.ping.maxDownloadSizeBytes:10000000}") private long maxDownloadSizeBytes; @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.", processNames = { "dsfdev_ping", "dsfdev_pong" }) - @Value("${dev.dsf.bpe.ping.maxUploadSize:10000000}") + @Value("${dev.dsf.bpe.ping.maxUploadSizeBytes:10000000}") private long maxUploadSizeBytes; @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values be: \"bits-per-second\", \"bytes-per-second\", \"megabits-per-second\", \"megabytes-per-second\". Default is \"megabytes-per-second\".", processNames = { From 0e84053285e8a8d50cd8c188cd79421347d7f942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 17:39:34 +0100 Subject: [PATCH 220/382] Fixed wrong amount of input parameters being allowed --- .../resources/fhir/StructureDefinition/dsf-task-start-ping.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index fffb9a3d..146301ce 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -31,7 +31,7 @@ </extension> <path value="Task.input" /> <min value="1" /> - <max value="3" /> + <max value="4" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> From efbf9bc5f1aba8a10d9f74deeba7fd7301c31b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 18:11:45 +0100 Subject: [PATCH 221/382] Added version utils to add versions to urls in PingStatusGenerator --- .../java/dev/dsf/bpe/util/VersionUtils.java | 16 ++++ .../output/generator/PingStatusGenerator.java | 79 +++++++++++-------- .../dsf/fhir/profiles/TaskProfileTest.java | 9 ++- 3 files changed, 67 insertions(+), 37 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/util/VersionUtils.java diff --git a/src/main/java/dev/dsf/bpe/util/VersionUtils.java b/src/main/java/dev/dsf/bpe/util/VersionUtils.java new file mode 100644 index 00000000..b112adef --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/VersionUtils.java @@ -0,0 +1,16 @@ +package dev.dsf.bpe.util; + +import dev.dsf.bpe.PingProcessPluginDefinition; + +public class VersionUtils +{ + public static String appendFhirResourceVersion(String toAppend) + { + return toAppend + "|" + getFhirResourceVersion(); + } + + public static String getFhirResourceVersion() + { + return new PingProcessPluginDefinition().getVersion().substring(0, 3); + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 2535ff4d..f097b51f 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -15,6 +15,7 @@ import org.hl7.fhir.r4.model.Type; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.VersionUtils; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; import dev.dsf.bpe.v1.constants.NamingSystems.OrganizationIdentifier; import dev.dsf.bpe.v1.variables.Target; @@ -276,10 +277,10 @@ private static boolean hasStatusCodeSet(TaskOutputComponent outputComponent) Type valueType = outputComponent.getValue(); List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); - return (valueType instanceof Coding coding - && ConstantsPing.CODESYSTEM_DSF_PING_STATUS.equals(coding.getSystem())) - || outputTypeCodings.stream() - .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); + return (valueType instanceof Coding coding && VersionUtils + .appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).equals(coding.getSystem())) + || outputTypeCodings.stream().anyMatch(coding -> VersionUtils + .appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING).equals(coding.getSystem())); } private static boolean hasNetworkSpeedSet(TaskOutputComponent outputComponent) @@ -368,8 +369,10 @@ private static TaskOutputComponent createStatusOutput(Target target, String outp private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent, String outputParameter, String statusCode) { - outputComponent.setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); - outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + outputComponent.setValue(new Coding().setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_STATUS)).setCode(statusCode)); + outputComponent.getType().addCoding() + .setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING)) + .setCode(outputParameter); return outputComponent; } @@ -380,30 +383,36 @@ private static TaskOutputComponent updateStatus(TaskOutputComponent outputCompon Type valueType = outputComponent.getValue(); if (valueType instanceof Coding coding) { - coding.setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode); + coding.setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_STATUS)) + .setCode(statusCode); } else { - outputComponent - .setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); + outputComponent.setValue(new Coding() + .setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_STATUS)) + .setCode(statusCode)); } List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); if (outputTypeCodings.isEmpty()) { - outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + outputComponent.getType().addCoding() + .setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING)) + .setCode(outputParameter); } else { if (outputTypeCodings.size() == 1) { Coding coding = outputTypeCodings.get(0); - coding.setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + coding.setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING)) + .setCode(outputParameter); } else { outputComponent.getType().setCoding(null); - outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + outputComponent.getType().addCoding() + .setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING)) .setCode(outputParameter); } } @@ -531,11 +540,11 @@ private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputCo Extension downloadSpeedExtension = extension.addExtension() .setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); Extension networkSpeed = downloadSpeedExtension.addExtension() - .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + .setUrl(VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT).setValue(new Coding( + VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), unit, null)); } return outputComponent; @@ -550,8 +559,8 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu Extension downloadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); if (downloadSpeedExtension != null) { - Extension networkSpeedExtension = downloadSpeedExtension - .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + Extension networkSpeedExtension = downloadSpeedExtension.getExtensionByUrl( + VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); @@ -559,18 +568,19 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, new DecimalType(downloadSpeed))); extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, - new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); + new Coding(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), + unit, null))); } } else { downloadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); Extension networkSpeed = downloadSpeedExtension.addExtension() - .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + .setUrl(VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT).setValue(new Coding( + VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), unit, null)); } } @@ -585,11 +595,11 @@ private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComp Extension extension = getOrCreatePingStatusExtension(outputComponent); Extension uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); Extension networkSpeed = uploadSpeedExtension.addExtension() - .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + .setUrl(VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(uploadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT).setValue(new Coding( + VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), unit, null)); } return outputComponent; @@ -604,8 +614,8 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC Extension uploadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); if (uploadSpeedExtension != null) { - Extension networkSpeedExtension = uploadSpeedExtension - .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + Extension networkSpeedExtension = uploadSpeedExtension.getExtensionByUrl( + VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); @@ -613,18 +623,19 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, new DecimalType(uploadSpeed))); extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, - new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); + new Coding(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), + unit, null))); } } else { uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); Extension networkSpeed = uploadSpeedExtension.addExtension() - .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + .setUrl(VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(uploadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT).setValue(new Coding( + VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), unit, null)); } } @@ -633,13 +644,15 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outputComponent) { - List<Extension> pingStatusExtensions = outputComponent.getExtension().stream() - .filter(extension -> ConstantsPing.EXTENSION_URL_PING_STATUS.equals(extension.getUrl())).toList(); + List<Extension> pingStatusExtensions = outputComponent + .getExtension().stream().filter(extension -> VersionUtils + .appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS).equals(extension.getUrl())) + .toList(); Extension extension; if (pingStatusExtensions.isEmpty()) { extension = outputComponent.addExtension(); - extension.setUrl(ConstantsPing.EXTENSION_URL_PING_STATUS); + extension.setUrl(VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS)); } else { diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index d5856ee3..4697a060 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -24,6 +24,7 @@ import ca.uhn.fhir.validation.ValidationResult; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; +import dev.dsf.bpe.util.VersionUtils; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; @@ -404,7 +405,7 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(new PingStatusGenerator().createPongStatusOutput(target, + task.addOutput(PingStatusGenerator.createPongStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); ValidationResult result = resourceValidator.validate(task); @@ -445,7 +446,7 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(new PingStatusGenerator().createPongStatusOutput(target, + task.addOutput(PingStatusGenerator.createPongStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); task.addInput(DownloadResourceSizeGenerator.create(1000)); @@ -461,7 +462,7 @@ public String getCorrelationKey() private Task createValidTaskPing() { Task task = new Task(); - task.getMeta().addProfile(ConstantsPing.PROFILE_DSF_TASK_PING); + task.getMeta().addProfile(VersionUtils.appendFhirResourceVersion(ConstantsPing.PROFILE_DSF_TASK_PING)); task.setInstantiatesCanonical(ConstantsPing.PROFILE_DSF_TASK_PONG_PROCESS_URI + "|" + def.getResourceVersion()); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); @@ -480,7 +481,7 @@ private Task createValidTaskPing() task.addInput() .setValue(new Reference().setType(ResourceType.Endpoint.name()) .setIdentifier(EndpointIdentifier.withValue("endpoint.target.org"))) - .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + .getType().addCoding().setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING)) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER); return task; From e39ea06c8c919251d4e29d7eb1820049722f18a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 14 Mar 2025 18:45:11 +0100 Subject: [PATCH 222/382] Added versions to urls --- .../dsf-extension-network-speed.xml | 6 +++--- .../dsf-extension-ping-status.xml | 2 +- .../StructureDefinition/dsf-task-cleanup-pong.xml | 4 ++-- .../fhir/StructureDefinition/dsf-task-ping.xml | 12 ++++++------ .../fhir/StructureDefinition/dsf-task-pong.xml | 8 ++++---- .../dsf-task-start-ping-autostart.xml | 6 +++--- .../fhir/StructureDefinition/dsf-task-start-ping.xml | 8 ++++---- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml index 58fbf85d..f72fc39f 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml @@ -73,19 +73,19 @@ <element id="Extension.extension:unit.value[x].system"> <path value="Extension.extension.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-units"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-units|#{version}"/> </element> <element id="Extension.extension:unit.value[x].code"> <path value="Extension.extension.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-units"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-units|#{version}"/> </binding> </element> <element id="Extension.url"> <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed|#{version}"/> </element> <element id="Extension.value[x]"> <path value="Extension.value[x]"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 420717ae..e01f4f51 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -193,7 +193,7 @@ </element> <element id="Extension.url"> <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status|#{version}"/> </element> <element id="Extension.value[x]"> <path value="Extension.value[x]"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index 6f47715e..989e5644 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -80,7 +80,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> </element> <element id="Task.input:downloaded-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -116,7 +116,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> </element> <element id="Task.input:downloaded-duration-millis.type.coding.code"> <path value="Task.input.type.coding.code"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index d41aed7e..295d77c0 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -81,7 +81,7 @@ <element id="Task.input:endpoint-identifier.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> </element> <element id="Task.input:endpoint-identifier.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -129,7 +129,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> </binding> </element> <element id="Task.input:download-resource-size-bytes.type.coding"> @@ -141,7 +141,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -179,7 +179,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> </element> <element id="Task.input:download-resource-reference.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -247,7 +247,7 @@ <element id="Task.output:pong-status.type.coding.system"> <path value="Task.output.type.coding.system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> </element> <element id="Task.output:pong-status.type.coding.code"> <path value="Task.output.type.coding.code"/> @@ -263,7 +263,7 @@ <element id="Task.output:pong-status.value[x].system"> <path value="Task.output.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status|#{version}"/> </element> <element id="Task.output:pong-status.value[x].code"> <path value="Task.output.value[x].code"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index e230e381..07590165 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -81,7 +81,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> </element> <element id="Task.input:download-resource-reference.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -131,7 +131,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> </element> <element id="Task.input:downloaded-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -167,7 +167,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> </element> <element id="Task.input:downloaded-duration-millis.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -202,7 +202,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> </element> <element id="Task.input:error-message.type.coding.code"> <path value="Task.input.type.coding.code"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml index ea9ca7bf..5a97e390 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml @@ -79,7 +79,7 @@ <element id="Task.input:target-endpoints.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> </element> <element id="Task.input:target-endpoints.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -119,7 +119,7 @@ <element id="Task.input:timer-interval.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> </element> <element id="Task.input:timer-interval.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -160,7 +160,7 @@ <element id="Task.input:download-resource-size-bytes.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code" /> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index 146301ce..9a2467a8 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -79,7 +79,7 @@ <element id="Task.input:target-endpoints.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> </element> <element id="Task.input:target-endpoints.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -114,7 +114,7 @@ <element id="Task.input:download-resource-size-bytes.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -159,7 +159,7 @@ <element id="Task.output:ping-status.type.coding.system"> <path value="Task.output.type.coding.system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> </element> <element id="Task.output:ping-status.type.coding.code"> <path value="Task.output.type.coding.code"/> @@ -175,7 +175,7 @@ <element id="Task.output:ping-status.value[x].system"> <path value="Task.output.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status|#{version}"/> </element> <element id="Task.output:ping-status.value[x].code"> <path value="Task.output.value[x].code"/> From a2108bcee35d5ad69a600fad8de3f33fc0221502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 12:04:33 +0100 Subject: [PATCH 223/382] Revert "Added versions to urls" This reverts commit e77b64297af865a43475f0bd275d809b1c539b99. --- .../dsf-extension-network-speed.xml | 6 +++--- .../dsf-extension-ping-status.xml | 2 +- .../StructureDefinition/dsf-task-cleanup-pong.xml | 4 ++-- .../fhir/StructureDefinition/dsf-task-ping.xml | 12 ++++++------ .../fhir/StructureDefinition/dsf-task-pong.xml | 8 ++++---- .../dsf-task-start-ping-autostart.xml | 6 +++--- .../fhir/StructureDefinition/dsf-task-start-ping.xml | 8 ++++---- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml index f72fc39f..58fbf85d 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml @@ -73,19 +73,19 @@ <element id="Extension.extension:unit.value[x].system"> <path value="Extension.extension.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-units|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-units"/> </element> <element id="Extension.extension:unit.value[x].code"> <path value="Extension.extension.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-units|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-units"/> </binding> </element> <element id="Extension.url"> <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed"/> </element> <element id="Extension.value[x]"> <path value="Extension.value[x]"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index e01f4f51..420717ae 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -193,7 +193,7 @@ </element> <element id="Extension.url"> <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> </element> <element id="Extension.value[x]"> <path value="Extension.value[x]"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index 989e5644..6f47715e 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -80,7 +80,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> </element> <element id="Task.input:downloaded-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -116,7 +116,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> </element> <element id="Task.input:downloaded-duration-millis.type.coding.code"> <path value="Task.input.type.coding.code"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index 295d77c0..d41aed7e 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -81,7 +81,7 @@ <element id="Task.input:endpoint-identifier.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> </element> <element id="Task.input:endpoint-identifier.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -129,7 +129,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> </binding> </element> <element id="Task.input:download-resource-size-bytes.type.coding"> @@ -141,7 +141,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -179,7 +179,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> </element> <element id="Task.input:download-resource-reference.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -247,7 +247,7 @@ <element id="Task.output:pong-status.type.coding.system"> <path value="Task.output.type.coding.system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> </element> <element id="Task.output:pong-status.type.coding.code"> <path value="Task.output.type.coding.code"/> @@ -263,7 +263,7 @@ <element id="Task.output:pong-status.value[x].system"> <path value="Task.output.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status"/> </element> <element id="Task.output:pong-status.value[x].code"> <path value="Task.output.value[x].code"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index 07590165..e230e381 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -81,7 +81,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> </element> <element id="Task.input:download-resource-reference.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -131,7 +131,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> </element> <element id="Task.input:downloaded-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -167,7 +167,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> </element> <element id="Task.input:downloaded-duration-millis.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -202,7 +202,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> </element> <element id="Task.input:error-message.type.coding.code"> <path value="Task.input.type.coding.code"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml index 5a97e390..ea9ca7bf 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml @@ -79,7 +79,7 @@ <element id="Task.input:target-endpoints.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> </element> <element id="Task.input:target-endpoints.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -119,7 +119,7 @@ <element id="Task.input:timer-interval.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> </element> <element id="Task.input:timer-interval.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -160,7 +160,7 @@ <element id="Task.input:download-resource-size-bytes.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code" /> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index 9a2467a8..146301ce 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -79,7 +79,7 @@ <element id="Task.input:target-endpoints.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> </element> <element id="Task.input:target-endpoints.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -114,7 +114,7 @@ <element id="Task.input:download-resource-size-bytes.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -159,7 +159,7 @@ <element id="Task.output:ping-status.type.coding.system"> <path value="Task.output.type.coding.system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> </element> <element id="Task.output:ping-status.type.coding.code"> <path value="Task.output.type.coding.code"/> @@ -175,7 +175,7 @@ <element id="Task.output:ping-status.value[x].system"> <path value="Task.output.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status"/> </element> <element id="Task.output:ping-status.value[x].code"> <path value="Task.output.value[x].code"/> From 73d04b1b3fadae1de713f32c26fc5b481c8b410b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 12:04:42 +0100 Subject: [PATCH 224/382] Revert "Added version utils to add versions to urls in PingStatusGenerator" This reverts commit 001f4acd8dd99bbdfb9904d104b94808b501b55e. --- .../java/dev/dsf/bpe/util/VersionUtils.java | 16 ---- .../output/generator/PingStatusGenerator.java | 79 ++++++++----------- .../dsf/fhir/profiles/TaskProfileTest.java | 9 +-- 3 files changed, 37 insertions(+), 67 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/util/VersionUtils.java diff --git a/src/main/java/dev/dsf/bpe/util/VersionUtils.java b/src/main/java/dev/dsf/bpe/util/VersionUtils.java deleted file mode 100644 index b112adef..00000000 --- a/src/main/java/dev/dsf/bpe/util/VersionUtils.java +++ /dev/null @@ -1,16 +0,0 @@ -package dev.dsf.bpe.util; - -import dev.dsf.bpe.PingProcessPluginDefinition; - -public class VersionUtils -{ - public static String appendFhirResourceVersion(String toAppend) - { - return toAppend + "|" + getFhirResourceVersion(); - } - - public static String getFhirResourceVersion() - { - return new PingProcessPluginDefinition().getVersion().substring(0, 3); - } -} diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index f097b51f..2535ff4d 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -15,7 +15,6 @@ import org.hl7.fhir.r4.model.Type; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.VersionUtils; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; import dev.dsf.bpe.v1.constants.NamingSystems.OrganizationIdentifier; import dev.dsf.bpe.v1.variables.Target; @@ -277,10 +276,10 @@ private static boolean hasStatusCodeSet(TaskOutputComponent outputComponent) Type valueType = outputComponent.getValue(); List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); - return (valueType instanceof Coding coding && VersionUtils - .appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).equals(coding.getSystem())) - || outputTypeCodings.stream().anyMatch(coding -> VersionUtils - .appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING).equals(coding.getSystem())); + return (valueType instanceof Coding coding + && ConstantsPing.CODESYSTEM_DSF_PING_STATUS.equals(coding.getSystem())) + || outputTypeCodings.stream() + .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); } private static boolean hasNetworkSpeedSet(TaskOutputComponent outputComponent) @@ -369,10 +368,8 @@ private static TaskOutputComponent createStatusOutput(Target target, String outp private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent, String outputParameter, String statusCode) { - outputComponent.setValue(new Coding().setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_STATUS)).setCode(statusCode)); - outputComponent.getType().addCoding() - .setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING)) - .setCode(outputParameter); + outputComponent.setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); + outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); return outputComponent; } @@ -383,36 +380,30 @@ private static TaskOutputComponent updateStatus(TaskOutputComponent outputCompon Type valueType = outputComponent.getValue(); if (valueType instanceof Coding coding) { - coding.setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_STATUS)) - .setCode(statusCode); + coding.setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode); } else { - outputComponent.setValue(new Coding() - .setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_STATUS)) - .setCode(statusCode)); + outputComponent + .setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); } List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); if (outputTypeCodings.isEmpty()) { - outputComponent.getType().addCoding() - .setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING)) - .setCode(outputParameter); + outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); } else { if (outputTypeCodings.size() == 1) { Coding coding = outputTypeCodings.get(0); - coding.setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING)) - .setCode(outputParameter); + coding.setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); } else { outputComponent.getType().setCoding(null); - outputComponent.getType().addCoding() - .setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING)) + outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(outputParameter); } } @@ -540,11 +531,11 @@ private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputCo Extension downloadSpeedExtension = extension.addExtension() .setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); Extension networkSpeed = downloadSpeedExtension.addExtension() - .setUrl(VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); + .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT).setValue(new Coding( - VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), unit, null)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } return outputComponent; @@ -559,8 +550,8 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu Extension downloadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); if (downloadSpeedExtension != null) { - Extension networkSpeedExtension = downloadSpeedExtension.getExtensionByUrl( - VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); + Extension networkSpeedExtension = downloadSpeedExtension + .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); @@ -568,19 +559,18 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, new DecimalType(downloadSpeed))); extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, - new Coding(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), - unit, null))); + new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); } } else { downloadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); Extension networkSpeed = downloadSpeedExtension.addExtension() - .setUrl(VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); + .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT).setValue(new Coding( - VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), unit, null)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } } @@ -595,11 +585,11 @@ private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComp Extension extension = getOrCreatePingStatusExtension(outputComponent); Extension uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); Extension networkSpeed = uploadSpeedExtension.addExtension() - .setUrl(VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); + .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(uploadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT).setValue(new Coding( - VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), unit, null)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } return outputComponent; @@ -614,8 +604,8 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC Extension uploadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); if (uploadSpeedExtension != null) { - Extension networkSpeedExtension = uploadSpeedExtension.getExtensionByUrl( - VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); + Extension networkSpeedExtension = uploadSpeedExtension + .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); @@ -623,19 +613,18 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, new DecimalType(uploadSpeed))); extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, - new Coding(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), - unit, null))); + new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); } } else { uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); Extension networkSpeed = uploadSpeedExtension.addExtension() - .setUrl(VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_NETWORK_SPEED)); + .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(uploadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT).setValue(new Coding( - VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING_UNITS), unit, null)); + networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } } @@ -644,15 +633,13 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outputComponent) { - List<Extension> pingStatusExtensions = outputComponent - .getExtension().stream().filter(extension -> VersionUtils - .appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS).equals(extension.getUrl())) - .toList(); + List<Extension> pingStatusExtensions = outputComponent.getExtension().stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_PING_STATUS.equals(extension.getUrl())).toList(); Extension extension; if (pingStatusExtensions.isEmpty()) { extension = outputComponent.addExtension(); - extension.setUrl(VersionUtils.appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS)); + extension.setUrl(ConstantsPing.EXTENSION_URL_PING_STATUS); } else { diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 4697a060..d5856ee3 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -24,7 +24,6 @@ import ca.uhn.fhir.validation.ValidationResult; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; -import dev.dsf.bpe.util.VersionUtils; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; @@ -405,7 +404,7 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(PingStatusGenerator.createPongStatusOutput(target, + task.addOutput(new PingStatusGenerator().createPongStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); ValidationResult result = resourceValidator.validate(task); @@ -446,7 +445,7 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(PingStatusGenerator.createPongStatusOutput(target, + task.addOutput(new PingStatusGenerator().createPongStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); task.addInput(DownloadResourceSizeGenerator.create(1000)); @@ -462,7 +461,7 @@ public String getCorrelationKey() private Task createValidTaskPing() { Task task = new Task(); - task.getMeta().addProfile(VersionUtils.appendFhirResourceVersion(ConstantsPing.PROFILE_DSF_TASK_PING)); + task.getMeta().addProfile(ConstantsPing.PROFILE_DSF_TASK_PING); task.setInstantiatesCanonical(ConstantsPing.PROFILE_DSF_TASK_PONG_PROCESS_URI + "|" + def.getResourceVersion()); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); @@ -481,7 +480,7 @@ private Task createValidTaskPing() task.addInput() .setValue(new Reference().setType(ResourceType.Endpoint.name()) .setIdentifier(EndpointIdentifier.withValue("endpoint.target.org"))) - .getType().addCoding().setSystem(VersionUtils.appendFhirResourceVersion(ConstantsPing.CODESYSTEM_DSF_PING)) + .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER); return task; From 6489553080f337066acdb67bd52b70fffe99443f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 13:40:32 +0100 Subject: [PATCH 225/382] Added tests for draft task resources --- .../dsf/fhir/profiles/TaskProfileTest.java | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index d5856ee3..d57f6740 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -2,10 +2,18 @@ import static org.junit.Assert.assertEquals; +import java.io.IOException; +import java.io.InputStream; import java.math.BigDecimal; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.time.Instant; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.Date; import java.util.List; +import java.util.TimeZone; import java.util.UUID; import org.hl7.fhir.r4.model.IntegerType; @@ -20,6 +28,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.validation.ResultSeverityEnum; import ca.uhn.fhir.validation.ValidationResult; import dev.dsf.bpe.ConstantsPing; @@ -590,4 +600,73 @@ private Task createValidTaskCleanupPong() task.addInput(NetworkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); return task; } + + @Test + public void testDraftTaskStartPingValid() throws IOException + { + FhirContext ctx = FhirContext.forR4(); + InputStream fileInputStream = getClass().getClassLoader() + .getResourceAsStream("fhir/Task/dsf-task-start-ping.xml"); + String xml = new String(fileInputStream.readAllBytes()); + xml = fillPlaceholders(xml); + fileInputStream.close(); + + IParser parser = ctx.newXmlParser(); + Task task = parser.parseResource(Task.class, xml); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + @Test + public void testDraftTaskStartPingAutostartValid() throws IOException + { + FhirContext ctx = FhirContext.forR4(); + InputStream fileInputStream = getClass().getClassLoader() + .getResourceAsStream("fhir/Task/dsf-task-start-ping-autostart.xml"); + String xml = new String(fileInputStream.readAllBytes()); + xml = fillPlaceholders(xml); + fileInputStream.close(); + + IParser parser = ctx.newXmlParser(); + Task task = parser.parseResource(Task.class, xml); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + @Test + public void testDraftTaskStopPingAutostartValid() throws IOException + { + FhirContext ctx = FhirContext.forR4(); + InputStream fileInputStream = getClass().getClassLoader() + .getResourceAsStream("fhir/Task/dsf-task-stop-ping-autostart.xml"); + String xml = new String(fileInputStream.readAllBytes()); + xml = fillPlaceholders(xml); + fileInputStream.close(); + + IParser parser = ctx.newXmlParser(); + Task task = parser.parseResource(Task.class, xml); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private String fillPlaceholders(String xml) + { + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + xml = xml.replaceAll("#\\{version}", def.getResourceVersion()); + xml = xml.replaceAll("#\\{date}", + dtf.format(LocalDate.ofInstant(Instant.now(), TimeZone.getDefault().toZoneId()))); + return xml; + } } From 53c0b2b672a04c125a05b030795b8e4f326f1b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 13:47:19 +0100 Subject: [PATCH 226/382] Added ping pong v1 CodeSystems and ValueSets to test compatibility to old resources --- .../dsf/fhir/profiles/TaskProfileTest.java | 8 +-- .../fhir/CodeSystem/dsf-ping-1_0.xml | 49 +++++++++++++++++++ .../fhir/CodeSystem/dsf-ping-status-1_0.xml | 49 +++++++++++++++++++ .../resources/fhir/ValueSet/dsf-ping-1_0.xml | 27 ++++++++++ .../fhir/ValueSet/dsf-ping-status-1_0.xml | 44 +++++++++++++++++ .../fhir/ValueSet/dsf-pong-status-1_0.xml | 39 +++++++++++++++ 6 files changed, 212 insertions(+), 4 deletions(-) create mode 100644 src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml create mode 100644 src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml create mode 100644 src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml create mode 100644 src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml create mode 100644 src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index d57f6740..e4ea397e 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -60,10 +60,10 @@ public class TaskProfileTest "dsf-task-ping.xml", "dsf-task-pong.xml", "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), - Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", - "dsf-ping-status.xml", "dsf-ping-units.xml"), - Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", - "dsf-ping-status.xml", "dsf-pong-status.xml", "dsf-ping-units.xml")); + Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", "dsf-ping.xml", + "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-ping-units.xml"), + Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", "dsf-ping-1_0.xml", + "dsf-ping-status.xml", "dsf-ping-status-1_0.xml", "dsf-pong-status.xml", "dsf-pong-status-1_0.xml", "dsf-ping-units.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); diff --git a/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml b/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml new file mode 100644 index 00000000..c2586c9f --- /dev/null +++ b/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml @@ -0,0 +1,49 @@ +<CodeSystem xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/CodeSystem/ping" /> + <!-- version managed by bpe --> + <version value="1.0" /> + <name value="DSF_Ping" /> + <title value="DSF Ping" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="CodeSystem with standard values for the process ping/pong" /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> + <concept> + <code value="ping-status" /> + <display value="Ping Status" /> + <definition value="Ping status of target organization" /> + </concept> + <concept> + <code value="pong-status" /> + <display value="Pong Status" /> + <definition value="Pong status of target organization" /> + </concept> + <concept> + <code value="endpoint-identifier" /> + <display value="Endpoint Identifier" /> + <definition value="Identifier of endpoint expecting pong (response) message" /> + </concept> + <concept> + <code value="target-endpoints" /> + <display value="Target Endpoints" /> + <definition value="Ping target endpoints, search query resulting in match or include results with Endpoint resources" /> + </concept> + <concept> + <code value="timer-interval" /> + <display value="Timer Interval" /> + <definition value="Interval between two autostarts of the ping process" /> + </concept> +</CodeSystem> \ No newline at end of file diff --git a/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml b/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml new file mode 100644 index 00000000..6a1bd2c4 --- /dev/null +++ b/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml @@ -0,0 +1,49 @@ +<CodeSystem xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/CodeSystem/ping-status" /> + <!-- version managed by bpe --> + <version value="1.0" /> + <name value="DSF_Ping_Status" /> + <title value="DSF Ping Status" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="CodeSystem with ping/pong status values" /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> + <concept> + <code value="not-allowed" /> + <display value="Not allowed" /> + <definition value="Not allowed to start pong-process at target organization" /> + </concept> + <concept> + <code value="not-reachable" /> + <display value="Not reachable" /> + <definition value="Ping could not be sent to target organization" /> + </concept> + <concept> + <code value="pong-missing" /> + <display value="Pong missing" /> + <definition value="No pong received from target organization" /> + </concept> + <concept> + <code value="pong-received" /> + <display value="Pong received" /> + <definition value="Pong received from target organization" /> + </concept> + <concept> + <code value="pong-send" /> + <display value="Pong send" /> + <definition value="Pong successfully sent to target organization" /> + </concept> +</CodeSystem> \ No newline at end of file diff --git a/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml b/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml new file mode 100644 index 00000000..e52dfd87 --- /dev/null +++ b/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml @@ -0,0 +1,27 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/ValueSet/ping" /> + <!-- version managed by bpe --> + <version value="1.0" /> + <name value="DSF_Ping" /> + <title value="DSF Ping" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="ValueSet with standard values for the process ping/pong" /> + <immutable value="true" /> + <compose> + <include> + <system value="http://dsf.dev/fhir/CodeSystem/ping" /> + <version value="1.0" /> + </include> + </compose> +</ValueSet> \ No newline at end of file diff --git a/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml b/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml new file mode 100644 index 00000000..afc26d27 --- /dev/null +++ b/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml @@ -0,0 +1,44 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system + value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/ValueSet/ping-status" /> + <!-- version managed by bpe --> + <version value="1.0" /> + <name value="DSF_Ping_Status" /> + <title value="DSF Ping Status" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="ValueSet with ping status values" /> + <immutable value="true" /> + <compose> + <include> + <system value="http://dsf.dev/fhir/CodeSystem/ping-status" /> + <version value="1.0" /> + <concept> + <code value="not-allowed" /> + <display value="Not allowed" /> + </concept> + <concept> + <code value="not-reachable" /> + <display value="Not reachable" /> + </concept> + <concept> + <code value="pong-missing" /> + <display value="Pong missing" /> + </concept> + <concept> + <code value="pong-received" /> + <display value="Pong received" /> + </concept> + </include> + </compose> +</ValueSet> \ No newline at end of file diff --git a/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml b/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml new file mode 100644 index 00000000..d0661cea --- /dev/null +++ b/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml @@ -0,0 +1,39 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/ValueSet/pong-status" /> + <!-- version managed by bpe --> + <version value="1.0" /> + <name value="DSF_Pong_Status" /> + <title value="DSF Pong Status" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="ValueSet with pong status values" /> + <immutable value="true" /> + <compose> + <include> + <system value="http://dsf.dev/fhir/CodeSystem/ping-status" /> + <version value="1.0" /> + <concept> + <code value="not-allowed" /> + <display value="Not allowed" /> + </concept> + <concept> + <code value="not-reachable" /> + <display value="Not reachable" /> + </concept> + <concept> + <code value="pong-send" /> + <display value="Pong send" /> + </concept> + </include> + </compose> +</ValueSet> \ No newline at end of file From 37653aa31fc52e64f8e40329b65da1fca28589b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 14:44:15 +0100 Subject: [PATCH 227/382] Added ping pong v1 CodeSystems and ValueSets to test compatibility to old resources --- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index e4ea397e..69ce88ba 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -60,10 +60,11 @@ public class TaskProfileTest "dsf-task-ping.xml", "dsf-task-pong.xml", "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), - Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", "dsf-ping.xml", - "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-ping-units.xml"), - Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", "dsf-ping-1_0.xml", - "dsf-ping-status.xml", "dsf-ping-status-1_0.xml", "dsf-pong-status.xml", "dsf-pong-status-1_0.xml", "dsf-ping-units.xml")); + Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", + "dsf-ping-1_0.xml", "dsf-ping-status.xml", "dsf-ping-status-1_0.xml", "dsf-ping-units.xml"), + Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", + "dsf-ping-1_0.xml", "dsf-ping-status.xml", "dsf-ping-status-1_0.xml", "dsf-pong-status.xml", + "dsf-pong-status-1_0.xml", "dsf-ping-units.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); From 0512b121b2742cd004c3ecafffe06c084ee58145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 14:49:19 +0100 Subject: [PATCH 228/382] Changed resource loading order --- .../java/dev/dsf/fhir/profiles/TaskProfileTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 69ce88ba..68c39f48 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -60,11 +60,11 @@ public class TaskProfileTest "dsf-task-ping.xml", "dsf-task-pong.xml", "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), - Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", - "dsf-ping-1_0.xml", "dsf-ping-status.xml", "dsf-ping-status-1_0.xml", "dsf-ping-units.xml"), - Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping.xml", - "dsf-ping-1_0.xml", "dsf-ping-status.xml", "dsf-ping-status-1_0.xml", "dsf-pong-status.xml", - "dsf-pong-status-1_0.xml", "dsf-ping-units.xml")); + Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", + "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-ping-units.xml"), + Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", + "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-pong-status-1_0.xml", + "dsf-pong-status.xml", "dsf-ping-units.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); From 821f48e7ddad4b0603be449dc16f9fc67d764ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 15:06:23 +0100 Subject: [PATCH 229/382] Renamed CodeSystem and ValueSet urls as a workaround because FHIR validation fails depending on the order the same FHIR resources with different versions are loaded --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 6 +++--- .../fhir/CodeSystem/dsf-ping-status.xml | 2 +- .../fhir/CodeSystem/dsf-ping-units.xml | 2 +- .../resources/fhir/CodeSystem/dsf-ping.xml | 2 +- .../dsf-extension-network-speed.xml | 4 ++-- .../dsf-task-cleanup-pong.xml | 4 ++-- .../StructureDefinition/dsf-task-ping.xml | 20 +++++++++---------- .../StructureDefinition/dsf-task-pong.xml | 10 +++++----- .../dsf-task-start-ping-autostart.xml | 12 +++++------ .../dsf-task-start-ping.xml | 16 +++++++-------- .../Task/dsf-task-start-ping-autostart.xml | 6 +++--- .../fhir/Task/dsf-task-start-ping.xml | 4 ++-- .../fhir/ValueSet/dsf-ping-status.xml | 4 ++-- .../fhir/ValueSet/dsf-ping-units.xml | 4 ++-- src/main/resources/fhir/ValueSet/dsf-ping.xml | 4 ++-- .../fhir/ValueSet/dsf-pong-status.xml | 4 ++-- .../fhir/CodeSystem/dsf-ping-1_0.xml | 2 +- .../fhir/CodeSystem/dsf-ping-status-1_0.xml | 2 +- .../resources/fhir/ValueSet/dsf-ping-1_0.xml | 4 ++-- .../fhir/ValueSet/dsf-ping-status-1_0.xml | 4 ++-- .../fhir/ValueSet/dsf-pong-status-1_0.xml | 4 ++-- 21 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index a9e11496..a8a593b8 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -45,7 +45,7 @@ private ConstantsPing() public static final String PROFILE_DSF_TASK_CLEANUP_PONG_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PONG; public static final String PROFILE_DSF_TASK_CLEANUP_PONG_MESSAGE_NAME = "cleanupPong"; - public static final String CODESYSTEM_DSF_PING = "http://dsf.dev/fhir/CodeSystem/ping"; + public static final String CODESYSTEM_DSF_PING = "http://dsf.dev/fhir/CodeSystem/ping-v2"; public static final String CODESYSTEM_DSF_PING_VALUE_PING_STATUS = "ping-status"; public static final String CODESYSTEM_DSF_PING_VALUE_PONG_STATUS = "pong-status"; public static final String CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER = "endpoint-identifier"; @@ -56,7 +56,7 @@ private ConstantsPing() public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES = "downloaded-bytes"; public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE = "download-resource-reference"; - public static final String CODESYSTEM_DSF_PING_STATUS = "http://dsf.dev/fhir/CodeSystem/ping-status"; + public static final String CODESYSTEM_DSF_PING_STATUS = "http://dsf.dev/fhir/CodeSystem/ping-status-v2"; public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED = "not-allowed"; public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE = "not-reachable"; public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING = "pong-missing"; @@ -65,7 +65,7 @@ private ConstantsPing() public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE = "error-message"; public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_RESOURCE_DOWNLOADED = "resource-downloaded"; - public static final String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units"; + public static final String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units-v2"; public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND = "bytes-per-second"; public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND = "megabits-per-second"; diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml index 29420c34..eed24337 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-status" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping_Status" /> diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml index 5dc9e976..b6109468 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-units" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping-units-v2" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping_Units" /> diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping.xml b/src/main/resources/fhir/CodeSystem/dsf-ping.xml index bc70ab9d..aa93700c 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping" /> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml index 58fbf85d..c82ca295 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml @@ -73,14 +73,14 @@ <element id="Extension.extension:unit.value[x].system"> <path value="Extension.extension.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-units"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-units-v2"/> </element> <element id="Extension.extension:unit.value[x].code"> <path value="Extension.extension.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-units"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-units-v2"/> </binding> </element> <element id="Extension.url"> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index 6f47715e..f05d5c2b 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -80,7 +80,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> <element id="Task.input:downloaded-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -116,7 +116,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> <element id="Task.input:downloaded-duration-millis.type.coding.code"> <path value="Task.input.type.coding.code"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index d41aed7e..fea2bfe4 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -70,7 +70,7 @@ <path value="Task.input.type" /> <binding> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> </binding> </element> <element id="Task.input:endpoint-identifier.type.coding"> @@ -81,7 +81,7 @@ <element id="Task.input:endpoint-identifier.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> </element> <element id="Task.input:endpoint-identifier.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -129,7 +129,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> </binding> </element> <element id="Task.input:download-resource-size-bytes.type.coding"> @@ -141,7 +141,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -167,7 +167,7 @@ <path value="Task.input.type"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> </binding> </element> <element id="Task.input:download-resource-reference.type.coding"> @@ -179,7 +179,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> <element id="Task.input:download-resource-reference.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -236,7 +236,7 @@ <path value="Task.output.type"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> </binding> </element> <element id="Task.output:pong-status.type.coding"> @@ -247,7 +247,7 @@ <element id="Task.output:pong-status.type.coding.system"> <path value="Task.output.type.coding.system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> <element id="Task.output:pong-status.type.coding.code"> <path value="Task.output.type.coding.code"/> @@ -263,14 +263,14 @@ <element id="Task.output:pong-status.value[x].system"> <path value="Task.output.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status-v2"/> </element> <element id="Task.output:pong-status.value[x].code"> <path value="Task.output.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/pong-status|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/pong-status-v2|#{version}"/> </binding> </element> </differential> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index e230e381..50e1915e 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -69,7 +69,7 @@ <path value="Task.input.type"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> </binding> </element> <element id="Task.input:download-resource-reference.type.coding"> @@ -81,7 +81,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> <element id="Task.input:download-resource-reference.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -131,7 +131,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> <element id="Task.input:downloaded-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -167,7 +167,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> <element id="Task.input:downloaded-duration-millis.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -202,7 +202,7 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> <element id="Task.input:error-message.type.coding.code"> <path value="Task.input.type.coding.code"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml index ea9ca7bf..969e6229 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml @@ -68,7 +68,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> </binding> </element> <element id="Task.input:target-endpoints.type.coding"> @@ -79,7 +79,7 @@ <element id="Task.input:target-endpoints.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> </element> <element id="Task.input:target-endpoints.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -108,7 +108,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> </binding> </element> <element id="Task.input:timer-interval.type.coding"> @@ -119,7 +119,7 @@ <element id="Task.input:timer-interval.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> </element> <element id="Task.input:timer-interval.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -154,13 +154,13 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> </binding> </element> <element id="Task.input:download-resource-size-bytes.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code" /> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index 146301ce..a28677d1 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -68,7 +68,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> </binding> </element> <element id="Task.input:target-endpoints.type.coding"> @@ -79,7 +79,7 @@ <element id="Task.input:target-endpoints.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> </element> <element id="Task.input:target-endpoints.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -108,13 +108,13 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> </binding> </element> <element id="Task.input:download-resource-size-bytes.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -148,7 +148,7 @@ <path value="Task.output.type"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> </binding> </element> <element id="Task.output:ping-status.type.coding"> @@ -159,7 +159,7 @@ <element id="Task.output:ping-status.type.coding.system"> <path value="Task.output.type.coding.system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> <element id="Task.output:ping-status.type.coding.code"> <path value="Task.output.type.coding.code"/> @@ -175,14 +175,14 @@ <element id="Task.output:ping-status.value[x].system"> <path value="Task.output.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status-v2"/> </element> <element id="Task.output:ping-status.value[x].code"> <path value="Task.output.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-status|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-status-v2|#{version}"/> </binding> </element> </differential> diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml index a754611b..0cff04de 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml @@ -38,7 +38,7 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <system value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> <code value="target-endpoints"/> </coding> </type> @@ -47,7 +47,7 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <system value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> <code value="timer-interval"/> </coding> </type> @@ -56,7 +56,7 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <system value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> <code value="download-resource-size-bytes"/> </coding> </type> diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping.xml b/src/main/resources/fhir/Task/dsf-task-start-ping.xml index 0418156b..29011e26 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping.xml @@ -38,7 +38,7 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <system value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> <code value="download-resource-size-bytes" /> </coding> </type> @@ -47,7 +47,7 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <system value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> <code value="target-endpoints"/> </coding> </type> diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-status.xml b/src/main/resources/fhir/ValueSet/dsf-ping-status.xml index 0729a89a..9bed9fec 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping-status.xml +++ b/src/main/resources/fhir/ValueSet/dsf-ping-status.xml @@ -6,7 +6,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping-status" /> + <url value="http://dsf.dev/fhir/ValueSet/ping-status-v2" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping_Status" /> @@ -21,7 +21,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-status" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> <version value="#{version}" /> <concept> <code value="not-allowed" /> diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml b/src/main/resources/fhir/ValueSet/dsf-ping-units.xml index 124233e4..fa619072 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml +++ b/src/main/resources/fhir/ValueSet/dsf-ping-units.xml @@ -6,7 +6,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping-units" /> + <url value="http://dsf.dev/fhir/ValueSet/ping-units-v2" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping_Units" /> @@ -21,7 +21,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-units" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-units-v2" /> <version value="#{version}" /> </include> </compose> diff --git a/src/main/resources/fhir/ValueSet/dsf-ping.xml b/src/main/resources/fhir/ValueSet/dsf-ping.xml index 0fef6dbf..4984f57a 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping.xml +++ b/src/main/resources/fhir/ValueSet/dsf-ping.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping" /> + <url value="http://dsf.dev/fhir/ValueSet/ping-v2" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping" /> @@ -20,7 +20,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> <version value="#{version}" /> </include> </compose> diff --git a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml index a4bd088e..97c471b7 100644 --- a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml +++ b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/pong-status" /> + <url value="http://dsf.dev/fhir/ValueSet/pong-status-v2" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Pong_Status" /> @@ -20,7 +20,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-status" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> <version value="#{version}" /> <concept> <code value="not-allowed" /> diff --git a/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml b/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml index c2586c9f..630c9073 100644 --- a/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml +++ b/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> <!-- version managed by bpe --> <version value="1.0" /> <name value="DSF_Ping" /> diff --git a/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml b/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml index 6a1bd2c4..62ebe1cb 100644 --- a/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml +++ b/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-status" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> <!-- version managed by bpe --> <version value="1.0" /> <name value="DSF_Ping_Status" /> diff --git a/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml b/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml index e52dfd87..4784f28a 100644 --- a/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml +++ b/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping" /> + <url value="http://dsf.dev/fhir/ValueSet/ping-v2" /> <!-- version managed by bpe --> <version value="1.0" /> <name value="DSF_Ping" /> @@ -20,7 +20,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> <version value="1.0" /> </include> </compose> diff --git a/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml b/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml index afc26d27..cae323ec 100644 --- a/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml +++ b/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml @@ -6,7 +6,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping-status" /> + <url value="http://dsf.dev/fhir/ValueSet/ping-status-v2" /> <!-- version managed by bpe --> <version value="1.0" /> <name value="DSF_Ping_Status" /> @@ -21,7 +21,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-status" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> <version value="1.0" /> <concept> <code value="not-allowed" /> diff --git a/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml b/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml index d0661cea..38a2020a 100644 --- a/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml +++ b/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/pong-status" /> + <url value="http://dsf.dev/fhir/ValueSet/pong-status-v2" /> <!-- version managed by bpe --> <version value="1.0" /> <name value="DSF_Pong_Status" /> @@ -20,7 +20,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-status" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> <version value="1.0" /> <concept> <code value="not-allowed" /> From 5adac2b0024dee79b7f4e084d3c7afa801675986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 15:30:04 +0100 Subject: [PATCH 230/382] Fixed inputs being wrongfully added as outputs --- src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 68c39f48..2eac0312 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -256,7 +256,7 @@ public String getCorrelationKey() }; Task task = createValidTaskStartPingProcess(); - task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType() + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE, List.of("some error message"))); @@ -300,7 +300,7 @@ public String getCorrelationKey() }; Task task = createValidTaskStartPingProcess(); - task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType() + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED, BigDecimal.ZERO, BigDecimal.ZERO, From a9695335238547ebfc06d005daf9c4cee94731a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 15:46:09 +0100 Subject: [PATCH 231/382] Added old extension to replicate a problem from actually running the plugin with both versions installed --- .../dsf/fhir/profiles/TaskProfileTest.java | 4 +- .../dsf-extension-ping-status-1_0.xml | 134 ++++++++++++++++++ 2 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/fhir/StructureDefinition/dsf-extension-ping-status-1_0.xml diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 2eac0312..de279e3f 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -57,8 +57,8 @@ public class TaskProfileTest public static final ValidationSupportRule validationRule = new ValidationSupportRule(def.getResourceVersion(), def.getResourceReleaseDate(), Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-network-speed.xml", "dsf-extension-ping-status.xml", - "dsf-task-ping.xml", "dsf-task-pong.xml", "dsf-task-start-ping.xml", - "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", + "dsf-extension-ping-status-1_0.xml", "dsf-task-ping.xml", "dsf-task-pong.xml", + "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-ping-units.xml"), diff --git a/src/test/resources/fhir/StructureDefinition/dsf-extension-ping-status-1_0.xml b/src/test/resources/fhir/StructureDefinition/dsf-extension-ping-status-1_0.xml new file mode 100644 index 00000000..3917b793 --- /dev/null +++ b/src/test/resources/fhir/StructureDefinition/dsf-extension-ping-status-1_0.xml @@ -0,0 +1,134 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag"/> + <code value="ALL"/> + </tag> + </meta> + <url value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> + <!-- version managed by bpe --> + <version value="1.0" /> + <name value="PingResponse"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <fhirVersion value="4.0.1"/> + <kind value="complex-type"/> + <abstract value="false"/> + <context> + <type value="element"/> + <expression value="Task.output"/> + </context> + <type value="Extension"/> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> + <derivation value="constraint"/> + <differential> + <element id="Extension.extension"> + <path value="Extension.extension"/> + <slicing> + <discriminator> + <type value="value"/> + <path value="url"/> + </discriminator> + <rules value="open"/> + </slicing> + <min value="3"/> + </element> + <element id="Extension.extension:correlation-key"> + <path value="Extension.extension"/> + <sliceName value="correlation-key"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:correlation-key.url"> + <path value="Extension.extension.url"/> + <fixedUri value="correlation-key"/> + </element> + <element id="Extension.extension:correlation-key.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <type> + <code value="string"/> + </type> + </element> + <element id="Extension.extension:organization-identifier"> + <path value="Extension.extension"/> + <sliceName value="organization-identifier"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:organization-identifier.url"> + <path value="Extension.extension.url"/> + <fixedUri value="organization-identifier"/> + </element> + <element id="Extension.extension:organization-identifier.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <type> + <code value="Identifier"/> + </type> + </element> + <element id="Extension.extension:organization-identifier.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <fixedUri value="http://dsf.dev/sid/organization-identifier"/> + </element> + <element id="Extension.extension:organization-identifier.value[x].value"> + <path value="Extension.extension.value[x].value"/> + <min value="1"/> + </element> + <element id="Extension.extension:endpoint-identifier"> + <path value="Extension.extension"/> + <sliceName value="endpoint-identifier"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:endpoint-identifier.url"> + <path value="Extension.extension.url"/> + <fixedUri value="endpoint-identifier"/> + </element> + <element id="Extension.extension:endpoint-identifier.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <type> + <code value="Identifier"/> + </type> + </element> + <element id="Extension.extension:endpoint-identifier.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <fixedUri value="http://dsf.dev/sid/endpoint-identifier"/> + </element> + <element id="Extension.extension:endpoint-identifier.value[x].value"> + <path value="Extension.extension.value[x].value"/> + <min value="1"/> + </element> + <element id="Extension.extension:error-message"> + <path value="Extension.extension"/> + <sliceName value="error-message"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Extension.extension:error-message.url"> + <path value="Extension.extension.url"/> + <fixedUri value="error-message"/> + </element> + <element id="Extension.extension:error-message.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <type> + <code value="string"/> + </type> + </element> + <element id="Extension.url"> + <path value="Extension.url"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> + </element> + <element id="Extension.value[x]"> + <path value="Extension.value[x]"/> + <max value="0"/> + </element> + </differential> +</StructureDefinition> \ No newline at end of file From 21be0d17c8de51eca0d24a4b46efc9c86dd218ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 15:50:09 +0100 Subject: [PATCH 232/382] Renamed extension url as a workaround because FHIR validation fails depending on the order the same FHIR resources with different versions are loaded --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 +- .../fhir/StructureDefinition/dsf-extension-ping-status.xml | 4 ++-- src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml | 2 +- .../fhir/StructureDefinition/dsf-task-start-ping.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index a8a593b8..34a97177 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -78,7 +78,7 @@ private ConstantsPing() public static final String CODESYSTEM_READ_ACCESS_TAG = "http://dsf.dev/fhir/CodeSystem/read-access-tag"; public static final String CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL = "ALL"; - public static final String EXTENSION_URL_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status"; + public static final String EXTENSION_URL_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"; public static final String EXTENSION_URL_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; public static final String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; public static final String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 420717ae..666c7412 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -5,7 +5,7 @@ <code value="ALL"/> </tag> </meta> - <url value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> + <url value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"/> <!-- version managed by bpe --> <version value="#{version}" /> <name value="PingResponse"/> @@ -193,7 +193,7 @@ </element> <element id="Extension.url"> <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"/> </element> <element id="Extension.value[x]"> <path value="Extension.value[x]"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index fea2bfe4..5acfec2e 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -229,7 +229,7 @@ <min value="1" /> <type> <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status|#{version}" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2|#{version}" /> </type> </element> <element id="Task.output:pong-status.type"> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index a28677d1..02c7cb0e 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -141,7 +141,7 @@ <min value="1" /> <type> <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status|#{version}" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2|#{version}" /> </type> </element> <element id="Task.output:ping-status.type"> From 2bc27577f066d61b28d1624dd7e3991de25dd668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 16:06:46 +0100 Subject: [PATCH 233/382] Providing a download resource size is now optional. It will take the default value of 10 MB if left empty --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 ++ .../bpe/service/SetDownloadResourceSize.java | 18 +++++++++++++----- .../dev/dsf/bpe/spring/config/PingConfig.java | 2 +- .../dsf-task-start-ping.xml | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 34a97177..b576c629 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -103,6 +103,8 @@ private ConstantsPing() private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_BYTES = "uploadedBytes"; private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS = "uploadedDurationMillis"; + public static final int DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT = 10000000; + public static final MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; public static final String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index 1bff46f2..99f5a076 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -1,8 +1,11 @@ package dev.dsf.bpe.service; +import java.util.Optional; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -11,9 +14,12 @@ public class SetDownloadResourceSize extends AbstractServiceDelegate { - public SetDownloadResourceSize(ProcessPluginApi api) + private final int maxDownloadResourceSizeBytes; + + public SetDownloadResourceSize(ProcessPluginApi api, int maxDownloadResourceSizeBytes) { super(api); + this.maxDownloadResourceSizeBytes = maxDownloadResourceSizeBytes; } @Override @@ -25,9 +31,11 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable private int getDownloadResourceSize(Variables variables) { - return api.getTaskHelper() - .getFirstInputParameterValue(variables.getStartTask(), ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, IntegerType.class) - .orElseThrow().getValue(); + Optional<IntegerType> downloadResourceSizeType = api.getTaskHelper().getFirstInputParameterValue( + variables.getStartTask(), ConstantsPing.CODESYSTEM_DSF_PING, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, IntegerType.class); + + return downloadResourceSizeType.isPresent() ? downloadResourceSizeType.get().getValue() + : Math.min(maxDownloadResourceSizeBytes, ConstantsPing.DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT); } } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index b945d73b..f0a8f0b2 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -233,7 +233,7 @@ public EstimateCleanupTimerDuration estimateCleanupTimerDuration() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SetDownloadResourceSize setDownloadResourceSize() { - return new SetDownloadResourceSize(api); + return new SetDownloadResourceSize(api, (int) maxDownloadSizeBytes); } @Bean diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index 02c7cb0e..c9f431ae 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -98,7 +98,7 @@ </extension> <path value="Task.input" /> <sliceName value="download-resource-size-bytes" /> - <min value="1" /> + <min value="0" /> <max value="1" /> </element> <element id="Task.input:download-resource-size-bytes.type"> From a4dcbd93e44135b98d31bd90e3b9370381d654f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 16:18:49 +0100 Subject: [PATCH 234/382] Revert "Now adds upload and download data with 0 as values if an error occurred because StoreResults expects those values to be set even if an error occurred" This reverts commit 789e449ae4c94a4ef44f88452b1989077bc0a005. --- src/main/java/dev/dsf/bpe/message/SendPing.java | 2 -- src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index c5cd3c75..9f46f11e 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -67,8 +67,6 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); String specialErrorMessage = createErrorMessage(exception); ErrorMessageListUtils.add(specialErrorMessage, execution); - variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0); - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index 49f56411..bdc2b485 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -5,10 +5,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveError extends AbstractServiceDelegate @@ -23,8 +21,6 @@ public LogAndSaveError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - String correlationKey = variables.getTarget().getCorrelationKey(); - variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey), 0); - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); + logger.info("Logging and saving error"); } } From 8979341dedb3857a76f9d4bf13f45a8e034afbcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 16:18:50 +0100 Subject: [PATCH 235/382] Revert "Error message is now added to error message list instead of being a separate error message in execution variables" This reverts commit 899bb3c9293c9ee726c9d31a83190c3fa2ea36d1. --- src/main/java/dev/dsf/bpe/message/SendPing.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index 9f46f11e..e65dd730 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -12,7 +12,6 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -66,7 +65,7 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); String specialErrorMessage = createErrorMessage(exception); - ErrorMessageListUtils.add(specialErrorMessage, execution); + variables.setString(ConstantsPing.getBpmnExecutionVariableErrorMessage(correlationKey), specialErrorMessage); logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); } From bcfa71666b3710fe1bd3ab5a807eac0afc787d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 16:29:33 +0100 Subject: [PATCH 236/382] Now correctly shows status code in output if ping fails to be sent to organization endpoint --- .../java/dev/dsf/bpe/message/SendPing.java | 9 +++--- .../bpe/service/ping/LogAndSaveSendError.java | 32 +++++++++++++++++++ .../dev/dsf/bpe/spring/config/PingConfig.java | 8 +++++ src/main/resources/bpe/ping.bpmn | 20 +++++++++--- 4 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index e65dd730..0ee08374 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -52,20 +52,19 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut } @Override - protected void handleIntermediateThrowEventError(DelegateExecution execution, Variables variables, - Exception exception, String errorMessage) + protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, + String errorMessage) { Target target = variables.getTarget(); - String correlationKey = target.getCorrelationKey(); String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; - variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); + execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); String specialErrorMessage = createErrorMessage(exception); - variables.setString(ConstantsPing.getBpmnExecutionVariableErrorMessage(correlationKey), specialErrorMessage); + execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableErrorMessage(), specialErrorMessage); logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java new file mode 100644 index 00000000..31993e08 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -0,0 +1,32 @@ +package dev.dsf.bpe.service.ping; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; +import dev.dsf.bpe.v1.variables.Variables; + +public class LogAndSaveSendError extends AbstractServiceDelegate +{ + public LogAndSaveSendError(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + { + String correlationKey = variables.getTarget().getCorrelationKey(); + String statusCode = (String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode()); + String errorMessage = (String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableErrorMessage()); + + variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); + ErrorMessageListUtils.add(errorMessage, execution); + variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0); + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); + } +} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index f0a8f0b2..c10dacd3 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -22,6 +22,7 @@ import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.ping.LogAndSaveError; import dev.dsf.bpe.service.ping.LogAndSaveNoResponse; +import dev.dsf.bpe.service.ping.LogAndSaveSendError; import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; import dev.dsf.bpe.service.ping.StoreResults; @@ -263,4 +264,11 @@ public StoreDownloadSpeed storeDownloadSpeed() { return new StoreDownloadSpeed(api, networkSpeedUnit); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public LogAndSaveSendError logAndSaveSendError() + { + return new LogAndSaveSendError(api); + } } diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index e27eef0b..c6966a14 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -49,7 +49,7 @@ </bpmn:exclusiveGateway> <bpmn:exclusiveGateway id="Gateway_09z7b0z"> <bpmn:incoming>Flow_136htek</bpmn:incoming> - <bpmn:incoming>Flow_101sqed</bpmn:incoming> + <bpmn:incoming>Flow_0upu487</bpmn:incoming> <bpmn:outgoing>Flow_1ho1hys</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:endEvent id="SubProcessEndEvent" camunda:asyncAfter="true"> @@ -124,7 +124,7 @@ <bpmn:sequenceFlow id="Flow_1j54c2s" sourceRef="Gateway_0z5gz96" targetRef="EventBasedGateway" /> <bpmn:sequenceFlow id="Flow_136htek" sourceRef="LogNoResponse" targetRef="Gateway_09z7b0z" /> <bpmn:sequenceFlow id="Flow_08vgmf6" sourceRef="Activity_0ri6fnv" targetRef="Gateway_0z5gz96" /> - <bpmn:sequenceFlow id="Flow_101sqed" name="not-allowed or not-reachable" sourceRef="Gateway_0z5gz96" targetRef="Gateway_09z7b0z"> + <bpmn:sequenceFlow id="Flow_101sqed" name="not-allowed or not-reachable" sourceRef="Gateway_0z5gz96" targetRef="Activity_0p5edt9"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && (statusCode == 'not-allowed' || statusCode == 'not-reachable')}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1ho1hys" sourceRef="Gateway_09z7b0z" targetRef="SubProcessEndEvent" /> @@ -143,6 +143,11 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1jwekqw" sourceRef="Activity_081me01" targetRef="Gateway_0p0be0a" /> <bpmn:sequenceFlow id="Flow_03nx6rk" sourceRef="Gateway_02orad4" targetRef="Event_1foycg9" /> + <bpmn:sequenceFlow id="Flow_0upu487" sourceRef="Activity_0p5edt9" targetRef="Gateway_09z7b0z" /> + <bpmn:serviceTask id="Activity_0p5edt9" name="Log And Save Send Error" camunda:class="dev.dsf.bpe.service.ping.LogAndSaveSendError"> + <bpmn:incoming>Flow_101sqed</bpmn:incoming> + <bpmn:outgoing>Flow_0upu487</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:textAnnotation id="TextAnnotation_0uc8utt"> <bpmn:text>Information in message: - dowloadResourceSize: long @@ -316,6 +321,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1980" y="622" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0p0eucz_di" bpmnElement="Activity_0p5edt9"> + <dc:Bounds x="1520" y="520" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0968qvb" bpmnElement="Event_0i4slcz"> <dc:Bounds x="2152" y="542" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -354,8 +362,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNEdge id="BPMNEdge_0ffsn0i" bpmnElement="Flow_101sqed"> <di:waypoint x="1340" y="385" /> <di:waypoint x="1340" y="560" /> - <di:waypoint x="1780" y="560" /> - <di:waypoint x="1780" y="475" /> + <di:waypoint x="1520" y="560" /> <bpmndi:BPMNLabel> <dc:Bounds x="1265" y="524" width="70" height="27" /> </bpmndi:BPMNLabel> @@ -417,6 +424,11 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2074" y="622" /> <di:waypoint x="2102" y="560" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0upu487_di" bpmnElement="Flow_0upu487"> + <di:waypoint x="1620" y="560" /> + <di:waypoint x="1780" y="560" /> + <di:waypoint x="1780" y="475" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_06i4ly8" bpmnElement="Activity_16rb6hc"> <dc:Bounds x="690" y="460" width="100" height="80" /> </bpmndi:BPMNShape> From 23f742499ec32ff7e8ab1dcb354f617b5b56a7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 17:23:39 +0100 Subject: [PATCH 237/382] Deleted SaveUploadSpeeds because it was unused --- .../bpe/service/pong/SaveUploadSpeeds.java | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/service/pong/SaveUploadSpeeds.java diff --git a/src/main/java/dev/dsf/bpe/service/pong/SaveUploadSpeeds.java b/src/main/java/dev/dsf/bpe/service/pong/SaveUploadSpeeds.java deleted file mode 100644 index d5f2b523..00000000 --- a/src/main/java/dev/dsf/bpe/service/pong/SaveUploadSpeeds.java +++ /dev/null @@ -1,22 +0,0 @@ -package dev.dsf.bpe.service.pong; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Variables; - -public class SaveUploadSpeeds extends AbstractServiceDelegate -{ - public SaveUploadSpeeds(ProcessPluginApi api) - { - super(api); - } - - @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception - { - - } -} From e03e360192be4c77389ac1db9beee9d5e0f70eeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 17:29:09 +0100 Subject: [PATCH 238/382] Added version placeholder to ping status extension in order to differentiate between it and the old ping-process's version --- src/main/java/dev/dsf/bpe/util/VersionUtils.java | 16 ++++++++++++++++ .../output/generator/PingStatusGenerator.java | 7 +++++-- .../dsf-extension-ping-status.xml | 2 +- 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/util/VersionUtils.java diff --git a/src/main/java/dev/dsf/bpe/util/VersionUtils.java b/src/main/java/dev/dsf/bpe/util/VersionUtils.java new file mode 100644 index 00000000..b112adef --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/VersionUtils.java @@ -0,0 +1,16 @@ +package dev.dsf.bpe.util; + +import dev.dsf.bpe.PingProcessPluginDefinition; + +public class VersionUtils +{ + public static String appendFhirResourceVersion(String toAppend) + { + return toAppend + "|" + getFhirResourceVersion(); + } + + public static String getFhirResourceVersion() + { + return new PingProcessPluginDefinition().getVersion().substring(0, 3); + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 2535ff4d..d630482c 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -1,5 +1,7 @@ package dev.dsf.bpe.util.task.output.generator; +import static dev.dsf.bpe.util.VersionUtils.appendFhirResourceVersion; + import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; @@ -634,12 +636,13 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outputComponent) { List<Extension> pingStatusExtensions = outputComponent.getExtension().stream() - .filter(extension -> ConstantsPing.EXTENSION_URL_PING_STATUS.equals(extension.getUrl())).toList(); + .filter(extension -> appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS).equals(extension.getUrl())) + .toList(); Extension extension; if (pingStatusExtensions.isEmpty()) { extension = outputComponent.addExtension(); - extension.setUrl(ConstantsPing.EXTENSION_URL_PING_STATUS); + extension.setUrl(appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS)); } else { diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 666c7412..acf99fbe 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -193,7 +193,7 @@ </element> <element id="Extension.url"> <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2|#{version}"/> </element> <element id="Extension.value[x]"> <path value="Extension.value[x]"/> From 0ba8ca3ddbb8a89b052f0f5410474dfa8305599a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 17:49:19 +0100 Subject: [PATCH 239/382] Improved logging by adding a new logger that outputs the Start-Task's url at the beginning of each log message and adding debug logs to most doExecute() methods --- .../PingPongDeploymentStateListener.java | 6 ++- .../listener/SetCorrelationKeyListener.java | 6 +++ .../java/dev/dsf/bpe/message/SendPong.java | 7 ++++ .../java/dev/dsf/bpe/service/Cleanup.java | 13 +++--- .../dev/dsf/bpe/service/GenerateResource.java | 10 +++-- .../bpe/service/SetDownloadResourceSize.java | 8 +++- .../dev/dsf/bpe/service/StoreResource.java | 9 ++-- ...adResourceAndMeasureSpeedInSubProcess.java | 10 ++++- .../dsf/bpe/service/ping/LogAndSaveError.java | 5 ++- .../service/ping/LogAndSaveNoResponse.java | 8 +++- .../bpe/service/ping/LogAndSaveSendError.java | 7 ++++ .../dev/dsf/bpe/service/ping/SavePong.java | 8 ++-- .../bpe/service/ping/SelectPingTargets.java | 24 ++++++----- .../dsf/bpe/service/ping/StoreResults.java | 9 ++++ .../pong/DownloadResourceAndMeasureSpeed.java | 9 +++- .../pong/EstimateCleanupTimerDuration.java | 8 ++-- .../service/pong/LogAndSaveAndStoreError.java | 7 ++-- .../service/pong/LogAndStoreSendError.java | 5 ++- .../dev/dsf/bpe/service/pong/LogPing.java | 5 ++- .../bpe/service/pong/SelectPongTarget.java | 10 +++-- .../service/pong/SetEndpointIdentifier.java | 6 +++ .../bpe/service/pong/StoreDownloadSpeed.java | 4 ++ .../bpe/service/pong/StoreUploadSpeed.java | 5 ++- .../bpe/util/BinaryResourceDownloader.java | 14 ++++--- .../dsf/bpe/util/logging/PingPongLogger.java | 42 +++++++++++++++++++ 25 files changed, 189 insertions(+), 56 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/util/logging/PingPongLogger.java diff --git a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java index b7db8780..8363afac 100644 --- a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java +++ b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java @@ -27,17 +27,19 @@ public PingPongDeploymentStateListener(PingConfig pingConfig) @Override public void onProcessesDeployed(List<String> processes) { + logger.debug("Validating plugin configuration..."); if (ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES.contains(networkSpeedUnit)) { - logger.info("Network speed unit is valid: {}", networkSpeedUnit); + logger.debug("Network speed unit is valid: {}", networkSpeedUnit); } else { pingConfig.setNetworkSpeedUnit(ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); - logger.info("Network speed unit \"{}\" is not valid. Valid values are: {}. Defaulting to \"{}\"", + logger.debug("Network speed unit \"{}\" is not valid. Valid values are: {}. Defaulting to \"{}\"", networkSpeedUnit, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); } + logger.debug("Configuration validation complete."); } @Override diff --git a/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java b/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java index 52089288..c74b9813 100644 --- a/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java +++ b/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java @@ -4,8 +4,11 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.constants.BpmnExecutionVariables; import dev.dsf.bpe.v1.variables.Target; @@ -29,6 +32,9 @@ public void afterPropertiesSet() throws Exception @Override public void notify(DelegateExecution execution) throws Exception { + PingPongLogger logger = new PingPongLogger(SetCorrelationKeyListener.class, + api.getVariables(execution).getStartTask()); + logger.debug("Setting correlation key for subprocess instance {}", execution.getProcessInstanceId()); Variables variables = api.getVariables(execution); Target target = variables.getTarget(); diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index a2caea61..a60b2b74 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -6,10 +6,13 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; @@ -85,6 +88,9 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw protected void handleIntermediateThrowEventError(DelegateExecution execution, Variables variables, Exception exception, String errorMessage) { + PingPongLogger logger = new PingPongLogger(SendPong.class, variables.getStartTask()); + Target target = variables.getTarget(); + String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED @@ -93,6 +99,7 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va String specialErrorMessage = createErrorMessage(exception); execution.setVariable(ConstantsPing.getBpmnExecutionVariableErrorMessage(), specialErrorMessage); + logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); } private String createErrorMessage(Exception exception) diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 1864a7ee..048e5dff 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -8,14 +8,14 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.service.pong.LogPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class Cleanup extends AbstractServiceDelegate { - private final static Logger logger = LoggerFactory.getLogger(Cleanup.class); - public Cleanup(ProcessPluginApi api) { super(api); @@ -24,7 +24,8 @@ public Cleanup(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - logger.info("Cleaning up..."); + PingPongLogger logger = new PingPongLogger(Cleanup.class, variables.getStartTask()); + logger.debug("Cleaning up..."); String downloadResourceId = new IdType( variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE)).getIdPart(); if (downloadResourceId != null) @@ -32,12 +33,12 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable api.getFhirWebserviceClientProvider().getLocalWebserviceClient().delete(Binary.class, downloadResourceId); api.getFhirWebserviceClientProvider().getLocalWebserviceClient().deletePermanently(Binary.class, downloadResourceId); - logger.info("Deleted Binary resource with ID {}", downloadResourceId); + logger.debug("Deleted Binary resource with ID {}", downloadResourceId); } else { - logger.info("Nothing to do"); + logger.debug("Nothing to do"); } - logger.info("Cleanup complete."); + logger.debug("Cleanup complete."); } } diff --git a/src/main/java/dev/dsf/bpe/service/GenerateResource.java b/src/main/java/dev/dsf/bpe/service/GenerateResource.java index c9aff2e8..fa3bab8a 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateResource.java @@ -11,14 +11,15 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.util.ReadAccessTagGenerator; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class GenerateResource extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(GenerateResource.class); private final int maxUploadSizeBytes; public GenerateResource(ProcessPluginApi api, int maxUploadSizeBytes) @@ -30,13 +31,16 @@ public GenerateResource(ProcessPluginApi api, int maxUploadSizeBytes) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(GenerateResource.class, variables.getStartTask()); + logger.debug("Generating resource..."); int downloadResourceSizeBytes = getDownloadResourceSize(variables); variables.setByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE, - generateRandomBinaryContent(downloadResourceSizeBytes)); + generateRandomBinaryContent(downloadResourceSizeBytes, logger)); + logger.debug("Generated resource."); } - private byte[] generateRandomBinaryContent(int desiredSizeBytes) + private byte[] generateRandomBinaryContent(int desiredSizeBytes, PingPongLogger logger) { int sizeBytes = Math.min(maxUploadSizeBytes, desiredSizeBytes); byte[] bytes = base64Encode(generateRandomByteArray((sizeBytes / 4) * 3)); diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index 99f5a076..fe4512e1 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -5,9 +5,10 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.IntegerType; -import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.service.pong.LogPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -25,8 +26,13 @@ public SetDownloadResourceSize(ProcessPluginApi api, int maxDownloadResourceSize @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(SetDownloadResourceSize.class, variables.getStartTask()); + logger.debug("Setting download resource size..."); + variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, getDownloadResourceSize(variables)); + + logger.debug("Set download resource size to " + maxDownloadResourceSizeBytes); } private int getDownloadResourceSize(Variables variables) diff --git a/src/main/java/dev/dsf/bpe/service/StoreResource.java b/src/main/java/dev/dsf/bpe/service/StoreResource.java index 3dd20db7..0a1e4275 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResource.java @@ -10,15 +10,15 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.util.ReadAccessTagGenerator; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class StoreResource extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(StoreResource.class); - public StoreResource(ProcessPluginApi api) { super(api); @@ -27,6 +27,9 @@ public StoreResource(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(StoreResource.class, variables.getStartTask()); + logger.debug("Storing binary resource for download..."); + IdType downloadResource = storeBinary( variables.getByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE)); @@ -34,7 +37,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); - logger.info("Stored binary resource for download"); + logger.debug("Stored binary resource for download"); } private IdType storeBinary(byte[] downloadResourceContent) diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 9ec4e251..3b894fd9 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -7,8 +7,10 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -16,7 +18,6 @@ public class DownloadResourceAndMeasureSpeedInSubProcess extends AbstractServiceDelegate { - public static final Logger logger = LoggerFactory.getLogger(DownloadResourceAndMeasureSpeedInSubProcess.class); private final int maxDownloadSizeBytes; public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api, int maxDownloadSizeBytes) @@ -28,11 +29,14 @@ public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api, int max @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(DownloadResourceAndMeasureSpeedInSubProcess.class, variables.getStartTask()); + logger.debug("Starting resource download to measure speed..."); + Task task = variables.getLatestTask(); Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download(variables, api, + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger).download(variables, api, task, maxDownloadSizeBytes); if (downloadResult.getErrorMessage() == null) @@ -46,5 +50,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { ErrorMessageListUtils.add(downloadResult.getErrorMessage(), delegateExecution); } + + logger.debug("Completed resource download and measured speed."); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index bdc2b485..7aeaee3e 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -5,14 +5,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveError extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(LogAndSaveError.class); - public LogAndSaveError(ProcessPluginApi api) { super(api); @@ -21,6 +20,8 @@ public LogAndSaveError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(LogAndSaveError.class, variables.getStartTask()); + logger.info("Logging and saving error"); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java index cff591b6..7ec78e3c 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java @@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -13,8 +14,6 @@ public class LogAndSaveNoResponse extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(LogAndSaveNoResponse.class); - public LogAndSaveNoResponse(ProcessPluginApi api) { super(api); @@ -23,6 +22,9 @@ public LogAndSaveNoResponse(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(LogAndSaveNoResponse.class, variables.getStartTask()); + logger.debug("Saving no response to process execution..."); + Target target = variables.getTarget(); logger.info("No PONG received from endpoint '{}'", target.getEndpointIdentifierValue()); @@ -30,5 +32,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable delegateExecution.removeVariable("statusCode"); variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING); + + logger.debug("Saved '{}' to process execution for correlation key '{}'", ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING, correlationKey); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 31993e08..cc6041db 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -2,9 +2,12 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -20,6 +23,8 @@ public LogAndSaveSendError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(LogAndSaveSendError.class, variables.getStartTask()); + String correlationKey = variables.getTarget().getCorrelationKey(); String statusCode = (String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode()); String errorMessage = (String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableErrorMessage()); @@ -28,5 +33,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw ErrorMessageListUtils.add(errorMessage, execution); variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0); variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); + logger.debug("Saved error when trying to send ping message. Status: {}, error message: {}", statusCode, + errorMessage); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index bd733734..0dc5a14e 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -14,6 +14,7 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -21,8 +22,6 @@ public class SavePong extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(SavePong.class); - public SavePong(ProcessPluginApi api) { super(api); @@ -31,7 +30,10 @@ public SavePong(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(SavePong.class, variables.getStartTask()); + Target target = variables.getTarget(); + logger.debug("Pong received from {}. Saving pong information...", target.getEndpointUrl()); String correlationKey = target.getCorrelationKey(); delegateExecution.removeVariable("statusCode"); variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), @@ -56,6 +58,6 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable .map(PrimitiveType::getValue).toList(); ErrorMessageListUtils.addAll(errorList, delegateExecution); - logger.info("Pong received from {}, saved pong information", target.getEndpointUrl()); + logger.debug("Saved pong information."); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java index 0e9dd3a6..67705339 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java @@ -29,6 +29,7 @@ import org.springframework.web.util.UriComponentsBuilder; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; @@ -38,7 +39,6 @@ public class SelectPingTargets extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(SelectPingTargets.class); private static final Pattern endpointResouceTypes = Pattern.compile( "Endpoint|HealthcareService|ImagingStudy|InsurancePlan|Location|Organization|OrganizationAffiliation|PractitionerRole"); @@ -51,8 +51,10 @@ public SelectPingTargets(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { - Stream<Endpoint> targetEndpoints = getTargetEndpointsSearchParameter(variables).map(this::searchForEndpoints) - .orElse(allEndpoints()).filter(isLocalEndpoint().negate()); + Task startTask = variables.getStartTask(); + Stream<Endpoint> targetEndpoints = getTargetEndpointsSearchParameter(variables) + .map(uriComponents -> searchForEndpoints(uriComponents, startTask)).orElse(allEndpoints()) + .filter(isLocalEndpoint().negate()); List<Organization> remoteOrganizations = api.getOrganizationProvider().getRemoteOrganizations(); Map<String, Identifier> organizationIdentifierByOrganizationId = remoteOrganizations.stream().collect( @@ -83,17 +85,18 @@ private Optional<UriComponents> getTargetEndpointsSearchParameter(Variables vari .map(requestUrl -> UriComponentsBuilder.fromUriString(requestUrl).build()); } - private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters) + private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters, Task startTask) { - return searchForEndpoints(searchParameters, 1, 0); + return searchForEndpoints(searchParameters, 1, 0, startTask); } - private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters, int page, int currentTotal) + private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters, int page, int currentTotal, + Task startTask) { if (searchParameters.getPathSegments().isEmpty()) return Stream.empty(); - Optional<Class<? extends Resource>> resourceType = getResourceType(searchParameters); + Optional<Class<? extends Resource>> resourceType = getResourceType(searchParameters, startTask); if (resourceType.isEmpty()) return Stream.empty(); @@ -105,14 +108,14 @@ private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters, int .searchWithStrictHandling(resourceType.get(), queryParameters); if (searchResult.getTotal() > currentTotal + searchResult.getEntry().size()) - return Stream.concat(toEndpoints(searchResult), - searchForEndpoints(searchParameters, page + 1, currentTotal + searchResult.getEntry().size())); + return Stream.concat(toEndpoints(searchResult), searchForEndpoints(searchParameters, page + 1, + currentTotal + searchResult.getEntry().size(), startTask)); else return toEndpoints(searchResult); } @SuppressWarnings("unchecked") - private Optional<Class<? extends Resource>> getResourceType(UriComponents searchParameters) + private Optional<Class<? extends Resource>> getResourceType(UriComponents searchParameters, Task startTask) { if (searchParameters.getPathSegments().isEmpty()) return Optional.empty(); @@ -127,6 +130,7 @@ private Optional<Class<? extends Resource>> getResourceType(UriComponents search } catch (ClassNotFoundException e) { + PingPongLogger logger = new PingPongLogger(SelectPingTargets.class, startTask); logger.error("Unable to find class for FHIR resource type " + type, e); return Optional.empty(); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 78c56a66..f5e0d31a 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -8,11 +8,14 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -44,6 +47,10 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(StoreResults.class, variables.getStartTask()); + + logger.debug("Storing results for process started with Task {}", + variables.getStartTask().getIdElement().getValue()); Task task = variables.getStartTask(); Targets targets = variables.getTargets(); @@ -107,5 +114,7 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(stat // TODO only send one combined status mail variables.updateTask(task); + + logger.debug("Successfully stored results for task {}", variables.getStartTask().getIdElement().getValue()); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index b8adb3b4..fe2b87b9 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -9,13 +9,13 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate { - public static final Logger logger = LoggerFactory.getLogger(DownloadResourceAndMeasureSpeed.class); private final int maxDownloadSizeBytes; public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, int maxDownloadSizeBytes) @@ -27,9 +27,12 @@ public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, int maxDownloadSize @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(DownloadResourceAndMeasureSpeed.class, variables.getStartTask()); + logger.debug("Starting resource download to measure speed..."); + Task task = variables.getStartTask(); - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader().download(variables, api, + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger).download(variables, api, task, maxDownloadSizeBytes); if (downloadResult.getErrorMessage() == null) @@ -43,5 +46,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { ErrorMessageListUtils.add(downloadResult.getErrorMessage(), delegateExecution); } + + logger.debug("Completed resource download and measured speed."); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java index 59bd15af..6144b82a 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java @@ -8,14 +8,13 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class EstimateCleanupTimerDuration extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(EstimateCleanupTimerDuration.class); - public EstimateCleanupTimerDuration(ProcessPluginApi api) { super(api); @@ -24,6 +23,9 @@ public EstimateCleanupTimerDuration(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(EstimateCleanupTimerDuration.class, variables.getStartTask()); + + logger.debug("Estimating cleanup timer duration..."); final long minTimerDurationMillis = 20000; long downloadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); @@ -34,6 +36,6 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable String cleanUpTimerDuration = Duration.ofMillis(timerDurationMillis).toString(); variables.setString("cleanupTimerDuration", cleanUpTimerDuration); - logger.info("Estimated cleanup timer duration as {}", cleanUpTimerDuration); + logger.debug("Estimated cleanup timer duration as {}", cleanUpTimerDuration); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 2be9744b..0fc752be 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -5,14 +5,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveAndStoreError extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(LogAndSaveAndStoreError.class); - public LogAndSaveAndStoreError(ProcessPluginApi api) { super(api); @@ -21,6 +20,8 @@ public LogAndSaveAndStoreError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - logger.info("Logging and saving and storing error"); + PingPongLogger logger = new PingPongLogger(LogAndSaveAndStoreError.class, variables.getStartTask()); + + logger.debug("Logging and saving and storing error"); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java index 9a4a3e23..d7a8dc77 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java @@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -17,8 +18,6 @@ public class LogAndStoreSendError extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(LogAndStoreSendError.class); - public LogAndStoreSendError(ProcessPluginApi api) { super(api); @@ -27,6 +26,8 @@ public LogAndStoreSendError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(LogAndSaveAndStoreError.class, variables.getStartTask()); + String statusCode = variables.getString(ConstantsPing.getBpmnExecutionVariableStatusCode()); String errorMessage = variables.getString(ConstantsPing.getBpmnExecutionVariableErrorMessage()); Target target = variables.getTarget(); diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogPing.java b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java index cc712063..95c5e222 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogPing.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java @@ -9,14 +9,13 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class LogPing extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(LogPing.class); - public LogPing(ProcessPluginApi api) { super(api); @@ -25,6 +24,8 @@ public LogPing(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(LogPing.class, variables.getStartTask()); + Task task = variables.getLatestTask(); logger.info("PING from {} (endpoint: {})", task.getRequester().getIdentifier().getValue(), diff --git a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java index 76e50506..efd40d45 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java @@ -3,11 +3,11 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.service.ping.SelectPingTargets; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; @@ -15,8 +15,6 @@ public class SelectPongTarget extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(SelectPongTarget.class); - public SelectPongTarget(ProcessPluginApi api) { super(api); @@ -25,6 +23,9 @@ public SelectPongTarget(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(SelectPingTargets.class, variables.getStartTask()); + logger.debug("Selecting pong targets..."); + Task task = variables.getStartTask(); String correlationKey = api.getTaskHelper() @@ -44,5 +45,6 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw variables.setTarget(variables.createTarget(targetOrganizationIdentifierValue, targetEndpointIdentifierValue, targetEndpointAddress, correlationKey)); + logger.debug("Selected pong targets."); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java index 0d9609cf..e2673630 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java @@ -7,6 +7,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -21,10 +22,15 @@ public SetEndpointIdentifier(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { + PingPongLogger logger = new PingPongLogger(SetEndpointIdentifier.class, variables.getStartTask()); + logger.debug("Setting endpoint identifier..."); + Task task = variables.getStartTask(); String endpointIdentifierValue = getEndpointIdentifierValue(task); variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER, endpointIdentifierValue); + + logger.debug("Set endpoint identifier to " + endpointIdentifierValue); } private String getEndpointIdentifierValue(Task task) diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 40bf5f0d..4ff0d7fc 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -8,6 +8,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -29,6 +30,8 @@ public StoreDownloadSpeed(ProcessPluginApi api, String networkSpeedUnit) protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { Task startTask = variables.getStartTask(); + PingPongLogger logger = new PingPongLogger(StoreDownloadSpeed.class, startTask); + logger.debug("Storing download speed..."); int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); long downloadedDurationMillis = variables @@ -42,5 +45,6 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingStatusGenerator.updateStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); variables.updateTask(startTask); + logger.debug("Stored download speed: " + downloadSpeed + " " + networkSpeedUnit); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index 04b9af0e..8d18926c 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -21,7 +22,6 @@ public class StoreUploadSpeed extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(StoreUploadSpeed.class); private final String networkSpeedUnit; public StoreUploadSpeed(ProcessPluginApi api, String networkSpeedUnit) @@ -35,6 +35,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { Task startTask = variables.getStartTask(); Task cleanup = variables.getLatestTask(); + PingPongLogger logger = new PingPongLogger(LogPing.class, startTask); + logger.debug("Storing upload speed..."); Optional<IntegerType> uploadedBytesTaskInput = getUploadedBytes(cleanup); Optional<DecimalType> uploadedDurationMillisTaskInput = getUploadedDurationMillis(cleanup); @@ -48,6 +50,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable PingStatusGenerator.updateStatusOutputUploadSpeed(startTask, uploadSpeed, networkSpeedUnit); variables.updateTask(startTask); + logger.debug("Stored upload speed: " + uploadSpeed + " " + networkSpeedUnit); } private Optional<IntegerType> getUploadedBytes(Task task) diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index f346e260..7bea256b 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -1,22 +1,25 @@ package dev.dsf.bpe.util; -import java.io.EOFException; import java.io.IOException; import java.io.InputStream; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Variables; public class BinaryResourceDownloader { - private static final Logger logger = LoggerFactory.getLogger(BinaryResourceDownloader.class); + private final PingPongLogger logger; + + public BinaryResourceDownloader(PingPongLogger logger) + { + this.logger = logger; + } public DownloadResult download(Variables variables, ProcessPluginApi api, Task task, int maxDownloadSizeBytes) { @@ -40,7 +43,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t try (binaryResourceInputStream) { logger.info( - "Starting resource download for: '{}'. Requested resource size is {} bytes, maximum downloadable size is {} bytes", + "Downloading resource for: '{}'. Requested resource size is {} bytes, maximum downloadable size is {} bytes...", downloadResourceReference.getReference(), downloadResourceSizeBytes, maxDownloadSizeBytes); long downloadStartTime = System.currentTimeMillis(); int numBytes = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); @@ -54,6 +57,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t } catch (IOException e) { + logger.error("Encountered an error while downloading resource: {}", e.getMessage()); downloadResult = new DownloadResult(e.getMessage()); } return downloadResult; diff --git a/src/main/java/dev/dsf/bpe/util/logging/PingPongLogger.java b/src/main/java/dev/dsf/bpe/util/logging/PingPongLogger.java new file mode 100644 index 00000000..e7cf5cdb --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/logging/PingPongLogger.java @@ -0,0 +1,42 @@ +package dev.dsf.bpe.util.logging; + +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PingPongLogger +{ + private final Logger logger; + private Task task; + + public PingPongLogger(Class<?> clazz, Task task) + { + this.logger = LoggerFactory.getLogger(clazz); + this.task = task; + } + + public void info(String message, Object... args) + { + logger.info(prependProcessInfo(message), args); + } + + public void warn(String message, Object... args) + { + logger.warn(prependProcessInfo(message), args); + } + + public void error(String message, Object... args) + { + logger.error(prependProcessInfo(message), args); + } + + public void debug(String message, Object... args) + { + logger.debug(prependProcessInfo(message), args); + } + + private String prependProcessInfo(String message) + { + return "Process for Task " + task.getIdElement().getValue() + ": " + message; + } +} From b3d8f9c648d0df8cddd83c843d699d7b9bd73443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 17:53:26 +0100 Subject: [PATCH 240/382] Ran format-and-sort --- .../ping/DownloadResourceAndMeasureSpeedInSubProcess.java | 7 ++++--- .../dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java | 3 ++- .../bpe/service/pong/DownloadResourceAndMeasureSpeed.java | 4 ++-- .../util/task/output/generator/PingStatusGenerator.java | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 3b894fd9..7b947790 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -29,15 +29,16 @@ public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api, int max @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - PingPongLogger logger = new PingPongLogger(DownloadResourceAndMeasureSpeedInSubProcess.class, variables.getStartTask()); + PingPongLogger logger = new PingPongLogger(DownloadResourceAndMeasureSpeedInSubProcess.class, + variables.getStartTask()); logger.debug("Starting resource download to measure speed..."); Task task = variables.getLatestTask(); Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger).download(variables, api, - task, maxDownloadSizeBytes); + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger) + .download(variables, api, task, maxDownloadSizeBytes); if (downloadResult.getErrorMessage() == null) { diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java index 7ec78e3c..360fab6b 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java @@ -33,6 +33,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING); - logger.debug("Saved '{}' to process execution for correlation key '{}'", ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING, correlationKey); + logger.debug("Saved '{}' to process execution for correlation key '{}'", + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING, correlationKey); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index fe2b87b9..b793a08b 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -32,8 +32,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task task = variables.getStartTask(); - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger).download(variables, api, - task, maxDownloadSizeBytes); + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger) + .download(variables, api, task, maxDownloadSizeBytes); if (downloadResult.getErrorMessage() == null) { diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index d630482c..0d23494d 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -636,7 +636,8 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outputComponent) { List<Extension> pingStatusExtensions = outputComponent.getExtension().stream() - .filter(extension -> appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS).equals(extension.getUrl())) + .filter(extension -> appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS) + .equals(extension.getUrl())) .toList(); Extension extension; if (pingStatusExtensions.isEmpty()) From c7ea3ee49cb8297c353f5abdf49841cdf3f0f743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 18 Mar 2025 17:55:25 +0100 Subject: [PATCH 241/382] Removed unused imports --- .../dev/dsf/bpe/listener/SetCorrelationKeyListener.java | 2 -- src/main/java/dev/dsf/bpe/message/SendPong.java | 2 -- src/main/java/dev/dsf/bpe/service/Cleanup.java | 3 --- src/main/java/dev/dsf/bpe/service/GenerateResource.java | 6 ------ .../java/dev/dsf/bpe/service/SetDownloadResourceSize.java | 1 - src/main/java/dev/dsf/bpe/service/StoreResource.java | 3 --- .../ping/DownloadResourceAndMeasureSpeedInSubProcess.java | 3 --- src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java | 2 -- .../java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java | 2 -- .../java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java | 3 --- src/main/java/dev/dsf/bpe/service/ping/SavePong.java | 2 -- .../java/dev/dsf/bpe/service/ping/SelectPingTargets.java | 2 -- src/main/java/dev/dsf/bpe/service/ping/StoreResults.java | 2 -- .../bpe/service/pong/DownloadResourceAndMeasureSpeed.java | 2 -- .../dsf/bpe/service/pong/EstimateCleanupTimerDuration.java | 2 -- .../dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java | 2 -- .../java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java | 2 -- src/main/java/dev/dsf/bpe/service/pong/LogPing.java | 2 -- .../java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java | 2 -- .../java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java | 2 -- src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java | 1 - 21 files changed, 48 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java b/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java index c74b9813..ec487ac1 100644 --- a/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java +++ b/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java @@ -4,8 +4,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.ExecutionListener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index a60b2b74..0eb05e6e 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -6,8 +6,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.mail.ErrorMailService; diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 048e5dff..064632a0 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -4,11 +4,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.IdType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; diff --git a/src/main/java/dev/dsf/bpe/service/GenerateResource.java b/src/main/java/dev/dsf/bpe/service/GenerateResource.java index fa3bab8a..c2e75838 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateResource.java @@ -2,17 +2,11 @@ import java.util.Base64; import java.util.Random; -import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Binary; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.service.pong.LogPing; -import dev.dsf.bpe.util.ReadAccessTagGenerator; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index fe4512e1..31e5d7c1 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -7,7 +7,6 @@ import org.hl7.fhir.r4.model.IntegerType; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; diff --git a/src/main/java/dev/dsf/bpe/service/StoreResource.java b/src/main/java/dev/dsf/bpe/service/StoreResource.java index 0a1e4275..0b71052a 100644 --- a/src/main/java/dev/dsf/bpe/service/StoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/StoreResource.java @@ -6,11 +6,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.IdType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.util.ReadAccessTagGenerator; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 7b947790..533bee21 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -3,11 +3,8 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index 7aeaee3e..e7e8dfe7 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -2,8 +2,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java index 360fab6b..28f6c6f1 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java @@ -2,8 +2,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index cc6041db..8978ecc0 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -2,15 +2,12 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveSendError extends AbstractServiceDelegate diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 0dc5a14e..bda3e795 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -9,8 +9,6 @@ import org.hl7.fhir.r4.model.PrimitiveType; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.ErrorMessageListUtils; diff --git a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java index 67705339..28563877 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java @@ -22,8 +22,6 @@ import org.hl7.fhir.r4.model.Organization; import org.hl7.fhir.r4.model.Resource; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponentsBuilder; diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index f5e0d31a..56579378 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -8,8 +8,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.ConstantsPing; diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index b793a08b..2d9130ab 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -3,8 +3,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.BinaryResourceDownloader; diff --git a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java index 6144b82a..810a39e0 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java @@ -4,8 +4,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 0fc752be..391fa914 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -2,8 +2,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java index d7a8dc77..74085f6d 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java @@ -5,8 +5,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogPing.java b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java index 95c5e222..54ce1e91 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogPing.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java @@ -5,8 +5,6 @@ import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 4ff0d7fc..3f5a999c 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -1,7 +1,6 @@ package dev.dsf.bpe.service.pong; import java.math.BigDecimal; -import java.util.List; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -13,7 +12,6 @@ import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class StoreDownloadSpeed extends AbstractServiceDelegate diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index 8d18926c..b7bdeaf5 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -9,8 +9,6 @@ import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.PrimitiveType; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java index 40f03805..1aebbc11 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java @@ -1,6 +1,5 @@ package dev.dsf.bpe.util; -import java.util.ArrayList; import java.util.List; import java.util.Vector; From 85a01cbcdcb6c254af6b413a5c763c6b5ce37e44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 09:25:48 +0100 Subject: [PATCH 242/382] Fused GenerateResource and StoreResource because Camunda will persist the generated Binary content between tasks, causing a OutOfMemory exception if the Binary content is too large to be persisted --- ...rce.java => GenerateAndStoreResource.java} | 24 +++++++-- .../dev/dsf/bpe/service/StoreResource.java | 52 ------------------- .../dev/dsf/bpe/spring/config/PingConfig.java | 24 +++------ src/main/resources/bpe/ping.bpmn | 20 ++----- src/main/resources/bpe/pong.bpmn | 18 ++----- 5 files changed, 36 insertions(+), 102 deletions(-) rename src/main/java/dev/dsf/bpe/service/{GenerateResource.java => GenerateAndStoreResource.java} (62%) delete mode 100644 src/main/java/dev/dsf/bpe/service/StoreResource.java diff --git a/src/main/java/dev/dsf/bpe/service/GenerateResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java similarity index 62% rename from src/main/java/dev/dsf/bpe/service/GenerateResource.java rename to src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index c2e75838..0be16358 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -1,10 +1,12 @@ package dev.dsf.bpe.service; +import java.io.ByteArrayInputStream; import java.util.Base64; import java.util.Random; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.IdType; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -12,11 +14,11 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; -public class GenerateResource extends AbstractServiceDelegate +public class GenerateAndStoreResource extends AbstractServiceDelegate { private final int maxUploadSizeBytes; - public GenerateResource(ProcessPluginApi api, int maxUploadSizeBytes) + public GenerateAndStoreResource(ProcessPluginApi api, int maxUploadSizeBytes) { super(api); this.maxUploadSizeBytes = maxUploadSizeBytes; @@ -25,13 +27,23 @@ public GenerateResource(ProcessPluginApi api, int maxUploadSizeBytes) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { - PingPongLogger logger = new PingPongLogger(GenerateResource.class, variables.getStartTask()); + PingPongLogger logger = new PingPongLogger(GenerateAndStoreResource.class, variables.getStartTask()); logger.debug("Generating resource..."); int downloadResourceSizeBytes = getDownloadResourceSize(variables); variables.setByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE, generateRandomBinaryContent(downloadResourceSizeBytes, logger)); logger.debug("Generated resource."); + logger.debug("Storing binary resource for download..."); + + IdType downloadResource = storeBinary( + variables.getByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE)); + + String reference = downloadResource.getValueAsString(); + + variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); + + logger.debug("Stored binary resource for download"); } private byte[] generateRandomBinaryContent(int desiredSizeBytes, PingPongLogger logger) @@ -61,4 +73,10 @@ private int getDownloadResourceSize(Variables variables) { return variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); } + + private IdType storeBinary(byte[] downloadResourceContent) + { + return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn() + .createBinary(new ByteArrayInputStream(downloadResourceContent), ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE, api.getOrganizationProvider().getLocalOrganization().get().getIdElement().getIdPart()); + } } diff --git a/src/main/java/dev/dsf/bpe/service/StoreResource.java b/src/main/java/dev/dsf/bpe/service/StoreResource.java deleted file mode 100644 index 0b71052a..00000000 --- a/src/main/java/dev/dsf/bpe/service/StoreResource.java +++ /dev/null @@ -1,52 +0,0 @@ -package dev.dsf.bpe.service; - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Binary; -import org.hl7.fhir.r4.model.IdType; - -import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ReadAccessTagGenerator; -import dev.dsf.bpe.util.logging.PingPongLogger; -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Variables; - -public class StoreResource extends AbstractServiceDelegate -{ - public StoreResource(ProcessPluginApi api) - { - super(api); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception - { - PingPongLogger logger = new PingPongLogger(StoreResource.class, variables.getStartTask()); - logger.debug("Storing binary resource for download..."); - - IdType downloadResource = storeBinary( - variables.getByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE)); - - String reference = downloadResource.getValueAsString(); - - variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); - - logger.debug("Stored binary resource for download"); - } - - private IdType storeBinary(byte[] downloadResourceContent) - { - Binary downloadResource = new Binary(); - downloadResource.setContent(downloadResourceContent); - downloadResource.setContentType(ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE.toString()); - downloadResource.setId(UUID.randomUUID().toString()); - downloadResource.getMeta() - .addTag(ReadAccessTagGenerator.create(ConstantsPing.CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL)); - - return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn() - .create(downloadResource); - } -} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index c10dacd3..d429ad94 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -15,9 +15,8 @@ import dev.dsf.bpe.message.SendPong; import dev.dsf.bpe.message.SendStartPing; import dev.dsf.bpe.service.Cleanup; -import dev.dsf.bpe.service.GenerateResource; +import dev.dsf.bpe.service.GenerateAndStoreResource; import dev.dsf.bpe.service.SetDownloadResourceSize; -import dev.dsf.bpe.service.StoreResource; import dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer; import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.ping.LogAndSaveError; @@ -146,13 +145,6 @@ public SendPong sendPong() return new SendPong(api, errorLogger()); } - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public StoreResource storeResource() - { - return new StoreResource(api); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public LogAndSaveNoResponse logAndSaveNoResponse() @@ -181,13 +173,6 @@ public DownloadResourceAndMeasureSpeedInSubProcess downloadResourceAndMeasureSpe return new DownloadResourceAndMeasureSpeedInSubProcess(api, (int) maxDownloadSizeBytes); } - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public GenerateResource generateResource() - { - return new GenerateResource(api, (int) maxUploadSizeBytes); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public LogAndStoreSendError logAndStoreSendError() @@ -271,4 +256,11 @@ public LogAndSaveSendError logAndSaveSendError() { return new LogAndSaveSendError(api); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public GenerateAndStoreResource generateAndStoreResource() + { + return new GenerateAndStoreResource(api, (int) maxUploadSizeBytes); + } } diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index c6966a14..dd9373af 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -19,7 +19,7 @@ <bpmn:incoming>Flow_0y9usku</bpmn:incoming> <bpmn:outgoing>Flow_1fjeq2h</bpmn:outgoing> <bpmn:timerEventDefinition id="TimerEventDefinition_1mgy0vi"> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT20S</bpmn:timeDuration> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT200S</bpmn:timeDuration> </bpmn:timerEventDefinition> </bpmn:intermediateCatchEvent> <bpmn:intermediateCatchEvent id="PongCatchEvent" name="Pong" camunda:asyncAfter="true"> @@ -165,11 +165,7 @@ <bpmn:association id="Association_14iteoh" sourceRef="Activity_0vw65a2" targetRef="TextAnnotation_0smygq5" /> <bpmn:association id="Association_0l3n1oc" sourceRef="TextAnnotation_08ic0l2" targetRef="Activity_0h9o9u7" /> </bpmn:subProcess> - <bpmn:serviceTask id="Activity_16rb6hc" name="Store Resource" camunda:class="dev.dsf.bpe.service.StoreResource"> - <bpmn:incoming>Flow_1qz7z39</bpmn:incoming> - <bpmn:outgoing>Flow_0m0hq4h</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0nwtf8o" name="Generate Resource" camunda:class="dev.dsf.bpe.service.GenerateResource"> + <bpmn:serviceTask id="Activity_0nwtf8o" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.GenerateAndStoreResource"> <bpmn:incoming>Flow_152nb9r</bpmn:incoming> <bpmn:outgoing>Flow_1qz7z39</bpmn:outgoing> </bpmn:serviceTask> @@ -185,8 +181,8 @@ <bpmn:incoming>Flow_1du5wys</bpmn:incoming> </bpmn:endEvent> <bpmn:exclusiveGateway id="Gateway_0bifi5h"> - <bpmn:incoming>Flow_0m0hq4h</bpmn:incoming> <bpmn:incoming>Flow_0iuuyo1</bpmn:incoming> + <bpmn:incoming>Flow_1qz7z39</bpmn:incoming> <bpmn:outgoing>Flow_1c15ef2</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:serviceTask id="SelectPingTargets" name="Select Targets" camunda:class="dev.dsf.bpe.service.ping.SelectPingTargets"> @@ -204,8 +200,7 @@ </bpmn:startEvent> <bpmn:sequenceFlow id="Flow_0j92st0" sourceRef="SelectPingTargets" targetRef="SubProcess" /> <bpmn:sequenceFlow id="Flow_1bfs68o" sourceRef="SubProcess" targetRef="Activity_0802w0b" /> - <bpmn:sequenceFlow id="Flow_1qz7z39" sourceRef="Activity_0nwtf8o" targetRef="Activity_16rb6hc" /> - <bpmn:sequenceFlow id="Flow_0m0hq4h" sourceRef="Activity_16rb6hc" targetRef="Gateway_0bifi5h" /> + <bpmn:sequenceFlow id="Flow_1qz7z39" sourceRef="Activity_0nwtf8o" targetRef="Gateway_0bifi5h" /> <bpmn:sequenceFlow id="Flow_152nb9r" sourceRef="Gateway_0xw5i5v" targetRef="Activity_0nwtf8o" /> <bpmn:sequenceFlow id="Flow_0gubpgz" sourceRef="Activity_0802w0b" targetRef="SaveResults" /> <bpmn:sequenceFlow id="Flow_1du5wys" sourceRef="SaveResults" targetRef="EndEvent" /> @@ -429,9 +424,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1780" y="560" /> <di:waypoint x="1780" y="475" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="BPMNShape_06i4ly8" bpmnElement="Activity_16rb6hc"> - <dc:Bounds x="690" y="460" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0fhb8wi" bpmnElement="Activity_0nwtf8o"> <dc:Bounds x="530" y="460" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -496,10 +488,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1ttfs4u" bpmnElement="Flow_1qz7z39"> <di:waypoint x="630" y="500" /> - <di:waypoint x="690" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_172mwqu" bpmnElement="Flow_0m0hq4h"> - <di:waypoint x="790" y="500" /> <di:waypoint x="840" y="500" /> <di:waypoint x="840" y="385" /> </bpmndi:BPMNEdge> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index b1c137e8..f9c5babc 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -87,16 +87,12 @@ <bpmn:incoming>Flow_148beur</bpmn:incoming> <bpmn:outgoing>Flow_0zib7wr</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_04mv5cn" name="Store Resource" camunda:class="dev.dsf.bpe.service.StoreResource"> - <bpmn:incoming>Flow_1w09zt7</bpmn:incoming> - <bpmn:outgoing>Flow_03hviat</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_1m4wavi" name="Generate Resource" camunda:class="dev.dsf.bpe.service.GenerateResource"> + <bpmn:serviceTask id="Activity_1m4wavi" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.GenerateAndStoreResource"> <bpmn:incoming>Flow_0x7t1ii</bpmn:incoming> <bpmn:outgoing>Flow_1w09zt7</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Activity_0xcqxjs" name="Estimate Cleanup Timer Duration" camunda:class="dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration"> - <bpmn:incoming>Flow_03hviat</bpmn:incoming> + <bpmn:incoming>Flow_1w09zt7</bpmn:incoming> <bpmn:outgoing>Flow_0gvrnxd</bpmn:outgoing> </bpmn:serviceTask> <bpmn:boundaryEvent id="Event_0olr5yw" name="Invalid Resource Reference" attachedToRef="Activity_095j2gg"> @@ -129,8 +125,7 @@ <bpmn:sequenceFlow id="Flow_0x7t1ii" sourceRef="Gateway_0fvmtve" targetRef="Activity_1m4wavi" /> <bpmn:sequenceFlow id="Flow_0uj7rm3" sourceRef="Event_0olr5yw" targetRef="Activity_1umihbr" /> <bpmn:sequenceFlow id="Flow_0yr2pmf" sourceRef="SelectPongTargetErrorBoundaryEvent" targetRef="Event_1qh25on" /> - <bpmn:sequenceFlow id="Flow_1w09zt7" sourceRef="Activity_1m4wavi" targetRef="Activity_04mv5cn" /> - <bpmn:sequenceFlow id="Flow_03hviat" sourceRef="Activity_04mv5cn" targetRef="Activity_0xcqxjs" /> + <bpmn:sequenceFlow id="Flow_1w09zt7" sourceRef="Activity_1m4wavi" targetRef="Activity_0xcqxjs" /> <bpmn:serviceTask id="Activity_1wdftvk" name="Set Download Resource Size" camunda:class="dev.dsf.bpe.service.SetDownloadResourceSize"> <bpmn:incoming>Flow_19b3cp4</bpmn:incoming> <bpmn:outgoing>Flow_1oo1n55</bpmn:outgoing> @@ -269,9 +264,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> <dc:Bounds x="2660" y="270" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1ouj7x3_di" bpmnElement="Activity_04mv5cn"> - <dc:Bounds x="1250" y="420" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1m4wavi_di" bpmnElement="Activity_1m4wavi"> <dc:Bounds x="1090" y="420" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -413,10 +405,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> <di:waypoint x="1190" y="460" /> - <di:waypoint x="1250" y="460" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_03hviat_di" bpmnElement="Flow_03hviat"> - <di:waypoint x="1350" y="460" /> <di:waypoint x="1410" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> From 3520065bc0bd2e863724a99794da8c10f09fc656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 09:27:01 +0100 Subject: [PATCH 243/382] maxDownloadSizeBytes and maxUploadSizeBytes are now integers because they were treated as such in the code anyways --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index d429ad94..1b2a55f4 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -53,12 +53,12 @@ public class PingConfig @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.", processNames = "dsfdev_ping, dsfdev_pong") @Value("${dev.dsf.bpe.ping.maxDownloadSizeBytes:10000000}") - private long maxDownloadSizeBytes; + private int maxDownloadSizeBytes; @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.", processNames = { "dsfdev_ping", "dsfdev_pong" }) @Value("${dev.dsf.bpe.ping.maxUploadSizeBytes:10000000}") - private long maxUploadSizeBytes; + private int maxUploadSizeBytes; @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values be: \"bits-per-second\", \"bytes-per-second\", \"megabits-per-second\", \"megabytes-per-second\". Default is \"megabytes-per-second\".", processNames = { "dsfdev_ping", "dsfdev_pong" }) @@ -219,7 +219,7 @@ public EstimateCleanupTimerDuration estimateCleanupTimerDuration() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SetDownloadResourceSize setDownloadResourceSize() { - return new SetDownloadResourceSize(api, (int) maxDownloadSizeBytes); + return new SetDownloadResourceSize(api, maxDownloadSizeBytes); } @Bean @@ -261,6 +261,6 @@ public LogAndSaveSendError logAndSaveSendError() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public GenerateAndStoreResource generateAndStoreResource() { - return new GenerateAndStoreResource(api, (int) maxUploadSizeBytes); + return new GenerateAndStoreResource(api, maxUploadSizeBytes); } } From 2ed80095a39f8a77e7c20e7ae4907e3d50b48680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 09:32:52 +0100 Subject: [PATCH 244/382] Removed description on error events as that is not the only reason for the error and I don't know all error that might occur --- src/main/resources/bpe/ping.bpmn | 2 +- src/main/resources/bpe/pong.bpmn | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index dd9373af..09f15278 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -113,7 +113,7 @@ </bpmn:extensionElements> <bpmn:incoming>Flow_03nx6rk</bpmn:incoming> </bpmn:endEvent> - <bpmn:boundaryEvent id="Event_0i4slcz" name="Invalid Resource Reference" attachedToRef="Activity_0h9o9u7"> + <bpmn:boundaryEvent id="Event_0i4slcz" attachedToRef="Activity_0h9o9u7"> <bpmn:outgoing>Flow_10h6pqh</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_0f1pn8k" errorRef="Error_1jmenbm" /> </bpmn:boundaryEvent> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index f9c5babc..e8486bba 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -95,7 +95,7 @@ <bpmn:incoming>Flow_1w09zt7</bpmn:incoming> <bpmn:outgoing>Flow_0gvrnxd</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:boundaryEvent id="Event_0olr5yw" name="Invalid Resource Reference" attachedToRef="Activity_095j2gg"> + <bpmn:boundaryEvent id="Event_0olr5yw" attachedToRef="Activity_095j2gg"> <bpmn:outgoing>Flow_0uj7rm3</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_0h8zmzk" errorRef="Error_1jmenbm" /> </bpmn:boundaryEvent> From a4e55efb9dab520799e7daca22601dafbcea1bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 12:03:12 +0100 Subject: [PATCH 245/382] Updated to include methods to update the error list in the status output. Also updated existing methods to differentiate between ping and pong processes when updating a task because methods invoked in the ping process always need to update a status output corresponding to a certain correlation key --- .../output/generator/PingStatusGenerator.java | 199 ++++++++++++++++-- 1 file changed, 186 insertions(+), 13 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 0d23494d..d70ffa69 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; import org.hl7.fhir.r4.model.Coding; @@ -23,10 +24,79 @@ public class PingStatusGenerator { - public static Task updatePingStatusOutput(Task task, String statusCode) + public static Task updatePingStatusOutput(Task task, String correlationKey, List<String> errorMessages) { - List<Task.TaskOutputComponent> pingStatusOutputs = getOutputsByCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS); + List<TaskOutputComponent> outputs = filterByCorrelationKey( + getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + + if (outputs.isEmpty()) + { + task.addOutput(updateStatusOutput(new TaskOutputComponent(), errorMessages)); + } else + { + if (outputs.size() == 1) + { + updateStatusOutput(outputs.get(0), errorMessages); + } + else + { + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + " with correlation key " + correlationKey); + } + } + return task; + } + + public static Task updatePongStatusOutput(Task task, List<String> errorMessages) + { + List<Task.TaskOutputComponent> pongStatusOutputs = getOutputsByCodes(task, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + if (pongStatusOutputs.isEmpty()) + { + task.addOutput(updateStatusOutput(new TaskOutputComponent(), errorMessages)); + } + else + { + if (pongStatusOutputs.size() == 1) + { + updateStatusOutput(pongStatusOutputs.get(0), errorMessages); + } + else + { + throw new RuntimeException("There is more than one pong status output for task " + task.getId()); + } + } + + return task; + } + + public static TaskOutputComponent updateStatusOutput(TaskOutputComponent output, List<String> errorMessages) + { + if (output != null) + { + Extension pingStatusExtension = getOrCreatePingStatusExtension(output); + List<Extension> errorMessageExtensions = pingStatusExtension.getExtension().stream().filter(extension -> ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension.getUrl())).toList(); + if(errorMessageExtensions.isEmpty()) + { + addErrorMessages(output, errorMessages); + } else { + Set<String> existingErrors = errorMessageExtensions.stream().map(extension -> ((StringType) extension.getValue()).getValue()).collect( + Collectors.toSet()); + existingErrors.addAll(errorMessages); + List<Extension> nonErrorMessageExtensions = pingStatusExtension.getExtension().stream().filter(extension -> !ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension.getUrl())).toList(); + List<Extension> updatedErrorMessageExtensions = existingErrors.stream().map(errorMessage -> new Extension().setUrl(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE) + .setValue(new StringType(errorMessage))).collect(Collectors.toCollection(ArrayList::new)); + updatedErrorMessageExtensions.addAll(nonErrorMessageExtensions); + pingStatusExtension.setExtension(updatedErrorMessageExtensions); + } + } + + return output; + } + + public static Task updatePingStatusOutput(Task task, String correlationKey, String statusCode) + { + List<Task.TaskOutputComponent> pingStatusOutputs = filterByCorrelationKey(getOutputsByCodes(task, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); if (pingStatusOutputs.isEmpty()) { task.addOutput(updatePingStatusOutput(new TaskOutputComponent(), statusCode)); @@ -39,7 +109,7 @@ public static Task updatePingStatusOutput(Task task, String statusCode) } else { - throw new RuntimeException("There is more than one ping status output for task " + task.getId()); + throw new RuntimeException("There is more than one ping status output for task " + task.getId() + " with correlation key " + correlationKey); } } @@ -97,10 +167,29 @@ public static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent out return outputComponent; } - public static Task updateStatusOutput(Task task, Target target) + public static Task updatePingStatusOutput(Task task, Target target) + { + List<Task.TaskOutputComponent> outputs = filterByCorrelationKey(getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), target.getCorrelationKey()); + if (outputs.isEmpty()) + { + task.addOutput(updateStatusOutput(new TaskOutputComponent(), target)); + } else + { + if (outputs.size() == 1) + { + updateStatusOutput(outputs.get(0), target); + } + else + { + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + " with correlation key " + target.getCorrelationKey()); + } + } + return task; + } + + public static Task updatePongStatusOutput(Task task, Target target) { List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { @@ -114,7 +203,7 @@ public static Task updateStatusOutput(Task task, Target target) } else { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId()); + throw new RuntimeException("There is more than one pong status output for task " + task.getId()); } } @@ -134,11 +223,31 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputC return outputComponent; } - public static Task updateStatusOutput(Task task, BigDecimal downloadSpeed, BigDecimal uploadSpeed, + public static Task updatePingStatusOutput(Task task, String correlationKey, BigDecimal downloadSpeed, BigDecimal uploadSpeed, + String statusCode) + { + List<Task.TaskOutputComponent> outputs = filterByCorrelationKey(getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + if (outputs.isEmpty()) + { + task.addOutput(updateStatusOutput(new TaskOutputComponent(), downloadSpeed, uploadSpeed, statusCode)); + } else + { + if (outputs.size() == 1) + { + updateStatusOutput(outputs.get(0), downloadSpeed, uploadSpeed, statusCode); + } + else + { + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + " with correlation key " + correlationKey); + } + } + return task; + } + + public static Task updatePongStatusOutput(Task task, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String statusCode) { List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { @@ -183,10 +292,29 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputC return outputComponent; } - public static Task updateStatusOutputDownloadSpeed(Task task, BigDecimal downloadSpeed, String networkSpeedUnit) + public static Task updatePingStatusOutputDownloadSpeed(Task task, String correlationKey, BigDecimal downloadSpeed, String networkSpeedUnit) + { + List<Task.TaskOutputComponent> outputs = filterByCorrelationKey(getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + if (outputs.isEmpty()) + { + task.addOutput(updateStatusOutputDownloadSpeed(new TaskOutputComponent(), downloadSpeed, networkSpeedUnit)); + } else + { + if (outputs.size() == 1) + { + updateStatusOutputDownloadSpeed(outputs.get(0), downloadSpeed, networkSpeedUnit); + } + else + { + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + " with correlation key " + correlationKey); + } + } + return task; + } + + public static Task updatePongStatusOutputDownloadSpeed(Task task, BigDecimal downloadSpeed, String networkSpeedUnit) { List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { @@ -222,10 +350,32 @@ public static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComp return outputComponent; } - public static Task updateStatusOutputUploadSpeed(Task task, BigDecimal uploadSpeed, String networkSpeedUnit) + public static Task updatePingStatusOutputUploadSpeed(Task task, String correlationKey, BigDecimal uploadSpeed, String networkSpeedUnit) + { + List<Task.TaskOutputComponent> outputs = filterByCorrelationKey(getOutputsByCodes(task, + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + if (outputs.isEmpty()) + { + task.addOutput(updateStatusOutputUploadSpeed(new TaskOutputComponent(), uploadSpeed, networkSpeedUnit)); + } + else + { + if (outputs.size() == 1) + { + updateStatusOutputUploadSpeed(outputs.get(0), uploadSpeed, networkSpeedUnit); + } + else + { + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + " with correlation key " + correlationKey); + } + } + + return task; + } + + public static Task updatePongStatusOutputUploadSpeed(Task task, BigDecimal uploadSpeed, String networkSpeedUnit) { List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { @@ -668,4 +818,27 @@ private static List<Task.TaskOutputComponent> getOutputsByCodes(Task task, Strin && Arrays.stream(codes).anyMatch(code -> code.equals(coding.getCode())))) .collect(Collectors.toCollection(ArrayList::new)); } + + private static List<Task.TaskOutputComponent> filterByCorrelationKey(List<TaskOutputComponent> outputs, String correlationKey) + { + return outputs.stream().filter(outputComponent -> { + List<Extension> outputExtensions = outputComponent.getExtension(); + if (outputExtensions.isEmpty()) return false; + List<Extension> pingStatusExtensions = outputExtensions.stream().filter(extension -> ConstantsPing.EXTENSION_URL_PING_STATUS.equals(extension.getUrl())).toList(); + if (pingStatusExtensions.isEmpty()) return false; + List<Extension> extensionsMatchingCorrelationKey = pingStatusExtensions.stream() + .filter(extension -> extension.getExtension().stream() + .anyMatch(extension1 -> ConstantsPing.EXTENSION_URL_CORRELATION_KEY.equals(extension1.getUrl()) + && correlationKey.equals(((StringType) extension1.getValue()).getValue()))) + .toList(); + if (extensionsMatchingCorrelationKey.isEmpty()) return false; + if (extensionsMatchingCorrelationKey.size() == 1) + { + return true; + } else + { + throw new RuntimeException("Only one Task.output.extension.extension with correlationKey is allowed but found " + extensionsMatchingCorrelationKey.size()); + } + }).collect(Collectors.toCollection(ArrayList::new)); + } } From 2d496cd89b7777c36677579de34cdde8037983f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 12:51:48 +0100 Subject: [PATCH 246/382] Fixed all error messages appearing on all ping status outputs --- src/main/java/dev/dsf/bpe/service/ping/SavePong.java | 2 +- src/main/java/dev/dsf/bpe/service/ping/StoreResults.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index bda3e795..90f53e40 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -54,7 +54,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable .getInputParameterValues(pong, ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE, StringType.class) .map(PrimitiveType::getValue).toList(); - ErrorMessageListUtils.addAll(errorList, delegateExecution); + ErrorMessageListUtils.addAll(errorList, delegateExecution, correlationKey); logger.debug("Saved pong information."); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 56579378..9259e68e 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -60,7 +60,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode) || ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statusCode)) { - List<String> errorMessages = ErrorMessageListUtils.getErrorMessageList(execution); + List<String> errorMessages = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); String errorMessage = errorMessages.get(0); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessages)); @@ -71,7 +71,7 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statu } else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(statusCode)) { - List<String> errorMessages = ErrorMessageListUtils.getErrorMessageList(execution); + List<String> errorMessages = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessages)); errorMailService.pongMessageNotReceived(task.getIdElement(), target); @@ -80,7 +80,7 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(stat { int downloadResourceSizeBytes = variables .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); - List<String> errorMessageList = ErrorMessageListUtils.getErrorMessageList(execution); + List<String> errorMessageList = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); if (downloadResourceSizeBytes >= 0) // if fat-ping { int downloadedBytes = variables From 5d2bd0fe6dd72375422bdd03e39166962a8a8c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 12:52:40 +0100 Subject: [PATCH 247/382] Adopted changes to PingStatusGenerator --- src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java | 2 +- src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 3f5a999c..afc3d91d 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -40,7 +40,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_RESOURCE_DOWNLOADED); - PingStatusGenerator.updateStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); + PingStatusGenerator.updatePongStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); variables.updateTask(startTask); logger.debug("Stored download speed: " + downloadSpeed + " " + networkSpeedUnit); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index b7bdeaf5..e38b4d8f 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -45,7 +45,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit); - PingStatusGenerator.updateStatusOutputUploadSpeed(startTask, uploadSpeed, networkSpeedUnit); + PingStatusGenerator.updatePongStatusOutputUploadSpeed(startTask, uploadSpeed, networkSpeedUnit); variables.updateTask(startTask); logger.debug("Stored upload speed: " + uploadSpeed + " " + networkSpeedUnit); From f8a3d80d7bb7cdcddaf94f2776f0bf7c151d3229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 12:54:40 +0100 Subject: [PATCH 248/382] Now has the option to store an access a correlation key specific error message list. This was needed because error messages in ping process belong to one specific instance/target which is identified by the correlation key --- .../bpe/service/ping/LogAndSaveSendError.java | 2 +- .../dsf/bpe/util/ErrorMessageListUtils.java | 42 ++++++++++++++++--- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 8978ecc0..11e7ec12 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -27,7 +27,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw String errorMessage = (String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableErrorMessage()); variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); - ErrorMessageListUtils.add(errorMessage, execution); + ErrorMessageListUtils.add(errorMessage, execution, correlationKey); variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0); variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); logger.debug("Saved error when trying to send ping message. Status: {}, error message: {}", statusCode, diff --git a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java index 1aebbc11..eff5f8d5 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java @@ -18,20 +18,52 @@ public static List<String> addAll(List<String> errors, DelegateExecution executi return errorList; } + public static List<String> addAll(List<String> errors, DelegateExecution execution, String correlationKey) + { + List<String> errorList = correlationKey != null ? getErrorMessageList(execution, correlationKey) : getErrorMessageList(execution); + if (errors == null) + return errorList; + errorList.addAll(errors); + return errorList; + } + public static List<String> add(String error, DelegateExecution execution) { - return add(error, ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, execution); + return add(error, execution, null); + } + + public static List<String> add(String error, DelegateExecution execution, String correlationKey) + { + if (correlationKey != null) + { + return add(error, ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), execution); + } else + { + return add(error, ConstantsPing.getBpmnExecutionVariableErrorMessageList(), execution); + } } - @SuppressWarnings("unchecked") public static List<String> getErrorMessageList(DelegateExecution execution) { - List<String> errorMessages = (List<String>) execution - .getVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST); + return getErrorMessageList(execution, null); + } + + @SuppressWarnings("unchecked") + public static List<String> getErrorMessageList(DelegateExecution execution, String correlationKey) + { + List<String> errorMessages = correlationKey != null ?(List<String>) execution + .getVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey)) :(List<String>) execution + .getVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList()); if (errorMessages == null) { errorMessages = new Vector<>(); - execution.setVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST, errorMessages); + if (correlationKey != null) + { + execution.setVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), errorMessages); + } else + { + execution.setVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(), errorMessages); + } } return errorMessages; } From befed56de349033ca804bf0dc3eadf497f41b3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 13:09:06 +0100 Subject: [PATCH 249/382] Adopted changes to PingStatusGenerator and now updates status with error messages --- src/main/java/dev/dsf/bpe/message/SendPong.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 0eb05e6e..4a2cec30 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -77,17 +77,18 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw super.doExecute(execution, variables); Task mainTask = variables.getStartTask(); - PingStatusGenerator.updateStatusOutput(mainTask, target); + PingStatusGenerator.updatePongStatusOutput(mainTask, target); PingStatusGenerator.updatePongStatusOutput(mainTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT); variables.updateTask(mainTask); } @Override - protected void handleIntermediateThrowEventError(DelegateExecution execution, Variables variables, + protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, String errorMessage) { PingPongLogger logger = new PingPongLogger(SendPong.class, variables.getStartTask()); Target target = variables.getTarget(); + Task startTask = variables.getStartTask(); String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() @@ -96,7 +97,9 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va execution.setVariable(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); String specialErrorMessage = createErrorMessage(exception); - execution.setVariable(ConstantsPing.getBpmnExecutionVariableErrorMessage(), specialErrorMessage); + ErrorMessageListUtils.add(specialErrorMessage, execution); + PingStatusGenerator.updatePongStatusOutput(startTask, ErrorMessageListUtils.getErrorMessageList(execution)); + variables.updateTask(startTask); logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); } From f8fc853f15902c733239467b95e663845adacf11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 13:16:01 +0100 Subject: [PATCH 250/382] DownloadResourceAndMeasureSpeed and DownloadResourceAndMeasureSpeedInSubProcess now throw BpmnErrors like the bpmn diagrams suggest. Errors get handled in LogAndSaveError and LogAndSaveAndStoreError respectively. Also renamed the error codes in bpmn files and added them to ConstantsPing --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 15 ++++++++++++++- ...wnloadResourceAndMeasureSpeedInSubProcess.java | 2 +- .../dev/dsf/bpe/service/ping/LogAndSaveError.java | 9 ++++++++- .../pong/DownloadResourceAndMeasureSpeed.java | 2 +- .../bpe/service/pong/LogAndSaveAndStoreError.java | 14 +++++++++++++- src/main/resources/bpe/ping.bpmn | 4 ++-- src/main/resources/bpe/pong.bpmn | 4 ++-- 7 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index b576c629..384e0321 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -96,12 +96,15 @@ private ConstantsPing() public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; private static final String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; private static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE = "errorMessage"; - public static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; + private static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; private static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; private static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; public static final String BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER = "targetEndpointIdentifier"; private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_BYTES = "uploadedBytes"; private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS = "uploadedDurationMillis"; + public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE = "resourceDownloadErrorMessage"; + + public static final String BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR = "resourceDownloadError"; public static final int DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT = 10000000; @@ -168,4 +171,14 @@ public static String getBpmnExecutionVariableUploadedDurationMillis(String corre { return BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS + "_" + correlationKey; } + + public static String getBpmnExecutionVariableErrorMessageList() + { + return BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST; + } + + public static String getBpmnExecutionVariableErrorMessageList(String correlationKey) + { + return getBpmnExecutionVariableErrorMessageList() + "_" + correlationKey; + } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 533bee21..f76837a6 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -46,7 +46,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } else { - ErrorMessageListUtils.add(downloadResult.getErrorMessage(), delegateExecution); + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, downloadResult.getErrorMessage()); } logger.debug("Completed resource download and measured speed."); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index e7e8dfe7..e664d97b 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -3,9 +3,12 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveError extends AbstractServiceDelegate @@ -19,7 +22,11 @@ public LogAndSaveError(ProcessPluginApi api) protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { PingPongLogger logger = new PingPongLogger(LogAndSaveError.class, variables.getStartTask()); + Target target = variables.getTarget(); - logger.info("Logging and saving error"); + String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE); + ErrorMessageListUtils.add(errorMessage, delegateExecution, target.getCorrelationKey()); + + logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), errorMessage); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 2d9130ab..d9d55135 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -42,7 +42,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } else { - ErrorMessageListUtils.add(downloadResult.getErrorMessage(), delegateExecution); + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, downloadResult.getErrorMessage()); } logger.debug("Completed resource download and measured speed."); diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 391fa914..09eab3ba 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -2,10 +2,15 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveAndStoreError extends AbstractServiceDelegate @@ -19,7 +24,14 @@ public LogAndSaveAndStoreError(ProcessPluginApi api) protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { PingPongLogger logger = new PingPongLogger(LogAndSaveAndStoreError.class, variables.getStartTask()); + Target target = variables.getTarget(); + Task startTask = variables.getStartTask(); - logger.debug("Logging and saving and storing error"); + String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE); + ErrorMessageListUtils.add(errorMessage, delegateExecution); + PingStatusGenerator.updatePongStatusOutput(startTask, ErrorMessageListUtils.getErrorMessageList(delegateExecution)); + variables.updateTask(startTask); + + logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), errorMessage); } } diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 09f15278..473e4434 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -2,7 +2,7 @@ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0abzurc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.17.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.20.0"> <bpmn:message id="Message_1pklz6t" name="startPing" /> <bpmn:message id="Message_10o3b8y" name="pong" /> - <bpmn:error id="Error_1jmenbm" name="invalid_resource_refernece" errorCode="invalid_resource_refernece" /> + <bpmn:error id="Error_1jmenbm" name="resourceDownloadError" errorCode="resourceDownloadError" /> <bpmn:process id="dsfdev_ping" isExecutable="true" camunda:versionTag="#{version}" camunda:historyTimeToLive="180"> <bpmn:subProcess id="SubProcess"> <bpmn:incoming>Flow_0j92st0</bpmn:incoming> @@ -115,7 +115,7 @@ </bpmn:endEvent> <bpmn:boundaryEvent id="Event_0i4slcz" attachedToRef="Activity_0h9o9u7"> <bpmn:outgoing>Flow_10h6pqh</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0f1pn8k" errorRef="Error_1jmenbm" /> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0f1pn8k" errorRef="Error_1jmenbm" camunda:errorMessageVariable="resourceDownloadErrorMessage" /> </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_10epxa2" sourceRef="SubProcessStartEvent" targetRef="Activity_0ri6fnv" /> <bpmn:sequenceFlow id="Flow_0y9usku" sourceRef="EventBasedGateway" targetRef="PongTimer" /> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index e8486bba..baa20209 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -97,7 +97,7 @@ </bpmn:serviceTask> <bpmn:boundaryEvent id="Event_0olr5yw" attachedToRef="Activity_095j2gg"> <bpmn:outgoing>Flow_0uj7rm3</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0h8zmzk" errorRef="Error_1jmenbm" /> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0h8zmzk" errorRef="Error_1jmenbm" camunda:errorMessageVariable="resourceDownloadErrorMessage" /> </bpmn:boundaryEvent> <bpmn:boundaryEvent id="SelectPongTargetErrorBoundaryEvent" name="target not allowed" attachedToRef="SelectPongTarget"> <bpmn:outgoing>Flow_0yr2pmf</bpmn:outgoing> @@ -200,7 +200,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmn:process> <bpmn:message id="Message_0u91abp" name="ping" /> <bpmn:message id="Message_2m36ftq" name="cleanupPong" /> - <bpmn:error id="Error_1jmenbm" name="invalid_resource_refernece" errorCode="invalid_resource_refernece" /> + <bpmn:error id="Error_1jmenbm" name="resourceDownloadError" errorCode="resourceDownloadError" /> <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> From 70dcdcb550ca559a34650bd2ee7c197651426bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 13:18:14 +0100 Subject: [PATCH 251/382] Ran format-and-sort --- .../java/dev/dsf/bpe/message/SendPong.java | 4 +- .../bpe/service/GenerateAndStoreResource.java | 5 +- ...adResourceAndMeasureSpeedInSubProcess.java | 3 +- .../dsf/bpe/service/ping/LogAndSaveError.java | 3 +- .../pong/DownloadResourceAndMeasureSpeed.java | 3 +- .../service/pong/LogAndSaveAndStoreError.java | 6 +- .../dsf/bpe/util/ErrorMessageListUtils.java | 19 +-- .../output/generator/PingStatusGenerator.java | 112 +++++++++++------- 8 files changed, 99 insertions(+), 56 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 4a2cec30..a1b6b466 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -83,8 +83,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw } @Override - protected void handleSendTaskError(DelegateExecution execution, Variables variables, - Exception exception, String errorMessage) + protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, + String errorMessage) { PingPongLogger logger = new PingPongLogger(SendPong.class, variables.getStartTask()); Target target = variables.getTarget(); diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 0be16358..b3836960 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -76,7 +76,8 @@ private int getDownloadResourceSize(Variables variables) private IdType storeBinary(byte[] downloadResourceContent) { - return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn() - .createBinary(new ByteArrayInputStream(downloadResourceContent), ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE, api.getOrganizationProvider().getLocalOrganization().get().getIdElement().getIdPart()); + return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().createBinary( + new ByteArrayInputStream(downloadResourceContent), ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE, + api.getOrganizationProvider().getLocalOrganization().get().getIdElement().getIdPart()); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index f76837a6..7277df03 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -46,7 +46,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } else { - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, downloadResult.getErrorMessage()); + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, + downloadResult.getErrorMessage()); } logger.debug("Completed resource download and measured speed."); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index e664d97b..77cd38b0 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -24,7 +24,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable PingPongLogger logger = new PingPongLogger(LogAndSaveError.class, variables.getStartTask()); Target target = variables.getTarget(); - String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE); + String errorMessage = variables + .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE); ErrorMessageListUtils.add(errorMessage, delegateExecution, target.getCorrelationKey()); logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), errorMessage); diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index d9d55135..4cc00447 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -42,7 +42,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } else { - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, downloadResult.getErrorMessage()); + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, + downloadResult.getErrorMessage()); } logger.debug("Completed resource download and measured speed."); diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 09eab3ba..d4734d3c 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -27,9 +27,11 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); Task startTask = variables.getStartTask(); - String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE); + String errorMessage = variables + .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE); ErrorMessageListUtils.add(errorMessage, delegateExecution); - PingStatusGenerator.updatePongStatusOutput(startTask, ErrorMessageListUtils.getErrorMessageList(delegateExecution)); + PingStatusGenerator.updatePongStatusOutput(startTask, + ErrorMessageListUtils.getErrorMessageList(delegateExecution)); variables.updateTask(startTask); logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), errorMessage); diff --git a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java index eff5f8d5..f2857330 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java @@ -20,7 +20,8 @@ public static List<String> addAll(List<String> errors, DelegateExecution executi public static List<String> addAll(List<String> errors, DelegateExecution execution, String correlationKey) { - List<String> errorList = correlationKey != null ? getErrorMessageList(execution, correlationKey) : getErrorMessageList(execution); + List<String> errorList = correlationKey != null ? getErrorMessageList(execution, correlationKey) + : getErrorMessageList(execution); if (errors == null) return errorList; errorList.addAll(errors); @@ -37,7 +38,8 @@ public static List<String> add(String error, DelegateExecution execution, String if (correlationKey != null) { return add(error, ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), execution); - } else + } + else { return add(error, ConstantsPing.getBpmnExecutionVariableErrorMessageList(), execution); } @@ -51,16 +53,19 @@ public static List<String> getErrorMessageList(DelegateExecution execution) @SuppressWarnings("unchecked") public static List<String> getErrorMessageList(DelegateExecution execution, String correlationKey) { - List<String> errorMessages = correlationKey != null ?(List<String>) execution - .getVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey)) :(List<String>) execution - .getVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList()); + List<String> errorMessages = correlationKey != null + ? (List<String>) execution + .getVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey)) + : (List<String>) execution.getVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList()); if (errorMessages == null) { errorMessages = new Vector<>(); if (correlationKey != null) { - execution.setVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), errorMessages); - } else + execution.setVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), + errorMessages); + } + else { execution.setVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(), errorMessages); } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index d70ffa69..22abd80a 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -32,7 +32,8 @@ public static Task updatePingStatusOutput(Task task, String correlationKey, List if (outputs.isEmpty()) { task.addOutput(updateStatusOutput(new TaskOutputComponent(), errorMessages)); - } else + } + else { if (outputs.size() == 1) { @@ -40,7 +41,8 @@ public static Task updatePingStatusOutput(Task task, String correlationKey, List } else { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + " with correlation key " + correlationKey); + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + + " with correlation key " + correlationKey); } } return task; @@ -74,17 +76,24 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent output, if (output != null) { Extension pingStatusExtension = getOrCreatePingStatusExtension(output); - List<Extension> errorMessageExtensions = pingStatusExtension.getExtension().stream().filter(extension -> ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension.getUrl())).toList(); - if(errorMessageExtensions.isEmpty()) + List<Extension> errorMessageExtensions = pingStatusExtension.getExtension().stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension.getUrl())).toList(); + if (errorMessageExtensions.isEmpty()) { addErrorMessages(output, errorMessages); - } else { - Set<String> existingErrors = errorMessageExtensions.stream().map(extension -> ((StringType) extension.getValue()).getValue()).collect( - Collectors.toSet()); + } + else + { + Set<String> existingErrors = errorMessageExtensions.stream() + .map(extension -> ((StringType) extension.getValue()).getValue()).collect(Collectors.toSet()); existingErrors.addAll(errorMessages); - List<Extension> nonErrorMessageExtensions = pingStatusExtension.getExtension().stream().filter(extension -> !ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension.getUrl())).toList(); - List<Extension> updatedErrorMessageExtensions = existingErrors.stream().map(errorMessage -> new Extension().setUrl(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE) - .setValue(new StringType(errorMessage))).collect(Collectors.toCollection(ArrayList::new)); + List<Extension> nonErrorMessageExtensions = pingStatusExtension.getExtension().stream() + .filter(extension -> !ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension.getUrl())) + .toList(); + List<Extension> updatedErrorMessageExtensions = existingErrors.stream() + .map(errorMessage -> new Extension().setUrl(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE) + .setValue(new StringType(errorMessage))) + .collect(Collectors.toCollection(ArrayList::new)); updatedErrorMessageExtensions.addAll(nonErrorMessageExtensions); pingStatusExtension.setExtension(updatedErrorMessageExtensions); } @@ -95,8 +104,8 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent output, public static Task updatePingStatusOutput(Task task, String correlationKey, String statusCode) { - List<Task.TaskOutputComponent> pingStatusOutputs = filterByCorrelationKey(getOutputsByCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + List<Task.TaskOutputComponent> pingStatusOutputs = filterByCorrelationKey( + getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); if (pingStatusOutputs.isEmpty()) { task.addOutput(updatePingStatusOutput(new TaskOutputComponent(), statusCode)); @@ -109,7 +118,8 @@ public static Task updatePingStatusOutput(Task task, String correlationKey, Stri } else { - throw new RuntimeException("There is more than one ping status output for task " + task.getId() + " with correlation key " + correlationKey); + throw new RuntimeException("There is more than one ping status output for task " + task.getId() + + " with correlation key " + correlationKey); } } @@ -169,11 +179,14 @@ public static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent out public static Task updatePingStatusOutput(Task task, Target target) { - List<Task.TaskOutputComponent> outputs = filterByCorrelationKey(getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), target.getCorrelationKey()); + List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( + getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), + target.getCorrelationKey()); if (outputs.isEmpty()) { task.addOutput(updateStatusOutput(new TaskOutputComponent(), target)); - } else + } + else { if (outputs.size() == 1) { @@ -181,7 +194,8 @@ public static Task updatePingStatusOutput(Task task, Target target) } else { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + " with correlation key " + target.getCorrelationKey()); + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + + " with correlation key " + target.getCorrelationKey()); } } return task; @@ -223,14 +237,16 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputC return outputComponent; } - public static Task updatePingStatusOutput(Task task, String correlationKey, BigDecimal downloadSpeed, BigDecimal uploadSpeed, - String statusCode) + public static Task updatePingStatusOutput(Task task, String correlationKey, BigDecimal downloadSpeed, + BigDecimal uploadSpeed, String statusCode) { - List<Task.TaskOutputComponent> outputs = filterByCorrelationKey(getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( + getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); if (outputs.isEmpty()) { task.addOutput(updateStatusOutput(new TaskOutputComponent(), downloadSpeed, uploadSpeed, statusCode)); - } else + } + else { if (outputs.size() == 1) { @@ -238,7 +254,8 @@ public static Task updatePingStatusOutput(Task task, String correlationKey, BigD } else { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + " with correlation key " + correlationKey); + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + + " with correlation key " + correlationKey); } } return task; @@ -292,13 +309,16 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputC return outputComponent; } - public static Task updatePingStatusOutputDownloadSpeed(Task task, String correlationKey, BigDecimal downloadSpeed, String networkSpeedUnit) + public static Task updatePingStatusOutputDownloadSpeed(Task task, String correlationKey, BigDecimal downloadSpeed, + String networkSpeedUnit) { - List<Task.TaskOutputComponent> outputs = filterByCorrelationKey(getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( + getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); if (outputs.isEmpty()) { task.addOutput(updateStatusOutputDownloadSpeed(new TaskOutputComponent(), downloadSpeed, networkSpeedUnit)); - } else + } + else { if (outputs.size() == 1) { @@ -306,7 +326,8 @@ public static Task updatePingStatusOutputDownloadSpeed(Task task, String correla } else { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + " with correlation key " + correlationKey); + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + + " with correlation key " + correlationKey); } } return task; @@ -350,10 +371,11 @@ public static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComp return outputComponent; } - public static Task updatePingStatusOutputUploadSpeed(Task task, String correlationKey, BigDecimal uploadSpeed, String networkSpeedUnit) + public static Task updatePingStatusOutputUploadSpeed(Task task, String correlationKey, BigDecimal uploadSpeed, + String networkSpeedUnit) { - List<Task.TaskOutputComponent> outputs = filterByCorrelationKey(getOutputsByCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( + getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); if (outputs.isEmpty()) { task.addOutput(updateStatusOutputUploadSpeed(new TaskOutputComponent(), uploadSpeed, networkSpeedUnit)); @@ -366,7 +388,8 @@ public static Task updatePingStatusOutputUploadSpeed(Task task, String correlati } else { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + " with correlation key " + correlationKey); + throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() + + " with correlation key " + correlationKey); } } @@ -819,25 +842,34 @@ private static List<Task.TaskOutputComponent> getOutputsByCodes(Task task, Strin .collect(Collectors.toCollection(ArrayList::new)); } - private static List<Task.TaskOutputComponent> filterByCorrelationKey(List<TaskOutputComponent> outputs, String correlationKey) + private static List<Task.TaskOutputComponent> filterByCorrelationKey(List<TaskOutputComponent> outputs, + String correlationKey) { - return outputs.stream().filter(outputComponent -> { + return outputs.stream().filter(outputComponent -> + { List<Extension> outputExtensions = outputComponent.getExtension(); - if (outputExtensions.isEmpty()) return false; - List<Extension> pingStatusExtensions = outputExtensions.stream().filter(extension -> ConstantsPing.EXTENSION_URL_PING_STATUS.equals(extension.getUrl())).toList(); - if (pingStatusExtensions.isEmpty()) return false; + if (outputExtensions.isEmpty()) + return false; + List<Extension> pingStatusExtensions = outputExtensions.stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_PING_STATUS.equals(extension.getUrl())).toList(); + if (pingStatusExtensions.isEmpty()) + return false; List<Extension> extensionsMatchingCorrelationKey = pingStatusExtensions.stream() - .filter(extension -> extension.getExtension().stream() - .anyMatch(extension1 -> ConstantsPing.EXTENSION_URL_CORRELATION_KEY.equals(extension1.getUrl()) - && correlationKey.equals(((StringType) extension1.getValue()).getValue()))) + .filter(extension -> extension.getExtension().stream().anyMatch( + extension1 -> ConstantsPing.EXTENSION_URL_CORRELATION_KEY.equals(extension1.getUrl()) + && correlationKey.equals(((StringType) extension1.getValue()).getValue()))) .toList(); - if (extensionsMatchingCorrelationKey.isEmpty()) return false; + if (extensionsMatchingCorrelationKey.isEmpty()) + return false; if (extensionsMatchingCorrelationKey.size() == 1) { return true; - } else + } + else { - throw new RuntimeException("Only one Task.output.extension.extension with correlationKey is allowed but found " + extensionsMatchingCorrelationKey.size()); + throw new RuntimeException( + "Only one Task.output.extension.extension with correlationKey is allowed but found " + + extensionsMatchingCorrelationKey.size()); } }).collect(Collectors.toCollection(ArrayList::new)); } From 56fdc6315544cf63f2200a682e27fb50d8cede43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 13:31:30 +0100 Subject: [PATCH 252/382] Fixed resource not being stored to local FHIR server because reference was faulty --- src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index b3836960..8ee390cf 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -78,6 +78,6 @@ private IdType storeBinary(byte[] downloadResourceContent) { return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().createBinary( new ByteArrayInputStream(downloadResourceContent), ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE, - api.getOrganizationProvider().getLocalOrganization().get().getIdElement().getIdPart()); + api.getOrganizationProvider().getLocalOrganization().get().getIdElement().getValue()); } } From a2b978fc5eb8e311cd1935d3fb0905683947a2a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 15:04:09 +0100 Subject: [PATCH 253/382] Outputs now all get sorted in the same way to produce consistent outputs --- .../output/generator/PingStatusGenerator.java | 127 +++++++++++++++++- 1 file changed, 121 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 22abd80a..91334e6f 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -545,6 +546,7 @@ private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent { outputComponent.setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + sortStatusOutputExtensions(outputComponent); return outputComponent; } @@ -582,6 +584,7 @@ private static TaskOutputComponent updateStatus(TaskOutputComponent outputCompon .setCode(outputParameter); } } + sortStatusOutputExtensions(outputComponent); return outputComponent; } @@ -595,6 +598,7 @@ private static TaskOutputComponent addTarget(TaskOutputComponent outputComponent .setValue(OrganizationIdentifier.withValue(target.getOrganizationIdentifierValue())); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER) .setValue(EndpointIdentifier.withValue(target.getEndpointIdentifierValue())); + sortStatusOutputExtensions(outputComponent); return outputComponent; } @@ -636,6 +640,7 @@ private static TaskOutputComponent updateTarget(TaskOutputComponent outputCompon extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER) .setValue(EndpointIdentifier.withValue(target.getEndpointIdentifierValue())); } + sortStatusOutputExtensions(outputComponent); return outputComponent; } @@ -651,7 +656,7 @@ private static TaskOutputComponent addErrorMessages(TaskOutputComponent outputCo .setValue(new StringType(errorMessage)); } } - + sortStatusOutputExtensions(outputComponent); return outputComponent; } @@ -676,6 +681,7 @@ private static TaskOutputComponent updateErrorMessages(TaskOutputComponent outpu { extension.setExtension(nonErrorExtensions); } + sortStatusOutputExtensions(outputComponent); return outputComponent; } @@ -712,6 +718,7 @@ private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputCo networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } + sortStatusOutputExtensions(outputComponent); return outputComponent; } @@ -748,6 +755,7 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } } + sortStatusOutputExtensions(outputComponent); return outputComponent; } @@ -766,6 +774,7 @@ private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComp networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } + sortStatusOutputExtensions(outputComponent); return outputComponent; } @@ -802,27 +811,57 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); } } + sortStatusOutputExtensions(outputComponent); return outputComponent; } private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outputComponent) + { + Optional<Extension> optionalExtension = getPingStatusExtension(outputComponent); + if (optionalExtension.isPresent()) + { + return optionalExtension.get(); + } + else + { + Extension extension = outputComponent.addExtension(); + extension.setUrl(appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS)); + return extension; + } + } + + private static Optional<Extension> getPingStatusExtension(Task task) + { + Optional<TaskOutputComponent> optPingStatusOutput = task.getOutput().stream() + .filter(outputComponent -> outputComponent.getExtension().stream() + .anyMatch(extension -> ConstantsPing.EXTENSION_URL_PING_STATUS.equals(extension.getUrl()))) + .findFirst(); + if (optPingStatusOutput.isPresent()) + { + return getPingStatusExtension(optPingStatusOutput.get()); + } + else + { + return Optional.empty(); + } + } + + private static Optional<Extension> getPingStatusExtension(TaskOutputComponent outputComponent) { List<Extension> pingStatusExtensions = outputComponent.getExtension().stream() .filter(extension -> appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS) .equals(extension.getUrl())) .toList(); - Extension extension; if (pingStatusExtensions.isEmpty()) { - extension = outputComponent.addExtension(); - extension.setUrl(appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS)); + return Optional.empty(); } else { if (pingStatusExtensions.size() == 1) { - extension = pingStatusExtensions.get(0); + return Optional.of(pingStatusExtensions.get(0)); } else { @@ -830,7 +869,6 @@ private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outp "Only one ping status extension is allowed but found " + pingStatusExtensions.size()); } } - return extension; } private static List<Task.TaskOutputComponent> getOutputsByCodes(Task task, String... codes) @@ -873,4 +911,81 @@ private static List<Task.TaskOutputComponent> filterByCorrelationKey(List<TaskOu } }).collect(Collectors.toCollection(ArrayList::new)); } + + private static void sortStatusOutputExtensions(Task task) + { + List<TaskOutputComponent> outputs = task.getOutput().stream() + .filter(outputComponent -> ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS + .equals(outputComponent.getType().getCodingFirstRep().getCode()) + || ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS + .equals(outputComponent.getType().getCodingFirstRep().getCode())) + .toList(); + outputs.forEach(PingStatusGenerator::sortStatusOutputExtensions); + } + + private static void sortStatusOutputExtensions(TaskOutputComponent outputComponent) + { + Optional<Extension> optPingStatusExtension = getPingStatusExtension(outputComponent); + if (optPingStatusExtension.isPresent()) + { + Extension pingStatusExtension = optPingStatusExtension.get(); + List<Extension> extensions = pingStatusExtension.getExtension(); + List<Extension> sortedExtensions = new ArrayList<>(); + + // Extensions representing Target + Optional<Extension> correlationKeyExtension = extensions.stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_CORRELATION_KEY.equals(extension.getUrl())) + .findFirst(); + Optional<Extension> organizationIdentifierExtension = extensions.stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER.equals(extension.getUrl())) + .findFirst(); + Optional<Extension> endpointIdentifierExtension = extensions.stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER.equals(extension.getUrl())) + .findFirst(); + if (correlationKeyExtension.isPresent()) + { + extensions.remove(correlationKeyExtension.get()); + sortedExtensions.add(correlationKeyExtension.get()); + } + if (organizationIdentifierExtension.isPresent()) + { + extensions.remove(organizationIdentifierExtension.get()); + sortedExtensions.add(organizationIdentifierExtension.get()); + } + if (endpointIdentifierExtension.isPresent()) + { + extensions.remove(endpointIdentifierExtension.get()); + sortedExtensions.add(endpointIdentifierExtension.get()); + } + + Optional<Extension> downloadSpeedExtension = extensions.stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED.equals(extension.getUrl())) + .findFirst(); + if (downloadSpeedExtension.isPresent()) + { + extensions.remove(downloadSpeedExtension.get()); + sortedExtensions.add(downloadSpeedExtension.get()); + } + + Optional<Extension> uploadSpeedExtension = extensions.stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_UPLOAD_SPEED.equals(extension.getUrl())) + .findFirst(); + if (uploadSpeedExtension.isPresent()) + { + extensions.remove(uploadSpeedExtension.get()); + sortedExtensions.add(uploadSpeedExtension.get()); + } + + List<Extension> errorMessageExtensions = extensions.stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension.getUrl())).toList(); + if (!errorMessageExtensions.isEmpty()) + { + extensions.removeAll(errorMessageExtensions); + sortedExtensions.addAll(errorMessageExtensions); + } + + sortedExtensions.addAll(extensions); + pingStatusExtension.setExtension(sortedExtensions); + } + } } From d1bb5051bff814bf5505c700c8113bf37e6a3737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 16:33:04 +0100 Subject: [PATCH 254/382] Errors are now all stored at the end of the pong process. Added SaveTimeoutError to save timeout error. Removed LogAndStoreSendError because storing is now done at the end of the process and the error is already saved in SendPong. Also fixed a bug in SendPong.doExecute where the error status code was overwritten after it got stored in SendPong.handleSendTaskError --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 + .../java/dev/dsf/bpe/message/SendPong.java | 9 +-- .../service/pong/LogAndStoreSendError.java | 41 ------------ .../bpe/service/pong/SaveTimeoutError.java | 34 ++++++++++ .../dev/dsf/bpe/service/pong/StoreErrors.java | 33 ++++++++++ .../dev/dsf/bpe/spring/config/PingConfig.java | 29 +++++---- src/main/resources/bpe/pong.bpmn | 65 +++++++++++-------- 7 files changed, 131 insertions(+), 82 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java create mode 100644 src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java create mode 100644 src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 384e0321..ced13c5e 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -106,6 +106,8 @@ private ConstantsPing() public static final String BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR = "resourceDownloadError"; + public static final String PONG_ERROR_MESSAGE_CLEANUP_TIMEOUT = "Timeout while waiting for cleanup message"; + public static final int DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT = 10000000; public static final MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index a1b6b466..95cae4e8 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -74,12 +74,11 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE protected void doExecute(DelegateExecution execution, Variables variables) throws Exception { Target target = variables.getTarget(); - super.doExecute(execution, variables); - Task mainTask = variables.getStartTask(); PingStatusGenerator.updatePongStatusOutput(mainTask, target); PingStatusGenerator.updatePongStatusOutput(mainTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT); variables.updateTask(mainTask); + super.doExecute(execution, variables); } @Override @@ -98,9 +97,11 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab String specialErrorMessage = createErrorMessage(exception); ErrorMessageListUtils.add(specialErrorMessage, execution); - PingStatusGenerator.updatePongStatusOutput(startTask, ErrorMessageListUtils.getErrorMessageList(execution)); - variables.updateTask(startTask); + PingStatusGenerator.updatePongStatusOutput(startTask, statusCode); + variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); + logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); + variables.updateTask(startTask); } private String createErrorMessage(Exception exception) diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java deleted file mode 100644 index 74085f6d..00000000 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndStoreSendError.java +++ /dev/null @@ -1,41 +0,0 @@ -package dev.dsf.bpe.service.pong; - -import java.util.List; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Task; - -import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.logging.PingPongLogger; -import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; -import dev.dsf.bpe.v1.variables.Variables; - -public class LogAndStoreSendError extends AbstractServiceDelegate -{ - public LogAndStoreSendError(ProcessPluginApi api) - { - super(api); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception - { - PingPongLogger logger = new PingPongLogger(LogAndSaveAndStoreError.class, variables.getStartTask()); - - String statusCode = variables.getString(ConstantsPing.getBpmnExecutionVariableStatusCode()); - String errorMessage = variables.getString(ConstantsPing.getBpmnExecutionVariableErrorMessage()); - Target target = variables.getTarget(); - - Task startTask = variables.getStartTask(); - Task.TaskOutputComponent pongStatus = PingStatusGenerator.createPongStatusOutput(variables.getTarget(), - statusCode, List.of(errorMessage)); - startTask.addOutput(pongStatus); - variables.updateTask(startTask); - logger.error("Error {} when trying to download resource from {}: {}", statusCode, - target.getEndpointIdentifierValue(), errorMessage); - } -} diff --git a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java new file mode 100644 index 00000000..eba52fa3 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java @@ -0,0 +1,34 @@ +package dev.dsf.bpe.service.pong; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class SaveTimeoutError extends AbstractServiceDelegate +{ + public SaveTimeoutError(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + { + Task startTask = variables.getStartTask(); + PingPongLogger logger = new PingPongLogger(SaveTimeoutError.class, startTask); + logger.debug("Storing timeout error..."); + + String errorMessage = ConstantsPing.PONG_ERROR_MESSAGE_CLEANUP_TIMEOUT; + + ErrorMessageListUtils.add(errorMessage, execution); + + logger.debug("Stored timeout error: {}", errorMessage); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java new file mode 100644 index 00000000..59e8a1a1 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java @@ -0,0 +1,33 @@ +package dev.dsf.bpe.service.pong; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class StoreErrors extends AbstractServiceDelegate +{ + public StoreErrors(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + { + Task startTask = variables.getStartTask(); + PingPongLogger logger = new PingPongLogger(StoreErrors.class, startTask); + logger.debug("Storing errors..."); + + PingStatusGenerator.updatePongStatusOutput(startTask, ErrorMessageListUtils.getErrorMessageList(execution)); + + variables.updateTask(startTask); + logger.debug("Stored errors in task: " + startTask.getIdElement().getValue()); + } +} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 1b2a55f4..ad24acac 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -21,18 +21,18 @@ import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.ping.LogAndSaveError; import dev.dsf.bpe.service.ping.LogAndSaveNoResponse; -import dev.dsf.bpe.service.ping.LogAndSaveSendError; import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; import dev.dsf.bpe.service.ping.StoreResults; import dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed; import dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration; import dev.dsf.bpe.service.pong.LogAndSaveAndStoreError; -import dev.dsf.bpe.service.pong.LogAndStoreSendError; import dev.dsf.bpe.service.pong.LogPing; +import dev.dsf.bpe.service.pong.SaveTimeoutError; import dev.dsf.bpe.service.pong.SelectPongTarget; import dev.dsf.bpe.service.pong.SetEndpointIdentifier; import dev.dsf.bpe.service.pong.StoreDownloadSpeed; +import dev.dsf.bpe.service.pong.StoreErrors; import dev.dsf.bpe.service.pong.StoreUploadSpeed; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; @@ -173,13 +173,6 @@ public DownloadResourceAndMeasureSpeedInSubProcess downloadResourceAndMeasureSpe return new DownloadResourceAndMeasureSpeedInSubProcess(api, (int) maxDownloadSizeBytes); } - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public LogAndStoreSendError logAndStoreSendError() - { - return new LogAndStoreSendError(api); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public Cleanup cleanup() @@ -252,9 +245,9 @@ public StoreDownloadSpeed storeDownloadSpeed() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public LogAndSaveSendError logAndSaveSendError() + public dev.dsf.bpe.service.ping.LogAndSaveSendError logAndSaveSendError() { - return new LogAndSaveSendError(api); + return new dev.dsf.bpe.service.ping.LogAndSaveSendError(api); } @Bean @@ -263,4 +256,18 @@ public GenerateAndStoreResource generateAndStoreResource() { return new GenerateAndStoreResource(api, maxUploadSizeBytes); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public SaveTimeoutError saveTimeoutError() + { + return new SaveTimeoutError(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public StoreErrors storeErrors() + { + return new StoreErrors(api); + } } diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index baa20209..81c27d48 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -48,10 +48,6 @@ <bpmn:outgoing>Flow_1bzjspe</bpmn:outgoing> <bpmn:outgoing>Flow_00t1ck1</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="Activity_0t0ex36" name="Log And Store Send Error" camunda:class="dev.dsf.bpe.service.pong.LogAndStoreSendError"> - <bpmn:incoming>Flow_0h8flp6</bpmn:incoming> - <bpmn:outgoing>Flow_148beur</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:eventBasedGateway id="Gateway_1l5dkpz"> <bpmn:incoming>Flow_1bzjspe</bpmn:incoming> <bpmn:outgoing>Flow_0rj915n</bpmn:outgoing> @@ -84,7 +80,7 @@ <bpmn:serviceTask id="Activity_0otptjn" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> <bpmn:incoming>Flow_1lfcycx</bpmn:incoming> - <bpmn:incoming>Flow_148beur</bpmn:incoming> + <bpmn:incoming>Flow_0h8flp6</bpmn:incoming> <bpmn:outgoing>Flow_0zib7wr</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Activity_1m4wavi" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.GenerateAndStoreResource"> @@ -112,7 +108,7 @@ <bpmn:sequenceFlow id="Flow_0gvrnxd" sourceRef="Activity_0xcqxjs" targetRef="Gateway_1ggdr8l" /> <bpmn:sequenceFlow id="Flow_1o3n9u6" sourceRef="Gateway_1ggdr8l" targetRef="LogPing" /> <bpmn:sequenceFlow id="Flow_0fzmjzb" sourceRef="Activity_005ywv2" targetRef="Gateway_0eiy9fm" /> - <bpmn:sequenceFlow id="Flow_0h8flp6" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0t0ex36"> + <bpmn:sequenceFlow id="Flow_0h8flp6" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0otptjn"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'not-reachable'}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1bzjspe" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1l5dkpz" /> @@ -137,16 +133,16 @@ <bpmn:sequenceFlow id="Flow_1oo1n55" sourceRef="Activity_1wdftvk" targetRef="Activity_13ypt7i" /> <bpmn:sequenceFlow id="Flow_0i7mizy" sourceRef="Activity_13ypt7i" targetRef="Gateway_1jwjxzn" /> <bpmn:endEvent id="Event_0i1din5"> - <bpmn:incoming>Flow_0zib7wr</bpmn:incoming> + <bpmn:incoming>Flow_1bgedez</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="Flow_19b3cp4" sourceRef="PingMessageStartEvent" targetRef="Activity_1wdftvk" /> - <bpmn:sequenceFlow id="Flow_0zib7wr" sourceRef="Activity_0otptjn" targetRef="Event_0i1din5" /> + <bpmn:sequenceFlow id="Flow_0zib7wr" sourceRef="Activity_0otptjn" targetRef="Activity_0lxtmlg" /> <bpmn:exclusiveGateway id="Gateway_1wktaap"> - <bpmn:incoming>Flow_1xfk4ds</bpmn:incoming> <bpmn:incoming>Flow_1eh8lho</bpmn:incoming> + <bpmn:incoming>Flow_1n4fb8d</bpmn:incoming> <bpmn:outgoing>Flow_1lfcycx</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="Flow_1xfk4ds" sourceRef="Event_0o4l2t4" targetRef="Gateway_1wktaap" /> + <bpmn:sequenceFlow id="Flow_1xfk4ds" sourceRef="Event_0o4l2t4" targetRef="Activity_1wt8irk" /> <bpmn:sequenceFlow id="Flow_1ttsk1o" sourceRef="Event_1xvd4tr" targetRef="Activity_1gd1tfz" /> <bpmn:serviceTask id="Activity_1gd1tfz" name="Store Upload Speed" camunda:class="dev.dsf.bpe.service.pong.StoreUploadSpeed"> <bpmn:incoming>Flow_1ttsk1o</bpmn:incoming> @@ -154,13 +150,22 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1eh8lho" sourceRef="Activity_1gd1tfz" targetRef="Gateway_1wktaap" /> <bpmn:sequenceFlow id="Flow_1lfcycx" sourceRef="Gateway_1wktaap" targetRef="Activity_0otptjn" /> - <bpmn:sequenceFlow id="Flow_148beur" sourceRef="Activity_0t0ex36" targetRef="Activity_0otptjn" /> <bpmn:sequenceFlow id="Flow_0crmxc2" sourceRef="Activity_095j2gg" targetRef="Activity_0i998dm" /> <bpmn:serviceTask id="Activity_0i998dm" name="Store Download Speed" camunda:class="dev.dsf.bpe.service.pong.StoreDownloadSpeed"> <bpmn:incoming>Flow_0crmxc2</bpmn:incoming> <bpmn:outgoing>Flow_0yujsot</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_0yujsot" sourceRef="Activity_0i998dm" targetRef="Gateway_0fvmtve" /> + <bpmn:sequenceFlow id="Flow_1n4fb8d" sourceRef="Activity_1wt8irk" targetRef="Gateway_1wktaap" /> + <bpmn:serviceTask id="Activity_1wt8irk" name="Save Timeout Error" camunda:class="dev.dsf.bpe.service.pong.SaveTimeoutError"> + <bpmn:incoming>Flow_1xfk4ds</bpmn:incoming> + <bpmn:outgoing>Flow_1n4fb8d</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1bgedez" sourceRef="Activity_0lxtmlg" targetRef="Event_0i1din5" /> + <bpmn:serviceTask id="Activity_0lxtmlg" name="Store Errors" camunda:class="dev.dsf.bpe.service.pong.StoreErrors"> + <bpmn:incoming>Flow_0zib7wr</bpmn:incoming> + <bpmn:outgoing>Flow_1bgedez</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:textAnnotation id="TextAnnotation_02e4h2c"> <bpmn:text>Log = logger Save = save as execution variable @@ -235,10 +240,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Gateway_0eiy9fm_di" bpmnElement="Gateway_0eiy9fm" isMarkerVisible="true"> <dc:Bounds x="2145" y="285" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_02b3m47_di" bpmnElement="Activity_0t0ex36"> - <dc:Bounds x="2370" y="270" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_12p2jrx_di" bpmnElement="Gateway_1l5dkpz"> <dc:Bounds x="2145" y="385" width="50" height="50" /> </bpmndi:BPMNShape> @@ -278,9 +279,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> <dc:Bounds x="430" y="270" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> - <dc:Bounds x="2822" y="292" width="36" height="36" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1wktaap_di" bpmnElement="Gateway_1wktaap" isMarkerVisible="true"> <dc:Bounds x="2685" y="385" width="50" height="50" /> </bpmndi:BPMNShape> @@ -292,6 +290,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="810" y="420" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0e5vsn7_di" bpmnElement="Activity_1wt8irk"> + <dc:Bounds x="2510" y="460" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> <dc:Bounds x="280" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> @@ -320,6 +322,13 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="400" y="183" width="585" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> + <dc:Bounds x="2932" y="292" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0ff4lt7_di" bpmnElement="Activity_0lxtmlg"> + <dc:Bounds x="2790" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> <dc:Bounds x="1862" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -364,7 +373,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0h8flp6_di" bpmnElement="Flow_0h8flp6"> <di:waypoint x="2195" y="310" /> - <di:waypoint x="2370" y="310" /> + <di:waypoint x="2660" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1bzjspe_di" bpmnElement="Flow_1bzjspe"> <di:waypoint x="2170" y="335" /> @@ -421,12 +430,11 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0zib7wr_di" bpmnElement="Flow_0zib7wr"> <di:waypoint x="2760" y="310" /> - <di:waypoint x="2822" y="310" /> + <di:waypoint x="2790" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1xfk4ds_di" bpmnElement="Flow_1xfk4ds"> <di:waypoint x="2428" y="500" /> - <di:waypoint x="2710" y="500" /> - <di:waypoint x="2710" y="435" /> + <di:waypoint x="2510" y="500" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ttsk1o_di" bpmnElement="Flow_1ttsk1o"> <di:waypoint x="2428" y="410" /> @@ -440,10 +448,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2710" y="385" /> <di:waypoint x="2710" y="350" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_148beur_di" bpmnElement="Flow_148beur"> - <di:waypoint x="2470" y="310" /> - <di:waypoint x="2660" y="310" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0crmxc2_di" bpmnElement="Flow_0crmxc2"> <di:waypoint x="750" y="460" /> <di:waypoint x="810" y="460" /> @@ -452,6 +456,11 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="910" y="460" /> <di:waypoint x="955" y="460" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1n4fb8d_di" bpmnElement="Flow_1n4fb8d"> + <di:waypoint x="2610" y="500" /> + <di:waypoint x="2710" y="500" /> + <di:waypoint x="2710" y="435" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> <di:waypoint x="722" y="420" /> <di:waypoint x="738" y="390" /> @@ -472,6 +481,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1464" y="500" /> <di:waypoint x="1469" y="543" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1bgedez_di" bpmnElement="Flow_1bgedez"> + <di:waypoint x="2890" y="310" /> + <di:waypoint x="2932" y="310" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From c6f3565360ae654337509c03ad16b4bb3bfd83a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 16:34:06 +0100 Subject: [PATCH 255/382] Added more context to error messages --- src/main/java/dev/dsf/bpe/message/SendPing.java | 2 +- src/main/java/dev/dsf/bpe/message/SendPong.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index 0ee08374..436aa711 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -80,7 +80,7 @@ private String createErrorMessage(Exception exception) && (exception.getMessage() == null || exception.getMessage().isBlank())) { StatusType statusInfo = w.getResponse().getStatusInfo(); - return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); + return "Error when sending ping message: " + statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); } else return exception.getMessage(); diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 95cae4e8..ebf29ad9 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -110,7 +110,7 @@ private String createErrorMessage(Exception exception) && (exception.getMessage() == null || exception.getMessage().isBlank())) { StatusType statusInfo = w.getResponse().getStatusInfo(); - return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); + return "Error when sending pong message: " + statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); } else return exception.getMessage(); From 1c0e3bc1751b89106b1318382bfc00d845a866d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 16:35:20 +0100 Subject: [PATCH 256/382] Ran format-and-sort --- src/main/java/dev/dsf/bpe/message/SendPing.java | 3 ++- src/main/java/dev/dsf/bpe/message/SendPong.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index 436aa711..b4978f1b 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -80,7 +80,8 @@ private String createErrorMessage(Exception exception) && (exception.getMessage() == null || exception.getMessage().isBlank())) { StatusType statusInfo = w.getResponse().getStatusInfo(); - return "Error when sending ping message: " + statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); + return "Error when sending ping message: " + statusInfo.getStatusCode() + " " + + statusInfo.getReasonPhrase(); } else return exception.getMessage(); diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index ebf29ad9..4dd9f4b2 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -110,7 +110,8 @@ private String createErrorMessage(Exception exception) && (exception.getMessage() == null || exception.getMessage().isBlank())) { StatusType statusInfo = w.getResponse().getStatusInfo(); - return "Error when sending pong message: " + statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); + return "Error when sending pong message: " + statusInfo.getStatusCode() + " " + + statusInfo.getReasonPhrase(); } else return exception.getMessage(); From ed21ed5a79d7aa351ef1a94b54954628f7730121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 16:41:26 +0100 Subject: [PATCH 257/382] Improved other branch of error message as well --- src/main/java/dev/dsf/bpe/message/SendPing.java | 2 +- src/main/java/dev/dsf/bpe/message/SendPong.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index b4978f1b..1c9248b4 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -84,7 +84,7 @@ private String createErrorMessage(Exception exception) + statusInfo.getReasonPhrase(); } else - return exception.getMessage(); + return "Error when sending ping message: " + exception.getMessage(); } private Identifier getLocalEndpointIdentifier() diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 4dd9f4b2..c1f05474 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -114,6 +114,6 @@ private String createErrorMessage(Exception exception) + statusInfo.getReasonPhrase(); } else - return exception.getMessage(); + return "Error when sending ping message: " + exception.getMessage(); } } From a3627cdf0ab29b60f4e00a5883ce3548b2e2c2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 16:50:48 +0100 Subject: [PATCH 258/382] Added hard limit to download and upload sizes to avoid Java running out of memory --- .../PingPongDeploymentStateListener.java | 19 ++++++++++++++++++ .../dev/dsf/bpe/spring/config/PingConfig.java | 20 +++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java index 8363afac..846bb892 100644 --- a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java +++ b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java @@ -39,6 +39,24 @@ public void onProcessesDeployed(List<String> processes) networkSpeedUnit, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); } + + //TODO: fixme + int maxDownloadSizeBytes = pingConfig.getMaxDownloadSizeBytes(); + int maxDownloadSizeBytesHeapFix = 100000000; + if (maxDownloadSizeBytes > maxDownloadSizeBytesHeapFix) + { + pingConfig.setMaxDownloadSizeBytes(maxDownloadSizeBytesHeapFix); + logger.debug("MaxDownloadSizeBytes is too large. Setting maxDownloadSizeBytes to {}. This avoids Java running out of memory and will be fixed in a future release", maxDownloadSizeBytesHeapFix); + } + + int maxUploadSizeBytes = pingConfig.getMaxUploadSizeBytes(); + int maxUploadSizeBytesHeapFix = 100000000; + if (maxUploadSizeBytes > maxUploadSizeBytesHeapFix) + { + pingConfig.setMaxUploadSizeBytes(maxUploadSizeBytesHeapFix); + logger.debug("MaxUploadSizeBytes is too large. Setting maxUploadSizeBytes to {}. This avoids Java running out of memory and will be fixed in a future release", maxUploadSizeBytesHeapFix); + } + logger.debug("Configuration validation complete."); } @@ -46,5 +64,6 @@ public void onProcessesDeployed(List<String> processes) public void afterPropertiesSet() throws Exception { Objects.requireNonNull(networkSpeedUnit); + Objects.requireNonNull(pingConfig); } } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index ad24acac..531f835d 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -75,6 +75,26 @@ public void setNetworkSpeedUnit(String networkSpeedUnit) this.networkSpeedUnit = networkSpeedUnit; } + public int getMaxDownloadSizeBytes() + { + return maxDownloadSizeBytes; + } + + public void setMaxDownloadSizeBytes(int maxDownloadSizeBytes) + { + this.maxDownloadSizeBytes = maxDownloadSizeBytes; + } + + public int getMaxUploadSizeBytes() + { + return maxUploadSizeBytes; + } + + public void setMaxUploadSizeBytes(int maxUploadSizeBytes) + { + this.maxUploadSizeBytes = maxUploadSizeBytes; + } + @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SetTargetAndConfigureTimer setTargetAndConfigureTimer() From 3bc1f97cf5dfe67f2a688a5d89115ee4ddd10115 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 16:51:37 +0100 Subject: [PATCH 259/382] Ran format-and-sort --- .../bpe/listener/PingPongDeploymentStateListener.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java index 846bb892..6f6f4489 100644 --- a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java +++ b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java @@ -40,13 +40,15 @@ public void onProcessesDeployed(List<String> processes) ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); } - //TODO: fixme + // TODO: fixme int maxDownloadSizeBytes = pingConfig.getMaxDownloadSizeBytes(); int maxDownloadSizeBytesHeapFix = 100000000; if (maxDownloadSizeBytes > maxDownloadSizeBytesHeapFix) { pingConfig.setMaxDownloadSizeBytes(maxDownloadSizeBytesHeapFix); - logger.debug("MaxDownloadSizeBytes is too large. Setting maxDownloadSizeBytes to {}. This avoids Java running out of memory and will be fixed in a future release", maxDownloadSizeBytesHeapFix); + logger.debug( + "MaxDownloadSizeBytes is too large. Setting maxDownloadSizeBytes to {}. This avoids Java running out of memory and will be fixed in a future release", + maxDownloadSizeBytesHeapFix); } int maxUploadSizeBytes = pingConfig.getMaxUploadSizeBytes(); @@ -54,7 +56,9 @@ public void onProcessesDeployed(List<String> processes) if (maxUploadSizeBytes > maxUploadSizeBytesHeapFix) { pingConfig.setMaxUploadSizeBytes(maxUploadSizeBytesHeapFix); - logger.debug("MaxUploadSizeBytes is too large. Setting maxUploadSizeBytes to {}. This avoids Java running out of memory and will be fixed in a future release", maxUploadSizeBytesHeapFix); + logger.debug( + "MaxUploadSizeBytes is too large. Setting maxUploadSizeBytes to {}. This avoids Java running out of memory and will be fixed in a future release", + maxUploadSizeBytesHeapFix); } logger.debug("Configuration validation complete."); From c18b9c4d06c8e640e7fa4c739d22c7113b136e34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 17:03:26 +0100 Subject: [PATCH 260/382] RC1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b69dde88..3cac3cdb 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ <groupId>dev.dsf</groupId> <artifactId>dsf-process-ping-pong</artifactId> - <version>2.0.0.0-SNAPSHOT</version> + <version>2.0.0.0-RC1</version> <packaging>jar</packaging> <properties> From d9cfad82f7a02390eaa012a6bbd64b324f8b866c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 17:49:46 +0100 Subject: [PATCH 261/382] Synchronized timer description with timeout value --- src/main/resources/bpe/ping.bpmn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 473e4434..b776b135 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -15,7 +15,7 @@ <bpmn:startEvent id="SubProcessStartEvent"> <bpmn:outgoing>Flow_10epxa2</bpmn:outgoing> </bpmn:startEvent> - <bpmn:intermediateCatchEvent id="PongTimer" name="PT20S"> + <bpmn:intermediateCatchEvent id="PongTimer" name="PT200S"> <bpmn:incoming>Flow_0y9usku</bpmn:incoming> <bpmn:outgoing>Flow_1fjeq2h</bpmn:outgoing> <bpmn:timerEventDefinition id="TimerEventDefinition_1mgy0vi"> @@ -250,7 +250,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="BPMNShape_13ugi24" bpmnElement="PongTimer"> <dc:Bounds x="1512" y="432" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1513" y="475" width="34" height="14" /> + <dc:Bounds x="1510" y="475" width="40" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1xv73wh" bpmnElement="PongCatchEvent"> From 238749146c4454a1fc3ab6e53cd83d5eb62cd7e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 17:57:16 +0100 Subject: [PATCH 262/382] Binary content does need to be encoded because it already gets encoded automatically. Instead, the entire requested content size should be generated. When downloading, only the content gets downloaded which also is already decoded. Set the execution variable "downloadResourceSizeBytes" to the size that was generated just to be safe. --- .../bpe/service/GenerateAndStoreResource.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 8ee390cf..16a5ff6e 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -31,13 +31,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Generating resource..."); int downloadResourceSizeBytes = getDownloadResourceSize(variables); - variables.setByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE, - generateRandomBinaryContent(downloadResourceSizeBytes, logger)); + byte[] resourceContent = generateRandomBinaryContent(downloadResourceSizeBytes, logger); + variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, + resourceContent.length); logger.debug("Generated resource."); logger.debug("Storing binary resource for download..."); - IdType downloadResource = storeBinary( - variables.getByteArray(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE)); + IdType downloadResource = storeBinary(resourceContent); String reference = downloadResource.getValueAsString(); @@ -49,9 +49,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable private byte[] generateRandomBinaryContent(int desiredSizeBytes, PingPongLogger logger) { int sizeBytes = Math.min(maxUploadSizeBytes, desiredSizeBytes); - byte[] bytes = base64Encode(generateRandomByteArray((sizeBytes / 4) * 3)); + byte[] bytes = generateRandomByteArray(sizeBytes); logger.info( - "Generated binary content for network speed measurement. Requested size was: {} bytes, generated size (base64 encoded) was : {}", + "Generated binary content for network speed measurement. Requested size was: {} bytes, generated size was : {}", desiredSizeBytes, bytes.length); return bytes; } @@ -64,11 +64,6 @@ private byte[] generateRandomByteArray(int sizeBytes) return randomBytes; } - private byte[] base64Encode(byte[] content) - { - return Base64.getEncoder().encode(content); - } - private int getDownloadResourceSize(Variables variables) { return variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); From fff0c2d506a194646f88570c2647fbbb704b654a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 18:28:08 +0100 Subject: [PATCH 263/382] Fixed a bug that caused the process to crash when executing slim ping because the optionals were empty --- .../dev/dsf/bpe/service/ping/SavePong.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 90f53e40..a4c7d085 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -1,6 +1,7 @@ package dev.dsf.bpe.service.ping; import java.util.List; +import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -39,16 +40,19 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task pong = variables.getLatestTask(); - long downloadedDurationMillis = api.getTaskHelper() - .getFirstInputParameterValue(pong, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, DecimalType.class) - .get().getValue().longValue(); - variables.setLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey), - downloadedDurationMillis); + Optional<DecimalType> optDownloadedDurationMillis = api.getTaskHelper().getFirstInputParameterValue(pong, + ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, + DecimalType.class); + optDownloadedDurationMillis.ifPresent(decimalType -> variables.setLong( + ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey), + decimalType.getValue().longValue())); + + Optional<IntegerType> optDownloadedBytes = api.getTaskHelper().getFirstInputParameterValue(pong, + ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, + IntegerType.class); + optDownloadedBytes.ifPresent(integerType -> variables.setInteger( + ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), integerType.getValue())); - int downloadedBytes = api.getTaskHelper().getFirstInputParameterValue(pong, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, IntegerType.class).get().getValue(); - variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), downloadedBytes); List<String> errorList = api.getTaskHelper() .getInputParameterValues(pong, ConstantsPing.CODESYSTEM_DSF_PING, From 972f9e2860d7f54b1515caa69e61976b36243b2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 18:49:36 +0100 Subject: [PATCH 264/382] Fixed a bug where outputs were not detected as ping status outputs resulting in a second, incomplete output to be generated --- .../output/generator/PingStatusGenerator.java | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 91334e6f..62783a8a 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -9,6 +9,7 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.DecimalType; @@ -28,7 +29,8 @@ public class PingStatusGenerator public static Task updatePingStatusOutput(Task task, String correlationKey, List<String> errorMessages) { List<TaskOutputComponent> outputs = filterByCorrelationKey( - getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), + correlationKey); if (outputs.isEmpty()) { @@ -51,7 +53,7 @@ public static Task updatePingStatusOutput(Task task, String correlationKey, List public static Task updatePongStatusOutput(Task task, List<String> errorMessages) { - List<Task.TaskOutputComponent> pongStatusOutputs = getOutputsByCodes(task, + List<Task.TaskOutputComponent> pongStatusOutputs = getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (pongStatusOutputs.isEmpty()) { @@ -106,7 +108,8 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent output, public static Task updatePingStatusOutput(Task task, String correlationKey, String statusCode) { List<Task.TaskOutputComponent> pingStatusOutputs = filterByCorrelationKey( - getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), + correlationKey); if (pingStatusOutputs.isEmpty()) { task.addOutput(updatePingStatusOutput(new TaskOutputComponent(), statusCode)); @@ -143,7 +146,7 @@ public static TaskOutputComponent updatePingStatusOutput(TaskOutputComponent out public static Task updatePongStatusOutput(Task task, String statusCode) { - List<Task.TaskOutputComponent> pongStatusOutputs = getOutputsByCodes(task, + List<Task.TaskOutputComponent> pongStatusOutputs = getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (pongStatusOutputs.isEmpty()) { @@ -181,7 +184,7 @@ public static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent out public static Task updatePingStatusOutput(Task task, Target target) { List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( - getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), + getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), target.getCorrelationKey()); if (outputs.isEmpty()) { @@ -204,7 +207,7 @@ public static Task updatePingStatusOutput(Task task, Target target) public static Task updatePongStatusOutput(Task task, Target target) { - List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, + List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { @@ -242,7 +245,8 @@ public static Task updatePingStatusOutput(Task task, String correlationKey, BigD BigDecimal uploadSpeed, String statusCode) { List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( - getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), + correlationKey); if (outputs.isEmpty()) { task.addOutput(updateStatusOutput(new TaskOutputComponent(), downloadSpeed, uploadSpeed, statusCode)); @@ -265,7 +269,7 @@ public static Task updatePingStatusOutput(Task task, String correlationKey, BigD public static Task updatePongStatusOutput(Task task, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String statusCode) { - List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, + List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { @@ -314,7 +318,8 @@ public static Task updatePingStatusOutputDownloadSpeed(Task task, String correla String networkSpeedUnit) { List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( - getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), + correlationKey); if (outputs.isEmpty()) { task.addOutput(updateStatusOutputDownloadSpeed(new TaskOutputComponent(), downloadSpeed, networkSpeedUnit)); @@ -336,7 +341,7 @@ public static Task updatePingStatusOutputDownloadSpeed(Task task, String correla public static Task updatePongStatusOutputDownloadSpeed(Task task, BigDecimal downloadSpeed, String networkSpeedUnit) { - List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, + List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { @@ -376,7 +381,8 @@ public static Task updatePingStatusOutputUploadSpeed(Task task, String correlati String networkSpeedUnit) { List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( - getOutputsByCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), correlationKey); + getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), + correlationKey); if (outputs.isEmpty()) { task.addOutput(updateStatusOutputUploadSpeed(new TaskOutputComponent(), uploadSpeed, networkSpeedUnit)); @@ -399,7 +405,7 @@ public static Task updatePingStatusOutputUploadSpeed(Task task, String correlati public static Task updatePongStatusOutputUploadSpeed(Task task, BigDecimal uploadSpeed, String networkSpeedUnit) { - List<Task.TaskOutputComponent> outputs = getOutputsByCodes(task, + List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (outputs.isEmpty()) { @@ -871,12 +877,16 @@ private static Optional<Extension> getPingStatusExtension(TaskOutputComponent ou } } - private static List<Task.TaskOutputComponent> getOutputsByCodes(Task task, String... codes) + private static List<Task.TaskOutputComponent> getOutputsByExtensionUrlAndCodes(Task task, String... codes) { - return task.getOutput().stream().filter(outputComponent -> !outputComponent.getType().getCoding().isEmpty()) - .filter(outputComponent -> outputComponent.getType().getCoding().stream() - .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem()) - && Arrays.stream(codes).anyMatch(code -> code.equals(coding.getCode())))) + return task + .getOutput().stream().filter( + outputComponent -> outputComponent.getType().getCoding().stream() + .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem()) + && Stream.of(codes).anyMatch(code -> code.equals(coding.getCode()))) + || outputComponent.getExtension().stream() + .anyMatch(extension -> appendFhirResourceVersion( + ConstantsPing.EXTENSION_URL_PING_STATUS).equals(extension.getUrl()))) .collect(Collectors.toCollection(ArrayList::new)); } From a82bddef073fbccb988a9ddf28a21c5a9e3df86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 18:51:27 +0100 Subject: [PATCH 265/382] Removed unused imports --- src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java | 1 - .../ping/DownloadResourceAndMeasureSpeedInSubProcess.java | 1 - .../dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java | 1 - .../dsf/bpe/util/task/output/generator/PingStatusGenerator.java | 1 - src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java | 2 -- 5 files changed, 6 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 16a5ff6e..0b66d3de 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -1,7 +1,6 @@ package dev.dsf.bpe.service; import java.io.ByteArrayInputStream; -import java.util.Base64; import java.util.Random; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 7277df03..f2108486 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -6,7 +6,6 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.BinaryResourceDownloader; -import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 4cc00447..94a21ecc 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -6,7 +6,6 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.BinaryResourceDownloader; -import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 62783a8a..a628e78d 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -4,7 +4,6 @@ import java.math.BigDecimal; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.Set; diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index de279e3f..24e9fb71 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -5,8 +5,6 @@ import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; -import java.nio.file.Files; -import java.nio.file.Paths; import java.time.Instant; import java.time.LocalDate; import java.time.format.DateTimeFormatter; From ba14f7cb97a7204e6cee41189a1dfe7bd3e703d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 19:18:08 +0100 Subject: [PATCH 266/382] Added error handling for HTTP request to fetch resource behind reference --- .../bpe/util/BinaryResourceDownloader.java | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 7bea256b..7c026574 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -36,28 +36,36 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t IdType downloadResourceReferenceIdType = new IdType(downloadResourceReference.getReference()); String downloadResourceReferenceId = downloadResourceReferenceIdType.getIdPart(); String webserviceUrl = downloadResourceReferenceIdType.getBaseUrl(); - - InputStream binaryResourceInputStream = api.getFhirWebserviceClientProvider().getWebserviceClient(webserviceUrl) - .readBinary(downloadResourceReferenceId, ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE); - - try (binaryResourceInputStream) + try { - logger.info( - "Downloading resource for: '{}'. Requested resource size is {} bytes, maximum downloadable size is {} bytes...", - downloadResourceReference.getReference(), downloadResourceSizeBytes, maxDownloadSizeBytes); - long downloadStartTime = System.currentTimeMillis(); - int numBytes = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); - binaryResourceInputStream.skipNBytes(numBytes); - long downloadEndTime = System.currentTimeMillis(); - long downloadedDurationMillis = downloadEndTime - downloadStartTime; - downloadResult = new DownloadResult(numBytes, downloadedDurationMillis); - logger.info("Finished downloading {} bytes. Took {}", numBytes, - toHoursMinutesSecondsMilliseconds(downloadedDurationMillis)); - + InputStream binaryResourceInputStream = api.getFhirWebserviceClientProvider() + .getWebserviceClient(webserviceUrl) + .readBinary(downloadResourceReferenceId, ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE); + + try (binaryResourceInputStream) + { + logger.info( + "Downloading resource for: '{}'. Requested resource size is {} bytes, maximum downloadable size is {} bytes...", + downloadResourceReference.getReference(), downloadResourceSizeBytes, maxDownloadSizeBytes); + long downloadStartTime = System.currentTimeMillis(); + int numBytes = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); + binaryResourceInputStream.skipNBytes(numBytes); + long downloadEndTime = System.currentTimeMillis(); + long downloadedDurationMillis = downloadEndTime - downloadStartTime; + downloadResult = new DownloadResult(numBytes, downloadedDurationMillis); + logger.info("Finished downloading {} bytes. Took {}", numBytes, + toHoursMinutesSecondsMilliseconds(downloadedDurationMillis)); + + } + catch (IOException e) + { + logger.error("Encountered an error while downloading resource: {}", e.getMessage()); + downloadResult = new DownloadResult(e.getMessage()); + } } - catch (IOException e) + catch (Exception e) { - logger.error("Encountered an error while downloading resource: {}", e.getMessage()); + logger.error("Encountered an error while trying to download resource: {}", e.getMessage()); downloadResult = new DownloadResult(e.getMessage()); } return downloadResult; From c3d6a65a1c77f13c9762b08dc94e326a54e9c4a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 19 Mar 2025 19:26:20 +0100 Subject: [PATCH 267/382] Moved LogPing to place where it actually makes sense --- src/main/resources/bpe/pong.bpmn | 260 +++++++++++++++---------------- 1 file changed, 130 insertions(+), 130 deletions(-) diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 81c27d48..ba3902cb 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -15,7 +15,7 @@ <bpmn:outgoing>Flow_0crmxc2</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="SelectPongTarget" name="Select Pong Target" camunda:class="dev.dsf.bpe.service.pong.SelectPongTarget"> - <bpmn:incoming>Flow_061qpt4</bpmn:incoming> + <bpmn:incoming>Flow_1o3n9u6</bpmn:incoming> <bpmn:outgoing>Flow_1eass2g</bpmn:outgoing> </bpmn:serviceTask> <bpmn:exclusiveGateway id="Gateway_1ggdr8l"> @@ -23,10 +23,6 @@ <bpmn:incoming>Flow_0gvrnxd</bpmn:incoming> <bpmn:outgoing>Flow_1o3n9u6</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:serviceTask id="LogPing" name="Log Ping" camunda:class="dev.dsf.bpe.service.pong.LogPing"> - <bpmn:incoming>Flow_1o3n9u6</bpmn:incoming> - <bpmn:outgoing>Flow_061qpt4</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:sendTask id="Activity_005ywv2" name="Pong" camunda:class="dev.dsf.bpe.message.SendPong"> <bpmn:extensionElements> <camunda:field name="instantiatesCanonical"> @@ -103,10 +99,9 @@ <bpmn:sequenceFlow id="Flow_08gidyv" sourceRef="Gateway_1jwjxzn" targetRef="Gateway_1ggdr8l"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_061qpt4" sourceRef="LogPing" targetRef="SelectPongTarget" /> <bpmn:sequenceFlow id="Flow_1eass2g" sourceRef="SelectPongTarget" targetRef="Activity_005ywv2" /> <bpmn:sequenceFlow id="Flow_0gvrnxd" sourceRef="Activity_0xcqxjs" targetRef="Gateway_1ggdr8l" /> - <bpmn:sequenceFlow id="Flow_1o3n9u6" sourceRef="Gateway_1ggdr8l" targetRef="LogPing" /> + <bpmn:sequenceFlow id="Flow_1o3n9u6" sourceRef="Gateway_1ggdr8l" targetRef="SelectPongTarget" /> <bpmn:sequenceFlow id="Flow_0fzmjzb" sourceRef="Activity_005ywv2" targetRef="Gateway_0eiy9fm" /> <bpmn:sequenceFlow id="Flow_0h8flp6" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0otptjn"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'not-reachable'}</bpmn:conditionExpression> @@ -123,7 +118,7 @@ <bpmn:sequenceFlow id="Flow_0yr2pmf" sourceRef="SelectPongTargetErrorBoundaryEvent" targetRef="Event_1qh25on" /> <bpmn:sequenceFlow id="Flow_1w09zt7" sourceRef="Activity_1m4wavi" targetRef="Activity_0xcqxjs" /> <bpmn:serviceTask id="Activity_1wdftvk" name="Set Download Resource Size" camunda:class="dev.dsf.bpe.service.SetDownloadResourceSize"> - <bpmn:incoming>Flow_19b3cp4</bpmn:incoming> + <bpmn:incoming>Flow_1j5lf0u</bpmn:incoming> <bpmn:outgoing>Flow_1oo1n55</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Activity_13ypt7i" name="Set Endpoint Identifier" camunda:class="dev.dsf.bpe.service.pong.SetEndpointIdentifier"> @@ -135,7 +130,7 @@ <bpmn:endEvent id="Event_0i1din5"> <bpmn:incoming>Flow_1bgedez</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="Flow_19b3cp4" sourceRef="PingMessageStartEvent" targetRef="Activity_1wdftvk" /> + <bpmn:sequenceFlow id="Flow_19b3cp4" sourceRef="PingMessageStartEvent" targetRef="Activity_02rqshk" /> <bpmn:sequenceFlow id="Flow_0zib7wr" sourceRef="Activity_0otptjn" targetRef="Activity_0lxtmlg" /> <bpmn:exclusiveGateway id="Gateway_1wktaap"> <bpmn:incoming>Flow_1eh8lho</bpmn:incoming> @@ -166,6 +161,11 @@ <bpmn:incoming>Flow_0zib7wr</bpmn:incoming> <bpmn:outgoing>Flow_1bgedez</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:serviceTask id="Activity_02rqshk" name="Log Ping" camunda:class="dev.dsf.bpe.service.pong.LogPing"> + <bpmn:incoming>Flow_19b3cp4</bpmn:incoming> + <bpmn:outgoing>Flow_1j5lf0u</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1j5lf0u" sourceRef="Activity_02rqshk" targetRef="Activity_1wdftvk" /> <bpmn:textAnnotation id="TextAnnotation_02e4h2c"> <bpmn:text>Log = logger Save = save as execution variable @@ -209,281 +209,281 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> - <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> - <dc:Bounds x="152" y="292" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="160" y="335" width="21" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1jwjxzn_di" bpmnElement="Gateway_1jwjxzn" isMarkerVisible="true"> - <dc:Bounds x="575" y="285" width="50" height="50" /> + <dc:Bounds x="735" y="285" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_095j2gg_di" bpmnElement="Activity_095j2gg"> - <dc:Bounds x="650" y="420" width="100" height="80" /> + <dc:Bounds x="810" y="420" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0ko681m_di" bpmnElement="SelectPongTarget"> - <dc:Bounds x="1780" y="270" width="100" height="80" /> + <dc:Bounds x="1940" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1r1hob1" bpmnElement="Gateway_1ggdr8l" isMarkerVisible="true"> - <dc:Bounds x="1565" y="285" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1lhkmjw" bpmnElement="LogPing"> - <dc:Bounds x="1660" y="270" width="100" height="80" /> - <bpmndi:BPMNLabel /> + <dc:Bounds x="1725" y="285" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1h1lrei_di" bpmnElement="Activity_005ywv2"> - <dc:Bounds x="1960" y="270" width="100" height="80" /> + <dc:Bounds x="2120" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0eiy9fm_di" bpmnElement="Gateway_0eiy9fm" isMarkerVisible="true"> - <dc:Bounds x="2145" y="285" width="50" height="50" /> + <dc:Bounds x="2305" y="285" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_12p2jrx_di" bpmnElement="Gateway_1l5dkpz"> - <dc:Bounds x="2145" y="385" width="50" height="50" /> + <dc:Bounds x="2305" y="385" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1xvd4tr_di" bpmnElement="Event_1xvd4tr"> - <dc:Bounds x="2392" y="392" width="36" height="36" /> + <dc:Bounds x="2552" y="392" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2391" y="438" width="42" height="14" /> + <dc:Bounds x="2551" y="438" width="42" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0o4l2t4_di" bpmnElement="Event_0o4l2t4"> - <dc:Bounds x="2392" y="482" width="36" height="36" /> + <dc:Bounds x="2552" y="482" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> - <dc:Bounds x="955" y="435" width="50" height="50" /> + <dc:Bounds x="1115" y="435" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1imd3tw_di" bpmnElement="Activity_1umihbr"> - <dc:Bounds x="840" y="540" width="100" height="80" /> + <dc:Bounds x="1000" y="540" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_05zzvx3_di" bpmnElement="Event_1qh25on"> - <dc:Bounds x="1862" y="595" width="36" height="36" /> + <dc:Bounds x="2022" y="595" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> - <dc:Bounds x="2660" y="270" width="100" height="80" /> + <dc:Bounds x="2820" y="270" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1m4wavi_di" bpmnElement="Activity_1m4wavi"> - <dc:Bounds x="1090" y="420" width="100" height="80" /> + <dc:Bounds x="1250" y="420" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_06klx97_di" bpmnElement="Activity_0xcqxjs"> - <dc:Bounds x="1410" y="420" width="100" height="80" /> + <dc:Bounds x="1570" y="420" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> - <dc:Bounds x="270" y="270" width="100" height="80" /> + <dc:Bounds x="430" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> - <dc:Bounds x="430" y="270" width="100" height="80" /> + <dc:Bounds x="590" y="270" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1wktaap_di" bpmnElement="Gateway_1wktaap" isMarkerVisible="true"> - <dc:Bounds x="2685" y="385" width="50" height="50" /> + <dc:Bounds x="2845" y="385" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0ntyg74_di" bpmnElement="Activity_1gd1tfz"> - <dc:Bounds x="2510" y="370" width="100" height="80" /> + <dc:Bounds x="2670" y="370" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> - <dc:Bounds x="810" y="420" width="100" height="80" /> + <dc:Bounds x="970" y="420" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0e5vsn7_di" bpmnElement="Activity_1wt8irk"> - <dc:Bounds x="2510" y="460" width="100" height="80" /> + <dc:Bounds x="2670" y="460" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> - <dc:Bounds x="280" y="80" width="420" height="70" /> + <dc:Bounds x="440" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1cled7l_di" bpmnElement="TextAnnotation_1cled7l"> - <dc:Bounds x="700" y="353" width="170" height="37" /> + <dc:Bounds x="860" y="353" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> - <dc:Bounds x="1910" y="439" width="250" height="84" /> + <dc:Bounds x="2070" y="439" width="250" height="84" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> - <dc:Bounds x="2860" y="439" width="200" height="41" /> + <dc:Bounds x="3020" y="439" width="200" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> - <dc:Bounds x="1420" y="543" width="275" height="41" /> + <dc:Bounds x="1580" y="543" width="275" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> - <dc:Bounds x="1040" y="544" width="170" height="40" /> + <dc:Bounds x="1200" y="544" width="170" height="40" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1bdbmbf" bpmnElement="TextAnnotation_14ea4yc"> - <dc:Bounds x="400" y="183" width="585" height="70" /> + <dc:Bounds x="560" y="183" width="585" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> - <dc:Bounds x="2932" y="292" width="36" height="36" /> + <dc:Bounds x="3092" y="292" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0ff4lt7_di" bpmnElement="Activity_0lxtmlg"> - <dc:Bounds x="2790" y="270" width="100" height="80" /> + <dc:Bounds x="2950" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1m1s18a" bpmnElement="Activity_02rqshk"> + <dc:Bounds x="260" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> + <dc:Bounds x="152" y="292" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="335" width="21" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> - <dc:Bounds x="1862" y="332" width="36" height="36" /> + <dc:Bounds x="2022" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1900" y="363" width="87" height="14" /> + <dc:Bounds x="2060" y="363" width="87" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_14ee8kb" bpmnElement="Event_0olr5yw"> - <dc:Bounds x="732" y="482" width="36" height="36" /> + <dc:Bounds x="892" y="482" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="770" y="516" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> - <di:waypoint x="600" y="335" /> - <di:waypoint x="600" y="460" /> - <di:waypoint x="650" y="460" /> + <di:waypoint x="760" y="335" /> + <di:waypoint x="760" y="460" /> + <di:waypoint x="810" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_08gidyv_di" bpmnElement="Flow_08gidyv"> - <di:waypoint x="625" y="310" /> - <di:waypoint x="1565" y="310" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_061qpt4_di" bpmnElement="Flow_061qpt4"> - <di:waypoint x="1760" y="310" /> - <di:waypoint x="1780" y="310" /> + <di:waypoint x="785" y="310" /> + <di:waypoint x="1725" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1eass2g_di" bpmnElement="Flow_1eass2g"> - <di:waypoint x="1880" y="310" /> - <di:waypoint x="1960" y="310" /> + <di:waypoint x="2040" y="310" /> + <di:waypoint x="2120" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0gvrnxd_di" bpmnElement="Flow_0gvrnxd"> - <di:waypoint x="1510" y="460" /> - <di:waypoint x="1590" y="460" /> - <di:waypoint x="1590" y="335" /> + <di:waypoint x="1670" y="460" /> + <di:waypoint x="1750" y="460" /> + <di:waypoint x="1750" y="335" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1o3n9u6_di" bpmnElement="Flow_1o3n9u6"> - <di:waypoint x="1615" y="310" /> - <di:waypoint x="1660" y="310" /> + <di:waypoint x="1775" y="310" /> + <di:waypoint x="1940" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fzmjzb_di" bpmnElement="Flow_0fzmjzb"> - <di:waypoint x="2060" y="310" /> - <di:waypoint x="2145" y="310" /> + <di:waypoint x="2220" y="310" /> + <di:waypoint x="2305" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0h8flp6_di" bpmnElement="Flow_0h8flp6"> - <di:waypoint x="2195" y="310" /> - <di:waypoint x="2660" y="310" /> + <di:waypoint x="2355" y="310" /> + <di:waypoint x="2820" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1bzjspe_di" bpmnElement="Flow_1bzjspe"> - <di:waypoint x="2170" y="335" /> - <di:waypoint x="2170" y="385" /> + <di:waypoint x="2330" y="335" /> + <di:waypoint x="2330" y="385" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_00t1ck1_di" bpmnElement="Flow_00t1ck1"> - <di:waypoint x="2170" y="285" /> - <di:waypoint x="2170" y="250" /> - <di:waypoint x="2710" y="250" /> - <di:waypoint x="2710" y="270" /> + <di:waypoint x="2330" y="285" /> + <di:waypoint x="2330" y="250" /> + <di:waypoint x="2870" y="250" /> + <di:waypoint x="2870" y="270" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0rj915n_di" bpmnElement="Flow_0rj915n"> - <di:waypoint x="2195" y="410" /> - <di:waypoint x="2392" y="410" /> + <di:waypoint x="2355" y="410" /> + <di:waypoint x="2552" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_17x98wg_di" bpmnElement="Flow_17x98wg"> - <di:waypoint x="2170" y="435" /> - <di:waypoint x="2170" y="500" /> - <di:waypoint x="2392" y="500" /> + <di:waypoint x="2330" y="435" /> + <di:waypoint x="2330" y="500" /> + <di:waypoint x="2552" y="500" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> - <di:waypoint x="940" y="580" /> - <di:waypoint x="980" y="580" /> - <di:waypoint x="980" y="485" /> + <di:waypoint x="1100" y="580" /> + <di:waypoint x="1140" y="580" /> + <di:waypoint x="1140" y="485" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0x7t1ii_di" bpmnElement="Flow_0x7t1ii"> - <di:waypoint x="1005" y="460" /> - <di:waypoint x="1090" y="460" /> + <di:waypoint x="1165" y="460" /> + <di:waypoint x="1250" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0uj7rm3_di" bpmnElement="Flow_0uj7rm3"> - <di:waypoint x="750" y="518" /> - <di:waypoint x="750" y="580" /> - <di:waypoint x="840" y="580" /> + <di:waypoint x="910" y="518" /> + <di:waypoint x="910" y="580" /> + <di:waypoint x="1000" y="580" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0yr2pmf_di" bpmnElement="Flow_0yr2pmf"> - <di:waypoint x="1880" y="368" /> - <di:waypoint x="1880" y="595" /> + <di:waypoint x="2040" y="368" /> + <di:waypoint x="2040" y="595" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> - <di:waypoint x="1190" y="460" /> - <di:waypoint x="1410" y="460" /> + <di:waypoint x="1350" y="460" /> + <di:waypoint x="1570" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> - <di:waypoint x="370" y="310" /> - <di:waypoint x="430" y="310" /> + <di:waypoint x="530" y="310" /> + <di:waypoint x="590" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0i7mizy_di" bpmnElement="Flow_0i7mizy"> - <di:waypoint x="530" y="310" /> - <di:waypoint x="575" y="310" /> + <di:waypoint x="690" y="310" /> + <di:waypoint x="735" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> <di:waypoint x="188" y="310" /> - <di:waypoint x="270" y="310" /> + <di:waypoint x="260" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0zib7wr_di" bpmnElement="Flow_0zib7wr"> - <di:waypoint x="2760" y="310" /> - <di:waypoint x="2790" y="310" /> + <di:waypoint x="2920" y="310" /> + <di:waypoint x="2950" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1xfk4ds_di" bpmnElement="Flow_1xfk4ds"> - <di:waypoint x="2428" y="500" /> - <di:waypoint x="2510" y="500" /> + <di:waypoint x="2588" y="500" /> + <di:waypoint x="2670" y="500" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ttsk1o_di" bpmnElement="Flow_1ttsk1o"> - <di:waypoint x="2428" y="410" /> - <di:waypoint x="2510" y="410" /> + <di:waypoint x="2588" y="410" /> + <di:waypoint x="2670" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1eh8lho_di" bpmnElement="Flow_1eh8lho"> - <di:waypoint x="2610" y="410" /> - <di:waypoint x="2685" y="410" /> + <di:waypoint x="2770" y="410" /> + <di:waypoint x="2845" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1lfcycx_di" bpmnElement="Flow_1lfcycx"> - <di:waypoint x="2710" y="385" /> - <di:waypoint x="2710" y="350" /> + <di:waypoint x="2870" y="385" /> + <di:waypoint x="2870" y="350" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0crmxc2_di" bpmnElement="Flow_0crmxc2"> - <di:waypoint x="750" y="460" /> - <di:waypoint x="810" y="460" /> + <di:waypoint x="910" y="460" /> + <di:waypoint x="970" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0yujsot_di" bpmnElement="Flow_0yujsot"> - <di:waypoint x="910" y="460" /> - <di:waypoint x="955" y="460" /> + <di:waypoint x="1070" y="460" /> + <di:waypoint x="1115" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1n4fb8d_di" bpmnElement="Flow_1n4fb8d"> - <di:waypoint x="2610" y="500" /> - <di:waypoint x="2710" y="500" /> - <di:waypoint x="2710" y="435" /> + <di:waypoint x="2770" y="500" /> + <di:waypoint x="2870" y="500" /> + <di:waypoint x="2870" y="435" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> - <di:waypoint x="722" y="420" /> - <di:waypoint x="738" y="390" /> + <di:waypoint x="882" y="420" /> + <di:waypoint x="898" y="390" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> - <di:waypoint x="1996" y="350" /> - <di:waypoint x="1965" y="439" /> + <di:waypoint x="2156" y="350" /> + <di:waypoint x="2125" y="439" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2758" y="346" /> - <di:waypoint x="2884" y="439" /> + <di:waypoint x="2918" y="346" /> + <di:waypoint x="3044" y="439" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> - <di:waypoint x="1128" y="544" /> - <di:waypoint x="1134" y="500" /> + <di:waypoint x="1288" y="544" /> + <di:waypoint x="1294" y="500" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> - <di:waypoint x="1464" y="500" /> - <di:waypoint x="1469" y="543" /> + <di:waypoint x="1624" y="500" /> + <di:waypoint x="1629" y="543" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1bgedez_di" bpmnElement="Flow_1bgedez"> - <di:waypoint x="2890" y="310" /> - <di:waypoint x="2932" y="310" /> + <di:waypoint x="3050" y="310" /> + <di:waypoint x="3092" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1j5lf0u_di" bpmnElement="Flow_1j5lf0u"> + <di:waypoint x="360" y="310" /> + <di:waypoint x="430" y="310" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> From 18d8cf927c95ceba75f6a8594cce78510e799ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 20 Mar 2025 10:06:00 +0100 Subject: [PATCH 268/382] Added error handling for missing download resource reference in message --- ...adResourceAndMeasureSpeedInSubProcess.java | 34 ++++++++++------- .../pong/DownloadResourceAndMeasureSpeed.java | 37 +++++++++++-------- .../bpe/util/BinaryResourceDownloader.java | 2 +- 3 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index f2108486..db1745a9 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -33,22 +33,28 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger) - .download(variables, api, task, maxDownloadSizeBytes); - - if (downloadResult.getErrorMessage() == null) + try { - variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey), - downloadResult.getDownloadedBytes()); - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), - downloadResult.getDownloadedDurationMillis()); - } - else + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger).download( + variables, api, task, maxDownloadSizeBytes); + + if (downloadResult.getErrorMessage() == null) + { + variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey), + downloadResult.getDownloadedBytes()); + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), + downloadResult.getDownloadedDurationMillis()); + } + else + { + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, + downloadResult.getErrorMessage()); + } + + logger.debug("Completed resource download and measured speed."); + } catch (Exception e) { - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, - downloadResult.getErrorMessage()); + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, e.getMessage()); } - - logger.debug("Completed resource download and measured speed."); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 94a21ecc..dc983793 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -1,5 +1,7 @@ package dev.dsf.bpe.service.pong; +import java.util.NoSuchElementException; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; @@ -29,22 +31,27 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task task = variables.getStartTask(); - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger) - .download(variables, api, task, maxDownloadSizeBytes); - - if (downloadResult.getErrorMessage() == null) + try { + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger) + .download(variables, api, task, maxDownloadSizeBytes); + + if (downloadResult.getErrorMessage() == null) + { + variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(), + downloadResult.getDownloadedBytes()); + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(), + downloadResult.getDownloadedDurationMillis()); + } + else + { + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, + downloadResult.getErrorMessage()); + } + + logger.debug("Completed resource download and measured speed."); + } catch (Exception e) { - variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(), - downloadResult.getDownloadedBytes()); - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(), - downloadResult.getDownloadedDurationMillis()); + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_UPLOAD_ERROR, e.getMessage()); } - else - { - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, - downloadResult.getErrorMessage()); - } - - logger.debug("Completed resource download and measured speed."); } } diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 7c026574..b2e36e9e 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -31,7 +31,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t Reference downloadResourceReference = api.getTaskHelper() .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, Reference.class) - .orElseThrow(); + .orElseThrow(() -> new RuntimeException("Unable to download resource. No reference provided in message.")); IdType downloadResourceReferenceIdType = new IdType(downloadResourceReference.getReference()); String downloadResourceReferenceId = downloadResourceReferenceIdType.getIdPart(); From 0819905de941d0cd61e0e9d0202ae1470401e264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 20 Mar 2025 16:39:58 +0100 Subject: [PATCH 269/382] Added error handling when failing to post binary resource to local FHIR server. This also required adding a new error-message output element to task-start-ping, modelling new BPMN errors and rewriting a lot of code to make able to handle things that were not considered to be missable so far --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 + .../java/dev/dsf/bpe/message/CleanupPong.java | 16 +- .../java/dev/dsf/bpe/message/SendPong.java | 23 +- .../bpe/service/GenerateAndStoreResource.java | 16 +- ...adResourceAndMeasureSpeedInSubProcess.java | 7 +- .../ping/LogAndSaveUploadErrorPing.java | 32 ++ .../dev/dsf/bpe/service/ping/SavePong.java | 3 +- .../dsf/bpe/service/ping/StoreResults.java | 22 +- .../pong/DownloadResourceAndMeasureSpeed.java | 8 +- .../pong/LogAndSaveUploadErrorPong.java | 32 ++ .../dev/dsf/bpe/spring/config/PingConfig.java | 16 + .../bpe/util/BinaryResourceDownloader.java | 3 +- .../generator/ErrorMessageGenerator.java | 27 ++ .../output/generator/PingStatusGenerator.java | 28 +- src/main/resources/bpe/ping.bpmn | 47 +- src/main/resources/bpe/pong.bpmn | 414 ++++++++++-------- .../dsf-task-cleanup-pong.xml | 4 +- .../dsf-task-start-ping.xml | 35 ++ .../dsf/fhir/profiles/TaskProfileTest.java | 15 + 19 files changed, 508 insertions(+), 242 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java create mode 100644 src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java create mode 100644 src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index ced13c5e..2eb4057e 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -103,8 +103,10 @@ private ConstantsPing() private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_BYTES = "uploadedBytes"; private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS = "uploadedDurationMillis"; public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE = "resourceDownloadErrorMessage"; + public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR_MESSAGE = "resourceUploadErrorMessage"; public static final String BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR = "resourceDownloadError"; + public static final String BPMN_ERROR_CODE_RESOURCE_UPLOAD_ERROR = "resourceUploadError"; public static final String PONG_ERROR_MESSAGE_CLEANUP_TIMEOUT = "Timeout while waiting for cleanup message"; diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPong.java b/src/main/java/dev/dsf/bpe/message/CleanupPong.java index 86d646e7..27eb0deb 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPong.java @@ -6,6 +6,8 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; @@ -25,13 +27,19 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE { Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - int downloadedBytes = variables + Integer downloadedBytes = variables .getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); - long downloadedDurationMillis = variables + Long downloadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); - return Stream.of(NetworkSpeedMetricGenerator.createDownloadedBytes(downloadedBytes), - NetworkSpeedMetricGenerator.createDownloadedDurationMillis(downloadedDurationMillis)); + Stream<Task.ParameterComponent> downloadedBytesParameter = downloadedBytes != null + ? Stream.of(DownloadedBytesGenerator.create(downloadedBytes)) + : Stream.empty(); + Stream<Task.ParameterComponent> downloadedDurationMillisParameter = downloadedDurationMillis != null + ? Stream.of(DownloadedDurationMillisGenerator.create(downloadedDurationMillis)) + : Stream.empty(); + + return Stream.of(downloadedBytesParameter, downloadedDurationMillisParameter).flatMap(s -> s); } @Override diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index c1f05474..0c738c35 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -52,17 +52,26 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); if (downloadResourceSizeBytes >= 0) { - int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); - long downloadedDurationMillis = variables + Integer downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); + Long downloadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); String downloadResourceReference = variables .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); - return Stream.concat( - Stream.of(DownloadedBytesGenerator.create(downloadedBytes), - DownloadedDurationMillisGenerator.create(downloadedDurationMillis), - DownloadResourceReferenceGenerator.create(downloadResourceReference)), - ErrorMessageGenerator.create(errorList).stream()); + Stream<Task.ParameterComponent> downloadedBytesParameter = downloadedBytes != null + ? Stream.of(DownloadedBytesGenerator.create(downloadedBytes)) + : Stream.empty(); + Stream<Task.ParameterComponent> downloadedDurationMillisParameter = downloadedDurationMillis != null + ? Stream.of(DownloadedDurationMillisGenerator.create(downloadedDurationMillis)) + : Stream.empty(); + Stream<Task.ParameterComponent> downloadedResourceReferenceParameter = downloadResourceReference != null + ? Stream.of(DownloadResourceReferenceGenerator.create(downloadResourceReference)) + : Stream.empty(); + + return Stream + .of(downloadedBytesParameter, downloadedDurationMillisParameter, + downloadedResourceReferenceParameter, ErrorMessageGenerator.create(errorList).stream()) + .flatMap(stream -> stream); } else { diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 0b66d3de..d842d60f 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -12,6 +12,7 @@ import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; +import jakarta.ws.rs.WebApplicationException; public class GenerateAndStoreResource extends AbstractServiceDelegate { @@ -36,13 +37,20 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Generated resource."); logger.debug("Storing binary resource for download..."); - IdType downloadResource = storeBinary(resourceContent); + try + { + IdType downloadResource = storeBinary(resourceContent); - String reference = downloadResource.getValueAsString(); + String reference = downloadResource.getValueAsString(); - variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); + variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); - logger.debug("Stored binary resource for download"); + logger.debug("Stored binary resource for download"); + } + catch (Exception e) + { + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_UPLOAD_ERROR, e.getMessage()); + } } private byte[] generateRandomBinaryContent(int desiredSizeBytes, PingPongLogger logger) diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index db1745a9..6538c8e3 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -35,8 +35,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable try { - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger).download( - variables, api, task, maxDownloadSizeBytes); + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger) + .download(variables, api, task, maxDownloadSizeBytes); if (downloadResult.getErrorMessage() == null) { @@ -52,7 +52,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } logger.debug("Completed resource download and measured speed."); - } catch (Exception e) + } + catch (Exception e) { throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, e.getMessage()); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java new file mode 100644 index 00000000..c1600bc4 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java @@ -0,0 +1,32 @@ +package dev.dsf.bpe.service.ping; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class LogAndSaveUploadErrorPing extends AbstractServiceDelegate +{ + public LogAndSaveUploadErrorPing(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + { + Task startTask = variables.getStartTask(); + PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPing.class, startTask); + + String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR_MESSAGE); + ErrorMessageListUtils.add(errorMessage, execution); + + logger.info("Error while storing binary resource for download: {}", errorMessage); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index a4c7d085..6528c336 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -57,7 +57,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable List<String> errorList = api.getTaskHelper() .getInputParameterValues(pong, ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE, StringType.class) - .map(PrimitiveType::getValue).toList(); + .map(PrimitiveType::getValue).map(string -> "Pong error: " + string).toList(); + ErrorMessageListUtils.addAll(errorList, delegateExecution, correlationKey); logger.debug("Saved pong information."); diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 9259e68e..f79860a3 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -15,6 +15,7 @@ import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; +import dev.dsf.bpe.util.task.output.generator.ErrorMessageGenerator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -52,6 +53,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task task = variables.getStartTask(); Targets targets = variables.getTargets(); + ErrorMessageGenerator.create(ErrorMessageListUtils.getErrorMessageList(execution)).forEach(task::addOutput); + targets.getEntries().stream().sorted(Comparator.comparing(Target::getEndpointIdentifierValue)).forEach(target -> { String correlationKey = target.getCorrelationKey(); @@ -83,21 +86,24 @@ else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(stat List<String> errorMessageList = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); if (downloadResourceSizeBytes >= 0) // if fat-ping { - int downloadedBytes = variables + Integer downloadedBytes = variables .getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); - long downloadedDurationMillis = variables + Long downloadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); - BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, - downloadedDurationMillis, networkSpeedUnit); + BigDecimal downloadSpeed = downloadedBytes != null && downloadedDurationMillis != null + ? NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, + networkSpeedUnit) + : null; - int uploadedBytes = variables + Integer uploadedBytes = variables .getInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey)); - long uploadedDurationMillis = variables + Long uploadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey)); - BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, - networkSpeedUnit); + BigDecimal uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null + ? NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit) + : null; task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList, downloadSpeed, uploadSpeed, networkSpeedUnit)); diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index dc983793..7a7a4267 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -31,7 +31,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task task = variables.getStartTask(); - try { + try + { BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger) .download(variables, api, task, maxDownloadSizeBytes); @@ -49,9 +50,10 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } logger.debug("Completed resource download and measured speed."); - } catch (Exception e) + } + catch (Exception e) { - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_UPLOAD_ERROR, e.getMessage()); + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, e.getMessage()); } } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java new file mode 100644 index 00000000..6ee624ba --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java @@ -0,0 +1,32 @@ +package dev.dsf.bpe.service.pong; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class LogAndSaveUploadErrorPong extends AbstractServiceDelegate +{ + public LogAndSaveUploadErrorPong(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + { + Task startTask = variables.getStartTask(); + PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPong.class, startTask); + + String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR_MESSAGE); + ErrorMessageListUtils.add(errorMessage, execution); + + logger.info("Error while storing binary resource for download: {}", errorMessage); + } +} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 531f835d..164d6145 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -21,12 +21,14 @@ import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.ping.LogAndSaveError; import dev.dsf.bpe.service.ping.LogAndSaveNoResponse; +import dev.dsf.bpe.service.ping.LogAndSaveUploadErrorPing; import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; import dev.dsf.bpe.service.ping.StoreResults; import dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed; import dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration; import dev.dsf.bpe.service.pong.LogAndSaveAndStoreError; +import dev.dsf.bpe.service.pong.LogAndSaveUploadErrorPong; import dev.dsf.bpe.service.pong.LogPing; import dev.dsf.bpe.service.pong.SaveTimeoutError; import dev.dsf.bpe.service.pong.SelectPongTarget; @@ -290,4 +292,18 @@ public StoreErrors storeErrors() { return new StoreErrors(api); } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public LogAndSaveUploadErrorPing logAndSaveUploadErrorPing() + { + return new LogAndSaveUploadErrorPing(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public LogAndSaveUploadErrorPong logAndSaveUploadErrorPong() + { + return new LogAndSaveUploadErrorPong(api); + } } diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index b2e36e9e..5264935b 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -22,6 +22,7 @@ public BinaryResourceDownloader(PingPongLogger logger) } public DownloadResult download(Variables variables, ProcessPluginApi api, Task task, int maxDownloadSizeBytes) + throws Exception { DownloadResult downloadResult; @@ -31,7 +32,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t Reference downloadResourceReference = api.getTaskHelper() .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, Reference.class) - .orElseThrow(() -> new RuntimeException("Unable to download resource. No reference provided in message.")); + .orElseThrow(() -> new Exception("Unable to download resource. No reference provided in message.")); IdType downloadResourceReferenceIdType = new IdType(downloadResourceReference.getReference()); String downloadResourceReferenceId = downloadResourceReferenceIdType.getIdPart(); diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java new file mode 100644 index 00000000..ab34226b --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java @@ -0,0 +1,27 @@ +package dev.dsf.bpe.util.task.output.generator; + +import java.util.List; +import java.util.stream.Collectors; + +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; + +public class ErrorMessageGenerator +{ + public static List<Task.TaskOutputComponent> create(List<String> errorMessages) + { + if (errorMessages == null || errorMessages.isEmpty()) + return List.of(); + return errorMessages.stream().map(ErrorMessageGenerator::create).collect(Collectors.toList()); + } + + public static Task.TaskOutputComponent create(String errorMessage) + { + Task.TaskOutputComponent param = new Task.TaskOutputComponent(); + param.setValue(new StringType(errorMessage)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + .setCode(ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE); + return param; + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index a628e78d..8cd25bfc 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -549,9 +549,13 @@ private static TaskOutputComponent createStatusOutput(Target target, String outp private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent, String outputParameter, String statusCode) { - outputComponent.setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); - outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); - sortStatusOutputExtensions(outputComponent); + if (outputParameter != null && statusCode != null) + { + outputComponent + .setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); + outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + sortStatusOutputExtensions(outputComponent); + } return outputComponent; } @@ -596,14 +600,18 @@ private static TaskOutputComponent updateStatus(TaskOutputComponent outputCompon private static TaskOutputComponent addTarget(TaskOutputComponent outputComponent, Target target) { - Extension extension = getOrCreatePingStatusExtension(outputComponent); + if (target != null) + { + Extension extension = getOrCreatePingStatusExtension(outputComponent); - extension.addExtension(ConstantsPing.EXTENSION_URL_CORRELATION_KEY, new StringType(target.getCorrelationKey())); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER) - .setValue(OrganizationIdentifier.withValue(target.getOrganizationIdentifierValue())); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER) - .setValue(EndpointIdentifier.withValue(target.getEndpointIdentifierValue())); - sortStatusOutputExtensions(outputComponent); + extension.addExtension(ConstantsPing.EXTENSION_URL_CORRELATION_KEY, + new StringType(target.getCorrelationKey())); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER) + .setValue(OrganizationIdentifier.withValue(target.getOrganizationIdentifierValue())); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER) + .setValue(EndpointIdentifier.withValue(target.getEndpointIdentifierValue())); + sortStatusOutputExtensions(outputComponent); + } return outputComponent; } diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index b776b135..25eabba1 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -183,6 +183,7 @@ <bpmn:exclusiveGateway id="Gateway_0bifi5h"> <bpmn:incoming>Flow_0iuuyo1</bpmn:incoming> <bpmn:incoming>Flow_1qz7z39</bpmn:incoming> + <bpmn:incoming>Flow_0ejw9k5</bpmn:incoming> <bpmn:outgoing>Flow_1c15ef2</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:serviceTask id="SelectPingTargets" name="Select Targets" camunda:class="dev.dsf.bpe.service.ping.SelectPingTargets"> @@ -214,6 +215,16 @@ <bpmn:outgoing>Flow_0fxlsv3</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_0e35w2m" sourceRef="StartPingMessageStartEvent" targetRef="Activity_1wdftvk" /> + <bpmn:boundaryEvent id="Event_159rcwi" name="Failed to create resource" attachedToRef="Activity_0nwtf8o"> + <bpmn:outgoing>Flow_0ql2dtr</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1f41ql6" errorRef="Error_0tkfq65" camunda:errorMessageVariable="resourceUploadErrorMessage" /> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="Flow_0ql2dtr" sourceRef="Event_159rcwi" targetRef="Activity_1ddl5dm" /> + <bpmn:sequenceFlow id="Flow_0ejw9k5" sourceRef="Activity_1ddl5dm" targetRef="Gateway_0bifi5h" /> + <bpmn:serviceTask id="Activity_1ddl5dm" name="Log And Save Error" camunda:class="dev.dsf.bpe.service.ping.LogAndSaveUploadErrorPing"> + <bpmn:incoming>Flow_0ql2dtr</bpmn:incoming> + <bpmn:outgoing>Flow_0ejw9k5</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:textAnnotation id="TextAnnotation_1ig0151"> <bpmn:text>Includes download speeds and errors of all pongs</bpmn:text> </bpmn:textAnnotation> @@ -239,8 +250,12 @@ Save = save as execution variable Store = store on DSF FHIR server either as separate resource or output parameter</bpmn:text> </bpmn:textAnnotation> </bpmn:process> + <bpmn:error id="Error_0tkfq65" name="resourceUploadError" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> + <bpmndi:BPMNShape id="Activity_0v585g9_di" bpmnElement="Activity_1ddl5dm"> + <dc:Bounds x="700" y="580" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> <dc:Bounds x="1040" y="180" width="1820" height="560" /> </bpmndi:BPMNShape> @@ -304,6 +319,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1820" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0p0eucz_di" bpmnElement="Activity_0p5edt9"> + <dc:Bounds x="1520" y="520" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> <dc:Bounds x="1270" y="220" width="250" height="70" /> <bpmndi:BPMNLabel /> @@ -316,9 +334,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1980" y="622" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0p0eucz_di" bpmnElement="Activity_0p5edt9"> - <dc:Bounds x="1520" y="520" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0968qvb" bpmnElement="Event_0i4slcz"> <dc:Bounds x="2152" y="542" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -407,6 +422,11 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2735" y="360" /> <di:waypoint x="2772" y="360" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0upu487_di" bpmnElement="Flow_0upu487"> + <di:waypoint x="1620" y="560" /> + <di:waypoint x="1780" y="560" /> + <di:waypoint x="1780" y="475" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> <di:waypoint x="1252" y="320" /> <di:waypoint x="1276" y="290" /> @@ -419,11 +439,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2074" y="622" /> <di:waypoint x="2102" y="560" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0upu487_di" bpmnElement="Flow_0upu487"> - <di:waypoint x="1620" y="560" /> - <di:waypoint x="1780" y="560" /> - <di:waypoint x="1780" y="475" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_0fhb8wi" bpmnElement="Activity_0nwtf8o"> <dc:Bounds x="530" y="460" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -478,6 +493,12 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="230" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_11osfov" bpmnElement="Event_159rcwi"> + <dc:Bounds x="612" y="522" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="652" y="516" width="76" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_09zmq8d" bpmnElement="Flow_0j92st0"> <di:waypoint x="1000" y="360" /> <di:waypoint x="1040" y="360" /> @@ -532,6 +553,16 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="3079" y="330" /> <di:waypoint x="3058" y="288" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0ql2dtr_di" bpmnElement="Flow_0ql2dtr"> + <di:waypoint x="630" y="558" /> + <di:waypoint x="630" y="620" /> + <di:waypoint x="700" y="620" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0ejw9k5_di" bpmnElement="Flow_0ejw9k5"> + <di:waypoint x="800" y="620" /> + <di:waypoint x="840" y="620" /> + <di:waypoint x="840" y="385" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index ba3902cb..86799b38 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -6,7 +6,7 @@ <bpmn:messageEventDefinition id="MessageEventDefinition_128t2ek" messageRef="Message_0u91abp" /> </bpmn:startEvent> <bpmn:exclusiveGateway id="Gateway_1jwjxzn" default="Flow_10z0d4x"> - <bpmn:incoming>Flow_0i7mizy</bpmn:incoming> + <bpmn:incoming>Flow_1gap0hi</bpmn:incoming> <bpmn:outgoing>Flow_10z0d4x</bpmn:outgoing> <bpmn:outgoing>Flow_08gidyv</bpmn:outgoing> </bpmn:exclusiveGateway> @@ -14,13 +14,10 @@ <bpmn:incoming>Flow_10z0d4x</bpmn:incoming> <bpmn:outgoing>Flow_0crmxc2</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="SelectPongTarget" name="Select Pong Target" camunda:class="dev.dsf.bpe.service.pong.SelectPongTarget"> - <bpmn:incoming>Flow_1o3n9u6</bpmn:incoming> - <bpmn:outgoing>Flow_1eass2g</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:exclusiveGateway id="Gateway_1ggdr8l"> <bpmn:incoming>Flow_08gidyv</bpmn:incoming> <bpmn:incoming>Flow_0gvrnxd</bpmn:incoming> + <bpmn:incoming>Flow_0dp8f59</bpmn:incoming> <bpmn:outgoing>Flow_1o3n9u6</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sendTask id="Activity_005ywv2" name="Pong" camunda:class="dev.dsf.bpe.message.SendPong"> @@ -35,7 +32,7 @@ <camunda:string>http://dsf.dev/fhir/StructureDefinition/task-pong|#{version}</camunda:string> </camunda:field> </bpmn:extensionElements> - <bpmn:incoming>Flow_1eass2g</bpmn:incoming> + <bpmn:incoming>Flow_1o3n9u6</bpmn:incoming> <bpmn:outgoing>Flow_0fzmjzb</bpmn:outgoing> </bpmn:sendTask> <bpmn:exclusiveGateway id="Gateway_0eiy9fm" default="Flow_1bzjspe"> @@ -58,7 +55,7 @@ <bpmn:incoming>Flow_17x98wg</bpmn:incoming> <bpmn:outgoing>Flow_1xfk4ds</bpmn:outgoing> <bpmn:timerEventDefinition id="TimerEventDefinition_0a3j29a"> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">${cleanupTimerDuration}</bpmn:timeDuration> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">${execution.hasVariable("cleanupTimerDuration") ? cleanupTimerDuration : "PT20S"}</bpmn:timeDuration> </bpmn:timerEventDefinition> </bpmn:intermediateCatchEvent> <bpmn:exclusiveGateway id="Gateway_0fvmtve"> @@ -70,9 +67,6 @@ <bpmn:incoming>Flow_0uj7rm3</bpmn:incoming> <bpmn:outgoing>Flow_1jehvly</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="Event_1qh25on"> - <bpmn:incoming>Flow_0yr2pmf</bpmn:incoming> - </bpmn:endEvent> <bpmn:serviceTask id="Activity_0otptjn" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> <bpmn:incoming>Flow_1lfcycx</bpmn:incoming> @@ -91,17 +85,12 @@ <bpmn:outgoing>Flow_0uj7rm3</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_0h8zmzk" errorRef="Error_1jmenbm" camunda:errorMessageVariable="resourceDownloadErrorMessage" /> </bpmn:boundaryEvent> - <bpmn:boundaryEvent id="SelectPongTargetErrorBoundaryEvent" name="target not allowed" attachedToRef="SelectPongTarget"> - <bpmn:outgoing>Flow_0yr2pmf</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0ty7e1r" errorRef="Error_1j0t9ud" /> - </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_10z0d4x" sourceRef="Gateway_1jwjxzn" targetRef="Activity_095j2gg" /> <bpmn:sequenceFlow id="Flow_08gidyv" sourceRef="Gateway_1jwjxzn" targetRef="Gateway_1ggdr8l"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_1eass2g" sourceRef="SelectPongTarget" targetRef="Activity_005ywv2" /> <bpmn:sequenceFlow id="Flow_0gvrnxd" sourceRef="Activity_0xcqxjs" targetRef="Gateway_1ggdr8l" /> - <bpmn:sequenceFlow id="Flow_1o3n9u6" sourceRef="Gateway_1ggdr8l" targetRef="SelectPongTarget" /> + <bpmn:sequenceFlow id="Flow_1o3n9u6" sourceRef="Gateway_1ggdr8l" targetRef="Activity_005ywv2" /> <bpmn:sequenceFlow id="Flow_0fzmjzb" sourceRef="Activity_005ywv2" targetRef="Gateway_0eiy9fm" /> <bpmn:sequenceFlow id="Flow_0h8flp6" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0otptjn"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'not-reachable'}</bpmn:conditionExpression> @@ -115,7 +104,6 @@ <bpmn:sequenceFlow id="Flow_1jehvly" sourceRef="Activity_1umihbr" targetRef="Gateway_0fvmtve" /> <bpmn:sequenceFlow id="Flow_0x7t1ii" sourceRef="Gateway_0fvmtve" targetRef="Activity_1m4wavi" /> <bpmn:sequenceFlow id="Flow_0uj7rm3" sourceRef="Event_0olr5yw" targetRef="Activity_1umihbr" /> - <bpmn:sequenceFlow id="Flow_0yr2pmf" sourceRef="SelectPongTargetErrorBoundaryEvent" targetRef="Event_1qh25on" /> <bpmn:sequenceFlow id="Flow_1w09zt7" sourceRef="Activity_1m4wavi" targetRef="Activity_0xcqxjs" /> <bpmn:serviceTask id="Activity_1wdftvk" name="Set Download Resource Size" camunda:class="dev.dsf.bpe.service.SetDownloadResourceSize"> <bpmn:incoming>Flow_1j5lf0u</bpmn:incoming> @@ -123,10 +111,9 @@ </bpmn:serviceTask> <bpmn:serviceTask id="Activity_13ypt7i" name="Set Endpoint Identifier" camunda:class="dev.dsf.bpe.service.pong.SetEndpointIdentifier"> <bpmn:incoming>Flow_1oo1n55</bpmn:incoming> - <bpmn:outgoing>Flow_0i7mizy</bpmn:outgoing> + <bpmn:outgoing>Flow_1fzloso</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1oo1n55" sourceRef="Activity_1wdftvk" targetRef="Activity_13ypt7i" /> - <bpmn:sequenceFlow id="Flow_0i7mizy" sourceRef="Activity_13ypt7i" targetRef="Gateway_1jwjxzn" /> <bpmn:endEvent id="Event_0i1din5"> <bpmn:incoming>Flow_1bgedez</bpmn:incoming> </bpmn:endEvent> @@ -166,6 +153,30 @@ <bpmn:outgoing>Flow_1j5lf0u</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1j5lf0u" sourceRef="Activity_02rqshk" targetRef="Activity_1wdftvk" /> + <bpmn:boundaryEvent id="Event_0c5a0v4" name="Failed to create resource" attachedToRef="Activity_1m4wavi"> + <bpmn:outgoing>Flow_0mgrru4</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0rltnl2" errorRef="Error_0y0cd8c" camunda:errorMessageVariable="resourceUploadErrorMessage" /> + </bpmn:boundaryEvent> + <bpmn:serviceTask id="Activity_1kb1v81" name="Log And Save Error" camunda:class="dev.dsf.bpe.service.pong.LogAndSaveUploadErrorPong"> + <bpmn:incoming>Flow_0mgrru4</bpmn:incoming> + <bpmn:outgoing>Flow_0dp8f59</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_0mgrru4" sourceRef="Event_0c5a0v4" targetRef="Activity_1kb1v81" /> + <bpmn:sequenceFlow id="Flow_0dp8f59" sourceRef="Activity_1kb1v81" targetRef="Gateway_1ggdr8l" /> + <bpmn:serviceTask id="Activity_0n0we3y" name="Select Pong Target" camunda:class="dev.dsf.bpe.service.pong.SelectPongTarget"> + <bpmn:incoming>Flow_1fzloso</bpmn:incoming> + <bpmn:outgoing>Flow_1gap0hi</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="Event_11q3y8a"> + <bpmn:incoming>Flow_0qxt5zo</bpmn:incoming> + </bpmn:endEvent> + <bpmn:boundaryEvent id="Event_1jkcqo6" name="target not allowed" attachedToRef="Activity_0n0we3y"> + <bpmn:outgoing>Flow_0qxt5zo</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_16rvc25" errorRef="Error_1j0t9ud" /> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="Flow_0qxt5zo" sourceRef="Event_1jkcqo6" targetRef="Event_11q3y8a" /> + <bpmn:sequenceFlow id="Flow_1fzloso" sourceRef="Activity_13ypt7i" targetRef="Activity_0n0we3y" /> + <bpmn:sequenceFlow id="Flow_1gap0hi" sourceRef="Activity_0n0we3y" targetRef="Gateway_1jwjxzn" /> <bpmn:textAnnotation id="TextAnnotation_02e4h2c"> <bpmn:text>Log = logger Save = save as execution variable @@ -207,284 +218,305 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:message id="Message_2m36ftq" name="cleanupPong" /> <bpmn:error id="Error_1jmenbm" name="resourceDownloadError" errorCode="resourceDownloadError" /> <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> + <bpmn:error id="Error_0y0cd8c" name="resourceUploadError" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> - <bpmndi:BPMNShape id="Gateway_1jwjxzn_di" bpmnElement="Gateway_1jwjxzn" isMarkerVisible="true"> - <dc:Bounds x="735" y="285" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_095j2gg_di" bpmnElement="Activity_095j2gg"> - <dc:Bounds x="810" y="420" width="100" height="80" /> + <bpmndi:BPMNShape id="TextAnnotation_1cled7l_di" bpmnElement="TextAnnotation_1cled7l"> + <dc:Bounds x="1030" y="353" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0ko681m_di" bpmnElement="SelectPongTarget"> - <dc:Bounds x="1940" y="270" width="100" height="80" /> + <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> + <dc:Bounds x="1610" y="520" width="275" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1r1hob1" bpmnElement="Gateway_1ggdr8l" isMarkerVisible="true"> - <dc:Bounds x="1725" y="285" width="50" height="50" /> + <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> + <dc:Bounds x="1370" y="544" width="170" height="40" /> + <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1h1lrei_di" bpmnElement="Activity_005ywv2"> - <dc:Bounds x="2120" y="270" width="100" height="80" /> + <dc:Bounds x="2040" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0eiy9fm_di" bpmnElement="Gateway_0eiy9fm" isMarkerVisible="true"> - <dc:Bounds x="2305" y="285" width="50" height="50" /> + <dc:Bounds x="2225" y="285" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_12p2jrx_di" bpmnElement="Gateway_1l5dkpz"> - <dc:Bounds x="2305" y="385" width="50" height="50" /> + <dc:Bounds x="2225" y="385" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1xvd4tr_di" bpmnElement="Event_1xvd4tr"> - <dc:Bounds x="2552" y="392" width="36" height="36" /> + <dc:Bounds x="2472" y="392" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2551" y="438" width="42" height="14" /> + <dc:Bounds x="2471" y="438" width="42" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0o4l2t4_di" bpmnElement="Event_0o4l2t4"> - <dc:Bounds x="2552" y="482" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> - <dc:Bounds x="1115" y="435" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1imd3tw_di" bpmnElement="Activity_1umihbr"> - <dc:Bounds x="1000" y="540" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_05zzvx3_di" bpmnElement="Event_1qh25on"> - <dc:Bounds x="2022" y="595" width="36" height="36" /> + <dc:Bounds x="2472" y="482" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> - <dc:Bounds x="2820" y="270" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1m4wavi_di" bpmnElement="Activity_1m4wavi"> - <dc:Bounds x="1250" y="420" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_06klx97_di" bpmnElement="Activity_0xcqxjs"> - <dc:Bounds x="1570" y="420" width="100" height="80" /> + <dc:Bounds x="2740" y="270" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> - <dc:Bounds x="430" y="270" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> - <dc:Bounds x="590" y="270" width="100" height="80" /> + <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> + <dc:Bounds x="3012" y="292" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1wktaap_di" bpmnElement="Gateway_1wktaap" isMarkerVisible="true"> - <dc:Bounds x="2845" y="385" width="50" height="50" /> + <dc:Bounds x="2765" y="385" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0ntyg74_di" bpmnElement="Activity_1gd1tfz"> - <dc:Bounds x="2670" y="370" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> - <dc:Bounds x="970" y="420" width="100" height="80" /> + <dc:Bounds x="2590" y="370" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0e5vsn7_di" bpmnElement="Activity_1wt8irk"> - <dc:Bounds x="2670" y="460" width="100" height="80" /> + <dc:Bounds x="2590" y="460" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> - <dc:Bounds x="440" y="80" width="420" height="70" /> + <bpmndi:BPMNShape id="Activity_0ff4lt7_di" bpmnElement="Activity_0lxtmlg"> + <dc:Bounds x="2870" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1cled7l_di" bpmnElement="TextAnnotation_1cled7l"> - <dc:Bounds x="860" y="353" width="170" height="37" /> + <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> + <dc:Bounds x="360" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> - <dc:Bounds x="2070" y="439" width="250" height="84" /> + <dc:Bounds x="1990" y="439" width="250" height="84" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> - <dc:Bounds x="3020" y="439" width="200" height="41" /> + <dc:Bounds x="2940" y="439" width="200" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> - <dc:Bounds x="1580" y="543" width="275" height="41" /> + <bpmndi:BPMNShape id="BPMNShape_1bdbmbf" bpmnElement="TextAnnotation_14ea4yc"> + <dc:Bounds x="480" y="183" width="585" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> - <dc:Bounds x="1200" y="544" width="170" height="40" /> + <bpmndi:BPMNShape id="Gateway_1jwjxzn_di" bpmnElement="Gateway_1jwjxzn" isMarkerVisible="true"> + <dc:Bounds x="905" y="285" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_095j2gg_di" bpmnElement="Activity_095j2gg"> + <dc:Bounds x="980" y="420" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1bdbmbf" bpmnElement="TextAnnotation_14ea4yc"> - <dc:Bounds x="560" y="183" width="585" height="70" /> + <bpmndi:BPMNShape id="BPMNShape_1r1hob1" bpmnElement="Gateway_1ggdr8l" isMarkerVisible="true"> + <dc:Bounds x="1895" y="285" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> + <dc:Bounds x="1285" y="435" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1imd3tw_di" bpmnElement="Activity_1umihbr"> + <dc:Bounds x="1170" y="540" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> - <dc:Bounds x="3092" y="292" width="36" height="36" /> + <bpmndi:BPMNShape id="Activity_1m4wavi_di" bpmnElement="Activity_1m4wavi"> + <dc:Bounds x="1420" y="420" width="100" height="80" /> + <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0ff4lt7_di" bpmnElement="Activity_0lxtmlg"> - <dc:Bounds x="2950" y="270" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_06klx97_di" bpmnElement="Activity_0xcqxjs"> + <dc:Bounds x="1740" y="420" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> + <dc:Bounds x="1140" y="420" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1m1s18a" bpmnElement="Activity_02rqshk"> - <dc:Bounds x="260" y="270" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_0pjdm6v_di" bpmnElement="Activity_1kb1v81"> + <dc:Bounds x="1590" y="600" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_022yft3" bpmnElement="Activity_0n0we3y"> + <dc:Bounds x="750" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0nbrkyz" bpmnElement="Event_11q3y8a"> + <dc:Bounds x="832" y="595" width="36" height="36" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> <dc:Bounds x="152" y="292" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="160" y="335" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="SelectPongTargetErrorBoundaryEvent"> - <dc:Bounds x="2022" y="332" width="36" height="36" /> + <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> + <dc:Bounds x="430" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> + <dc:Bounds x="590" y="270" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1m1s18a" bpmnElement="Activity_02rqshk"> + <dc:Bounds x="260" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> + <di:waypoint x="1052" y="420" /> + <di:waypoint x="1068" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> + <di:waypoint x="1458" y="544" /> + <di:waypoint x="1464" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> + <di:waypoint x="1740" y="491" /> + <di:waypoint x="1694" y="520" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_0xroqjg_di" bpmnElement="Event_0c5a0v4"> + <dc:Bounds x="1502" y="482" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2060" y="363" width="87" height="14" /> + <dc:Bounds x="1542" y="476" width="76" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_14ee8kb" bpmnElement="Event_0olr5yw"> - <dc:Bounds x="892" y="482" width="36" height="36" /> + <dc:Bounds x="1062" y="482" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="770" y="516" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> - <di:waypoint x="760" y="335" /> - <di:waypoint x="760" y="460" /> - <di:waypoint x="810" y="460" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_08gidyv_di" bpmnElement="Flow_08gidyv"> - <di:waypoint x="785" y="310" /> - <di:waypoint x="1725" y="310" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1eass2g_di" bpmnElement="Flow_1eass2g"> - <di:waypoint x="2040" y="310" /> - <di:waypoint x="2120" y="310" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0gvrnxd_di" bpmnElement="Flow_0gvrnxd"> - <di:waypoint x="1670" y="460" /> - <di:waypoint x="1750" y="460" /> - <di:waypoint x="1750" y="335" /> - </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="BPMNShape_1jslfi1" bpmnElement="Event_1jkcqo6"> + <dc:Bounds x="832" y="332" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="746" y="373" width="87" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Flow_1o3n9u6_di" bpmnElement="Flow_1o3n9u6"> - <di:waypoint x="1775" y="310" /> - <di:waypoint x="1940" y="310" /> + <di:waypoint x="1945" y="310" /> + <di:waypoint x="2040" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fzmjzb_di" bpmnElement="Flow_0fzmjzb"> - <di:waypoint x="2220" y="310" /> - <di:waypoint x="2305" y="310" /> + <di:waypoint x="2140" y="310" /> + <di:waypoint x="2225" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0h8flp6_di" bpmnElement="Flow_0h8flp6"> - <di:waypoint x="2355" y="310" /> - <di:waypoint x="2820" y="310" /> + <di:waypoint x="2275" y="310" /> + <di:waypoint x="2740" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1bzjspe_di" bpmnElement="Flow_1bzjspe"> - <di:waypoint x="2330" y="335" /> - <di:waypoint x="2330" y="385" /> + <di:waypoint x="2250" y="335" /> + <di:waypoint x="2250" y="385" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_00t1ck1_di" bpmnElement="Flow_00t1ck1"> - <di:waypoint x="2330" y="285" /> - <di:waypoint x="2330" y="250" /> - <di:waypoint x="2870" y="250" /> - <di:waypoint x="2870" y="270" /> + <di:waypoint x="2250" y="285" /> + <di:waypoint x="2250" y="250" /> + <di:waypoint x="2790" y="250" /> + <di:waypoint x="2790" y="270" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0rj915n_di" bpmnElement="Flow_0rj915n"> - <di:waypoint x="2355" y="410" /> - <di:waypoint x="2552" y="410" /> + <di:waypoint x="2275" y="410" /> + <di:waypoint x="2472" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_17x98wg_di" bpmnElement="Flow_17x98wg"> - <di:waypoint x="2330" y="435" /> - <di:waypoint x="2330" y="500" /> - <di:waypoint x="2552" y="500" /> + <di:waypoint x="2250" y="435" /> + <di:waypoint x="2250" y="500" /> + <di:waypoint x="2472" y="500" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> - <di:waypoint x="1100" y="580" /> - <di:waypoint x="1140" y="580" /> - <di:waypoint x="1140" y="485" /> + <bpmndi:BPMNEdge id="Flow_0zib7wr_di" bpmnElement="Flow_0zib7wr"> + <di:waypoint x="2840" y="310" /> + <di:waypoint x="2870" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0x7t1ii_di" bpmnElement="Flow_0x7t1ii"> - <di:waypoint x="1165" y="460" /> - <di:waypoint x="1250" y="460" /> + <bpmndi:BPMNEdge id="Flow_1xfk4ds_di" bpmnElement="Flow_1xfk4ds"> + <di:waypoint x="2508" y="500" /> + <di:waypoint x="2590" y="500" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0uj7rm3_di" bpmnElement="Flow_0uj7rm3"> - <di:waypoint x="910" y="518" /> - <di:waypoint x="910" y="580" /> - <di:waypoint x="1000" y="580" /> + <bpmndi:BPMNEdge id="Flow_1ttsk1o_di" bpmnElement="Flow_1ttsk1o"> + <di:waypoint x="2508" y="410" /> + <di:waypoint x="2590" y="410" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0yr2pmf_di" bpmnElement="Flow_0yr2pmf"> - <di:waypoint x="2040" y="368" /> - <di:waypoint x="2040" y="595" /> + <bpmndi:BPMNEdge id="Flow_1eh8lho_di" bpmnElement="Flow_1eh8lho"> + <di:waypoint x="2690" y="410" /> + <di:waypoint x="2765" y="410" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> - <di:waypoint x="1350" y="460" /> - <di:waypoint x="1570" y="460" /> + <bpmndi:BPMNEdge id="Flow_1lfcycx_di" bpmnElement="Flow_1lfcycx"> + <di:waypoint x="2790" y="385" /> + <di:waypoint x="2790" y="350" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> - <di:waypoint x="530" y="310" /> - <di:waypoint x="590" y="310" /> + <bpmndi:BPMNEdge id="Flow_1n4fb8d_di" bpmnElement="Flow_1n4fb8d"> + <di:waypoint x="2690" y="500" /> + <di:waypoint x="2790" y="500" /> + <di:waypoint x="2790" y="435" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0i7mizy_di" bpmnElement="Flow_0i7mizy"> - <di:waypoint x="690" y="310" /> - <di:waypoint x="735" y="310" /> + <bpmndi:BPMNEdge id="Flow_1bgedez_di" bpmnElement="Flow_1bgedez"> + <di:waypoint x="2970" y="310" /> + <di:waypoint x="3012" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> - <di:waypoint x="188" y="310" /> - <di:waypoint x="260" y="310" /> + <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> + <di:waypoint x="2076" y="350" /> + <di:waypoint x="2045" y="439" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0zib7wr_di" bpmnElement="Flow_0zib7wr"> - <di:waypoint x="2920" y="310" /> - <di:waypoint x="2950" y="310" /> + <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> + <di:waypoint x="2838" y="346" /> + <di:waypoint x="2964" y="439" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1xfk4ds_di" bpmnElement="Flow_1xfk4ds"> - <di:waypoint x="2588" y="500" /> - <di:waypoint x="2670" y="500" /> + <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> + <di:waypoint x="930" y="335" /> + <di:waypoint x="930" y="460" /> + <di:waypoint x="980" y="460" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1ttsk1o_di" bpmnElement="Flow_1ttsk1o"> - <di:waypoint x="2588" y="410" /> - <di:waypoint x="2670" y="410" /> + <bpmndi:BPMNEdge id="Flow_08gidyv_di" bpmnElement="Flow_08gidyv"> + <di:waypoint x="955" y="310" /> + <di:waypoint x="1895" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1eh8lho_di" bpmnElement="Flow_1eh8lho"> - <di:waypoint x="2770" y="410" /> - <di:waypoint x="2845" y="410" /> + <bpmndi:BPMNEdge id="Flow_0crmxc2_di" bpmnElement="Flow_0crmxc2"> + <di:waypoint x="1080" y="460" /> + <di:waypoint x="1140" y="460" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1lfcycx_di" bpmnElement="Flow_1lfcycx"> - <di:waypoint x="2870" y="385" /> - <di:waypoint x="2870" y="350" /> + <bpmndi:BPMNEdge id="Flow_0gvrnxd_di" bpmnElement="Flow_0gvrnxd"> + <di:waypoint x="1840" y="460" /> + <di:waypoint x="1920" y="460" /> + <di:waypoint x="1920" y="335" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0crmxc2_di" bpmnElement="Flow_0crmxc2"> - <di:waypoint x="910" y="460" /> - <di:waypoint x="970" y="460" /> + <bpmndi:BPMNEdge id="Flow_0dp8f59_di" bpmnElement="Flow_0dp8f59"> + <di:waypoint x="1690" y="640" /> + <di:waypoint x="1920" y="640" /> + <di:waypoint x="1920" y="335" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0yujsot_di" bpmnElement="Flow_0yujsot"> - <di:waypoint x="1070" y="460" /> - <di:waypoint x="1115" y="460" /> + <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> + <di:waypoint x="1270" y="580" /> + <di:waypoint x="1310" y="580" /> + <di:waypoint x="1310" y="485" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1n4fb8d_di" bpmnElement="Flow_1n4fb8d"> - <di:waypoint x="2770" y="500" /> - <di:waypoint x="2870" y="500" /> - <di:waypoint x="2870" y="435" /> + <bpmndi:BPMNEdge id="Flow_0yujsot_di" bpmnElement="Flow_0yujsot"> + <di:waypoint x="1240" y="460" /> + <di:waypoint x="1285" y="460" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> - <di:waypoint x="882" y="420" /> - <di:waypoint x="898" y="390" /> + <bpmndi:BPMNEdge id="Flow_0x7t1ii_di" bpmnElement="Flow_0x7t1ii"> + <di:waypoint x="1335" y="460" /> + <di:waypoint x="1420" y="460" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> - <di:waypoint x="2156" y="350" /> - <di:waypoint x="2125" y="439" /> + <bpmndi:BPMNEdge id="Flow_0uj7rm3_di" bpmnElement="Flow_0uj7rm3"> + <di:waypoint x="1080" y="518" /> + <di:waypoint x="1080" y="580" /> + <di:waypoint x="1170" y="580" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2918" y="346" /> - <di:waypoint x="3044" y="439" /> + <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> + <di:waypoint x="1520" y="460" /> + <di:waypoint x="1740" y="460" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> - <di:waypoint x="1288" y="544" /> - <di:waypoint x="1294" y="500" /> + <bpmndi:BPMNEdge id="Flow_0mgrru4_di" bpmnElement="Flow_0mgrru4"> + <di:waypoint x="1520" y="518" /> + <di:waypoint x="1520" y="640" /> + <di:waypoint x="1590" y="640" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> - <di:waypoint x="1624" y="500" /> - <di:waypoint x="1629" y="543" /> + <bpmndi:BPMNEdge id="BPMNEdge_0jfh43l" bpmnElement="Flow_0qxt5zo"> + <di:waypoint x="850" y="368" /> + <di:waypoint x="850" y="595" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1bgedez_di" bpmnElement="Flow_1bgedez"> - <di:waypoint x="3050" y="310" /> - <di:waypoint x="3092" y="310" /> + <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> + <di:waypoint x="188" y="310" /> + <di:waypoint x="260" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1j5lf0u_di" bpmnElement="Flow_1j5lf0u"> <di:waypoint x="360" y="310" /> <di:waypoint x="430" y="310" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> + <di:waypoint x="530" y="310" /> + <di:waypoint x="590" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1fzloso_di" bpmnElement="Flow_1fzloso"> + <di:waypoint x="690" y="310" /> + <di:waypoint x="750" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1gap0hi_di" bpmnElement="Flow_1gap0hi"> + <di:waypoint x="850" y="310" /> + <di:waypoint x="905" y="310" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index f05d5c2b..a021340a 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -30,8 +30,8 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="3" /> - <max value="5" /> + <min value="2" /> + <max value="4" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index c9f431ae..ffe47756 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -121,6 +121,41 @@ <min value="1" /> <fixedCode value="download-resource-size-bytes" /> </element> + <element id="Task.output:error-message"> + <path value="Task.output"/> + <sliceName value="error-message"/> + <min value="0"/> + </element> + <element id="Task.output:error-message.type"> + <path value="Task.output.type"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.output:error-message.type.coding"> + <path value="Task.output.type.coding" /> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.output:error-message.type.coding.system"> + <path value="Task.output.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + </element> + <element id="Task.output:error-message.type.coding.code"> + <path value="Task.output.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="error-message" /> + </element> + <element id="Task.output:error-message.value[x]"> + <path value="Task.output.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="string"/> + </type> + </element> <element id="Task.output:ping-status"> <path value="Task.output"/> <sliceName value="ping-status"/> diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 24e9fb71..90c383a9 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -192,6 +192,21 @@ public void testTaskStartPingProcessProfileValid() throws Exception || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + @Test + public void testTaskStartPingProcessProfileValidWithErrorMessages() throws Exception + { + Task task = createValidTaskStartPingProcess(); + + dev.dsf.bpe.util.task.output.generator.ErrorMessageGenerator.create(List.of("Foo", "Bar")) + .forEach(task::addOutput); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + @Test public void testTaskStartPingProcessProfileValidWithTargetEndpoints() throws Exception { From afa0474be5105303bf13cc77db6aafd325f63bcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 20 Mar 2025 17:35:16 +0100 Subject: [PATCH 270/382] Fixed nullpointer --- .../dsf/bpe/service/pong/EstimateCleanupTimerDuration.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java index 810a39e0..49fffc6f 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java @@ -1,6 +1,7 @@ package dev.dsf.bpe.service.pong; import java.time.Duration; +import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -25,8 +26,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Estimating cleanup timer duration..."); final long minTimerDurationMillis = 20000; - long downloadedDurationMillis = variables - .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); + long downloadedDurationMillis = Optional + .ofNullable(variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis())) + .orElse(0L); long timerDurationMillis = downloadedDurationMillis > Long.MAX_VALUE / 10 - minTimerDurationMillis ? Long.MAX_VALUE : downloadedDurationMillis * 10 + minTimerDurationMillis; From fa728d6f86a42f6b4f5b312172691bb4da1d68cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 21 Mar 2025 09:35:47 +0100 Subject: [PATCH 271/382] Removed unused import --- .../dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 7a7a4267..6692790d 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -1,7 +1,5 @@ package dev.dsf.bpe.service.pong; -import java.util.NoSuchElementException; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; From f3d43534d45539eee229dc71b7f1f80598ffd795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 21 Mar 2025 09:40:00 +0100 Subject: [PATCH 272/382] Improved error messages. If the exception was a WebApplicationException and didn't carry any message, the error message in the status output would read something along the lines of "Error message empty" because there wasn't any message provided to the BPMN error that is thrown if downloadResult contains an error message --- .../dsf/bpe/util/BinaryResourceDownloader.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 5264935b..39179fad 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -11,6 +11,7 @@ import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Variables; +import jakarta.ws.rs.WebApplicationException; public class BinaryResourceDownloader { @@ -60,14 +61,23 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t } catch (IOException e) { - logger.error("Encountered an error while downloading resource: {}", e.getMessage()); - downloadResult = new DownloadResult(e.getMessage()); + String error = "Encountered an error while downloading resource: " + e.getMessage(); + logger.error(error); + downloadResult = new DownloadResult(error); } } + catch (WebApplicationException e) + { + String error = "Encountered an error while trying to download resource: " + + e.getResponse().getStatusInfo().getStatusCode() + " " + e.getMessage(); + logger.error(error); + downloadResult = new DownloadResult(error); + } catch (Exception e) { - logger.error("Encountered an error while trying to download resource: {}", e.getMessage()); - downloadResult = new DownloadResult(e.getMessage()); + String error = "Encountered an error while trying to download resource: " + e.getMessage(); + logger.error(error); + downloadResult = new DownloadResult(error); } return downloadResult; } From bcbe516ecfe5c9b4b08a5edaefcdc321ab6d3d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 21 Mar 2025 11:33:12 +0100 Subject: [PATCH 273/382] Added information on ping-ping v2.x --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 0d055bce..8017bfc2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ In this repository you will find the ping-pong process for connection testing, which can be deployed on the [DSF](https://github.com/datasharingframework/dsf). +## Version 2.x release +Version 2.x of the ping-pong process (dubbed "Fat-Ping") includes the ability to test whether downloading FHIR resources from other DSF instances is possible. This also includes approximately measuring the network speed of resource downloads with larger download sizes (~100MB) returning more accurate results. It retains the ability to make connection tests without downloading resource like ping-pong 1.x. Documentation on configuration is available in the (wiki)[https://github.com/datasharingframework/dsf-process-ping-pong/wiki]. + ## Development Branching follows the git-flow model, for the latest development version see branch [develop](https://github.com/datasharingframework/dsf-process-ping-pong/tree/develop). From 7682fce0f619fe8dc79aa55dda34a20d78030166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 21 Mar 2025 11:36:24 +0100 Subject: [PATCH 274/382] Fixed parenthesis --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8017bfc2..be2f66d6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ In this repository you will find the ping-pong process for connection testing, which can be deployed on the [DSF](https://github.com/datasharingframework/dsf). ## Version 2.x release -Version 2.x of the ping-pong process (dubbed "Fat-Ping") includes the ability to test whether downloading FHIR resources from other DSF instances is possible. This also includes approximately measuring the network speed of resource downloads with larger download sizes (~100MB) returning more accurate results. It retains the ability to make connection tests without downloading resource like ping-pong 1.x. Documentation on configuration is available in the (wiki)[https://github.com/datasharingframework/dsf-process-ping-pong/wiki]. +Version 2.x of the ping-pong process (dubbed "Fat-Ping") includes the ability to test whether downloading FHIR resources from other DSF instances is possible. This also includes approximately measuring the network speed of resource downloads with larger download sizes (~100MB) returning more accurate results. It retains the ability to make connection tests without downloading resource like ping-pong 1.x. Documentation on configuration is available in the [wiki](https://github.com/datasharingframework/dsf-process-ping-pong/wiki). ## Development Branching follows the git-flow model, for the latest development version see branch [develop](https://github.com/datasharingframework/dsf-process-ping-pong/tree/develop). From 77889ec6efe1e4885ed4626003dbb768e3b7d532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 21 Mar 2025 17:19:03 +0100 Subject: [PATCH 275/382] Added missing error code to error boundary event --- src/main/resources/bpe/pong.bpmn | 278 +++++++++++++++---------------- 1 file changed, 139 insertions(+), 139 deletions(-) diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 86799b38..1fae2a96 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -218,21 +218,25 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:message id="Message_2m36ftq" name="cleanupPong" /> <bpmn:error id="Error_1jmenbm" name="resourceDownloadError" errorCode="resourceDownloadError" /> <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> - <bpmn:error id="Error_0y0cd8c" name="resourceUploadError" /> + <bpmn:error id="Error_0y0cd8c" name="resourceUploadError" errorCode="resourceUploadError" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_pong"> - <bpmndi:BPMNShape id="TextAnnotation_1cled7l_di" bpmnElement="TextAnnotation_1cled7l"> - <dc:Bounds x="1030" y="353" width="170" height="37" /> - <bpmndi:BPMNLabel /> + <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> + <dc:Bounds x="152" y="292" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="335" width="21" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> - <dc:Bounds x="1610" y="520" width="275" height="41" /> - <bpmndi:BPMNLabel /> + <bpmndi:BPMNShape id="Gateway_1jwjxzn_di" bpmnElement="Gateway_1jwjxzn" isMarkerVisible="true"> + <dc:Bounds x="905" y="285" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> - <dc:Bounds x="1370" y="544" width="170" height="40" /> + <bpmndi:BPMNShape id="Activity_095j2gg_di" bpmnElement="Activity_095j2gg"> + <dc:Bounds x="980" y="420" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_1r1hob1" bpmnElement="Gateway_1ggdr8l" isMarkerVisible="true"> + <dc:Bounds x="1895" y="285" width="50" height="50" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1h1lrei_di" bpmnElement="Activity_005ywv2"> <dc:Bounds x="2040" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -252,9 +256,30 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Event_0o4l2t4_di" bpmnElement="Event_0o4l2t4"> <dc:Bounds x="2472" y="482" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> + <dc:Bounds x="1285" y="435" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1imd3tw_di" bpmnElement="Activity_1umihbr"> + <dc:Bounds x="1170" y="540" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0pmiy6i_di" bpmnElement="Activity_0otptjn"> <dc:Bounds x="2740" y="270" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1m4wavi_di" bpmnElement="Activity_1m4wavi"> + <dc:Bounds x="1420" y="420" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_06klx97_di" bpmnElement="Activity_0xcqxjs"> + <dc:Bounds x="1740" y="420" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> + <dc:Bounds x="430" y="270" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> + <dc:Bounds x="590" y="270" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0i1din5_di" bpmnElement="Event_0i1din5"> <dc:Bounds x="3012" y="292" width="36" height="36" /> </bpmndi:BPMNShape> @@ -265,6 +290,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2590" y="370" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> + <dc:Bounds x="1140" y="420" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0e5vsn7_di" bpmnElement="Activity_1wt8irk"> <dc:Bounds x="2590" y="460" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -273,90 +302,55 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2870" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> - <dc:Bounds x="360" y="80" width="420" height="70" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> - <dc:Bounds x="1990" y="439" width="250" height="84" /> + <bpmndi:BPMNShape id="BPMNShape_1m1s18a" bpmnElement="Activity_02rqshk"> + <dc:Bounds x="260" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> - <dc:Bounds x="2940" y="439" width="200" height="41" /> + <bpmndi:BPMNShape id="Activity_0pjdm6v_di" bpmnElement="Activity_1kb1v81"> + <dc:Bounds x="1590" y="600" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1bdbmbf" bpmnElement="TextAnnotation_14ea4yc"> - <dc:Bounds x="480" y="183" width="585" height="70" /> + <bpmndi:BPMNShape id="BPMNShape_022yft3" bpmnElement="Activity_0n0we3y"> + <dc:Bounds x="750" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_1jwjxzn_di" bpmnElement="Gateway_1jwjxzn" isMarkerVisible="true"> - <dc:Bounds x="905" y="285" width="50" height="50" /> + <bpmndi:BPMNShape id="BPMNShape_0nbrkyz" bpmnElement="Event_11q3y8a"> + <dc:Bounds x="832" y="595" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_095j2gg_di" bpmnElement="Activity_095j2gg"> - <dc:Bounds x="980" y="420" width="100" height="80" /> + <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> + <dc:Bounds x="360" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1r1hob1" bpmnElement="Gateway_1ggdr8l" isMarkerVisible="true"> - <dc:Bounds x="1895" y="285" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> - <dc:Bounds x="1285" y="435" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1imd3tw_di" bpmnElement="Activity_1umihbr"> - <dc:Bounds x="1170" y="540" width="100" height="80" /> + <bpmndi:BPMNShape id="TextAnnotation_1cled7l_di" bpmnElement="TextAnnotation_1cled7l"> + <dc:Bounds x="1030" y="353" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1m4wavi_di" bpmnElement="Activity_1m4wavi"> - <dc:Bounds x="1420" y="420" width="100" height="80" /> + <bpmndi:BPMNShape id="TextAnnotation_1o7v81w_di" bpmnElement="TextAnnotation_1o7v81w"> + <dc:Bounds x="1990" y="439" width="250" height="84" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_06klx97_di" bpmnElement="Activity_0xcqxjs"> - <dc:Bounds x="1740" y="420" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> - <dc:Bounds x="1140" y="420" width="100" height="80" /> + <bpmndi:BPMNShape id="TextAnnotation_17fzn7d_di" bpmnElement="TextAnnotation_17fzn7d"> + <dc:Bounds x="2940" y="439" width="200" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0pjdm6v_di" bpmnElement="Activity_1kb1v81"> - <dc:Bounds x="1590" y="600" width="100" height="80" /> + <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> + <dc:Bounds x="1610" y="520" width="275" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_022yft3" bpmnElement="Activity_0n0we3y"> - <dc:Bounds x="750" y="270" width="100" height="80" /> + <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> + <dc:Bounds x="1370" y="544" width="170" height="40" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0nbrkyz" bpmnElement="Event_11q3y8a"> - <dc:Bounds x="832" y="595" width="36" height="36" /> + <bpmndi:BPMNShape id="BPMNShape_1bdbmbf" bpmnElement="TextAnnotation_14ea4yc"> + <dc:Bounds x="480" y="183" width="585" height="70" /> + <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="PingMessageStartEvent"> - <dc:Bounds x="152" y="292" width="36" height="36" /> + <bpmndi:BPMNShape id="BPMNShape_1jslfi1" bpmnElement="Event_1jkcqo6"> + <dc:Bounds x="832" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="160" y="335" width="21" height="14" /> + <dc:Bounds x="746" y="373" width="87" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> - <dc:Bounds x="430" y="270" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1u5xx7p_di" bpmnElement="Activity_13ypt7i"> - <dc:Bounds x="590" y="270" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1m1s18a" bpmnElement="Activity_02rqshk"> - <dc:Bounds x="260" y="270" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> - <di:waypoint x="1052" y="420" /> - <di:waypoint x="1068" y="390" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> - <di:waypoint x="1458" y="544" /> - <di:waypoint x="1464" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> - <di:waypoint x="1740" y="491" /> - <di:waypoint x="1694" y="520" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_0xroqjg_di" bpmnElement="Event_0c5a0v4"> <dc:Bounds x="1502" y="482" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -369,12 +363,20 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="770" y="516" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_1jslfi1" bpmnElement="Event_1jkcqo6"> - <dc:Bounds x="832" y="332" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="746" y="373" width="87" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> + <di:waypoint x="930" y="335" /> + <di:waypoint x="930" y="460" /> + <di:waypoint x="980" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_08gidyv_di" bpmnElement="Flow_08gidyv"> + <di:waypoint x="955" y="310" /> + <di:waypoint x="1895" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0gvrnxd_di" bpmnElement="Flow_0gvrnxd"> + <di:waypoint x="1840" y="460" /> + <di:waypoint x="1920" y="460" /> + <di:waypoint x="1920" y="335" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1o3n9u6_di" bpmnElement="Flow_1o3n9u6"> <di:waypoint x="1945" y="310" /> <di:waypoint x="2040" y="310" /> @@ -406,6 +408,32 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2250" y="500" /> <di:waypoint x="2472" y="500" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> + <di:waypoint x="1270" y="580" /> + <di:waypoint x="1310" y="580" /> + <di:waypoint x="1310" y="485" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0x7t1ii_di" bpmnElement="Flow_0x7t1ii"> + <di:waypoint x="1335" y="460" /> + <di:waypoint x="1420" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0uj7rm3_di" bpmnElement="Flow_0uj7rm3"> + <di:waypoint x="1080" y="518" /> + <di:waypoint x="1080" y="580" /> + <di:waypoint x="1170" y="580" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> + <di:waypoint x="1520" y="460" /> + <di:waypoint x="1740" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> + <di:waypoint x="530" y="310" /> + <di:waypoint x="590" y="310" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> + <di:waypoint x="188" y="310" /> + <di:waypoint x="260" y="310" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0zib7wr_di" bpmnElement="Flow_0zib7wr"> <di:waypoint x="2840" y="310" /> <di:waypoint x="2870" y="310" /> @@ -426,89 +454,41 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2790" y="385" /> <di:waypoint x="2790" y="350" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1n4fb8d_di" bpmnElement="Flow_1n4fb8d"> - <di:waypoint x="2690" y="500" /> - <di:waypoint x="2790" y="500" /> - <di:waypoint x="2790" y="435" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1bgedez_di" bpmnElement="Flow_1bgedez"> - <di:waypoint x="2970" y="310" /> - <di:waypoint x="3012" y="310" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> - <di:waypoint x="2076" y="350" /> - <di:waypoint x="2045" y="439" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2838" y="346" /> - <di:waypoint x="2964" y="439" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> - <di:waypoint x="930" y="335" /> - <di:waypoint x="930" y="460" /> - <di:waypoint x="980" y="460" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_08gidyv_di" bpmnElement="Flow_08gidyv"> - <di:waypoint x="955" y="310" /> - <di:waypoint x="1895" y="310" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0crmxc2_di" bpmnElement="Flow_0crmxc2"> <di:waypoint x="1080" y="460" /> <di:waypoint x="1140" y="460" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0gvrnxd_di" bpmnElement="Flow_0gvrnxd"> - <di:waypoint x="1840" y="460" /> - <di:waypoint x="1920" y="460" /> - <di:waypoint x="1920" y="335" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0dp8f59_di" bpmnElement="Flow_0dp8f59"> - <di:waypoint x="1690" y="640" /> - <di:waypoint x="1920" y="640" /> - <di:waypoint x="1920" y="335" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> - <di:waypoint x="1270" y="580" /> - <di:waypoint x="1310" y="580" /> - <di:waypoint x="1310" y="485" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0yujsot_di" bpmnElement="Flow_0yujsot"> <di:waypoint x="1240" y="460" /> <di:waypoint x="1285" y="460" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0x7t1ii_di" bpmnElement="Flow_0x7t1ii"> - <di:waypoint x="1335" y="460" /> - <di:waypoint x="1420" y="460" /> + <bpmndi:BPMNEdge id="Flow_1n4fb8d_di" bpmnElement="Flow_1n4fb8d"> + <di:waypoint x="2690" y="500" /> + <di:waypoint x="2790" y="500" /> + <di:waypoint x="2790" y="435" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0uj7rm3_di" bpmnElement="Flow_0uj7rm3"> - <di:waypoint x="1080" y="518" /> - <di:waypoint x="1080" y="580" /> - <di:waypoint x="1170" y="580" /> + <bpmndi:BPMNEdge id="Flow_1bgedez_di" bpmnElement="Flow_1bgedez"> + <di:waypoint x="2970" y="310" /> + <di:waypoint x="3012" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> - <di:waypoint x="1520" y="460" /> - <di:waypoint x="1740" y="460" /> + <bpmndi:BPMNEdge id="Flow_1j5lf0u_di" bpmnElement="Flow_1j5lf0u"> + <di:waypoint x="360" y="310" /> + <di:waypoint x="430" y="310" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0mgrru4_di" bpmnElement="Flow_0mgrru4"> <di:waypoint x="1520" y="518" /> <di:waypoint x="1520" y="640" /> <di:waypoint x="1590" y="640" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0dp8f59_di" bpmnElement="Flow_0dp8f59"> + <di:waypoint x="1690" y="640" /> + <di:waypoint x="1920" y="640" /> + <di:waypoint x="1920" y="335" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0jfh43l" bpmnElement="Flow_0qxt5zo"> <di:waypoint x="850" y="368" /> <di:waypoint x="850" y="595" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_19b3cp4_di" bpmnElement="Flow_19b3cp4"> - <di:waypoint x="188" y="310" /> - <di:waypoint x="260" y="310" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1j5lf0u_di" bpmnElement="Flow_1j5lf0u"> - <di:waypoint x="360" y="310" /> - <di:waypoint x="430" y="310" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> - <di:waypoint x="530" y="310" /> - <di:waypoint x="590" y="310" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1fzloso_di" bpmnElement="Flow_1fzloso"> <di:waypoint x="690" y="310" /> <di:waypoint x="750" y="310" /> @@ -517,6 +497,26 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="850" y="310" /> <di:waypoint x="905" y="310" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> + <di:waypoint x="1052" y="420" /> + <di:waypoint x="1068" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> + <di:waypoint x="2076" y="350" /> + <di:waypoint x="2045" y="439" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> + <di:waypoint x="2838" y="346" /> + <di:waypoint x="2964" y="439" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> + <di:waypoint x="1458" y="544" /> + <di:waypoint x="1464" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> + <di:waypoint x="1740" y="491" /> + <di:waypoint x="1694" y="520" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From 9fcb2925769b4069c8495891ef5898d3c6b5a0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 21 Mar 2025 17:25:20 +0100 Subject: [PATCH 276/382] Added missing error code to error boundary event --- src/main/resources/bpe/ping.bpmn | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 25eabba1..9f1f5703 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -250,12 +250,9 @@ Save = save as execution variable Store = store on DSF FHIR server either as separate resource or output parameter</bpmn:text> </bpmn:textAnnotation> </bpmn:process> - <bpmn:error id="Error_0tkfq65" name="resourceUploadError" /> + <bpmn:error id="Error_0tkfq65" name="resourceUploadError" errorCode="resourceUploadError" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> - <bpmndi:BPMNShape id="Activity_0v585g9_di" bpmnElement="Activity_1ddl5dm"> - <dc:Bounds x="700" y="580" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> <dc:Bounds x="1040" y="180" width="1820" height="560" /> </bpmndi:BPMNShape> @@ -473,6 +470,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="260" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0v585g9_di" bpmnElement="Activity_1ddl5dm"> + <dc:Bounds x="700" y="580" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> <dc:Bounds x="2990" y="239" width="160" height="49" /> <bpmndi:BPMNLabel /> @@ -541,6 +541,16 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="188" y="360" /> <di:waypoint x="260" y="360" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0ql2dtr_di" bpmnElement="Flow_0ql2dtr"> + <di:waypoint x="630" y="558" /> + <di:waypoint x="630" y="620" /> + <di:waypoint x="700" y="620" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0ejw9k5_di" bpmnElement="Flow_0ejw9k5"> + <di:waypoint x="800" y="620" /> + <di:waypoint x="840" y="620" /> + <di:waypoint x="840" y="385" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> <di:waypoint x="539" y="540" /> <di:waypoint x="498" y="580" /> @@ -553,16 +563,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="3079" y="330" /> <di:waypoint x="3058" y="288" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0ql2dtr_di" bpmnElement="Flow_0ql2dtr"> - <di:waypoint x="630" y="558" /> - <di:waypoint x="630" y="620" /> - <di:waypoint x="700" y="620" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0ejw9k5_di" bpmnElement="Flow_0ejw9k5"> - <di:waypoint x="800" y="620" /> - <di:waypoint x="840" y="620" /> - <di:waypoint x="840" y="385" /> - </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From b57bbce70295d0f34eb342f6af5f47751b242388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 21 Mar 2025 17:31:04 +0100 Subject: [PATCH 277/382] v2.0.0.0-RC2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3cac3cdb..0904d48a 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ <groupId>dev.dsf</groupId> <artifactId>dsf-process-ping-pong</artifactId> - <version>2.0.0.0-RC1</version> + <version>2.0.0.0-RC2</version> <packaging>jar</packaging> <properties> From 3ac362c65fcd275739df0a110eb47969849bf8dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 4 Apr 2025 10:43:09 +0200 Subject: [PATCH 278/382] Set version to 2.0.0.0-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0904d48a..b69dde88 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ <groupId>dev.dsf</groupId> <artifactId>dsf-process-ping-pong</artifactId> - <version>2.0.0.0-RC2</version> + <version>2.0.0.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> From 94433541fe456855ec36486603e9ec0dccb22b15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 8 Apr 2025 16:21:13 +0200 Subject: [PATCH 279/382] Ping status now represents the status of the entire ping sub-process. This means it either is completed or errors occurred. The new values in CodeSystem dsf-ping-status.xml reflect that. This required changing all instances where the status gets set. Generally, the status should now only get set at the end of the process/sub-process instead of setting it multiple times during process execution. Additionally, introduced AggregateErrorMailService which can aggregate error messages into a list and send them all in one e-mail instead of sending one e-mail per error message like before --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 11 +-- .../bpe/mail/AggregateErrorMailService.java | 99 +++++++++++++++++++ .../dev/dsf/bpe/mail/ErrorMailService.java | 14 +-- .../java/dev/dsf/bpe/message/SendPing.java | 10 +- .../java/dev/dsf/bpe/message/SendPong.java | 6 +- .../service/ping/LogAndSaveNoResponse.java | 4 +- .../bpe/service/ping/LogAndSaveSendError.java | 5 +- .../dev/dsf/bpe/service/ping/SavePong.java | 4 +- .../dsf/bpe/service/ping/StoreResults.java | 88 +++++++---------- .../bpe/service/pong/StoreDownloadSpeed.java | 3 +- .../dev/dsf/bpe/service/pong/StoreErrors.java | 16 ++- .../dev/dsf/bpe/spring/config/PingConfig.java | 10 +- .../generator/ErrorMessageGenerator.java | 2 +- .../generator/ErrorMessageGenerator.java | 2 +- src/main/resources/bpe/ping.bpmn | 2 +- .../fhir/CodeSystem/dsf-ping-status.xml | 33 ++----- .../fhir/ValueSet/dsf-ping-status.xml | 16 --- .../fhir/ValueSet/dsf-pong-status.xml | 16 --- .../dsf/fhir/profiles/TaskProfileTest.java | 12 +-- 19 files changed, 195 insertions(+), 158 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 2eb4057e..6faefe87 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -55,15 +55,12 @@ private ConstantsPing() public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS = "downloaded-duration-millis"; public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES = "downloaded-bytes"; public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE = "download-resource-reference"; + public static final String CODESYSTEM_DSF_PING_VALUE_ERROR_MESSAGE = "error-message"; public static final String CODESYSTEM_DSF_PING_STATUS = "http://dsf.dev/fhir/CodeSystem/ping-status-v2"; - public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED = "not-allowed"; - public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE = "not-reachable"; - public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING = "pong-missing"; - public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED = "pong-received"; - public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT = "pong-sent"; - public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE = "error-message"; - public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_RESOURCE_DOWNLOADED = "resource-downloaded"; + public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED = "completed"; + public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PENDING = "pending"; + public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR = "error"; public static final String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units-v2"; public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; diff --git a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java new file mode 100644 index 00000000..c3831e87 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java @@ -0,0 +1,99 @@ +package dev.dsf.bpe.mail; + +import java.util.ArrayList; +import java.util.List; + +import org.hl7.fhir.r4.model.IdType; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.variables.Target; + +public class AggregateErrorMailService extends ErrorMailService +{ + private static final String MAIL_MESSAGE_INTRO = "Error(s) while executing ping-pong process:"; + private static final String PING_PROCESS_HAS_ERRORS = "Ping process has errors"; + + private List<String> errorMessages; + + public AggregateErrorMailService(ProcessPluginApi api, boolean sendPingProcessFailedMail, + boolean sendPongProcessFailedMail) + { + super(api, sendPingProcessFailedMail, sendPongProcessFailedMail); + errorMessages = new ArrayList<>(); + } + + public void addMessagePing(Target target, String message) + { + pingProcessErrorLogger.info("Ping process error: {}", message); + + if (sendPingProcessFailedMail) + { + errorMessages.add(createMessage(target, message, null)); + } + } + + public void addMessagePong(Target target, String message) + { + pongProcessErrorLogger.info("Pong process error: {}", message); + + if (sendPongProcessFailedMail) + { + errorMessages.add(createMessage(target, message, null)); + } + } + + public void send(IdType taskId) + { + if (!errorMessages.isEmpty()) + { + api.getMailService().send(PING_PROCESS_HAS_ERRORS, buildMailMessage(taskId)); + errorMessages = new ArrayList<>(); + } + } + + protected String buildMailMessage(IdType taskId) + { + StringBuilder mailMessage = new StringBuilder(); + + mailMessage.append(MAIL_MESSAGE_INTRO); + mailMessage.append("\n\n"); + + errorMessages.forEach(errorMessage -> + { + mailMessage.append(errorMessage); + mailMessage.append("\n\n"); + }); + + mailMessage.append("\nProcess started by: "); + mailMessage.append(taskId.toVersionless() + .withServerBase(api.getEndpointProvider().getLocalEndpointAddress(), "Task").getValue()); + + return mailMessage.toString(); + } + + protected String createMessage(Target target, String message, String messageDetails) + { + StringBuilder b = new StringBuilder(); + + b.append(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().orElse("?")); + b.append('/'); + b.append(api.getEndpointProvider().getLocalEndpointIdentifierValue().orElse("?")); + + b.append(" -> "); + + b.append(target.getOrganizationIdentifierValue()); + b.append('/'); + b.append(target.getEndpointIdentifierValue()); + + b.append(": "); + b.append(message); + + if (messageDetails != null) + { + b.append("\n\t"); + b.append(messageDetails); + } + + return b.toString(); + } +} diff --git a/src/main/java/dev/dsf/bpe/mail/ErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/ErrorMailService.java index b3366e01..4f3195be 100644 --- a/src/main/java/dev/dsf/bpe/mail/ErrorMailService.java +++ b/src/main/java/dev/dsf/bpe/mail/ErrorMailService.java @@ -12,16 +12,16 @@ public class ErrorMailService implements InitializingBean { - private static final Logger pingProcessErrorLogger = LoggerFactory.getLogger("ping-process-error-logger"); - private static final Logger pongProcessErrorLogger = LoggerFactory.getLogger("pong-process-error-logger"); + protected static final Logger pingProcessErrorLogger = LoggerFactory.getLogger("ping-process-error-logger"); + protected static final Logger pongProcessErrorLogger = LoggerFactory.getLogger("pong-process-error-logger"); - private static final String SUBJECT_PING_PROCESS_FAILED = "Ping Process Failed"; - private static final String SUBJECT_PONG_PROCESS_FAILED = "Pong Process Failed"; + protected static final String SUBJECT_PING_PROCESS_FAILED = "Ping Process Failed"; + protected static final String SUBJECT_PONG_PROCESS_FAILED = "Pong Process Failed"; - private final ProcessPluginApi api; + protected final ProcessPluginApi api; - private final boolean sendPingProcessFailedMail; - private final boolean sendPongProcessFailedMail; + protected final boolean sendPingProcessFailedMail; + protected final boolean sendPongProcessFailedMail; public ErrorMailService(ProcessPluginApi api, boolean sendPingProcessFailedMail, boolean sendPongProcessFailedMail) { diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index 1c9248b4..1b3a916b 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -57,15 +57,15 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab { Target target = variables.getTarget(); - String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null - && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() - ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED - : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; + String responseCode = exception instanceof WebApplicationException w && w.getResponse() != null + ? Response.Status.fromStatusCode(w.getResponse().getStatus()).toString() + : "unknown"; + String statusCode = ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR; execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); String specialErrorMessage = createErrorMessage(exception); execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableErrorMessage(), specialErrorMessage); - logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); + logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), responseCode); } @Override diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index 0c738c35..b1ff1afa 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -85,7 +85,6 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Target target = variables.getTarget(); Task mainTask = variables.getStartTask(); PingStatusGenerator.updatePongStatusOutput(mainTask, target); - PingStatusGenerator.updatePongStatusOutput(mainTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT); variables.updateTask(mainTask); super.doExecute(execution, variables); } @@ -99,9 +98,8 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab Task startTask = variables.getStartTask(); String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null - && w.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode() - ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED - : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE; + ? Response.Status.fromStatusCode(w.getResponse().getStatus()).toString() + : "unknown"; execution.setVariable(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); String specialErrorMessage = createErrorMessage(exception); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java index 28f6c6f1..4cc89c51 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java @@ -29,9 +29,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable String correlationKey = target.getCorrelationKey(); delegateExecution.removeVariable("statusCode"); variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING); + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); logger.debug("Saved '{}' to process execution for correlation key '{}'", - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING, correlationKey); + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR, correlationKey); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 11e7ec12..2d179a0f 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -23,14 +23,11 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(LogAndSaveSendError.class, variables.getStartTask()); String correlationKey = variables.getTarget().getCorrelationKey(); - String statusCode = (String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode()); String errorMessage = (String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableErrorMessage()); - variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), statusCode); ErrorMessageListUtils.add(errorMessage, execution, correlationKey); variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0); variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); - logger.debug("Saved error when trying to send ping message. Status: {}, error message: {}", statusCode, - errorMessage); + logger.debug("Saved error when trying to send ping message. Error message: {}", errorMessage); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 6528c336..93ce4ef5 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -35,8 +35,6 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Pong received from {}. Saving pong information...", target.getEndpointUrl()); String correlationKey = target.getCorrelationKey(); delegateExecution.removeVariable("statusCode"); - variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED); Task pong = variables.getLatestTask(); @@ -56,7 +54,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable List<String> errorList = api.getTaskHelper() .getInputParameterValues(pong, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE, StringType.class) + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR_MESSAGE, StringType.class) .map(PrimitiveType::getValue).map(string -> "Pong error: " + string).toList(); ErrorMessageListUtils.addAll(errorList, delegateExecution, correlationKey); diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index f79860a3..0c93e472 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -11,7 +11,7 @@ import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.mail.ErrorMailService; +import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; @@ -25,10 +25,10 @@ public class StoreResults extends AbstractServiceDelegate implements InitializingBean { - private final ErrorMailService errorMailService; + private final AggregateErrorMailService errorMailService; private final String networkSpeedUnit; - public StoreResults(ProcessPluginApi api, ErrorMailService errorMailService, String networkSpeedUnit) + public StoreResults(ProcessPluginApi api, AggregateErrorMailService errorMailService, String networkSpeedUnit) { super(api); this.networkSpeedUnit = networkSpeedUnit; @@ -59,66 +59,48 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw { String correlationKey = target.getCorrelationKey(); - String statusCode = variables.getString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey)); - if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode) - || ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statusCode)) + List<String> errors = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); + String statusCode = errors.isEmpty() ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED + : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR; + int downloadResourceSizeBytes = variables + .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + List<String> errorMessageList = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); + if (downloadResourceSizeBytes >= 0) // if fat-ping { - List<String> errorMessages = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); - String errorMessage = errorMessages.get(0); - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessages)); - - if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE.equals(statusCode)) - errorMailService.endpointNotReachableForPing(task.getIdElement(), target, errorMessage); - else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_ALLOWED.equals(statusCode)) - errorMailService.endpointReachablePingForbidden(task.getIdElement(), target, errorMessage); + Integer downloadedBytes = variables + .getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); + Long downloadedDurationMillis = variables + .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); + + BigDecimal downloadSpeed = downloadedBytes != null && downloadedDurationMillis != null + ? NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit) + : null; + + Integer uploadedBytes = variables + .getInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey)); + Long uploadedDurationMillis = variables + .getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey)); + + BigDecimal uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null + ? NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit) + : null; + + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList, + downloadSpeed, uploadSpeed, networkSpeedUnit)); } - else if (ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_MISSING.equals(statusCode)) + else // if slim-ping { - List<String> errorMessages = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessages)); - - errorMailService.pongMessageNotReceived(task.getIdElement(), target); - } - else - { - int downloadResourceSizeBytes = variables - .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); - List<String> errorMessageList = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); - if (downloadResourceSizeBytes >= 0) // if fat-ping - { - Integer downloadedBytes = variables - .getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); - Long downloadedDurationMillis = variables - .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); - - BigDecimal downloadSpeed = downloadedBytes != null && downloadedDurationMillis != null - ? NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, - networkSpeedUnit) - : null; - - Integer uploadedBytes = variables - .getInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey)); - Long uploadedDurationMillis = variables - .getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey)); - - BigDecimal uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null - ? NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit) - : null; - - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList, - downloadSpeed, uploadSpeed, networkSpeedUnit)); - } - else // if slim-ping - { - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode)); - } + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList)); } + errors.forEach(error -> errorMailService.addMessagePing(target, error)); }); // TODO only send one combined status mail variables.updateTask(task); + errorMailService.send(task.getIdElement()); + logger.debug("Successfully stored results for task {}", variables.getStartTask().getIdElement().getValue()); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index afc3d91d..00014aa1 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -38,8 +38,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit); - PingStatusGenerator.updatePongStatusOutput(startTask, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_RESOURCE_DOWNLOADED); + PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PENDING); PingStatusGenerator.updatePongStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); variables.updateTask(startTask); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java index 59e8a1a1..2cf75377 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java @@ -1,9 +1,12 @@ package dev.dsf.bpe.service.pong; +import java.util.List; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.ErrorMessageListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; @@ -25,7 +28,18 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(StoreErrors.class, startTask); logger.debug("Storing errors..."); - PingStatusGenerator.updatePongStatusOutput(startTask, ErrorMessageListUtils.getErrorMessageList(execution)); + List<String> errors = ErrorMessageListUtils.getErrorMessageList(execution); + PingStatusGenerator.updatePongStatusOutput(startTask, errors); + + if (!errors.isEmpty()) + { + PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); + } + else + { + PingStatusGenerator.updatePongStatusOutput(startTask, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED); + } variables.updateTask(startTask); logger.debug("Stored errors in task: " + startTask.getIdElement().getValue()); diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 164d6145..86df8c0b 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -9,7 +9,7 @@ import dev.dsf.bpe.listener.PingPongDeploymentStateListener; import dev.dsf.bpe.listener.SetCorrelationKeyListener; -import dev.dsf.bpe.mail.ErrorMailService; +import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.message.CleanupPong; import dev.dsf.bpe.message.SendPing; import dev.dsf.bpe.message.SendPong; @@ -46,11 +46,11 @@ public class PingConfig private ProcessPluginApi api; @ProcessDocumentation(description = "To enable a mail being sent if the ping process fails, set to 'true'. This requires the SMPT mail service client to be configured in the DSF", processNames = "dsfdev_ping") - @Value("${dev.dsf.dsf.bpe.ping.mail.onPingProcessFailed:false}") + @Value("${dev.dsf.bpe.ping.mail.onPingProcessFailed:false}") private boolean sendPingProcessFailedMail; @ProcessDocumentation(description = "To enable a mail being sent if the pong process fails, set to 'true'. This requires the SMPT mail service client to be configured in the DSF", processNames = "dsfdev_pong") - @Value("${dev.dsf.dsf.bpe.ping.mail.onPongProcessFailed:false}") + @Value("${dev.dsf.bpe.ping.mail.onPongProcessFailed:false}") private boolean sendPongProcessFailedMail; @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.", processNames = "dsfdev_ping, dsfdev_pong") @@ -112,9 +112,9 @@ public SendStartPing sendStartPing() } @Bean - public ErrorMailService errorLogger() + public AggregateErrorMailService errorLogger() { - return new ErrorMailService(api, sendPingProcessFailedMail, sendPongProcessFailedMail); + return new AggregateErrorMailService(api, sendPingProcessFailedMail, sendPongProcessFailedMail); } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java index d7c62b67..23287968 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java @@ -21,7 +21,7 @@ public static Task.ParameterComponent create(String errorMessage) { Task.ParameterComponent param = new Task.ParameterComponent(); param.setValue(new StringType(errorMessage)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE); + .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR_MESSAGE); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java index ab34226b..e8a30b3a 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java @@ -21,7 +21,7 @@ public static Task.TaskOutputComponent create(String errorMessage) { Task.TaskOutputComponent param = new Task.TaskOutputComponent(); param.setValue(new StringType(errorMessage)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR_MESSAGE); + .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR_MESSAGE); return param; } } diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 9f1f5703..80aad39a 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -125,7 +125,7 @@ <bpmn:sequenceFlow id="Flow_136htek" sourceRef="LogNoResponse" targetRef="Gateway_09z7b0z" /> <bpmn:sequenceFlow id="Flow_08vgmf6" sourceRef="Activity_0ri6fnv" targetRef="Gateway_0z5gz96" /> <bpmn:sequenceFlow id="Flow_101sqed" name="not-allowed or not-reachable" sourceRef="Gateway_0z5gz96" targetRef="Activity_0p5edt9"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && (statusCode == 'not-allowed' || statusCode == 'not-reachable')}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'error'}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1ho1hys" sourceRef="Gateway_09z7b0z" targetRef="SubProcessEndEvent" /> <bpmn:sequenceFlow id="Flow_13u1nzy" sourceRef="Gateway_0p0be0a" targetRef="Gateway_02orad4"> diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml index eed24337..2fe8cdc1 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml @@ -22,33 +22,18 @@ <versionNeeded value="false" /> <content value="complete" /> <concept> - <code value="not-allowed" /> - <display value="Not allowed" /> - <definition value="Not allowed to start pong-process at target organization" /> + <code value="completed" /> + <display value="Completed" /> + <definition value="Ping-pong was completed successfully" /> </concept> <concept> - <code value="not-reachable" /> - <display value="Not reachable" /> - <definition value="Ping could not be sent to target organization" /> + <code value="error" /> + <display value="Error" /> + <definition value="An error occurred during ping-pong process" /> </concept> <concept> - <code value="pong-missing" /> - <display value="Pong missing" /> - <definition value="No pong received from target organization" /> - </concept> - <concept> - <code value="pong-received" /> - <display value="Pong received" /> - <definition value="Pong received from target organization" /> - </concept> - <concept> - <code value="pong-sent" /> - <display value="Pong sent" /> - <definition value="Pong successfully sent to target organization" /> - </concept> - <concept> - <code value="resource-downloaded"/> - <display value="Resource downloaded"/> - <definition value="Resource was downloaded successfully"/> + <code value="pending"/> + <display value="Pending"/> + <definition value="Execution completion is still pending"/> </concept> </CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-status.xml b/src/main/resources/fhir/ValueSet/dsf-ping-status.xml index 9bed9fec..b315e52f 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping-status.xml +++ b/src/main/resources/fhir/ValueSet/dsf-ping-status.xml @@ -23,22 +23,6 @@ <include> <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> <version value="#{version}" /> - <concept> - <code value="not-allowed" /> - <display value="Not allowed" /> - </concept> - <concept> - <code value="not-reachable" /> - <display value="Not reachable" /> - </concept> - <concept> - <code value="pong-missing" /> - <display value="Pong missing" /> - </concept> - <concept> - <code value="pong-received" /> - <display value="Pong received" /> - </concept> </include> </compose> </ValueSet> \ No newline at end of file diff --git a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml index 97c471b7..e6187730 100644 --- a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml +++ b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml @@ -22,22 +22,6 @@ <include> <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> <version value="#{version}" /> - <concept> - <code value="not-allowed" /> - <display value="Not allowed" /> - </concept> - <concept> - <code value="not-reachable" /> - <display value="Not reachable" /> - </concept> - <concept> - <code value="pong-sent" /> - <display value="Pong sent" /> - </concept> - <concept> - <code value="resource-downloaded"/> - <display value="Resource downloaded"/> - </concept> </include> </compose> </ValueSet> \ No newline at end of file diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 90c383a9..de8c8c76 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -272,7 +272,7 @@ public String getCorrelationKey() task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_NOT_REACHABLE, List.of("some error message"))); + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR, List.of("some error message"))); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -316,7 +316,7 @@ public String getCorrelationKey() task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_RECEIVED, BigDecimal.ZERO, BigDecimal.ZERO, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED, BigDecimal.ZERO, BigDecimal.ZERO, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND)); ValidationResult result = resourceValidator.validate(task); @@ -428,8 +428,8 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(new PingStatusGenerator().createPongStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); + task.addOutput(PingStatusGenerator.createPongStatusOutput(target, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED)); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -469,8 +469,8 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(new PingStatusGenerator().createPongStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PONG_SENT)); + task.addOutput(PingStatusGenerator.createPongStatusOutput(target, + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED)); task.addInput(DownloadResourceSizeGenerator.create(1000)); task.addInput(DownloadResourceReferenceGenerator.create("https://test.endpoint.org/fhir/Binary")); From d83051366c468824c3c000580d14912825037870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 11 Apr 2025 13:37:56 +0200 Subject: [PATCH 280/382] Condition should check for status code "error" now --- src/main/resources/bpe/pong.bpmn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 1fae2a96..eb6a376b 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -93,7 +93,7 @@ <bpmn:sequenceFlow id="Flow_1o3n9u6" sourceRef="Gateway_1ggdr8l" targetRef="Activity_005ywv2" /> <bpmn:sequenceFlow id="Flow_0fzmjzb" sourceRef="Activity_005ywv2" targetRef="Gateway_0eiy9fm" /> <bpmn:sequenceFlow id="Flow_0h8flp6" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0otptjn"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'not-reachable'}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'error'}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1bzjspe" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1l5dkpz" /> <bpmn:sequenceFlow id="Flow_00t1ck1" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0otptjn"> @@ -155,7 +155,7 @@ <bpmn:sequenceFlow id="Flow_1j5lf0u" sourceRef="Activity_02rqshk" targetRef="Activity_1wdftvk" /> <bpmn:boundaryEvent id="Event_0c5a0v4" name="Failed to create resource" attachedToRef="Activity_1m4wavi"> <bpmn:outgoing>Flow_0mgrru4</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0rltnl2" errorRef="Error_0y0cd8c" camunda:errorMessageVariable="resourceUploadErrorMessage" /> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0rltnl2" errorRef="Error_0y0cd8c" camunda:errorMessageVariable="resourceUploadError" /> </bpmn:boundaryEvent> <bpmn:serviceTask id="Activity_1kb1v81" name="Log And Save Error" camunda:class="dev.dsf.bpe.service.pong.LogAndSaveUploadErrorPong"> <bpmn:incoming>Flow_0mgrru4</bpmn:incoming> From 5260f516adf5534bee7c4cd5480d7165854855fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 28 Apr 2025 15:48:35 +0200 Subject: [PATCH 281/382] Error messages are no longer stored as a simple string in Task inputs and outputs. Instead, they are now a construct consisting of the process, process step, action, link to potential fix(es) and detailed error/exception message. E-Mails now include all errors that occurred throughout one process execution instead of sending one e-mail for each error. This also fixes #14 --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 69 +++++-- .../dsf/bpe/PingProcessPluginDefinition.java | 19 +- src/main/java/dev/dsf/bpe/ProcessError.java | 114 ++++++++++++ .../bpe/mail/AggregateErrorMailService.java | 93 ++++++---- .../dev/dsf/bpe/mail/ErrorMailService.java | 129 ------------- .../java/dev/dsf/bpe/message/SendPing.java | 22 ++- .../java/dev/dsf/bpe/message/SendPong.java | 37 ++-- ...adResourceAndMeasureSpeedInSubProcess.java | 37 ++-- .../dsf/bpe/service/ping/LogAndSaveError.java | 12 +- .../service/ping/LogAndSaveNoResponse.java | 11 +- .../bpe/service/ping/LogAndSaveSendError.java | 24 ++- .../ping/LogAndSaveUploadErrorPing.java | 11 +- .../dev/dsf/bpe/service/ping/SavePong.java | 13 +- .../dsf/bpe/service/ping/StoreResults.java | 13 +- .../pong/DownloadResourceAndMeasureSpeed.java | 37 ++-- .../service/pong/LogAndSaveAndStoreError.java | 16 +- .../pong/LogAndSaveUploadErrorPong.java | 11 +- .../bpe/service/pong/SaveTimeoutError.java | 14 +- .../dev/dsf/bpe/service/pong/StoreErrors.java | 5 +- .../dev/dsf/bpe/spring/config/PingConfig.java | 14 +- .../bpe/util/BinaryResourceDownloader.java | 71 ++++++-- .../java/dev/dsf/bpe/util/ErrorListUtils.java | 130 ++++++++++++++ .../dsf/bpe/util/ErrorMessageListUtils.java | 88 --------- .../bpe/util/task/input/ErrorInputParser.java | 24 +++ .../ErrorInputComponentGenerator.java | 33 ++++ .../generator/ErrorMessageGenerator.java | 27 --- .../generator/ErrorMessageGenerator.java | 27 --- .../ErrorOutputComponentGenerator.java | 33 ++++ .../output/generator/PingStatusGenerator.java | 135 +++++++------- src/main/resources/bpe/ping.bpmn | 4 +- src/main/resources/bpe/pong.bpmn | 2 +- .../CodeSystem/dsf-ping-process-steps.xml | 139 ++++++++++++++ .../fhir/CodeSystem/dsf-ping-processes.xml | 34 ++++ .../resources/fhir/CodeSystem/dsf-ping.xml | 6 +- .../dsf-extension-extension-error.xml | 169 ++++++++++++++++++ .../dsf-extension-ping-status.xml | 50 ++++-- .../dsf-input-extension-error.xml | 151 ++++++++++++++++ .../dsf-output-extension-error.xml | 151 ++++++++++++++++ .../dsf-task-cleanup-pong.xml | 8 + .../StructureDefinition/dsf-task-ping.xml | 59 ++++++ .../StructureDefinition/dsf-task-pong.xml | 52 ++++-- .../dsf-task-start-ping.xml | 48 +++-- .../fhir/ValueSet/dsf-ping-process-steps.xml | 27 +++ .../fhir/ValueSet/dsf-ping-processes.xml | 27 +++ .../bpe/PingProcessPluginDefinitionTest.java | 4 +- .../dsf/fhir/profiles/TaskProfileTest.java | 37 +++- 46 files changed, 1650 insertions(+), 587 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/ProcessError.java delete mode 100644 src/main/java/dev/dsf/bpe/mail/ErrorMailService.java create mode 100644 src/main/java/dev/dsf/bpe/util/ErrorListUtils.java delete mode 100644 src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java create mode 100644 src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java create mode 100644 src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java delete mode 100644 src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java delete mode 100644 src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java create mode 100644 src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java create mode 100644 src/main/resources/fhir/CodeSystem/dsf-ping-process-steps.xml create mode 100644 src/main/resources/fhir/CodeSystem/dsf-ping-processes.xml create mode 100644 src/main/resources/fhir/StructureDefinition/dsf-extension-extension-error.xml create mode 100644 src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml create mode 100644 src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml create mode 100644 src/main/resources/fhir/ValueSet/dsf-ping-process-steps.xml create mode 100644 src/main/resources/fhir/ValueSet/dsf-ping-processes.xml diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 6faefe87..6919791c 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -55,13 +55,43 @@ private ConstantsPing() public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS = "downloaded-duration-millis"; public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES = "downloaded-bytes"; public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE = "download-resource-reference"; - public static final String CODESYSTEM_DSF_PING_VALUE_ERROR_MESSAGE = "error-message"; + public static final String CODESYSTEM_DSF_PING_VALUE_ERROR = "error"; public static final String CODESYSTEM_DSF_PING_STATUS = "http://dsf.dev/fhir/CodeSystem/ping-status-v2"; public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED = "completed"; public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PENDING = "pending"; public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR = "error"; + public static final String CODESYSTEM_DSF_PING_PROCESSES = "http://dsf.dev/fhir/CodeSystem/ping-processes-v2"; + public static final String CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING = "ping"; + public static final String CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG = "pong"; + + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS = "http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SET_DOWNLOAD_RESOURCE_SIZE = "set-download-resource-size"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_GENERATE_AND_STORE_RESOURCE = "generate-and-store-resource"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_LOG_AND_SAVE_ERROR = "log-and-save-error"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SELECT_TARGETS = "select-targets"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING = "ping"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_LOG_AND_SAVE_SEND_ERROR = "log-and-save-send-error"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_LOG_AND_SAVE_NO_RESPONSE = "log-and-save-no-response"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SAVE_PONG = "save-pong"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED = "download-resource-and-measure-speed"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP_PONG = "cleanup-pong"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP = "cleanup"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_STORE_RESULTS = "store-results"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_LOG_PING = "log-ping"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SET_ENDPOINT_IDENTIFIER = "set-endpoint-identifier"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SELECT_PONG_TARGET = "select-pong-target"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_STORE_DOWNLOAD_SPEED = "store-download-speed"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_LOG_AND_SAVE_AND_STORE_ERROR = "log-and-save-and-store-error"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_ESTIMATE_CLEANUP_TIMER_DURATION = "estimate-cleanup-timer-duration"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PONG = "pong"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_STORE_UPLOAD_SPEED = "store-upload-speed"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SAVE_TIMEOUT_ERROR = "save-timeout-error"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_STORE_ERRORS = "store-errors"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP_TIMER_CATCH_EVENT = "cleanup-timer-catch-event"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PONG_MESSAGE_TIMEOUT_TIMER_CATCH_EVENT = "pong-timer-catch-event"; + public static final String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units-v2"; public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND = "bytes-per-second"; @@ -75,16 +105,25 @@ private ConstantsPing() public static final String CODESYSTEM_READ_ACCESS_TAG = "http://dsf.dev/fhir/CodeSystem/read-access-tag"; public static final String CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL = "ALL"; - public static final String EXTENSION_URL_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"; - public static final String EXTENSION_URL_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; + public static final String STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"; + public static final String STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; + public static final String STRUCTURE_DEFINITION_URL_EXTENSION_EXTENSION_ERROR = "http://dsf.dev/fhir/StructureDefinition/extension-extension-error"; + public static final String STRUCTURE_DEFINITION_URL_INPUT_EXTENSION_ERROR = "http://dsf.dev/fhir/StructureDefinition/input-extension-error"; + public static final String STRUCTURE_DEFINITION_URL_OUTPUT_EXTENSION_ERROR = "http://dsf.dev/fhir/StructureDefinition/output-extension-error"; + public static final String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; public static final String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; public static final String EXTENSION_URL_ENDPOINT_IDENTIFIER = "endpoint-identifier"; - public static final String EXTENSION_URL_ERROR_MESSAGE = "error-message"; public static final String EXTENSION_URL_DOWNLOAD_SPEED = "download-speed"; public static final String EXTENSION_URL_UPLOAD_SPEED = "upload-speed"; public static final String EXTENSION_URL_NETWORK_SPEED_UNIT = "unit"; public static final String EXTENSION_URL_NETWORK_SPEED_VALUE = "network-speed"; + public static final String EXTENSION_URL_ERROR = "error"; + public static final String EXTENSION_URL_PROCESS = "process"; + public static final String EXTENSION_URL_PROCESS_STEP = "process-step"; + public static final String EXTENSION_URL_ACTION = "action"; + public static final String EXTENSION_URL_POTENTIAL_FIX = "potential-fix"; + public static final String EXTENSION_URL_MESSAGE = "message"; public static final String BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL = "timerInterval"; public static final String BPMN_EXECUTION_VARIABLE_STOP_TIMER = "stopTimer"; @@ -92,15 +131,15 @@ private ConstantsPing() public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE = "downloadResource"; public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; private static final String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; - private static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE = "errorMessage"; - private static final String BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST = "errorMessages"; + private static final String BPMN_EXECUTION_VARIABLE_ERROR = "error"; + private static final String BPMN_EXECUTION_VARIABLE_ERROR_LIST = "errors"; private static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; private static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; public static final String BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER = "targetEndpointIdentifier"; private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_BYTES = "uploadedBytes"; private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS = "uploadedDurationMillis"; - public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE = "resourceDownloadErrorMessage"; - public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR_MESSAGE = "resourceUploadErrorMessage"; + public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR = "resourceDownloadError"; + public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR = "resourceUploadError"; public static final String BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR = "resourceDownloadError"; public static final String BPMN_ERROR_CODE_RESOURCE_UPLOAD_ERROR = "resourceUploadError"; @@ -113,6 +152,8 @@ private ConstantsPing() public static final String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; + public static final String POTENTIAL_FIX_URL_DUMMY = "dsf.dev"; + public static String getBpmnExecutionVariableStatusCode() { return BPMN_EXECUTION_VARIABLE_STATUS_CODE; @@ -123,14 +164,14 @@ public static String getBpmnExecutionVariableStatusCode(String correlationKey) return BPMN_EXECUTION_VARIABLE_STATUS_CODE + "_" + correlationKey; } - public static String getBpmnExecutionVariableErrorMessage() + public static String getBpmnExecutionVariableError() { - return BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE; + return BPMN_EXECUTION_VARIABLE_ERROR; } public static String getBpmnExecutionVariableErrorMessage(String correlationKey) { - return BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE + "_" + correlationKey; + return BPMN_EXECUTION_VARIABLE_ERROR + "_" + correlationKey; } public static String getBpmnExecutionVariableDownloadedBytes() @@ -173,13 +214,13 @@ public static String getBpmnExecutionVariableUploadedDurationMillis(String corre return BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS + "_" + correlationKey; } - public static String getBpmnExecutionVariableErrorMessageList() + public static String getBpmnExecutionVariableErrorList() { - return BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE_LIST; + return BPMN_EXECUTION_VARIABLE_ERROR_LIST; } public static String getBpmnExecutionVariableErrorMessageList(String correlationKey) { - return getBpmnExecutionVariableErrorMessageList() + "_" + correlationKey; + return getBpmnExecutionVariableErrorList() + "_" + correlationKey; } } diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index 0a1b65b8..813b866f 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -62,6 +62,9 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var sStopPingAutostart = "fhir/StructureDefinition/dsf-task-stop-ping-autostart.xml"; var sCleanupPong = "fhir/StructureDefinition/dsf-task-cleanup-pong.xml"; var sNetworkSpeedExtension = "fhir/StructureDefinition/dsf-extension-network-speed.xml"; + var sErrorExtensionExtension = "fhir/StructureDefinition/dsf-extension-extension-error.xml"; + var sErrorInputExtension = "fhir/StructureDefinition/dsf-input-extension-error.xml"; + var sErrorOutputExtension = "fhir/StructureDefinition/dsf-output-extension-error.xml"; var tStartPing = "fhir/Task/dsf-task-start-ping.xml"; var tStartPingAutoStart = "fhir/Task/dsf-task-start-ping-autostart.xml"; @@ -72,13 +75,15 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var vPingStatus = "fhir/ValueSet/dsf-ping-status.xml"; var vPongStatus = "fhir/ValueSet/dsf-pong-status.xml"; - return Map.of(ConstantsPing.PROCESS_NAME_FULL_PING, - Arrays.asList(aPing, cPing, cPingStatus, cPingUnits, sPingStatus, sStartPing, sPong, sCleanupPong, + return Map.of( + ConstantsPing.PROCESS_NAME_FULL_PING, Arrays.asList(aPing, cPing, cPingStatus, cPingUnits, + sErrorExtensionExtension, sErrorOutputExtension, sPingStatus, sStartPing, sPong, sCleanupPong, sNetworkSpeedExtension, tStartPing, vPing, vPingStatus, vPingUnits), - ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, - Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, - tStopPingAutoStart, vPing), - ConstantsPing.PROCESS_NAME_FULL_PONG, Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, sPingStatus, - sPing, sNetworkSpeedExtension, vPing, vPongStatus, vPingUnits)); + ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, Arrays.asList(aPingAutostart, cPing, + sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, tStopPingAutoStart, vPing), + ConstantsPing.PROCESS_NAME_FULL_PONG, + Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, sErrorExtensionExtension, sErrorInputExtension, + sErrorOutputExtension, sPingStatus, sPing, sNetworkSpeedExtension, vPing, vPongStatus, + vPingUnits)); } } diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java new file mode 100644 index 00000000..0981c580 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -0,0 +1,114 @@ +package dev.dsf.bpe; + +import java.util.List; + +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.UrlType; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +public record ProcessError(String process, String processStep, String action, String potentialFixUrl, String message) +{ + @Override + public boolean equals(Object obj) + { + return obj instanceof ProcessError error && process.equals(error.process()) + && processStep.equals(error.processStep()) && action.equals(error.action()) + && message.equals(error.message()); + + } + + public static Extension toExtensionExtension(ProcessError error) + { + Extension errorExtension = new Extension(); + errorExtension.setUrl(ConstantsPing.EXTENSION_URL_ERROR); + Extension errorExtensionExtension = new Extension(); + + errorExtensionExtension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_EXTENSION_ERROR); + errorExtensionExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, error.process(), null)); + errorExtensionExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, error.process(), null)); + errorExtensionExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION) + .setValue(new StringType(error.action())); + errorExtensionExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) + .setValue(new UrlType(error.potentialFixUrl())); + errorExtensionExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE) + .setValue(new StringType(error.message())); + + errorExtension.addExtension(errorExtensionExtension); + return errorExtension; + } + + public static Extension toInputExtension(ProcessError error) + { + return toParameterExtension(error, ConstantsPing.STRUCTURE_DEFINITION_URL_INPUT_EXTENSION_ERROR); + } + + public static Extension toOutputExtension(ProcessError error) + { + return toParameterExtension(error, ConstantsPing.STRUCTURE_DEFINITION_URL_OUTPUT_EXTENSION_ERROR); + } + + private static Extension toParameterExtension(ProcessError error, String structureDefinitionUrl) + { + Extension extension = new Extension(); + + extension.setUrl(structureDefinitionUrl); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, error.process(), null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, error.process(), null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(error.action())); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) + .setValue(new UrlType(error.potentialFixUrl())); + + return extension; + } + + public static ProcessError toError(Extension extension) + { + String process = ((Coding) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_PROCESS).getValue()) + .getCode(); + String processStep = ((Coding) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP).getValue()) + .getCode(); + String action = ((StringType) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_ACTION).getValue()) + .getValue(); + String potentialFixUrl = ((StringType) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) + .getValue()).getValue(); + String message = ((StringType) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_MESSAGE).getValue()) + .getValue(); + + return new ProcessError(process, processStep, action, potentialFixUrl, message); + } + + public static String toString(List<ProcessError> errors) throws JsonProcessingException + { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.writeValueAsString(errors); + } + + public static String toString(ProcessError error) throws JsonProcessingException + { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.writeValueAsString(error); + } + + public static List<ProcessError> parseList(String json) throws JsonProcessingException + { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.readValue(json, new TypeReference<List<ProcessError>>() + { + }); + } + + public static ProcessError parse(String json) throws JsonProcessingException + { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.readValue(json, ProcessError.class); + } +} diff --git a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java index c3831e87..aced3fdb 100644 --- a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java +++ b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java @@ -4,50 +4,44 @@ import java.util.List; import org.hl7.fhir.r4.model.IdType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Target; -public class AggregateErrorMailService extends ErrorMailService +public class AggregateErrorMailService { + private static final Logger errorMailServiceLogger = LoggerFactory.getLogger("error-mail-service-logger"); private static final String MAIL_MESSAGE_INTRO = "Error(s) while executing ping-pong process:"; private static final String PING_PROCESS_HAS_ERRORS = "Ping process has errors"; + private final ProcessPluginApi api; + private final boolean sendProcessFailedMail; + private List<String> errorMessages; - public AggregateErrorMailService(ProcessPluginApi api, boolean sendPingProcessFailedMail, - boolean sendPongProcessFailedMail) + public AggregateErrorMailService(ProcessPluginApi api, boolean sendProcessFailedMail) { - super(api, sendPingProcessFailedMail, sendPongProcessFailedMail); + this.api = api; + this.sendProcessFailedMail = sendProcessFailedMail; errorMessages = new ArrayList<>(); } - public void addMessagePing(Target target, String message) + public void addError(Target target, ProcessError error) { - pingProcessErrorLogger.info("Ping process error: {}", message); - - if (sendPingProcessFailedMail) - { - errorMessages.add(createMessage(target, message, null)); - } - } - - public void addMessagePong(Target target, String message) - { - pongProcessErrorLogger.info("Pong process error: {}", message); - - if (sendPongProcessFailedMail) - { - errorMessages.add(createMessage(target, message, null)); - } + errorMessages.add(createMessage(target, error)); } public void send(IdType taskId) { - if (!errorMessages.isEmpty()) + if (sendProcessFailedMail) { api.getMailService().send(PING_PROCESS_HAS_ERRORS, buildMailMessage(taskId)); errorMessages = new ArrayList<>(); + errorMailServiceLogger.info("Sent e-mail with process errors"); } } @@ -64,34 +58,61 @@ protected String buildMailMessage(IdType taskId) mailMessage.append("\n\n"); }); - mailMessage.append("\nProcess started by: "); + mailMessage.append("Process started by: "); mailMessage.append(taskId.toVersionless() .withServerBase(api.getEndpointProvider().getLocalEndpointAddress(), "Task").getValue()); return mailMessage.toString(); } - protected String createMessage(Target target, String message, String messageDetails) + protected String createMessage(Target target, ProcessError error) { StringBuilder b = new StringBuilder(); - b.append(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().orElse("?")); - b.append('/'); - b.append(api.getEndpointProvider().getLocalEndpointIdentifierValue().orElse("?")); + if (error != null && error.process() != null) + { + if (ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING.equals(error.process())) + { + b.append(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().orElse("?")); + b.append('/'); + b.append(api.getEndpointProvider().getLocalEndpointIdentifierValue().orElse("?")); - b.append(" -> "); + b.append(" -> "); - b.append(target.getOrganizationIdentifierValue()); - b.append('/'); - b.append(target.getEndpointIdentifierValue()); + b.append(target.getOrganizationIdentifierValue()); + b.append('/'); + b.append(target.getEndpointIdentifierValue()); - b.append(": "); - b.append(message); + b.append(":"); + + } + else + { + b.append(target.getOrganizationIdentifierValue()); + b.append('/'); + b.append(target.getEndpointIdentifierValue()); + + b.append(" -> "); + + b.append(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().orElse("?")); + b.append('/'); + b.append(api.getEndpointProvider().getLocalEndpointIdentifierValue().orElse("?")); + + b.append(": "); + } - if (messageDetails != null) - { b.append("\n\t"); - b.append(messageDetails); + b.append("Process: ").append(error.process()); + b.append("\n\t"); + b.append("Process step: ").append(error.processStep()); + b.append("\n\t"); + b.append("Action: ").append(error.action()); + b.append("\n\t"); + b.append("Message: ").append(error.message()); + } + else + { + b.append("Unable to display error because error is null or process is neither of 'ping' or 'pong'"); } return b.toString(); diff --git a/src/main/java/dev/dsf/bpe/mail/ErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/ErrorMailService.java deleted file mode 100644 index 4f3195be..00000000 --- a/src/main/java/dev/dsf/bpe/mail/ErrorMailService.java +++ /dev/null @@ -1,129 +0,0 @@ -package dev.dsf.bpe.mail; - -import java.util.Objects; - -import org.hl7.fhir.r4.model.IdType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.InitializingBean; - -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.variables.Target; - -public class ErrorMailService implements InitializingBean -{ - protected static final Logger pingProcessErrorLogger = LoggerFactory.getLogger("ping-process-error-logger"); - protected static final Logger pongProcessErrorLogger = LoggerFactory.getLogger("pong-process-error-logger"); - - protected static final String SUBJECT_PING_PROCESS_FAILED = "Ping Process Failed"; - protected static final String SUBJECT_PONG_PROCESS_FAILED = "Pong Process Failed"; - - protected final ProcessPluginApi api; - - protected final boolean sendPingProcessFailedMail; - protected final boolean sendPongProcessFailedMail; - - public ErrorMailService(ProcessPluginApi api, boolean sendPingProcessFailedMail, boolean sendPongProcessFailedMail) - { - this.api = api; - - this.sendPingProcessFailedMail = sendPingProcessFailedMail; - this.sendPongProcessFailedMail = sendPongProcessFailedMail; - } - - @Override - public void afterPropertiesSet() throws Exception - { - Objects.requireNonNull(api, "api"); - } - - private String createMessage(Target target, String message, String messageDetails, IdType taskId) - { - StringBuilder b = new StringBuilder(); - - b.append(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().orElse("?")); - b.append('/'); - b.append(api.getEndpointProvider().getLocalEndpointIdentifierValue().orElse("?")); - - b.append(" -> "); - - b.append(target.getOrganizationIdentifierValue()); - b.append('/'); - b.append(target.getEndpointIdentifierValue()); - - b.append(": "); - b.append(message); - - if (messageDetails != null) - { - b.append("\n\t"); - b.append(messageDetails); - } - - b.append("\n\nProcess started by: "); - b.append(taskId.toVersionless().withServerBase(api.getEndpointProvider().getLocalEndpointAddress(), "Task") - .getValue()); - - return b.toString(); - } - - public void pongMessageNotReceived(IdType taskId, Target target) - { - pingProcessErrorLogger.debug("No pong from organization '{}', Endpoint '{}' received", - target.getOrganizationIdentifierValue(), target.getEndpointIdentifierValue()); - - if (sendPingProcessFailedMail) - { - api.getMailService().send(SUBJECT_PING_PROCESS_FAILED, - createMessage(target, "No pong message received", null, taskId)); - } - } - - public void endpointNotReachableForPing(IdType taskId, Target target, String errorMessage) - { - pingProcessErrorLogger.debug("Endpoint '{}' at organization '{}' not reachable with ping: {}", - target.getOrganizationIdentifierValue(), target.getEndpointIdentifierValue(), errorMessage); - - if (sendPingProcessFailedMail) - { - api.getMailService().send(SUBJECT_PING_PROCESS_FAILED, - createMessage(target, "Not reachable with ping", errorMessage, taskId)); - } - } - - public void endpointReachablePingForbidden(IdType taskId, Target target, String errorMessage) - { - pingProcessErrorLogger.debug("Endpoint '{}' at organization '{}' reachable, ping forbidden: {}", - target.getOrganizationIdentifierValue(), target.getEndpointIdentifierValue(), errorMessage); - - if (sendPongProcessFailedMail) - { - api.getMailService().send(SUBJECT_PING_PROCESS_FAILED, - createMessage(target, "Ping forbidden", errorMessage, taskId)); - } - } - - public void endpointNotReachableForPong(IdType taskId, Target target, String errorMessage) - { - pongProcessErrorLogger.debug("Endpoint '{}' at organization '{}' not reachable with pong: {}", - target.getOrganizationIdentifierValue(), target.getEndpointIdentifierValue(), errorMessage); - - if (sendPongProcessFailedMail) - { - api.getMailService().send(SUBJECT_PONG_PROCESS_FAILED, - createMessage(target, "Not reachable with pong", errorMessage, taskId)); - } - } - - public void endpointReachablePongForbidden(IdType taskId, Target target, String errorMessage) - { - pongProcessErrorLogger.debug("Endpoint '{}' at organization '{}' reachable, pong forbidden: {}", - target.getOrganizationIdentifierValue(), target.getEndpointIdentifierValue(), errorMessage); - - if (sendPongProcessFailedMail) - { - api.getMailService().send(SUBJECT_PONG_PROCESS_FAILED, - createMessage(target, "Pong forbidden", errorMessage, taskId)); - } - } -} diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index 1b3a916b..3a7d56c7 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -11,7 +11,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.core.JsonProcessingException; + import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -64,7 +67,19 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); String specialErrorMessage = createErrorMessage(exception); - execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableErrorMessage(), specialErrorMessage); + ProcessError pingSendError = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, + "Sending ping message to " + target.getEndpointUrl(), ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + specialErrorMessage); + try + { + execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableError(), + ProcessError.toString(pingSendError)); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), responseCode); } @@ -80,11 +95,10 @@ private String createErrorMessage(Exception exception) && (exception.getMessage() == null || exception.getMessage().isBlank())) { StatusType statusInfo = w.getResponse().getStatusInfo(); - return "Error when sending ping message: " + statusInfo.getStatusCode() + " " - + statusInfo.getReasonPhrase(); + return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); } else - return "Error when sending ping message: " + exception.getMessage(); + return exception.getMessage(); } private Identifier getLocalEndpointIdentifier() diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPong.java index b1ff1afa..bfa9efd0 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPong.java @@ -8,13 +8,14 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.mail.ErrorMailService; -import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.mail.AggregateErrorMailService; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; -import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; +import dev.dsf.bpe.util.task.input.generator.ErrorInputComponentGenerator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; @@ -26,9 +27,9 @@ public class SendPong extends AbstractTaskMessageSend { - private final ErrorMailService errorMailService; + private final AggregateErrorMailService errorMailService; - public SendPong(ProcessPluginApi api, ErrorMailService errorMailService) + public SendPong(ProcessPluginApi api, AggregateErrorMailService errorMailService) { super(api); @@ -47,7 +48,7 @@ public void afterPropertiesSet() throws Exception protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - List<String> errorList = ErrorMessageListUtils.getErrorMessageList(execution); + List<ProcessError> errorList = ErrorListUtils.getErrorMessageList(execution); int downloadResourceSizeBytes = variables .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); if (downloadResourceSizeBytes >= 0) @@ -68,14 +69,13 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE ? Stream.of(DownloadResourceReferenceGenerator.create(downloadResourceReference)) : Stream.empty(); - return Stream - .of(downloadedBytesParameter, downloadedDurationMillisParameter, - downloadedResourceReferenceParameter, ErrorMessageGenerator.create(errorList).stream()) + return Stream.of(downloadedBytesParameter, downloadedDurationMillisParameter, + downloadedResourceReferenceParameter, ErrorInputComponentGenerator.create(errorList).stream()) .flatMap(stream -> stream); } else { - return ErrorMessageGenerator.create(errorList).stream(); + return ErrorInputComponentGenerator.create(errorList).stream(); } } @@ -100,12 +100,16 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null ? Response.Status.fromStatusCode(w.getResponse().getStatus()).toString() : "unknown"; - execution.setVariable(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); String specialErrorMessage = createErrorMessage(exception); - ErrorMessageListUtils.add(specialErrorMessage, execution); - PingStatusGenerator.updatePongStatusOutput(startTask, statusCode); - variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); + ProcessError pongSendError = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PONG, + "Sending pong message to " + target.getEndpointUrl(), ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + specialErrorMessage); + ErrorListUtils.add(pongSendError, execution); + PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); + variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(), + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); variables.updateTask(startTask); @@ -117,10 +121,9 @@ private String createErrorMessage(Exception exception) && (exception.getMessage() == null || exception.getMessage().isBlank())) { StatusType statusInfo = w.getResponse().getStatusInfo(); - return "Error when sending pong message: " + statusInfo.getStatusCode() + " " - + statusInfo.getReasonPhrase(); + return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); } else - return "Error when sending ping message: " + exception.getMessage(); + return exception.getMessage(); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 6538c8e3..b13050a1 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -5,6 +5,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -33,29 +34,25 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - try + + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING) + .download(variables, api, task, maxDownloadSizeBytes); + + if (downloadResult.getError() == null) { - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger) - .download(variables, api, task, maxDownloadSizeBytes); - - if (downloadResult.getErrorMessage() == null) - { - variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey), - downloadResult.getDownloadedBytes()); - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), - downloadResult.getDownloadedDurationMillis()); - } - else - { - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, - downloadResult.getErrorMessage()); - } - - logger.debug("Completed resource download and measured speed."); + variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey), + downloadResult.getDownloadedBytes()); + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), + downloadResult.getDownloadedDurationMillis()); } - catch (Exception e) + else { - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, e.getMessage()); + delegateExecution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR, + downloadResult.getError()); + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR); } + + logger.debug("Completed resource download and measured speed."); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index 77cd38b0..f6f610fd 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -4,7 +4,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -24,10 +25,11 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable PingPongLogger logger = new PingPongLogger(LogAndSaveError.class, variables.getStartTask()); Target target = variables.getTarget(); - String errorMessage = variables - .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE); - ErrorMessageListUtils.add(errorMessage, delegateExecution, target.getCorrelationKey()); + ProcessError error = (ProcessError) delegateExecution + .getVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR); - logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), errorMessage); + ErrorListUtils.add(error, delegateExecution, target.getCorrelationKey()); + + logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), error.message()); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java index 4cc89c51..524d1968 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java @@ -4,6 +4,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -24,12 +26,15 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Saving no response to process execution..."); Target target = variables.getTarget(); - logger.info("No PONG received from endpoint '{}'", target.getEndpointIdentifierValue()); + String pongMissingMessage = "No PONG received from endpoint '" + target.getEndpointIdentifierValue() + "'"; + logger.info(pongMissingMessage); String correlationKey = target.getCorrelationKey(); delegateExecution.removeVariable("statusCode"); - variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(correlationKey), - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); + ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PONG_MESSAGE_TIMEOUT_TIMER_CATCH_EVENT, + "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, pongMissingMessage); + ErrorListUtils.add(error, delegateExecution, correlationKey); logger.debug("Saved '{}' to process execution for correlation key '{}'", ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR, correlationKey); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 2d179a0f..0375671f 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -3,8 +3,11 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import com.fasterxml.jackson.core.JsonProcessingException; + import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -23,11 +26,18 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(LogAndSaveSendError.class, variables.getStartTask()); String correlationKey = variables.getTarget().getCorrelationKey(); - String errorMessage = (String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableErrorMessage()); - - ErrorMessageListUtils.add(errorMessage, execution, correlationKey); - variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0); - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); - logger.debug("Saved error when trying to send ping message. Error message: {}", errorMessage); + try + { + ProcessError error = ProcessError + .parse((String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableError())); + ErrorListUtils.add(error, execution, correlationKey); + variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0); + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); + logger.debug("Saved error when trying to send ping message. Error message: {}", error.message()); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java index c1600bc4..0cac83c1 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java @@ -5,7 +5,8 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -24,8 +25,12 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task startTask = variables.getStartTask(); PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPing.class, startTask); - String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR_MESSAGE); - ErrorMessageListUtils.add(errorMessage, execution); + String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR); + ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_GENERATE_AND_STORE_RESOURCE, + "Storing binary resource on local DSF FHIR server", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + errorMessage); + ErrorListUtils.add(error, execution); logger.info("Error while storing binary resource for download: {}", errorMessage); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 93ce4ef5..5c9bdcab 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -7,13 +7,13 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.IntegerType; -import org.hl7.fhir.r4.model.PrimitiveType; -import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; +import dev.dsf.bpe.util.task.input.ErrorInputParser; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -52,12 +52,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), integerType.getValue())); - List<String> errorList = api.getTaskHelper() - .getInputParameterValues(pong, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR_MESSAGE, StringType.class) - .map(PrimitiveType::getValue).map(string -> "Pong error: " + string).toList(); + List<ProcessError> errorList = ErrorInputParser.parseInputs(pong); - ErrorMessageListUtils.addAll(errorList, delegateExecution, correlationKey); + ErrorListUtils.addAll(errorList, delegateExecution, correlationKey); logger.debug("Saved pong information."); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 0c93e472..559c1534 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -11,11 +11,12 @@ import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.mail.AggregateErrorMailService; -import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; -import dev.dsf.bpe.util.task.output.generator.ErrorMessageGenerator; +import dev.dsf.bpe.util.task.output.generator.ErrorOutputComponentGenerator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -53,18 +54,18 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task task = variables.getStartTask(); Targets targets = variables.getTargets(); - ErrorMessageGenerator.create(ErrorMessageListUtils.getErrorMessageList(execution)).forEach(task::addOutput); + ErrorOutputComponentGenerator.create(ErrorListUtils.getErrorMessageList(execution)).forEach(task::addOutput); targets.getEntries().stream().sorted(Comparator.comparing(Target::getEndpointIdentifierValue)).forEach(target -> { String correlationKey = target.getCorrelationKey(); - List<String> errors = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); + List<ProcessError> errors = ErrorListUtils.getErrorMessageList(execution, correlationKey); String statusCode = errors.isEmpty() ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR; int downloadResourceSizeBytes = variables .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); - List<String> errorMessageList = ErrorMessageListUtils.getErrorMessageList(execution, correlationKey); + List<ProcessError> errorMessageList = ErrorListUtils.getErrorMessageList(execution, correlationKey); if (downloadResourceSizeBytes >= 0) // if fat-ping { Integer downloadedBytes = variables @@ -92,7 +93,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw { task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList)); } - errors.forEach(error -> errorMailService.addMessagePing(target, error)); + errors.forEach(error -> errorMailService.addError(target, error)); }); // TODO only send one combined status mail diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 6692790d..1e81dea0 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -5,10 +5,12 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate @@ -28,30 +30,25 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Starting resource download to measure speed..."); Task task = variables.getStartTask(); + Target target = variables.getTarget(); - try + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG) + .download(variables, api, task, maxDownloadSizeBytes); + + if (downloadResult.getError() == null) { - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger) - .download(variables, api, task, maxDownloadSizeBytes); - - if (downloadResult.getErrorMessage() == null) - { - variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(), - downloadResult.getDownloadedBytes()); - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(), - downloadResult.getDownloadedDurationMillis()); - } - else - { - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, - downloadResult.getErrorMessage()); - } - - logger.debug("Completed resource download and measured speed."); + variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(), + downloadResult.getDownloadedBytes()); + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(), + downloadResult.getDownloadedDurationMillis()); } - catch (Exception e) + else { - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR, e.getMessage()); + delegateExecution.setVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR, + downloadResult.getError()); + throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR); } + logger.debug("Completed resource download and measured speed."); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index d4734d3c..650178da 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -5,7 +5,8 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -27,11 +28,14 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); Task startTask = variables.getStartTask(); - String errorMessage = variables - .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR_MESSAGE); - ErrorMessageListUtils.add(errorMessage, delegateExecution); - PingStatusGenerator.updatePongStatusOutput(startTask, - ErrorMessageListUtils.getErrorMessageList(delegateExecution)); + String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR); + ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, + "Downloading binary resource from " + target.getEndpointUrl(), ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + errorMessage); + + ErrorListUtils.add(error, delegateExecution); + PingStatusGenerator.updatePongStatusOutput(startTask, ErrorListUtils.getErrorMessageList(delegateExecution)); variables.updateTask(startTask); logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), errorMessage); diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java index 6ee624ba..1bcb6b37 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java @@ -5,7 +5,8 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -24,8 +25,12 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task startTask = variables.getStartTask(); PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPong.class, startTask); - String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR_MESSAGE); - ErrorMessageListUtils.add(errorMessage, execution); + String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR); + ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_GENERATE_AND_STORE_RESOURCE, + "Storing binary resource for download", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, errorMessage); + + ErrorListUtils.add(error, execution); logger.info("Error while storing binary resource for download: {}", errorMessage); } diff --git a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java index eba52fa3..1acb767d 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java @@ -5,10 +5,12 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class SaveTimeoutError extends AbstractServiceDelegate @@ -22,13 +24,17 @@ public SaveTimeoutError(ProcessPluginApi api) protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { Task startTask = variables.getStartTask(); + Target target = variables.getTarget(); PingPongLogger logger = new PingPongLogger(SaveTimeoutError.class, startTask); logger.debug("Storing timeout error..."); - String errorMessage = ConstantsPing.PONG_ERROR_MESSAGE_CLEANUP_TIMEOUT; + ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP_TIMER_CATCH_EVENT, + "Waiting for cleanup message from " + target.getOrganizationIdentifierValue(), + ConstantsPing.POTENTIAL_FIX_URL_DUMMY, "Timeout while waiting for cleanup message"); - ErrorMessageListUtils.add(errorMessage, execution); + ErrorListUtils.add(error, execution); - logger.debug("Stored timeout error: {}", errorMessage); + logger.debug("Stored timeout error: {}", error.message()); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java index 2cf75377..bec6dc69 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java @@ -7,7 +7,8 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.util.ErrorMessageListUtils; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -28,7 +29,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(StoreErrors.class, startTask); logger.debug("Storing errors..."); - List<String> errors = ErrorMessageListUtils.getErrorMessageList(execution); + List<ProcessError> errors = ErrorListUtils.getErrorMessageList(execution); PingStatusGenerator.updatePongStatusOutput(startTask, errors); if (!errors.isEmpty()) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 86df8c0b..e6fe0c15 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -112,9 +112,15 @@ public SendStartPing sendStartPing() } @Bean - public AggregateErrorMailService errorLogger() + public AggregateErrorMailService pingErrorLogger() { - return new AggregateErrorMailService(api, sendPingProcessFailedMail, sendPongProcessFailedMail); + return new AggregateErrorMailService(api, sendPingProcessFailedMail); + } + + @Bean + public AggregateErrorMailService pongErrorLogger() + { + return new AggregateErrorMailService(api, sendPongProcessFailedMail); } @@ -143,7 +149,7 @@ public SetCorrelationKeyListener setCorrelationKeyListener() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public StoreResults savePingResults() { - return new StoreResults(api, errorLogger(), networkSpeedUnit); + return new StoreResults(api, pingErrorLogger(), networkSpeedUnit); } @Bean @@ -164,7 +170,7 @@ public SelectPongTarget selectPongTarget() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SendPong sendPong() { - return new SendPong(api, errorLogger()); + return new SendPong(api, pongErrorLogger()); } @Bean diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 39179fad..e7a6c5b7 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -2,12 +2,14 @@ import java.io.IOException; import java.io.InputStream; +import java.util.Optional; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Variables; @@ -16,25 +18,36 @@ public class BinaryResourceDownloader { private final PingPongLogger logger; + private final String process; - public BinaryResourceDownloader(PingPongLogger logger) + public BinaryResourceDownloader(PingPongLogger logger, String process) { this.logger = logger; + this.process = process; } public DownloadResult download(Variables variables, ProcessPluginApi api, Task task, int maxDownloadSizeBytes) - throws Exception { DownloadResult downloadResult; int downloadResourceSizeBytes = variables .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); - Reference downloadResourceReference = api.getTaskHelper() - .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, Reference.class) - .orElseThrow(() -> new Exception("Unable to download resource. No reference provided in message.")); + Optional<Reference> optDownloadResourceReference = api.getTaskHelper().getFirstInputParameterValue(task, + ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, + Reference.class); + if (optDownloadResourceReference.isEmpty()) + { + ProcessError error = new ProcessError(process, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, + "Extracting binary resource reference from task " + task.getIdElement().getValue(), + ConstantsPing.POTENTIAL_FIX_URL_DUMMY, "No reference provided in task"); + downloadResult = new DownloadResult(error); + return downloadResult; + } + + Reference downloadResourceReference = optDownloadResourceReference.get(); IdType downloadResourceReferenceIdType = new IdType(downloadResourceReference.getReference()); String downloadResourceReferenceId = downloadResourceReferenceIdType.getIdPart(); String webserviceUrl = downloadResourceReferenceIdType.getBaseUrl(); @@ -61,22 +74,34 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t } catch (IOException e) { - String error = "Encountered an error while downloading resource: " + e.getMessage(); - logger.error(error); + binaryResourceInputStream.close(); + String errorMessage = e.getMessage(); + ProcessError error = new ProcessError(process, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, + "Downloading binary resource from " + webserviceUrl, ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + errorMessage); + logger.error("Encountered an error while downloading resource: {}", errorMessage); downloadResult = new DownloadResult(error); } } catch (WebApplicationException e) { - String error = "Encountered an error while trying to download resource: " - + e.getResponse().getStatusInfo().getStatusCode() + " " + e.getMessage(); - logger.error(error); + String errorMessage = e.getResponse().getStatusInfo().getStatusCode() + " " + e.getMessage(); + ProcessError error = new ProcessError(process, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, + "Downloading binary resource from " + webserviceUrl, ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + errorMessage); + logger.error("Encountered an error while downloading resource: {}", errorMessage); downloadResult = new DownloadResult(error); } catch (Exception e) { - String error = "Encountered an error while trying to download resource: " + e.getMessage(); - logger.error(error); + String errorMessage = e.getMessage(); + ProcessError error = new ProcessError(process, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, + "Downloading binary resource from " + webserviceUrl, ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + errorMessage); + logger.error("Encountered an error while downloading resource: {}", errorMessage); downloadResult = new DownloadResult(error); } return downloadResult; @@ -95,20 +120,20 @@ public static class DownloadResult { private final int downloadedBytes; private final long downloadedDurationMillis; - private final String errorMessage; + private final ProcessError error; public DownloadResult(int downloadedBytes, long downloadedDurationMillis) { this.downloadedBytes = downloadedBytes; this.downloadedDurationMillis = downloadedDurationMillis; - errorMessage = null; + error = null; } - public DownloadResult(String errorMessage) + public DownloadResult(ProcessError error) { downloadedBytes = 0; downloadedDurationMillis = 0; - this.errorMessage = errorMessage; + this.error = error; } public int getDownloadedBytes() @@ -121,9 +146,17 @@ public long getDownloadedDurationMillis() return downloadedDurationMillis; } - public String getErrorMessage() + public ProcessError getError() + { + return error; + } + } + + public static class MissingReferenceException extends Exception + { + public MissingReferenceException(String message) { - return errorMessage; + super(message); } } } diff --git a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java new file mode 100644 index 00000000..c9a1c3fe --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java @@ -0,0 +1,130 @@ +package dev.dsf.bpe.util; + +import java.util.List; +import java.util.Vector; + +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import com.fasterxml.jackson.core.JsonProcessingException; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; + +public class ErrorListUtils +{ + public static void addAll(List<ProcessError> errors, DelegateExecution execution) + { + List<ProcessError> errorList = getErrorMessageList(execution); + if (errors != null) + { + errorList.addAll(errors); + saveErrorList(errorList, execution, null); + } + } + + public static void addAll(List<ProcessError> errors, DelegateExecution execution, String correlationKey) + { + List<ProcessError> errorList = correlationKey != null ? getErrorMessageList(execution, correlationKey) + : getErrorMessageList(execution); + if (errors != null) + { + errorList.addAll(errors); + saveErrorList(errorList, execution, correlationKey); + } + } + + public static void add(ProcessError error, DelegateExecution execution) + { + add(error, execution, null); + } + + public static void add(ProcessError error, DelegateExecution execution, String correlationKey) + { + if (correlationKey != null) + { + add(error, ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), execution); + } + else + { + add(error, ConstantsPing.getBpmnExecutionVariableErrorList(), execution); + } + } + + public static List<ProcessError> getErrorMessageList(DelegateExecution execution) + { + return getErrorMessageList(execution, null); + } + + public static List<ProcessError> getErrorMessageList(DelegateExecution execution, String correlationKey) + { + if (correlationKey != null) + { + return getErrorMessageList(ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), + execution); + } + else + { + return getErrorMessageList(ConstantsPing.getBpmnExecutionVariableErrorList(), execution); + } + } + + public static List<ProcessError> getErrorMessageList(String variableName, DelegateExecution execution) + { + String errorJson = (String) execution.getVariable(variableName); + if (errorJson == null) + { + List<ProcessError> errors = new Vector<>(); + try + { + execution.setVariable(variableName, ProcessError.toString(errors)); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + return errors; + } + else + { + try + { + return ProcessError.parseList(errorJson); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + } + } + + public static void add(ProcessError error, String variableName, DelegateExecution execution) + { + List<ProcessError> errors = getErrorMessageList(variableName, execution); + errors.add(error); + saveErrorList(errors, variableName, execution); + } + + private static void saveErrorList(List<ProcessError> errors, DelegateExecution execution, String correlationKey) + { + if (correlationKey != null) + { + saveErrorList(errors, ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), execution); + } + else + { + saveErrorList(errors, ConstantsPing.getBpmnExecutionVariableErrorList(), execution); + } + } + + private static void saveErrorList(List<ProcessError> errors, String variableName, DelegateExecution execution) + { + try + { + execution.setVariable(variableName, ProcessError.toString(errors)); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java deleted file mode 100644 index f2857330..00000000 --- a/src/main/java/dev/dsf/bpe/util/ErrorMessageListUtils.java +++ /dev/null @@ -1,88 +0,0 @@ -package dev.dsf.bpe.util; - -import java.util.List; -import java.util.Vector; - -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import dev.dsf.bpe.ConstantsPing; - -public class ErrorMessageListUtils -{ - public static List<String> addAll(List<String> errors, DelegateExecution execution) - { - List<String> errorList = getErrorMessageList(execution); - if (errors == null) - return errorList; - errorList.addAll(errors); - return errorList; - } - - public static List<String> addAll(List<String> errors, DelegateExecution execution, String correlationKey) - { - List<String> errorList = correlationKey != null ? getErrorMessageList(execution, correlationKey) - : getErrorMessageList(execution); - if (errors == null) - return errorList; - errorList.addAll(errors); - return errorList; - } - - public static List<String> add(String error, DelegateExecution execution) - { - return add(error, execution, null); - } - - public static List<String> add(String error, DelegateExecution execution, String correlationKey) - { - if (correlationKey != null) - { - return add(error, ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), execution); - } - else - { - return add(error, ConstantsPing.getBpmnExecutionVariableErrorMessageList(), execution); - } - } - - public static List<String> getErrorMessageList(DelegateExecution execution) - { - return getErrorMessageList(execution, null); - } - - @SuppressWarnings("unchecked") - public static List<String> getErrorMessageList(DelegateExecution execution, String correlationKey) - { - List<String> errorMessages = correlationKey != null - ? (List<String>) execution - .getVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey)) - : (List<String>) execution.getVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList()); - if (errorMessages == null) - { - errorMessages = new Vector<>(); - if (correlationKey != null) - { - execution.setVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), - errorMessages); - } - else - { - execution.setVariable(ConstantsPing.getBpmnExecutionVariableErrorMessageList(), errorMessages); - } - } - return errorMessages; - } - - @SuppressWarnings("unchecked") - public static List<String> add(String error, String variableName, DelegateExecution execution) - { - List<String> errorMessages = (List<String>) execution.getVariable(variableName); - if (errorMessages == null) - { - errorMessages = new Vector<>(); - execution.setVariable(variableName, errorMessages); - } - errorMessages.add(error); - return errorMessages; - } -} diff --git a/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java b/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java new file mode 100644 index 00000000..bdf02e3f --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java @@ -0,0 +1,24 @@ +package dev.dsf.bpe.util.task.input; + +import java.util.List; + +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; + +public class ErrorInputParser +{ + public static List<ProcessError> parseInputs(Task task) + { + List<Task.ParameterComponent> inputs = task.getInput().stream() + .filter(input -> ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR + .equals(input.getType().getCodingFirstRep().getCode())) + .toList(); + + return inputs.stream() + .map(input -> ProcessError + .toError(input.getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_INPUT_EXTENSION_ERROR))) + .toList(); + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java new file mode 100644 index 00000000..86fce5e1 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java @@ -0,0 +1,33 @@ +package dev.dsf.bpe.util.task.input.generator; + +import java.util.List; +import java.util.stream.Collectors; + +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; + +public class ErrorInputComponentGenerator +{ + public static List<Task.ParameterComponent> create(List<ProcessError> errors) + { + if (errors == null || errors.isEmpty()) + return List.of(); + return errors.stream().map(ErrorInputComponentGenerator::create).collect(Collectors.toList()); + } + + public static Task.ParameterComponent create(ProcessError error) + { + Task.ParameterComponent param = new Task.ParameterComponent(); + + param.getType().addCoding( + new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR, null)); + param.addExtension(ProcessError.toInputExtension(error)); + param.setValue(new StringType(error.message())); + + return param; + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java deleted file mode 100644 index 23287968..00000000 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorMessageGenerator.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.dsf.bpe.util.task.input.generator; - -import java.util.List; -import java.util.stream.Collectors; - -import org.hl7.fhir.r4.model.StringType; -import org.hl7.fhir.r4.model.Task; - -import dev.dsf.bpe.ConstantsPing; - -public class ErrorMessageGenerator -{ - public static List<Task.ParameterComponent> create(List<String> errorMessages) - { - if (errorMessages == null || errorMessages.isEmpty()) - return List.of(); - return errorMessages.stream().map(ErrorMessageGenerator::create).collect(Collectors.toList()); - } - - public static Task.ParameterComponent create(String errorMessage) - { - Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(new StringType(errorMessage)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR_MESSAGE); - return param; - } -} diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java deleted file mode 100644 index e8a30b3a..00000000 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorMessageGenerator.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.dsf.bpe.util.task.output.generator; - -import java.util.List; -import java.util.stream.Collectors; - -import org.hl7.fhir.r4.model.StringType; -import org.hl7.fhir.r4.model.Task; - -import dev.dsf.bpe.ConstantsPing; - -public class ErrorMessageGenerator -{ - public static List<Task.TaskOutputComponent> create(List<String> errorMessages) - { - if (errorMessages == null || errorMessages.isEmpty()) - return List.of(); - return errorMessages.stream().map(ErrorMessageGenerator::create).collect(Collectors.toList()); - } - - public static Task.TaskOutputComponent create(String errorMessage) - { - Task.TaskOutputComponent param = new Task.TaskOutputComponent(); - param.setValue(new StringType(errorMessage)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR_MESSAGE); - return param; - } -} diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java new file mode 100644 index 00000000..e5248ad1 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java @@ -0,0 +1,33 @@ +package dev.dsf.bpe.util.task.output.generator; + +import java.util.List; +import java.util.stream.Collectors; + +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; + +public class ErrorOutputComponentGenerator +{ + public static List<Task.TaskOutputComponent> create(List<ProcessError> errors) + { + if (errors == null || errors.isEmpty()) + return List.of(); + return errors.stream().map(ErrorOutputComponentGenerator::create).collect(Collectors.toList()); + } + + public static Task.TaskOutputComponent create(ProcessError error) + { + Task.TaskOutputComponent param = new Task.TaskOutputComponent(); + + param.getType().addCoding( + new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR, null)); + param.addExtension(ProcessError.toOutputExtension(error)); + param.setValue(new StringType(error.message())); + + return param; + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 8cd25bfc..6609d2cd 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -19,13 +19,14 @@ import org.hl7.fhir.r4.model.Type; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; import dev.dsf.bpe.v1.constants.NamingSystems.OrganizationIdentifier; import dev.dsf.bpe.v1.variables.Target; public class PingStatusGenerator { - public static Task updatePingStatusOutput(Task task, String correlationKey, List<String> errorMessages) + public static Task updatePingStatusOutput(Task task, String correlationKey, List<ProcessError> errors) { List<TaskOutputComponent> outputs = filterByCorrelationKey( getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), @@ -33,13 +34,13 @@ public static Task updatePingStatusOutput(Task task, String correlationKey, List if (outputs.isEmpty()) { - task.addOutput(updateStatusOutput(new TaskOutputComponent(), errorMessages)); + task.addOutput(updateStatusOutput(new TaskOutputComponent(), errors)); } else { if (outputs.size() == 1) { - updateStatusOutput(outputs.get(0), errorMessages); + updateStatusOutput(outputs.get(0), errors); } else { @@ -50,19 +51,19 @@ public static Task updatePingStatusOutput(Task task, String correlationKey, List return task; } - public static Task updatePongStatusOutput(Task task, List<String> errorMessages) + public static Task updatePongStatusOutput(Task task, List<ProcessError> errors) { List<Task.TaskOutputComponent> pongStatusOutputs = getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); if (pongStatusOutputs.isEmpty()) { - task.addOutput(updateStatusOutput(new TaskOutputComponent(), errorMessages)); + task.addOutput(updateStatusOutput(new TaskOutputComponent(), errors)); } else { if (pongStatusOutputs.size() == 1) { - updateStatusOutput(pongStatusOutputs.get(0), errorMessages); + updateStatusOutput(pongStatusOutputs.get(0), errors); } else { @@ -73,31 +74,20 @@ public static Task updatePongStatusOutput(Task task, List<String> errorMessages) return task; } - public static TaskOutputComponent updateStatusOutput(TaskOutputComponent output, List<String> errorMessages) + public static TaskOutputComponent updateStatusOutput(TaskOutputComponent output, List<ProcessError> errors) { if (output != null) { Extension pingStatusExtension = getOrCreatePingStatusExtension(output); - List<Extension> errorMessageExtensions = pingStatusExtension.getExtension().stream() - .filter(extension -> ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension.getUrl())).toList(); - if (errorMessageExtensions.isEmpty()) + List<Extension> errorExtensions = pingStatusExtension.getExtension().stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_ERROR.equals(extension.getUrl())).toList(); + if (errorExtensions.isEmpty()) { - addErrorMessages(output, errorMessages); + addErrors(output, errors); } else { - Set<String> existingErrors = errorMessageExtensions.stream() - .map(extension -> ((StringType) extension.getValue()).getValue()).collect(Collectors.toSet()); - existingErrors.addAll(errorMessages); - List<Extension> nonErrorMessageExtensions = pingStatusExtension.getExtension().stream() - .filter(extension -> !ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension.getUrl())) - .toList(); - List<Extension> updatedErrorMessageExtensions = existingErrors.stream() - .map(errorMessage -> new Extension().setUrl(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE) - .setValue(new StringType(errorMessage))) - .collect(Collectors.toCollection(ArrayList::new)); - updatedErrorMessageExtensions.addAll(nonErrorMessageExtensions); - pingStatusExtension.setExtension(updatedErrorMessageExtensions); + updateErrors(output, errors); } } @@ -496,17 +486,17 @@ public static TaskOutputComponent createPingStatusOutput(Target target, String s } public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, - List<String> errorMessages) + List<ProcessError> errors) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, - errorMessages, null, null, null); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errors, null, + null, null); } public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, - List<String> errorMessages, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) + List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, - errorMessages, downloadSpeed, uploadSpeed, unit); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errors, + downloadSpeed, uploadSpeed, unit); } public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode) @@ -521,26 +511,26 @@ public static TaskOutputComponent createPongStatusOutput(Target target, String s } public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, - List<String> errorMessages) + List<ProcessError> errors) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, - errorMessages, null, null, null); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errors, null, + null, null); } public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, - List<String> errorMessages, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) + List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, - errorMessages, downloadSpeed, uploadSpeed, unit); + return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errors, + downloadSpeed, uploadSpeed, unit); } private static TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, - List<String> errorMessages, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) + List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) { TaskOutputComponent output = new TaskOutputComponent(); addStatus(output, outputParameter, statusCode); addTarget(output, target); - addErrorMessages(output, errorMessages); + addErrors(output, errors); addNetworkSpeed(output, downloadSpeed, uploadSpeed, unit); return output; @@ -658,34 +648,30 @@ private static TaskOutputComponent updateTarget(TaskOutputComponent outputCompon return outputComponent; } - private static TaskOutputComponent addErrorMessages(TaskOutputComponent outputComponent, List<String> errorMessages) + private static TaskOutputComponent addErrors(TaskOutputComponent outputComponent, List<ProcessError> errors) { - if (errorMessages != null) + if (errors != null) { Extension extension = getOrCreatePingStatusExtension(outputComponent); - for (String errorMessage : errorMessages) + for (ProcessError error : errors) { - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE) - .setValue(new StringType(errorMessage)); + extension.addExtension(ProcessError.toExtensionExtension(error)); } } sortStatusOutputExtensions(outputComponent); return outputComponent; } - private static TaskOutputComponent updateErrorMessages(TaskOutputComponent outputComponent, - List<String> errorMessages) + private static TaskOutputComponent updateErrors(TaskOutputComponent outputComponent, List<ProcessError> errors) { Extension extension = getOrCreatePingStatusExtension(outputComponent); List<Extension> nonErrorExtensions = extension.getExtension().stream() - .filter(extension1 -> !ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension1.getUrl())) + .filter(extension1 -> !ConstantsPing.EXTENSION_URL_ERROR.equals(extension1.getUrl())) .collect(Collectors.toCollection(ArrayList::new)); - if (errorMessages != null) + if (errors != null) { - List<Extension> newErrorExtensions = errorMessages.stream() - .map(errorMessage -> new Extension(ConstantsPing.EXTENSION_URL_ERROR_MESSAGE, - new StringType(errorMessage))) + List<Extension> newErrorExtensions = errors.stream().map(ProcessError::toExtensionExtension) .collect(Collectors.toCollection(ArrayList::new)); nonErrorExtensions.addAll(newErrorExtensions); extension.setExtension(newErrorExtensions); @@ -725,7 +711,7 @@ private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputCo Extension downloadSpeedExtension = extension.addExtension() .setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); Extension networkSpeed = downloadSpeedExtension.addExtension() - .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + .setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) @@ -746,7 +732,7 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu if (downloadSpeedExtension != null) { Extension networkSpeedExtension = downloadSpeedExtension - .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + .getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); @@ -761,7 +747,7 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu { downloadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); Extension networkSpeed = downloadSpeedExtension.addExtension() - .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + .setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) @@ -781,7 +767,7 @@ private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComp Extension extension = getOrCreatePingStatusExtension(outputComponent); Extension uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); Extension networkSpeed = uploadSpeedExtension.addExtension() - .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + .setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(uploadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) @@ -802,7 +788,7 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC if (uploadSpeedExtension != null) { Extension networkSpeedExtension = uploadSpeedExtension - .getExtensionByUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + .getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); if (networkSpeedExtension != null) { networkSpeedExtension.setExtension(new ArrayList<>()); @@ -817,7 +803,7 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC { uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); Extension networkSpeed = uploadSpeedExtension.addExtension() - .setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED); + .setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(uploadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) @@ -839,7 +825,7 @@ private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outp else { Extension extension = outputComponent.addExtension(); - extension.setUrl(appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS)); + extension.setUrl(appendFhirResourceVersion(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS)); return extension; } } @@ -848,7 +834,8 @@ private static Optional<Extension> getPingStatusExtension(Task task) { Optional<TaskOutputComponent> optPingStatusOutput = task.getOutput().stream() .filter(outputComponent -> outputComponent.getExtension().stream() - .anyMatch(extension -> ConstantsPing.EXTENSION_URL_PING_STATUS.equals(extension.getUrl()))) + .anyMatch(extension -> ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS + .equals(extension.getUrl()))) .findFirst(); if (optPingStatusOutput.isPresent()) { @@ -863,8 +850,8 @@ private static Optional<Extension> getPingStatusExtension(Task task) private static Optional<Extension> getPingStatusExtension(TaskOutputComponent outputComponent) { List<Extension> pingStatusExtensions = outputComponent.getExtension().stream() - .filter(extension -> appendFhirResourceVersion(ConstantsPing.EXTENSION_URL_PING_STATUS) - .equals(extension.getUrl())) + .filter(extension -> appendFhirResourceVersion( + ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS).equals(extension.getUrl())) .toList(); if (pingStatusExtensions.isEmpty()) { @@ -886,14 +873,14 @@ private static Optional<Extension> getPingStatusExtension(TaskOutputComponent ou private static List<Task.TaskOutputComponent> getOutputsByExtensionUrlAndCodes(Task task, String... codes) { - return task - .getOutput().stream().filter( - outputComponent -> outputComponent.getType().getCoding().stream() - .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem()) - && Stream.of(codes).anyMatch(code -> code.equals(coding.getCode()))) - || outputComponent.getExtension().stream() - .anyMatch(extension -> appendFhirResourceVersion( - ConstantsPing.EXTENSION_URL_PING_STATUS).equals(extension.getUrl()))) + return task.getOutput().stream() + .filter(outputComponent -> outputComponent.getType().getCoding().stream() + .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem()) + && Stream.of(codes).anyMatch(code -> code.equals(coding.getCode()))) + || outputComponent.getExtension().stream() + .anyMatch(extension -> appendFhirResourceVersion( + ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS) + .equals(extension.getUrl()))) .collect(Collectors.toCollection(ArrayList::new)); } @@ -906,7 +893,9 @@ private static List<Task.TaskOutputComponent> filterByCorrelationKey(List<TaskOu if (outputExtensions.isEmpty()) return false; List<Extension> pingStatusExtensions = outputExtensions.stream() - .filter(extension -> ConstantsPing.EXTENSION_URL_PING_STATUS.equals(extension.getUrl())).toList(); + .filter(extension -> ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS + .equals(extension.getUrl())) + .toList(); if (pingStatusExtensions.isEmpty()) return false; List<Extension> extensionsMatchingCorrelationKey = pingStatusExtensions.stream() @@ -993,12 +982,12 @@ private static void sortStatusOutputExtensions(TaskOutputComponent outputCompone sortedExtensions.add(uploadSpeedExtension.get()); } - List<Extension> errorMessageExtensions = extensions.stream() - .filter(extension -> ConstantsPing.EXTENSION_URL_ERROR_MESSAGE.equals(extension.getUrl())).toList(); - if (!errorMessageExtensions.isEmpty()) + List<Extension> errorExtensions = extensions.stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_ERROR.equals(extension.getUrl())).toList(); + if (!errorExtensions.isEmpty()) { - extensions.removeAll(errorMessageExtensions); - sortedExtensions.addAll(errorMessageExtensions); + extensions.removeAll(errorExtensions); + sortedExtensions.addAll(errorExtensions); } sortedExtensions.addAll(extensions); diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 80aad39a..2ec07ac5 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -115,7 +115,7 @@ </bpmn:endEvent> <bpmn:boundaryEvent id="Event_0i4slcz" attachedToRef="Activity_0h9o9u7"> <bpmn:outgoing>Flow_10h6pqh</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0f1pn8k" errorRef="Error_1jmenbm" camunda:errorMessageVariable="resourceDownloadErrorMessage" /> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0f1pn8k" errorRef="Error_1jmenbm" camunda:errorMessageVariable="resourceDownloadError" /> </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_10epxa2" sourceRef="SubProcessStartEvent" targetRef="Activity_0ri6fnv" /> <bpmn:sequenceFlow id="Flow_0y9usku" sourceRef="EventBasedGateway" targetRef="PongTimer" /> @@ -217,7 +217,7 @@ <bpmn:sequenceFlow id="Flow_0e35w2m" sourceRef="StartPingMessageStartEvent" targetRef="Activity_1wdftvk" /> <bpmn:boundaryEvent id="Event_159rcwi" name="Failed to create resource" attachedToRef="Activity_0nwtf8o"> <bpmn:outgoing>Flow_0ql2dtr</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_1f41ql6" errorRef="Error_0tkfq65" camunda:errorMessageVariable="resourceUploadErrorMessage" /> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1f41ql6" errorRef="Error_0tkfq65" camunda:errorMessageVariable="resourceUploadError" /> </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_0ql2dtr" sourceRef="Event_159rcwi" targetRef="Activity_1ddl5dm" /> <bpmn:sequenceFlow id="Flow_0ejw9k5" sourceRef="Activity_1ddl5dm" targetRef="Gateway_0bifi5h" /> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index eb6a376b..9a8fd34c 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -83,7 +83,7 @@ </bpmn:serviceTask> <bpmn:boundaryEvent id="Event_0olr5yw" attachedToRef="Activity_095j2gg"> <bpmn:outgoing>Flow_0uj7rm3</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0h8zmzk" errorRef="Error_1jmenbm" camunda:errorMessageVariable="resourceDownloadErrorMessage" /> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0h8zmzk" errorRef="Error_1jmenbm" /> </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_10z0d4x" sourceRef="Gateway_1jwjxzn" targetRef="Activity_095j2gg" /> <bpmn:sequenceFlow id="Flow_08gidyv" sourceRef="Gateway_1jwjxzn" targetRef="Gateway_1ggdr8l"> diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-process-steps.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-process-steps.xml new file mode 100644 index 00000000..8be176de --- /dev/null +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-process-steps.xml @@ -0,0 +1,139 @@ +<CodeSystem xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="DSF_Ping_Process_Steps" /> + <title value="DSF Ping Process Steps" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="CodeSystem with ping/pong process steps" /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> + <concept> + <code value="set-download-resource-size"/> + <display value="Set Download Resource Size"/> + <definition value="Sets the size of the resource to be downloaded" /> + </concept> + <concept> + <code value="generate-and-store-resource"/> + <display value="Generate And Store Resource"/> + <definition value="Generates the resource for download and posts it to the local DSF FHIR server" /> + </concept> + <concept> + <code value="log-and-save-error"/> + <display value="Log And Save Error"/> + <definition value="Logs an error and saves it as an execution variable" /> + </concept> + <concept> + <code value="select-targets"/> + <display value="Select Targets"/> + <definition value="Selects targets to be pinged" /> + </concept> + <concept> + <code value="ping"/> + <display value="Ping"/> + <definition value="Sends a ping message" /> + </concept> + <concept> + <code value="log-and-save-send-error"/> + <display value="Log And Save Send Error"/> + <definition value="Logs a send error and saves it as an execution variable" /> + </concept> + <concept> + <code value="log-and-save-no-response"/> + <display value="Log And Save No Response"/> + <definition value="Logs and saves that a pong message is missing" /> + </concept> + <concept> + <code value="save-pong"/> + <display value="Save Pong"/> + <definition value="Saves the input parameters of the pong message as execution variables" /> + </concept> + <concept> + <code value="download-resource-and-measure-speed"/> + <display value="Download Resource And Measure Speed"/> + <definition value="Downloads the resource referenced by the input parameter of the previously received message and measures the network speed" /> + </concept> + <concept> + <code value="cleanup-pong"/> + <display value="Cleanup Pong"/> + <definition value="Sends a cleanup message to the pong process" /> + </concept> + <concept> + <code value="cleanup"/> + <display value="cleanup"/> + <definition value="Cleans up the process e.g. by deleting the binary resource that was created to test connections and measure network speed" /> + </concept> + <concept> + <code value="store-results"/> + <display value="Store Results"/> + <definition value="Stores results of the process as output parameters of the start task" /> + </concept> + <concept> + <code value="log-ping"/> + <display value="Log Ping"/> + <definition value="Logs that a ping message was received" /> + </concept> + <concept> + <code value="set-endpoint-identifier"/> + <display value="Set Endpoint Identifier"/> + <definition value="Sets the endpoint identifier from the ping message" /> + </concept> + <concept> + <code value="select-pong-target"/> + <display value="Select Pong Target"/> + <definition value="Selects the target to reply to with a pong message" /> + </concept> + <concept> + <code value="store-download-speed"/> + <display value="Store Download Speed"/> + <definition value="Stores the measured download speed" /> + </concept> + <concept> + <code value="log-and-save-and-store-error"/> + <display value="Log And Save And Store Error"/> + <definition value="Logs and error and saves it as an execution variable and stores it as an output parameter in the start task" /> + </concept> + <concept> + <code value="estimate-cleanup-timer-duration"/> + <display value="Estimate Cleanup Timer Duration"/> + <definition value="Estimates the duration of the cleanup timer" /> + </concept> + <concept> + <code value="pong"/> + <display value="Pong"/> + <definition value="Sends a pong message to the target" /> + </concept> + <concept> + <code value="store-upload-speed"/> + <display value="Store Upload Speed"/> + <definition value="Stores the measured upload speed" /> + </concept> + <concept> + <code value="save-timeout-error"/> + <display value="Save Timeout Error"/> + <definition value="Saves the timeout error while waiting for cleanup message in an execution variable" /> + </concept> + <concept> + <code value="store-errors"/> + <display value="Store Errors"/> + <definition value="Stores all error that are present as execution variables as output parameters of the start task" /> + </concept> + <concept> + <code value="cleanup-timer-catch-event"/> + <display value="Cleanup Timer Catch Event"/> + <definition value="Timeout event while waiting for cleanup message"/> + </concept> +</CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-processes.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-processes.xml new file mode 100644 index 00000000..28822fc1 --- /dev/null +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-processes.xml @@ -0,0 +1,34 @@ +<CodeSystem xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/CodeSystem/ping-processes-v2" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="DSF_Ping_Processes" /> + <title value="DSF Ping Processes" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="CodeSystem with processes in the ping-pong plugin" /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> + <concept> + <code value="ping"/> + <display value="Ping"/> + <definition value="Ping process" /> + </concept> + <concept> + <code value="pong"/> + <display value="Pong"/> + <definition value="Pong process" /> + </concept> +</CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping.xml b/src/main/resources/fhir/CodeSystem/dsf-ping.xml index aa93700c..97a2fb11 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping.xml @@ -72,8 +72,8 @@ <definition value="Duration it took for the resource to be downloaded to measure network speed"/> </concept> <concept> - <code value="error-message"/> - <display value="Error Message"/> - <definition value="Error message to be added as an output parameter in the Start Ping Task"/> + <code value="error"/> + <display value="Error"/> + <definition value="Error to be added as an output parameter in the Start Ping Task"/> </concept> </CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-extension-error.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-extension-error.xml new file mode 100644 index 00000000..c9ecbf01 --- /dev/null +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-extension-error.xml @@ -0,0 +1,169 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag"/> + <code value="ALL"/> + </tag> + </meta> + <url value="http://dsf.dev/fhir/StructureDefinition/extension-extension-error"/> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="Error"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <fhirVersion value="4.0.1"/> + <kind value="complex-type"/> + <abstract value="false"/> + <context> + <type value="element"/> + <expression value="Extension"/> + </context> + <type value="Extension"/> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> + <derivation value="constraint"/> + <differential> + <element id="Extension.extension"> + <path value="Extension.extension"/> + <slicing> + <discriminator> + <type value="value"/> + <path value="url"/> + </discriminator> + <rules value="open"/> + </slicing> + <min value="4"/> + <max value="5"/> + </element> + <element id="Extension.extension:process"> + <path value="Extension.extension"/> + <sliceName value="process"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:process.url"> + <path value="Extension.extension.url"/> + <fixedUri value="process"/> + </element> + <element id="Extension.extension:process.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Extension.extension:process.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-processes-v2"/> + </element> + <element id="Extension.extension:process.value[x].code"> + <path value="Extension.extension.value[x].code"/> + <min value="1"/> + <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-processes-v2|#{version}"/> + </binding> + </element> + <element id="Extension.extension:process-step"> + <path value="Extension.extension"/> + <sliceName value="process-step"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:process-step.url"> + <path value="Extension.extension.url"/> + <fixedUri value="process-step"/> + </element> + <element id="Extension.extension:process-step.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Extension.extension:process-step.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2"/> + </element> + <element id="Extension.extension:process-step.value[x].code"> + <path value="Extension.extension.value[x].code"/> + <min value="1"/> + <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-process-steps-v2|#{version}"/> + </binding> + </element> + <element id="Extension.extension:action"> + <path value="Extension.extension"/> + <sliceName value="action"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:action.url"> + <path value="Extension.extension.url"/> + <fixedUri value="action"/> + </element> + <element id="Extension.extension:action.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="string"/> + </type> + </element> + <element id="Extension.extension:potential-fix"> + <path value="Extension.extension"/> + <sliceName value="potential-fix"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:potential-fix.url"> + <path value="Extension.extension.url"/> + <fixedUri value="potential-fix"/> + </element> + <element id="Extension.extension:potential-fix.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="url"/> + </type> + </element> + <element id="Extension.extension:message"> + <path value="Extension.extension"/> + <sliceName value="message"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:message.url"> + <path value="Extension.extension.url"/> + <fixedUri value="message"/> + </element> + <element id="Extension.extension:message.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="string"/> + </type> + </element> + <element id="Extension.url"> + <path value="Extension.url"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-extension-error"/> + </element> + <element id="Extension.value[x]"> + <path value="Extension.value[x]"/> + <max value="0"/> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index acf99fbe..b591479b 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -105,22 +105,6 @@ <path value="Extension.extension.value[x].value"/> <min value="1"/> </element> - <element id="Extension.extension:error-message"> - <path value="Extension.extension"/> - <sliceName value="error-message"/> - <min value="0"/> - </element> - <element id="Extension.extension:error-message.url"> - <path value="Extension.extension.url"/> - <fixedUri value="error-message"/> - </element> - <element id="Extension.extension:error-message.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <type> - <code value="string"/> - </type> - </element> <element id="Extension.extension:download-speed"> <path value="Extension.extension"/> <sliceName value="download-speed"/> @@ -191,6 +175,40 @@ <path value="Extension.extension.value[x]"/> <max value="0"/> </element> + <element id="Extension.extension:error"> + <path value="Extension.extension"/> + <sliceName value="error"/> + <min value="0"/> + </element> + <element id="Extension.extension:error.extension"> + <path value="Extension.extension.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:error.extension:error-extension"> + <path value="Extension.extension.extension" /> + <sliceName value="error-extension" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-extension-error|#{version}" /> + </type> + </element> + <element id="Extension.extension:error.url"> + <path value="Extension.extension.url"/> + <fixedUri value="error"/> + </element> + <element id="Extension.extension:error.value[x]"> + <path value="Extension.extension.value[x]"/> + <max value="0"/> + </element> <element id="Extension.url"> <path value="Extension.url"/> <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2|#{version}"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml b/src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml new file mode 100644 index 00000000..ab1b3bfe --- /dev/null +++ b/src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml @@ -0,0 +1,151 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag"/> + <code value="ALL"/> + </tag> + </meta> + <url value="http://dsf.dev/fhir/StructureDefinition/input-extension-error"/> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="Error"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <fhirVersion value="4.0.1"/> + <kind value="complex-type"/> + <abstract value="false"/> + <context> + <type value="element"/> + <expression value="Task.input"/> + </context> + <type value="Extension"/> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> + <derivation value="constraint"/> + <differential> + <element id="Extension.extension"> + <path value="Extension.extension"/> + <slicing> + <discriminator> + <type value="value"/> + <path value="url"/> + </discriminator> + <rules value="open"/> + </slicing> + <min value="4"/> + <max value="5"/> + </element> + <element id="Extension.extension:process"> + <path value="Extension.extension"/> + <sliceName value="process"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:process.url"> + <path value="Extension.extension.url"/> + <fixedUri value="process"/> + </element> + <element id="Extension.extension:process.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Extension.extension:process.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-processes-v2"/> + </element> + <element id="Extension.extension:process.value[x].code"> + <path value="Extension.extension.value[x].code"/> + <min value="1"/> + <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-processes-v2|#{version}"/> + </binding> + </element> + <element id="Extension.extension:process-step"> + <path value="Extension.extension"/> + <sliceName value="process-step"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:process-step.url"> + <path value="Extension.extension.url"/> + <fixedUri value="process-step"/> + </element> + <element id="Extension.extension:process-step.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Extension.extension:process-step.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2"/> + </element> + <element id="Extension.extension:process-step.value[x].code"> + <path value="Extension.extension.value[x].code"/> + <min value="1"/> + <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-process-steps-v2|#{version}"/> + </binding> + </element> + <element id="Extension.extension:action"> + <path value="Extension.extension"/> + <sliceName value="action"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:action.url"> + <path value="Extension.extension.url"/> + <fixedUri value="action"/> + </element> + <element id="Extension.extension:action.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="string"/> + </type> + </element> + <element id="Extension.extension:potential-fix"> + <path value="Extension.extension"/> + <sliceName value="potential-fix"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:potential-fix.url"> + <path value="Extension.extension.url"/> + <fixedUri value="potential-fix"/> + </element> + <element id="Extension.extension:potential-fix.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="url"/> + </type> + </element> + <element id="Extension.url"> + <path value="Extension.url"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/input-extension-error"/> + </element> + <element id="Extension.value[x]"> + <path value="Extension.value[x]"/> + <max value="0"/> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml b/src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml new file mode 100644 index 00000000..5229350a --- /dev/null +++ b/src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml @@ -0,0 +1,151 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag"/> + <code value="ALL"/> + </tag> + </meta> + <url value="http://dsf.dev/fhir/StructureDefinition/output-extension-error"/> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="Error"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <fhirVersion value="4.0.1"/> + <kind value="complex-type"/> + <abstract value="false"/> + <context> + <type value="element"/> + <expression value="Task.output"/> + </context> + <type value="Extension"/> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> + <derivation value="constraint"/> + <differential> + <element id="Extension.extension"> + <path value="Extension.extension"/> + <slicing> + <discriminator> + <type value="value"/> + <path value="url"/> + </discriminator> + <rules value="open"/> + </slicing> + <min value="4"/> + <max value="5"/> + </element> + <element id="Extension.extension:process"> + <path value="Extension.extension"/> + <sliceName value="process"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:process.url"> + <path value="Extension.extension.url"/> + <fixedUri value="process"/> + </element> + <element id="Extension.extension:process.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Extension.extension:process.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-processes-v2"/> + </element> + <element id="Extension.extension:process.value[x].code"> + <path value="Extension.extension.value[x].code"/> + <min value="1"/> + <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-processes-v2|#{version}"/> + </binding> + </element> + <element id="Extension.extension:process-step"> + <path value="Extension.extension"/> + <sliceName value="process-step"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:process-step.url"> + <path value="Extension.extension.url"/> + <fixedUri value="process-step"/> + </element> + <element id="Extension.extension:process-step.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Extension.extension:process-step.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2"/> + </element> + <element id="Extension.extension:process-step.value[x].code"> + <path value="Extension.extension.value[x].code"/> + <min value="1"/> + <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-process-steps-v2|#{version}"/> + </binding> + </element> + <element id="Extension.extension:action"> + <path value="Extension.extension"/> + <sliceName value="action"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:action.url"> + <path value="Extension.extension.url"/> + <fixedUri value="action"/> + </element> + <element id="Extension.extension:action.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="string"/> + </type> + </element> + <element id="Extension.extension:potential-fix"> + <path value="Extension.extension"/> + <sliceName value="potential-fix"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:potential-fix.url"> + <path value="Extension.extension.url"/> + <fixedUri value="potential-fix"/> + </element> + <element id="Extension.extension:potential-fix.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="url"/> + </type> + </element> + <element id="Extension.url"> + <path value="Extension.url"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/output-extension-error"/> + </element> + <element id="Extension.value[x]"> + <path value="Extension.value[x]"/> + <max value="0"/> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index a021340a..7cca3bda 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -70,6 +70,10 @@ <path value="Task.input.type"/> <min value="1"/> <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> + </binding> </element> <element id="Task.input:downloaded-bytes.type.coding"> <path value="Task.input.type.coding"/> @@ -106,6 +110,10 @@ <path value="Task.input.type"/> <min value="1"/> <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> + </binding> </element> <element id="Task.input:downloaded-duration-millis.type.coding"> <path value="Task.input.type.coding"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index 5acfec2e..cc5e1e58 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -209,6 +209,65 @@ <path value="Task.input.value[x].identifier"/> <max value="0"/> </element> + <element id="Task.output:process-error"> + <path value="Task.output"/> + <sliceName value="process-error"/> + <min value="0"/> + </element> + <element id="Task.output:process-error.extension"> + <path value="Task.output.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.output:process-error.extension:error-extension"> + <path value="Task.output.extension" /> + <sliceName value="error-extension" /> + <min value="1" /> + <max value="1"/> + <type> + <code value="Extension" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/output-extension-error|#{version}" /> + </type> + </element> + <element id="Task.output:process-error.type"> + <path value="Task.output.type"/> + <min value="1"/> + <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> + </binding> + </element> + <element id="Task.output:process-error.type.coding"> + <path value="Task.output.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.output:process-error.type.coding.system"> + <path value="Task.output.type.coding.system"/> + <min value="1"/> + <max value="1"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + </element> + <element id="Task.output:process-error.type.coding.code"> + <path value="Task.output.type.coding.code"/> + <min value="1"/> + <max value="1"/> + <fixedCode value="error"/> + </element> + <element id="Task.output:process-error.value[x]"> + <path value="Task.output.value[x]"/> + <type> + <code value="string"/> + </type> + </element> <element id="Task.output:pong-status"> <path value="Task.output"/> <sliceName value="pong-status"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index 50e1915e..7ad44fd2 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -121,6 +121,10 @@ <path value="Task.input.type"/> <min value="1"/> <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> + </binding> </element> <element id="Task.input:downloaded-bytes.type.coding"> <path value="Task.input.type.coding"/> @@ -157,6 +161,10 @@ <path value="Task.input.type"/> <min value="1"/> <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> + </binding> </element> <element id="Task.input:downloaded-duration-millis.type.coding"> <path value="Task.input.type.coding"/> @@ -183,37 +191,61 @@ <code value="decimal"/> </type> </element> - <element id="Task.input:error-message"> + <element id="Task.input:process-error"> <path value="Task.input"/> - <sliceName value="error-message"/> + <sliceName value="process-error"/> <min value="0"/> </element> - <element id="Task.input:error-message.type"> + <element id="Task.input:process-error.extension"> + <path value="Task.input.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.input:process-error.extension:error-extension"> + <path value="Task.input.extension" /> + <sliceName value="process-error-extension" /> + <min value="1" /> + <max value="1"/> + <type> + <code value="Extension" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/input-extension-error|#{version}" /> + </type> + </element> + <element id="Task.input:process-error.type"> <path value="Task.input.type"/> <min value="1"/> <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> + </binding> </element> - <element id="Task.input:error-message.type.coding"> + <element id="Task.input:process-error.type.coding"> <path value="Task.input.type.coding"/> <min value="1"/> <max value="1"/> </element> - <element id="Task.input:error-message.type.coding.system"> + <element id="Task.input:process-error.type.coding.system"> <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> - <element id="Task.input:error-message.type.coding.code"> + <element id="Task.input:process-error.type.coding.code"> <path value="Task.input.type.coding.code"/> <min value="1"/> <max value="1"/> - <fixedCode value="error-message"/> + <fixedCode value="error"/> </element> - <element id="Task.input:error-message.value[x]"> + <element id="Task.input:process-error.value[x]"> <path value="Task.input.value[x]"/> - <min value="1"/> - <max value="1"/> <type> <code value="string"/> </type> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index ffe47756..7632db45 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -121,37 +121,61 @@ <min value="1" /> <fixedCode value="download-resource-size-bytes" /> </element> - <element id="Task.output:error-message"> + <element id="Task.output:process-error"> <path value="Task.output"/> - <sliceName value="error-message"/> + <sliceName value="process-error"/> <min value="0"/> </element> - <element id="Task.output:error-message.type"> + <element id="Task.output:process-error.extension"> + <path value="Task.output.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.output:process-error.extension:error-extension"> + <path value="Task.output.extension" /> + <sliceName value="error-extension" /> + <min value="1" /> + <max value="1"/> + <type> + <code value="Extension" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/output-extension-error|#{version}" /> + </type> + </element> + <element id="Task.output:process-error.type"> <path value="Task.output.type"/> <min value="1"/> <max value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> + </binding> </element> - <element id="Task.output:error-message.type.coding"> - <path value="Task.output.type.coding" /> + <element id="Task.output:process-error.type.coding"> + <path value="Task.output.type.coding"/> <min value="1"/> <max value="1"/> </element> - <element id="Task.output:error-message.type.coding.system"> + <element id="Task.output:process-error.type.coding.system"> <path value="Task.output.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> - <element id="Task.output:error-message.type.coding.code"> + <element id="Task.output:process-error.type.coding.code"> <path value="Task.output.type.coding.code"/> <min value="1"/> <max value="1"/> - <fixedCode value="error-message" /> + <fixedCode value="error"/> </element> - <element id="Task.output:error-message.value[x]"> + <element id="Task.output:process-error.value[x]"> <path value="Task.output.value[x]"/> - <min value="1"/> - <max value="1"/> <type> <code value="string"/> </type> diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-process-steps.xml b/src/main/resources/fhir/ValueSet/dsf-ping-process-steps.xml new file mode 100644 index 00000000..bfc215a9 --- /dev/null +++ b/src/main/resources/fhir/ValueSet/dsf-ping-process-steps.xml @@ -0,0 +1,27 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/ValueSet/ping-process-steps-v2" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="DSF_Ping_Process_Steps" /> + <title value="DSF Ping Process Steps" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="ValueSet with ping/pong process steps" /> + <immutable value="true" /> + <compose> + <include> + <system value="http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2" /> + <version value="#{version}" /> + </include> + </compose> +</ValueSet> \ No newline at end of file diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-processes.xml b/src/main/resources/fhir/ValueSet/dsf-ping-processes.xml new file mode 100644 index 00000000..afc3919c --- /dev/null +++ b/src/main/resources/fhir/ValueSet/dsf-ping-processes.xml @@ -0,0 +1,27 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/ValueSet/ping-processes-v2" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="DSF_Ping_Processes" /> + <title value="DSF Ping Processes" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="ValueSet with processes in the ping-pong plugin" /> + <immutable value="true" /> + <compose> + <include> + <system value="http://dsf.dev/fhir/CodeSystem/ping-processes-v2" /> + <version value="#{version}" /> + </include> + </compose> +</ValueSet> \ No newline at end of file diff --git a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java index 55e289ab..fed3c5ae 100644 --- a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java +++ b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java @@ -20,7 +20,7 @@ public void testResourceLoading() throws Exception var ping = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING); assertNotNull(ping); - assertEquals(13, ping.stream().filter(this::exists).count()); + assertEquals(15, ping.stream().filter(this::exists).count()); var pingAutostart = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART); assertNotNull(pingAutostart); @@ -28,7 +28,7 @@ public void testResourceLoading() throws Exception var pong = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PONG); assertNotNull(pong); - assertEquals(10, pong.stream().filter(this::exists).count()); + assertEquals(13, pong.stream().filter(this::exists).count()); } private boolean exists(String file) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index de8c8c76..da811487 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -8,9 +8,11 @@ import java.time.Instant; import java.time.LocalDate; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; +import java.util.Random; import java.util.TimeZone; import java.util.UUID; @@ -32,10 +34,12 @@ import ca.uhn.fhir.validation.ValidationResult; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; +import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; -import dev.dsf.bpe.util.task.input.generator.ErrorMessageGenerator; +import dev.dsf.bpe.util.task.input.generator.ErrorInputComponentGenerator; import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; +import dev.dsf.bpe.util.task.output.generator.ErrorOutputComponentGenerator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; @@ -54,15 +58,19 @@ public class TaskProfileTest @ClassRule public static final ValidationSupportRule validationRule = new ValidationSupportRule(def.getResourceVersion(), def.getResourceReleaseDate(), - Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-network-speed.xml", "dsf-extension-ping-status.xml", + Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-extension-error.xml", + "dsf-input-extension-error.xml", "dsf-output-extension-error.xml", + "dsf-extension-network-speed.xml", "dsf-extension-ping-status.xml", "dsf-extension-ping-status-1_0.xml", "dsf-task-ping.xml", "dsf-task-pong.xml", "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", - "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-ping-units.xml"), + "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-ping-units.xml", + "dsf-ping-process-steps.xml", "dsf-ping-processes.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-pong-status-1_0.xml", - "dsf-pong-status.xml", "dsf-ping-units.xml")); + "dsf-pong-status.xml", "dsf-ping-units.xml", "dsf-ping-process-steps.xml", + "dsf-ping-processes.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); @@ -197,8 +205,7 @@ public void testTaskStartPingProcessProfileValidWithErrorMessages() throws Excep { Task task = createValidTaskStartPingProcess(); - dev.dsf.bpe.util.task.output.generator.ErrorMessageGenerator.create(List.of("Foo", "Bar")) - .forEach(task::addOutput); + ErrorOutputComponentGenerator.create(processErrors(4)).forEach(task::addOutput); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -207,6 +214,18 @@ public void testTaskStartPingProcessProfileValidWithErrorMessages() throws Excep || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + private List<ProcessError> processErrors(int amount) + { + List<ProcessError> errors = new ArrayList<>(); + for (int i = 0; i < amount; i++) + { + errors.add(new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, UUID.randomUUID().toString(), + ConstantsPing.POTENTIAL_FIX_URL_DUMMY, UUID.randomUUID().toString())); + } + return errors; + } + @Test public void testTaskStartPingProcessProfileValidWithTargetEndpoints() throws Exception { @@ -272,7 +291,7 @@ public String getCorrelationKey() task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR, List.of("some error message"))); + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR, processErrors(5))); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -546,8 +565,8 @@ public void testTaskPongValidWithMultipleErrorMessages() task.addInput(DownloadResourceReferenceGenerator.create("https://test.endpoint.org/fhir/Binary")); task.addInput(NetworkSpeedMetricGenerator.createDownloadedBytes(1000)); task.addInput(NetworkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); - task.addInput(ErrorMessageGenerator.create("Something went wrong")); - task.addInput(ErrorMessageGenerator.create("Something went wrong really badly")); + task.addInput(ErrorInputComponentGenerator.create(processErrors(1).get(0))); + task.addInput(ErrorInputComponentGenerator.create(processErrors(1).get(0))); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); From 990f97b28fd8becefdb4433e39dc9c32464ad489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 30 Apr 2025 09:37:08 +0200 Subject: [PATCH 282/382] Closes #17 --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 + .../java/dev/dsf/bpe/message/SendPing.java | 23 +++++ .../bpe/service/ping/CheckPingTaskStatus.java | 94 +++++++++++++++++++ .../service/ping/LogAndSaveNoResponse.java | 42 --------- .../dev/dsf/bpe/spring/config/PingConfig.java | 6 +- src/main/resources/bpe/ping.bpmn | 2 +- 6 files changed, 123 insertions(+), 46 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java delete mode 100644 src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 6919791c..71e98717 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -91,6 +91,7 @@ private ConstantsPing() public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_STORE_ERRORS = "store-errors"; public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP_TIMER_CATCH_EVENT = "cleanup-timer-catch-event"; public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PONG_MESSAGE_TIMEOUT_TIMER_CATCH_EVENT = "pong-timer-catch-event"; + public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS = "check-ping-task-status"; public static final String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units-v2"; public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; @@ -140,6 +141,7 @@ private ConstantsPing() private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS = "uploadedDurationMillis"; public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR = "resourceDownloadError"; public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR = "resourceUploadError"; + public static final String BPMN_EXECUTION_VARIABLE_PING_TASK_ID = "pingTaskId"; public static final String BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR = "resourceDownloadError"; public static final String BPMN_ERROR_CODE_RESOURCE_UPLOAD_ERROR = "resourceUploadError"; diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPing.java index 3a7d56c7..6ff4c783 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPing.java @@ -3,6 +3,7 @@ import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResourceType; @@ -21,6 +22,7 @@ import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.fhir.client.FhirWebserviceClient; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response.StatusType; @@ -28,6 +30,7 @@ public class SendPing extends AbstractTaskMessageSend { private static final Logger logger = LoggerFactory.getLogger(SendPing.class); + private IdType taskId; public SendPing(ProcessPluginApi api) { @@ -54,6 +57,26 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut Stream.concat(downloadResourceReferenceStream, downloadResourceSizeBytesStream)); } + @Override + protected void sendTask(DelegateExecution execution, Variables variables, Target target, + String instantiatesCanonical, String messageName, String businessKey, String profile, + Stream<ParameterComponent> additionalInputParameters) + { + super.sendTask(execution, variables, target, instantiatesCanonical, messageName, businessKey, profile, + additionalInputParameters); + if (taskId != null) + { + execution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_PING_TASK_ID, taskId); + } + } + + @Override + protected IdType doSend(FhirWebserviceClient client, Task task) + { + taskId = super.doSend(client, task); + return taskId; + } + @Override protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, String errorMessage) diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java new file mode 100644 index 00000000..a68ac245 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -0,0 +1,94 @@ +package dev.dsf.bpe.service.ping; + +import java.util.Map; +import java.util.Objects; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; +import dev.dsf.bpe.util.logging.PingPongLogger; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; +import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.fhir.client.FhirWebserviceClient; +import jakarta.ws.rs.WebApplicationException; + +public class CheckPingTaskStatus extends AbstractServiceDelegate +{ + public CheckPingTaskStatus(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + PingPongLogger logger = new PingPongLogger(CheckPingTaskStatus.class, variables.getStartTask()); + logger.debug("Checking status of ping task..."); + + Target target = variables.getTarget(); + String correlationKey = target.getCorrelationKey(); + + IdType taskId = (IdType) delegateExecution.getVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_PING_TASK_ID); + + Objects.requireNonNull(taskId); + FhirWebserviceClient fhirWebserviceClient = api.getFhirWebserviceClientProvider() + .getWebserviceClient(target.getEndpointUrl()); + ProcessError error; + try + { + + Task pingTask = fhirWebserviceClient.withRetry(3, 1000).read(Task.class, taskId.getIdPart()); + switch (pingTask.getStatus()) + { + case REQUESTED -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, + "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " + + target.getEndpointUrl() + " is " + pingTask.getStatus()); + case INPROGRESS -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, + "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " + + target.getEndpointUrl() + " is " + pingTask.getStatus()); + case FAILED -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, + "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " + + target.getEndpointUrl() + " is " + pingTask.getStatus()); + case COMPLETED -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, + "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " + + target.getEndpointUrl() + " is " + pingTask.getStatus()); + default -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, + "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " + + target.getEndpointUrl() + " is " + pingTask.getStatus() + + ". Unexpected status. Should be either of " + Task.TaskStatus.REQUESTED + ", " + + Task.TaskStatus.INPROGRESS + ", " + Task.TaskStatus.COMPLETED + " or " + + Task.TaskStatus.FAILED); + } + + + } + catch (WebApplicationException e) + { + error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, + "Pong message timed out. Retrieving ping task resource with id " + taskId.getIdPart() + " from " + + target.getEndpointUrl(), + ConstantsPing.POTENTIAL_FIX_URL_DUMMY, e.getMessage()); + } + ErrorListUtils.add(error, delegateExecution, correlationKey); + logger.debug("Saved '{}' to process execution for correlation key '{}'", + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR, correlationKey); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java deleted file mode 100644 index 524d1968..00000000 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveNoResponse.java +++ /dev/null @@ -1,42 +0,0 @@ -package dev.dsf.bpe.service.ping; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.ProcessError; -import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; -import dev.dsf.bpe.v1.variables.Variables; - -public class LogAndSaveNoResponse extends AbstractServiceDelegate -{ - public LogAndSaveNoResponse(ProcessPluginApi api) - { - super(api); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception - { - PingPongLogger logger = new PingPongLogger(LogAndSaveNoResponse.class, variables.getStartTask()); - logger.debug("Saving no response to process execution..."); - - Target target = variables.getTarget(); - String pongMissingMessage = "No PONG received from endpoint '" + target.getEndpointIdentifierValue() + "'"; - logger.info(pongMissingMessage); - - String correlationKey = target.getCorrelationKey(); - delegateExecution.removeVariable("statusCode"); - ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PONG_MESSAGE_TIMEOUT_TIMER_CATCH_EVENT, - "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, pongMissingMessage); - ErrorListUtils.add(error, delegateExecution, correlationKey); - - logger.debug("Saved '{}' to process execution for correlation key '{}'", - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR, correlationKey); - } -} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index e6fe0c15..00fa1cda 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -18,9 +18,9 @@ import dev.dsf.bpe.service.GenerateAndStoreResource; import dev.dsf.bpe.service.SetDownloadResourceSize; import dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer; +import dev.dsf.bpe.service.ping.CheckPingTaskStatus; import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.ping.LogAndSaveError; -import dev.dsf.bpe.service.ping.LogAndSaveNoResponse; import dev.dsf.bpe.service.ping.LogAndSaveUploadErrorPing; import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; @@ -175,9 +175,9 @@ public SendPong sendPong() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public LogAndSaveNoResponse logAndSaveNoResponse() + public CheckPingTaskStatus logAndSaveNoResponse() { - return new LogAndSaveNoResponse(api); + return new CheckPingTaskStatus(api); } @Bean diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 2ec07ac5..5796e77f 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -38,7 +38,7 @@ <bpmn:outgoing>Flow_0y9usku</bpmn:outgoing> <bpmn:outgoing>Flow_1lghrxh</bpmn:outgoing> </bpmn:eventBasedGateway> - <bpmn:serviceTask id="LogNoResponse" name="Log and Save No Response" camunda:class="dev.dsf.bpe.service.ping.LogAndSaveNoResponse"> + <bpmn:serviceTask id="LogNoResponse" name="Check Ping Task Status" camunda:class="dev.dsf.bpe.service.ping.CheckPingTaskStatus"> <bpmn:incoming>Flow_1fjeq2h</bpmn:incoming> <bpmn:outgoing>Flow_136htek</bpmn:outgoing> </bpmn:serviceTask> From a34a1a9426f5d2242e60d18a607a399f0bc4e623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 19 May 2025 10:50:10 +0200 Subject: [PATCH 283/382] Added data-absent-reason extension to Task.input and Task.output in order to add the error message back into the extension --- src/main/java/dev/dsf/bpe/ProcessError.java | 1 + .../ErrorOutputComponentGenerator.java | 6 +++++- .../dsf-input-extension-error.xml | 18 ++++++++++++++++++ .../dsf-output-extension-error.xml | 18 ++++++++++++++++++ .../fhir/StructureDefinition/dsf-task-ping.xml | 18 +++++++++++------- .../fhir/StructureDefinition/dsf-task-pong.xml | 18 +++++++++++------- .../dsf-task-start-ping.xml | 18 +++++++++++------- 7 files changed, 75 insertions(+), 22 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 0981c580..b8057f8e 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -66,6 +66,7 @@ private static Extension toParameterExtension(ProcessError error, String structu extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(error.action())); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) .setValue(new UrlType(error.potentialFixUrl())); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(error.message())); return extension; } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java index e5248ad1..3085a9c2 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java @@ -4,6 +4,7 @@ import java.util.stream.Collectors; import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; @@ -26,7 +27,10 @@ public static Task.TaskOutputComponent create(ProcessError error) param.getType().addCoding( new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR, null)); param.addExtension(ProcessError.toOutputExtension(error)); - param.setValue(new StringType(error.message())); + Extension dataAbsentReason = new Extension() + .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason").setValue( + new Coding("http://terminology.hl7.org/CodeSystem/data-absent-reason", "not-applicable", null)); + param.addExtension(dataAbsentReason); return param; } diff --git a/src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml b/src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml index ab1b3bfe..627874d3 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml @@ -139,6 +139,24 @@ <code value="url"/> </type> </element> + <element id="Extension.extension:message"> + <path value="Extension.extension"/> + <sliceName value="message"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:message.url"> + <path value="Extension.extension.url"/> + <fixedUri value="message"/> + </element> + <element id="Extension.extension:message.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="string"/> + </type> + </element> <element id="Extension.url"> <path value="Extension.url"/> <fixedUri value="http://dsf.dev/fhir/StructureDefinition/input-extension-error"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml b/src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml index 5229350a..c30902b9 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml @@ -139,6 +139,24 @@ <code value="url"/> </type> </element> + <element id="Extension.extension:message"> + <path value="Extension.extension"/> + <sliceName value="message"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:message.url"> + <path value="Extension.extension.url"/> + <fixedUri value="message"/> + </element> + <element id="Extension.extension:message.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="string"/> + </type> + </element> <element id="Extension.url"> <path value="Extension.url"/> <fixedUri value="http://dsf.dev/fhir/StructureDefinition/output-extension-error"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index cc5e1e58..289d8329 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -224,7 +224,7 @@ <rules value="open" /> </slicing> <min value="1"/> - <max value="1"/> + <max value="2"/> </element> <element id="Task.output:process-error.extension:error-extension"> <path value="Task.output.extension" /> @@ -236,6 +236,16 @@ <profile value="http://dsf.dev/fhir/StructureDefinition/output-extension-error|#{version}" /> </type> </element> + <element id="Task.output:process-error.extension:data-absent-reason"> + <path value="Task.output.extension" /> + <sliceName value="data-absent-reason" /> + <min value="1" /> + <max value="1"/> + <type> + <code value="Extension" /> + <profile value="http://hl7.org/fhir/StructureDefinition/data-absent-reason" /> + </type> + </element> <element id="Task.output:process-error.type"> <path value="Task.output.type"/> <min value="1"/> @@ -262,12 +272,6 @@ <max value="1"/> <fixedCode value="error"/> </element> - <element id="Task.output:process-error.value[x]"> - <path value="Task.output.value[x]"/> - <type> - <code value="string"/> - </type> - </element> <element id="Task.output:pong-status"> <path value="Task.output"/> <sliceName value="pong-status"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index 7ad44fd2..c050a103 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -206,7 +206,7 @@ <rules value="open" /> </slicing> <min value="1"/> - <max value="1"/> + <max value="2"/> </element> <element id="Task.input:process-error.extension:error-extension"> <path value="Task.input.extension" /> @@ -218,6 +218,16 @@ <profile value="http://dsf.dev/fhir/StructureDefinition/input-extension-error|#{version}" /> </type> </element> + <element id="Task.input:process-error.extension:data-absent-reason"> + <path value="Task.input.extension" /> + <sliceName value="data-absent-reason" /> + <min value="1" /> + <max value="1"/> + <type> + <code value="Extension" /> + <profile value="http://hl7.org/fhir/StructureDefinition/data-absent-reason" /> + </type> + </element> <element id="Task.input:process-error.type"> <path value="Task.input.type"/> <min value="1"/> @@ -244,11 +254,5 @@ <max value="1"/> <fixedCode value="error"/> </element> - <element id="Task.input:process-error.value[x]"> - <path value="Task.input.value[x]"/> - <type> - <code value="string"/> - </type> - </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index 7632db45..6cc38da9 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -136,7 +136,7 @@ <rules value="open" /> </slicing> <min value="1"/> - <max value="1"/> + <max value="2"/> </element> <element id="Task.output:process-error.extension:error-extension"> <path value="Task.output.extension" /> @@ -148,6 +148,16 @@ <profile value="http://dsf.dev/fhir/StructureDefinition/output-extension-error|#{version}" /> </type> </element> + <element id="Task.output:process-error.extension:data-absent-reason"> + <path value="Task.output.extension" /> + <sliceName value="data-absent-reason" /> + <min value="1" /> + <max value="1"/> + <type> + <code value="Extension" /> + <profile value="http://hl7.org/fhir/StructureDefinition/data-absent-reason" /> + </type> + </element> <element id="Task.output:process-error.type"> <path value="Task.output.type"/> <min value="1"/> @@ -174,12 +184,6 @@ <max value="1"/> <fixedCode value="error"/> </element> - <element id="Task.output:process-error.value[x]"> - <path value="Task.output.value[x]"/> - <type> - <code value="string"/> - </type> - </element> <element id="Task.output:ping-status"> <path value="Task.output"/> <sliceName value="ping-status"/> From 867659163089e6ae80b5416c7f7888da32ce751d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 19 May 2025 13:32:46 +0200 Subject: [PATCH 284/382] Moved data-absent-reason extension to Task.input.value[x] --- .../ErrorInputComponentGenerator.java | 9 ++++++++- .../ErrorOutputComponentGenerator.java | 9 ++++++--- .../fhir/StructureDefinition/dsf-task-ping.xml | 18 +++++++----------- .../fhir/StructureDefinition/dsf-task-pong.xml | 18 +++++++----------- .../dsf-task-start-ping.xml | 18 +++++++----------- 5 files changed, 35 insertions(+), 37 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java index 86fce5e1..c39dc0ea 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java @@ -3,10 +3,13 @@ import java.util.List; import java.util.stream.Collectors; +import org.hl7.fhir.r4.model.CodeType; import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; +import ca.uhn.fhir.model.primitive.CodeDt; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; @@ -26,7 +29,11 @@ public static Task.ParameterComponent create(ProcessError error) param.getType().addCoding( new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR, null)); param.addExtension(ProcessError.toInputExtension(error)); - param.setValue(new StringType(error.message())); + Extension dataAbsentReason = new Extension() + .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") + .setValue(new CodeType("not-applicable")); + param.setValue(new StringType()); + param.getValue().addExtension(dataAbsentReason); return param; } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java index 3085a9c2..8e28f48b 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java @@ -3,11 +3,13 @@ import java.util.List; import java.util.stream.Collectors; +import org.hl7.fhir.r4.model.CodeType; import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; +import ca.uhn.fhir.model.primitive.CodeDt; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; @@ -28,9 +30,10 @@ public static Task.TaskOutputComponent create(ProcessError error) new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR, null)); param.addExtension(ProcessError.toOutputExtension(error)); Extension dataAbsentReason = new Extension() - .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason").setValue( - new Coding("http://terminology.hl7.org/CodeSystem/data-absent-reason", "not-applicable", null)); - param.addExtension(dataAbsentReason); + .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") + .setValue(new CodeType("not-applicable")); + param.setValue(new StringType()); + param.getValue().addExtension(dataAbsentReason); return param; } diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index 289d8329..cc5e1e58 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -224,7 +224,7 @@ <rules value="open" /> </slicing> <min value="1"/> - <max value="2"/> + <max value="1"/> </element> <element id="Task.output:process-error.extension:error-extension"> <path value="Task.output.extension" /> @@ -236,16 +236,6 @@ <profile value="http://dsf.dev/fhir/StructureDefinition/output-extension-error|#{version}" /> </type> </element> - <element id="Task.output:process-error.extension:data-absent-reason"> - <path value="Task.output.extension" /> - <sliceName value="data-absent-reason" /> - <min value="1" /> - <max value="1"/> - <type> - <code value="Extension" /> - <profile value="http://hl7.org/fhir/StructureDefinition/data-absent-reason" /> - </type> - </element> <element id="Task.output:process-error.type"> <path value="Task.output.type"/> <min value="1"/> @@ -272,6 +262,12 @@ <max value="1"/> <fixedCode value="error"/> </element> + <element id="Task.output:process-error.value[x]"> + <path value="Task.output.value[x]"/> + <type> + <code value="string"/> + </type> + </element> <element id="Task.output:pong-status"> <path value="Task.output"/> <sliceName value="pong-status"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index c050a103..7ad44fd2 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -206,7 +206,7 @@ <rules value="open" /> </slicing> <min value="1"/> - <max value="2"/> + <max value="1"/> </element> <element id="Task.input:process-error.extension:error-extension"> <path value="Task.input.extension" /> @@ -218,16 +218,6 @@ <profile value="http://dsf.dev/fhir/StructureDefinition/input-extension-error|#{version}" /> </type> </element> - <element id="Task.input:process-error.extension:data-absent-reason"> - <path value="Task.input.extension" /> - <sliceName value="data-absent-reason" /> - <min value="1" /> - <max value="1"/> - <type> - <code value="Extension" /> - <profile value="http://hl7.org/fhir/StructureDefinition/data-absent-reason" /> - </type> - </element> <element id="Task.input:process-error.type"> <path value="Task.input.type"/> <min value="1"/> @@ -254,5 +244,11 @@ <max value="1"/> <fixedCode value="error"/> </element> + <element id="Task.input:process-error.value[x]"> + <path value="Task.input.value[x]"/> + <type> + <code value="string"/> + </type> + </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index 6cc38da9..7632db45 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -136,7 +136,7 @@ <rules value="open" /> </slicing> <min value="1"/> - <max value="2"/> + <max value="1"/> </element> <element id="Task.output:process-error.extension:error-extension"> <path value="Task.output.extension" /> @@ -148,16 +148,6 @@ <profile value="http://dsf.dev/fhir/StructureDefinition/output-extension-error|#{version}" /> </type> </element> - <element id="Task.output:process-error.extension:data-absent-reason"> - <path value="Task.output.extension" /> - <sliceName value="data-absent-reason" /> - <min value="1" /> - <max value="1"/> - <type> - <code value="Extension" /> - <profile value="http://hl7.org/fhir/StructureDefinition/data-absent-reason" /> - </type> - </element> <element id="Task.output:process-error.type"> <path value="Task.output.type"/> <min value="1"/> @@ -184,6 +174,12 @@ <max value="1"/> <fixedCode value="error"/> </element> + <element id="Task.output:process-error.value[x]"> + <path value="Task.output.value[x]"/> + <type> + <code value="string"/> + </type> + </element> <element id="Task.output:ping-status"> <path value="Task.output"/> <sliceName value="ping-status"/> From 5ffa9d1ef0ff68bb825da505f250fe106d334d06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 19 May 2025 14:18:45 +0200 Subject: [PATCH 285/382] Optimized to use only 1 extension instead of 3 --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 4 +- .../dsf/bpe/PingProcessPluginDefinition.java | 22 +-- src/main/java/dev/dsf/bpe/ProcessError.java | 36 +--- .../bpe/util/task/input/ErrorInputParser.java | 2 +- .../ErrorInputComponentGenerator.java | 2 +- .../ErrorOutputComponentGenerator.java | 2 +- .../output/generator/PingStatusGenerator.java | 4 +- ...sion-error.xml => dsf-extension-error.xml} | 12 +- .../dsf-extension-ping-status.xml | 2 +- .../dsf-input-extension-error.xml | 169 ------------------ .../dsf-output-extension-error.xml | 169 ------------------ .../StructureDefinition/dsf-task-ping.xml | 2 +- .../StructureDefinition/dsf-task-pong.xml | 2 +- .../dsf-task-start-ping.xml | 2 +- .../bpe/PingProcessPluginDefinitionTest.java | 4 +- .../dsf/fhir/profiles/TaskProfileTest.java | 10 +- 16 files changed, 37 insertions(+), 407 deletions(-) rename src/main/resources/fhir/StructureDefinition/{dsf-extension-extension-error.xml => dsf-extension-error.xml} (96%) delete mode 100644 src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml delete mode 100644 src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 71e98717..63c9f0ae 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -108,9 +108,7 @@ private ConstantsPing() public static final String STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"; public static final String STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; - public static final String STRUCTURE_DEFINITION_URL_EXTENSION_EXTENSION_ERROR = "http://dsf.dev/fhir/StructureDefinition/extension-extension-error"; - public static final String STRUCTURE_DEFINITION_URL_INPUT_EXTENSION_ERROR = "http://dsf.dev/fhir/StructureDefinition/input-extension-error"; - public static final String STRUCTURE_DEFINITION_URL_OUTPUT_EXTENSION_ERROR = "http://dsf.dev/fhir/StructureDefinition/output-extension-error"; + public static final String STRUCTURE_DEFINITION_URL_EXTENSION_ERROR = "http://dsf.dev/fhir/StructureDefinition/extension-error"; public static final String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; public static final String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index 813b866f..222cec43 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -62,9 +62,7 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var sStopPingAutostart = "fhir/StructureDefinition/dsf-task-stop-ping-autostart.xml"; var sCleanupPong = "fhir/StructureDefinition/dsf-task-cleanup-pong.xml"; var sNetworkSpeedExtension = "fhir/StructureDefinition/dsf-extension-network-speed.xml"; - var sErrorExtensionExtension = "fhir/StructureDefinition/dsf-extension-extension-error.xml"; - var sErrorInputExtension = "fhir/StructureDefinition/dsf-input-extension-error.xml"; - var sErrorOutputExtension = "fhir/StructureDefinition/dsf-output-extension-error.xml"; + var sErrorExtension = "fhir/StructureDefinition/dsf-extension-error.xml"; var tStartPing = "fhir/Task/dsf-task-start-ping.xml"; var tStartPingAutoStart = "fhir/Task/dsf-task-start-ping-autostart.xml"; @@ -75,15 +73,13 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var vPingStatus = "fhir/ValueSet/dsf-ping-status.xml"; var vPongStatus = "fhir/ValueSet/dsf-pong-status.xml"; - return Map.of( - ConstantsPing.PROCESS_NAME_FULL_PING, Arrays.asList(aPing, cPing, cPingStatus, cPingUnits, - sErrorExtensionExtension, sErrorOutputExtension, sPingStatus, sStartPing, sPong, sCleanupPong, - sNetworkSpeedExtension, tStartPing, vPing, vPingStatus, vPingUnits), - ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, Arrays.asList(aPingAutostart, cPing, - sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, tStopPingAutoStart, vPing), - ConstantsPing.PROCESS_NAME_FULL_PONG, - Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, sErrorExtensionExtension, sErrorInputExtension, - sErrorOutputExtension, sPingStatus, sPing, sNetworkSpeedExtension, vPing, vPongStatus, - vPingUnits)); + return Map.of(ConstantsPing.PROCESS_NAME_FULL_PING, + Arrays.asList(aPing, cPing, cPingStatus, cPingUnits, sErrorExtension, sPingStatus, sStartPing, sPong, + sCleanupPong, sNetworkSpeedExtension, tStartPing, vPing, vPingStatus, vPingUnits), + ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, + Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, + tStopPingAutoStart, vPing), + ConstantsPing.PROCESS_NAME_FULL_PONG, Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, + sErrorExtension, sPingStatus, sPing, sNetworkSpeedExtension, vPing, vPongStatus, vPingUnits)); } } diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index b8057f8e..d479662b 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -22,43 +22,11 @@ public boolean equals(Object obj) } - public static Extension toExtensionExtension(ProcessError error) - { - Extension errorExtension = new Extension(); - errorExtension.setUrl(ConstantsPing.EXTENSION_URL_ERROR); - Extension errorExtensionExtension = new Extension(); - - errorExtensionExtension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_EXTENSION_ERROR); - errorExtensionExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, error.process(), null)); - errorExtensionExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, error.process(), null)); - errorExtensionExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION) - .setValue(new StringType(error.action())); - errorExtensionExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) - .setValue(new UrlType(error.potentialFixUrl())); - errorExtensionExtension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE) - .setValue(new StringType(error.message())); - - errorExtension.addExtension(errorExtensionExtension); - return errorExtension; - } - - public static Extension toInputExtension(ProcessError error) - { - return toParameterExtension(error, ConstantsPing.STRUCTURE_DEFINITION_URL_INPUT_EXTENSION_ERROR); - } - - public static Extension toOutputExtension(ProcessError error) - { - return toParameterExtension(error, ConstantsPing.STRUCTURE_DEFINITION_URL_OUTPUT_EXTENSION_ERROR); - } - - private static Extension toParameterExtension(ProcessError error, String structureDefinitionUrl) + public static Extension toExtension(ProcessError error) { Extension extension = new Extension(); + extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); - extension.setUrl(structureDefinitionUrl); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, error.process(), null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) diff --git a/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java b/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java index bdf02e3f..fa356928 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java @@ -18,7 +18,7 @@ public static List<ProcessError> parseInputs(Task task) return inputs.stream() .map(input -> ProcessError - .toError(input.getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_INPUT_EXTENSION_ERROR))) + .toError(input.getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR))) .toList(); } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java index c39dc0ea..a025a12a 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java @@ -28,7 +28,7 @@ public static Task.ParameterComponent create(ProcessError error) param.getType().addCoding( new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR, null)); - param.addExtension(ProcessError.toInputExtension(error)); + param.addExtension(ProcessError.toExtension(error)); Extension dataAbsentReason = new Extension() .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") .setValue(new CodeType("not-applicable")); diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java index 8e28f48b..d26ef6f3 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java @@ -28,7 +28,7 @@ public static Task.TaskOutputComponent create(ProcessError error) param.getType().addCoding( new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR, null)); - param.addExtension(ProcessError.toOutputExtension(error)); + param.addExtension(ProcessError.toExtension(error)); Extension dataAbsentReason = new Extension() .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") .setValue(new CodeType("not-applicable")); diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 6609d2cd..fb1c71f0 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -655,7 +655,7 @@ private static TaskOutputComponent addErrors(TaskOutputComponent outputComponent Extension extension = getOrCreatePingStatusExtension(outputComponent); for (ProcessError error : errors) { - extension.addExtension(ProcessError.toExtensionExtension(error)); + extension.addExtension(ProcessError.toExtension(error)); } } sortStatusOutputExtensions(outputComponent); @@ -671,7 +671,7 @@ private static TaskOutputComponent updateErrors(TaskOutputComponent outputCompon if (errors != null) { - List<Extension> newErrorExtensions = errors.stream().map(ProcessError::toExtensionExtension) + List<Extension> newErrorExtensions = errors.stream().map(ProcessError::toExtension) .collect(Collectors.toCollection(ArrayList::new)); nonErrorExtensions.addAll(newErrorExtensions); extension.setExtension(newErrorExtensions); diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-extension-error.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml similarity index 96% rename from src/main/resources/fhir/StructureDefinition/dsf-extension-extension-error.xml rename to src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml index c9ecbf01..3b3f55ed 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-extension-error.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml @@ -5,7 +5,7 @@ <code value="ALL"/> </tag> </meta> - <url value="http://dsf.dev/fhir/StructureDefinition/extension-extension-error"/> + <url value="http://dsf.dev/fhir/StructureDefinition/extension-error"/> <!-- version managed by bpe --> <version value="#{version}" /> <name value="Error"/> @@ -21,6 +21,14 @@ <type value="element"/> <expression value="Extension"/> </context> + <context> + <type value="element"/> + <expression value="Task.input"/> + </context> + <context> + <type value="element"/> + <expression value="Task.output"/> + </context> <type value="Extension"/> <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> <derivation value="constraint"/> @@ -159,7 +167,7 @@ </element> <element id="Extension.url"> <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-extension-error"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-error"/> </element> <element id="Extension.value[x]"> <path value="Extension.value[x]"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index b591479b..541ad8dc 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -198,7 +198,7 @@ <min value="1" /> <type> <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/extension-extension-error|#{version}" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-error|#{version}" /> </type> </element> <element id="Extension.extension:error.url"> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml b/src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml deleted file mode 100644 index 627874d3..00000000 --- a/src/main/resources/fhir/StructureDefinition/dsf-input-extension-error.xml +++ /dev/null @@ -1,169 +0,0 @@ -<StructureDefinition xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag"/> - <code value="ALL"/> - </tag> - </meta> - <url value="http://dsf.dev/fhir/StructureDefinition/input-extension-error"/> - <!-- version managed by bpe --> - <version value="#{version}" /> - <name value="Error"/> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <!-- date managed by bpe --> - <date value="#{date}" /> - <fhirVersion value="4.0.1"/> - <kind value="complex-type"/> - <abstract value="false"/> - <context> - <type value="element"/> - <expression value="Task.input"/> - </context> - <type value="Extension"/> - <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> - <derivation value="constraint"/> - <differential> - <element id="Extension.extension"> - <path value="Extension.extension"/> - <slicing> - <discriminator> - <type value="value"/> - <path value="url"/> - </discriminator> - <rules value="open"/> - </slicing> - <min value="4"/> - <max value="5"/> - </element> - <element id="Extension.extension:process"> - <path value="Extension.extension"/> - <sliceName value="process"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:process.url"> - <path value="Extension.extension.url"/> - <fixedUri value="process"/> - </element> - <element id="Extension.extension:process.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="Coding"/> - </type> - </element> - <element id="Extension.extension:process.value[x].system"> - <path value="Extension.extension.value[x].system"/> - <min value="1"/> - <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-processes-v2"/> - </element> - <element id="Extension.extension:process.value[x].code"> - <path value="Extension.extension.value[x].code"/> - <min value="1"/> - <max value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-processes-v2|#{version}"/> - </binding> - </element> - <element id="Extension.extension:process-step"> - <path value="Extension.extension"/> - <sliceName value="process-step"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:process-step.url"> - <path value="Extension.extension.url"/> - <fixedUri value="process-step"/> - </element> - <element id="Extension.extension:process-step.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="Coding"/> - </type> - </element> - <element id="Extension.extension:process-step.value[x].system"> - <path value="Extension.extension.value[x].system"/> - <min value="1"/> - <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2"/> - </element> - <element id="Extension.extension:process-step.value[x].code"> - <path value="Extension.extension.value[x].code"/> - <min value="1"/> - <max value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-process-steps-v2|#{version}"/> - </binding> - </element> - <element id="Extension.extension:action"> - <path value="Extension.extension"/> - <sliceName value="action"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:action.url"> - <path value="Extension.extension.url"/> - <fixedUri value="action"/> - </element> - <element id="Extension.extension:action.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="string"/> - </type> - </element> - <element id="Extension.extension:potential-fix"> - <path value="Extension.extension"/> - <sliceName value="potential-fix"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:potential-fix.url"> - <path value="Extension.extension.url"/> - <fixedUri value="potential-fix"/> - </element> - <element id="Extension.extension:potential-fix.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="url"/> - </type> - </element> - <element id="Extension.extension:message"> - <path value="Extension.extension"/> - <sliceName value="message"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:message.url"> - <path value="Extension.extension.url"/> - <fixedUri value="message"/> - </element> - <element id="Extension.extension:message.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="string"/> - </type> - </element> - <element id="Extension.url"> - <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/input-extension-error"/> - </element> - <element id="Extension.value[x]"> - <path value="Extension.value[x]"/> - <max value="0"/> - </element> - </differential> -</StructureDefinition> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml b/src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml deleted file mode 100644 index c30902b9..00000000 --- a/src/main/resources/fhir/StructureDefinition/dsf-output-extension-error.xml +++ /dev/null @@ -1,169 +0,0 @@ -<StructureDefinition xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag"/> - <code value="ALL"/> - </tag> - </meta> - <url value="http://dsf.dev/fhir/StructureDefinition/output-extension-error"/> - <!-- version managed by bpe --> - <version value="#{version}" /> - <name value="Error"/> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <!-- date managed by bpe --> - <date value="#{date}" /> - <fhirVersion value="4.0.1"/> - <kind value="complex-type"/> - <abstract value="false"/> - <context> - <type value="element"/> - <expression value="Task.output"/> - </context> - <type value="Extension"/> - <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> - <derivation value="constraint"/> - <differential> - <element id="Extension.extension"> - <path value="Extension.extension"/> - <slicing> - <discriminator> - <type value="value"/> - <path value="url"/> - </discriminator> - <rules value="open"/> - </slicing> - <min value="4"/> - <max value="5"/> - </element> - <element id="Extension.extension:process"> - <path value="Extension.extension"/> - <sliceName value="process"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:process.url"> - <path value="Extension.extension.url"/> - <fixedUri value="process"/> - </element> - <element id="Extension.extension:process.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="Coding"/> - </type> - </element> - <element id="Extension.extension:process.value[x].system"> - <path value="Extension.extension.value[x].system"/> - <min value="1"/> - <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-processes-v2"/> - </element> - <element id="Extension.extension:process.value[x].code"> - <path value="Extension.extension.value[x].code"/> - <min value="1"/> - <max value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-processes-v2|#{version}"/> - </binding> - </element> - <element id="Extension.extension:process-step"> - <path value="Extension.extension"/> - <sliceName value="process-step"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:process-step.url"> - <path value="Extension.extension.url"/> - <fixedUri value="process-step"/> - </element> - <element id="Extension.extension:process-step.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="Coding"/> - </type> - </element> - <element id="Extension.extension:process-step.value[x].system"> - <path value="Extension.extension.value[x].system"/> - <min value="1"/> - <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2"/> - </element> - <element id="Extension.extension:process-step.value[x].code"> - <path value="Extension.extension.value[x].code"/> - <min value="1"/> - <max value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-process-steps-v2|#{version}"/> - </binding> - </element> - <element id="Extension.extension:action"> - <path value="Extension.extension"/> - <sliceName value="action"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:action.url"> - <path value="Extension.extension.url"/> - <fixedUri value="action"/> - </element> - <element id="Extension.extension:action.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="string"/> - </type> - </element> - <element id="Extension.extension:potential-fix"> - <path value="Extension.extension"/> - <sliceName value="potential-fix"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:potential-fix.url"> - <path value="Extension.extension.url"/> - <fixedUri value="potential-fix"/> - </element> - <element id="Extension.extension:potential-fix.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="url"/> - </type> - </element> - <element id="Extension.extension:message"> - <path value="Extension.extension"/> - <sliceName value="message"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:message.url"> - <path value="Extension.extension.url"/> - <fixedUri value="message"/> - </element> - <element id="Extension.extension:message.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="string"/> - </type> - </element> - <element id="Extension.url"> - <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/output-extension-error"/> - </element> - <element id="Extension.value[x]"> - <path value="Extension.value[x]"/> - <max value="0"/> - </element> - </differential> -</StructureDefinition> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index cc5e1e58..8080b9dd 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -233,7 +233,7 @@ <max value="1"/> <type> <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/output-extension-error|#{version}" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-error|#{version}" /> </type> </element> <element id="Task.output:process-error.type"> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index 7ad44fd2..6ae2aab7 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -215,7 +215,7 @@ <max value="1"/> <type> <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/input-extension-error|#{version}" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-error|#{version}" /> </type> </element> <element id="Task.input:process-error.type"> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index 7632db45..bd941da4 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -145,7 +145,7 @@ <max value="1"/> <type> <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/output-extension-error|#{version}" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-error|#{version}" /> </type> </element> <element id="Task.output:process-error.type"> diff --git a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java index fed3c5ae..26b6ed5e 100644 --- a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java +++ b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java @@ -20,7 +20,7 @@ public void testResourceLoading() throws Exception var ping = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING); assertNotNull(ping); - assertEquals(15, ping.stream().filter(this::exists).count()); + assertEquals(14, ping.stream().filter(this::exists).count()); var pingAutostart = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART); assertNotNull(pingAutostart); @@ -28,7 +28,7 @@ public void testResourceLoading() throws Exception var pong = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PONG); assertNotNull(pong); - assertEquals(13, pong.stream().filter(this::exists).count()); + assertEquals(11, pong.stream().filter(this::exists).count()); } private boolean exists(String file) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index da811487..9bdd0d5c 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -58,12 +58,10 @@ public class TaskProfileTest @ClassRule public static final ValidationSupportRule validationRule = new ValidationSupportRule(def.getResourceVersion(), def.getResourceReleaseDate(), - Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-extension-error.xml", - "dsf-input-extension-error.xml", "dsf-output-extension-error.xml", - "dsf-extension-network-speed.xml", "dsf-extension-ping-status.xml", - "dsf-extension-ping-status-1_0.xml", "dsf-task-ping.xml", "dsf-task-pong.xml", - "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", - "dsf-task-cleanup-pong.xml"), + Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-error.xml", "dsf-extension-network-speed.xml", + "dsf-extension-ping-status.xml", "dsf-extension-ping-status-1_0.xml", "dsf-task-ping.xml", + "dsf-task-pong.xml", "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", + "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-ping-units.xml", "dsf-ping-process-steps.xml", "dsf-ping-processes.xml"), From 272e6c2098e9616e9fa060847dd519db50e64a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 25 Jun 2025 10:50:17 +0200 Subject: [PATCH 286/382] Network speed unit default is now mbit/s --- .../dev/dsf/bpe/listener/PingPongDeploymentStateListener.java | 4 ++-- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java index 6f6f4489..91902f8d 100644 --- a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java +++ b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java @@ -34,10 +34,10 @@ public void onProcessesDeployed(List<String> processes) } else { - pingConfig.setNetworkSpeedUnit(ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); + pingConfig.setNetworkSpeedUnit(ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND); logger.debug("Network speed unit \"{}\" is not valid. Valid values are: {}. Defaulting to \"{}\"", networkSpeedUnit, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES, - ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); + ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND); } // TODO: fixme diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 00fa1cda..21f579db 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -64,7 +64,7 @@ public class PingConfig @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values be: \"bits-per-second\", \"bytes-per-second\", \"megabits-per-second\", \"megabytes-per-second\". Default is \"megabytes-per-second\".", processNames = { "dsfdev_ping", "dsfdev_pong" }) - @Value("${dev.dsf.bpe.ping.networkSpeedUnit:megabytes-per-second}") + @Value("${dev.dsf.bpe.ping.networkSpeedUnit:megabits-per-second}") private String networkSpeedUnit; public String getNetworkSpeedUnit() From 84dded719ec1ee0129e8ce93290ed86168dcdb93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 25 Jun 2025 10:50:53 +0200 Subject: [PATCH 287/382] Upgrade to DSF 1.8.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b69dde88..6900fa68 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ <compileSource>17</compileSource> <compileTarget>17</compileTarget> - <dsf.version>1.2.0</dsf.version> + <dsf.version>1.8.0</dsf.version> <dsf.location>../dsf</dsf.location> </properties> From f9574bc68a0f93a610a78872bcbfe895656e3075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 25 Jun 2025 10:51:26 +0200 Subject: [PATCH 288/382] Marked as serializable in order for Camunda to be able to serialize it --- src/main/java/dev/dsf/bpe/ProcessError.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index d479662b..1f2d4d21 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -1,5 +1,6 @@ package dev.dsf.bpe; +import java.io.Serializable; import java.util.List; import org.hl7.fhir.r4.model.Coding; @@ -12,6 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public record ProcessError(String process, String processStep, String action, String potentialFixUrl, String message) + implements Serializable { @Override public boolean equals(Object obj) From 2ade0134eb95cb71aebb1ee172e4d3fa4749c98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 25 Jun 2025 11:58:20 +0200 Subject: [PATCH 289/382] Added missing CodeSystems and ValueSets --- .../dsf/bpe/PingProcessPluginDefinition.java | 20 ++++++++++++------- .../bpe/PingProcessPluginDefinitionTest.java | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index 222cec43..38f71510 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -53,6 +53,8 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var cPing = "fhir/CodeSystem/dsf-ping.xml"; var cPingStatus = "fhir/CodeSystem/dsf-ping-status.xml"; var cPingUnits = "fhir/CodeSystem/dsf-ping-units.xml"; + var cPingProcesses = "fhir/CodeSystem/dsf-ping-processes.xml"; + var cPingProcessSteps = "fhir/CodeSystem/dsf-ping-process-steps.xml"; var sPingStatus = "fhir/StructureDefinition/dsf-extension-ping-status.xml"; var sPing = "fhir/StructureDefinition/dsf-task-ping.xml"; @@ -72,14 +74,18 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var vPingUnits = "fhir/ValueSet/dsf-ping-units.xml"; var vPingStatus = "fhir/ValueSet/dsf-ping-status.xml"; var vPongStatus = "fhir/ValueSet/dsf-pong-status.xml"; + var vPingProcesses = "fhir/ValueSet/dsf-ping-processes.xml"; + var vPingProcessSteps = "fhir/ValueSet/dsf-ping-process-steps.xml"; return Map.of(ConstantsPing.PROCESS_NAME_FULL_PING, - Arrays.asList(aPing, cPing, cPingStatus, cPingUnits, sErrorExtension, sPingStatus, sStartPing, sPong, - sCleanupPong, sNetworkSpeedExtension, tStartPing, vPing, vPingStatus, vPingUnits), - ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, - Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, - tStopPingAutoStart, vPing), - ConstantsPing.PROCESS_NAME_FULL_PONG, Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, - sErrorExtension, sPingStatus, sPing, sNetworkSpeedExtension, vPing, vPongStatus, vPingUnits)); + Arrays.asList(aPing, cPing, cPingStatus, cPingUnits, cPingProcesses, cPingProcessSteps, sErrorExtension, + sPingStatus, sStartPing, sPong, sCleanupPong, sNetworkSpeedExtension, tStartPing, vPing, + vPingStatus, vPingUnits, vPingProcesses, vPingProcessSteps), + ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, Arrays.asList(aPingAutostart, cPing, + sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, tStopPingAutoStart, vPing), + ConstantsPing.PROCESS_NAME_FULL_PONG, + Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, cPingProcesses, cPingProcessSteps, sErrorExtension, + sPingStatus, sPing, sNetworkSpeedExtension, vPing, vPongStatus, vPingUnits, vPingProcesses, + vPingProcessSteps)); } } diff --git a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java index 26b6ed5e..fc964b10 100644 --- a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java +++ b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java @@ -20,7 +20,7 @@ public void testResourceLoading() throws Exception var ping = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING); assertNotNull(ping); - assertEquals(14, ping.stream().filter(this::exists).count()); + assertEquals(18, ping.stream().filter(this::exists).count()); var pingAutostart = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART); assertNotNull(pingAutostart); @@ -28,7 +28,7 @@ public void testResourceLoading() throws Exception var pong = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PONG); assertNotNull(pong); - assertEquals(11, pong.stream().filter(this::exists).count()); + assertEquals(15, pong.stream().filter(this::exists).count()); } private boolean exists(String file) From 329dd30d6b3517700a11132fa921a3014912fa77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 25 Jun 2025 11:58:43 +0200 Subject: [PATCH 290/382] Removed unused variable --- .../dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 1e81dea0..99f7a15a 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -30,7 +30,6 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Starting resource download to measure speed..."); Task task = variables.getStartTask(); - Target target = variables.getTarget(); BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger, ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG) From 19d34d562e211a7d371361a2d65d76966f2ef67b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 25 Jun 2025 11:59:32 +0200 Subject: [PATCH 291/382] Fixed wrongly retrieving errors from previous step --- .../dsf/bpe/service/pong/LogAndSaveAndStoreError.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 650178da..0a5676a5 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -28,16 +28,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); Task startTask = variables.getStartTask(); - String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR); - ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, - "Downloading binary resource from " + target.getEndpointUrl(), ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - errorMessage); + ProcessError error = (ProcessError) delegateExecution + .getVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR); ErrorListUtils.add(error, delegateExecution); PingStatusGenerator.updatePongStatusOutput(startTask, ErrorListUtils.getErrorMessageList(delegateExecution)); variables.updateTask(startTask); - logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), errorMessage); + logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), error.message()); } } From 04b5ddf49b79b5f18ad8ccf0e7dcde1695666a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 25 Jun 2025 14:52:04 +0200 Subject: [PATCH 292/382] Added trimming because WebApplicationExceptions may not have a message --- src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index e7a6c5b7..4c0d3068 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -86,7 +86,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t } catch (WebApplicationException e) { - String errorMessage = e.getResponse().getStatusInfo().getStatusCode() + " " + e.getMessage(); + String errorMessage = (e.getResponse().getStatusInfo().getStatusCode() + " " + e.getMessage()).trim(); ProcessError error = new ProcessError(process, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, "Downloading binary resource from " + webserviceUrl, ConstantsPing.POTENTIAL_FIX_URL_DUMMY, From 2ad5af2f982e15543ba865792e4f534d8da88121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 25 Jun 2025 14:52:58 +0200 Subject: [PATCH 293/382] Fixed use of wrong type which resulted in ClassCastException --- src/main/java/dev/dsf/bpe/ProcessError.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 1f2d4d21..7b88e96b 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -49,7 +49,7 @@ public static ProcessError toError(Extension extension) .getCode(); String action = ((StringType) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_ACTION).getValue()) .getValue(); - String potentialFixUrl = ((StringType) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) + String potentialFixUrl = ((UrlType) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) .getValue()).getValue(); String message = ((StringType) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_MESSAGE).getValue()) .getValue(); From 0b51d02c935592cf5e2ad2b0b3d83ac8d59a3a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 25 Jun 2025 15:18:13 +0200 Subject: [PATCH 294/382] Added error handling to cleanup message --- .../java/dev/dsf/bpe/message/CleanupPong.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPong.java b/src/main/java/dev/dsf/bpe/message/CleanupPong.java index 27eb0deb..2b5ffbbd 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPong.java @@ -4,8 +4,13 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.core.JsonProcessingException; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; @@ -13,9 +18,12 @@ import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Response; public class CleanupPong extends AbstractTaskMessageSend { + private static final Logger logger = LoggerFactory.getLogger(CleanupPong.class); public CleanupPong(ProcessPluginApi api) { super(api); @@ -42,6 +50,35 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE return Stream.of(downloadedBytesParameter, downloadedDurationMillisParameter).flatMap(s -> s); } + @Override + protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, + String errorMessage) + { + Target target = variables.getTarget(); + + String responseCode = exception instanceof WebApplicationException w && w.getResponse() != null + ? Response.Status.fromStatusCode(w.getResponse().getStatus()).toString() + : "unknown"; + String statusCode = ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR; + + execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); + String specialErrorMessage = createErrorMessage(exception); + ProcessError pingSendError = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP_PONG, + "Sending cleanup message to " + target.getEndpointUrl(), ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + specialErrorMessage); + try + { + execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableError(), + ProcessError.toString(pingSendError)); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), responseCode); + } + @Override protected void sendTask(DelegateExecution execution, Variables variables, Target target, String instantiatesCanonical, String messageName, String businessKey, String profile, @@ -77,4 +114,16 @@ public String getCorrelationKey() super.sendTask(execution, variables, newTarget, instantiatesCanonical, messageName, businessKey, profile, additionalInputParameters); } + + private String createErrorMessage(Exception exception) + { + if (exception instanceof WebApplicationException w + && (exception.getMessage() == null || exception.getMessage().isBlank())) + { + Response.StatusType statusInfo = w.getResponse().getStatusInfo(); + return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); + } + else + return exception.getMessage(); + } } From 19eb2b0f34392f37e1a3a6c9b8ca73903d59bc41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 18 Jul 2025 14:34:55 +0200 Subject: [PATCH 295/382] - Updated potential fix urls to point to real addresses. Closes #18 - Made potential fix url optional because only we should only offer potential fixes to errors we have potential fixes for - Cleanup service got split into CleanupPing and CleanupPong because error handling was added to Cleanup and ProcessError require the knowledge of which kind of Process they originated in - GenerateAndStoreResource got split into GenerateAndStoreResourcePing and GenerateAndStoreResourcePong because error handling is now using ProcessErrors which require knowledge of which kind of Process they originated in --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 10 +- src/main/java/dev/dsf/bpe/ProcessError.java | 14 +- ...eanupPong.java => CleanupPongMessage.java} | 46 ++--- .../{SendPing.java => SendPingMessage.java} | 45 ++--- .../{SendPong.java => SendPongMessage.java} | 36 +--- .../java/dev/dsf/bpe/service/Cleanup.java | 61 +++++-- .../bpe/service/GenerateAndStoreResource.java | 30 ++- .../bpe/service/ping/CheckPingTaskStatus.java | 36 ++-- .../dev/dsf/bpe/service/ping/CleanupPing.java | 27 +++ ...adResourceAndMeasureSpeedInSubProcess.java | 2 - .../ping/GenerateAndStoreResourcePing.java | 27 +++ .../ping/LogAndSaveUploadErrorPing.java | 11 +- .../dev/dsf/bpe/service/pong/CleanupPong.java | 27 +++ .../pong/DownloadResourceAndMeasureSpeed.java | 3 - .../pong/GenerateAndStoreResourcePong.java | 28 +++ .../pong/LogAndSaveUploadErrorPong.java | 8 +- .../bpe/service/pong/SaveTimeoutError.java | 4 +- .../dev/dsf/bpe/spring/config/PingConfig.java | 46 +++-- .../bpe/util/BinaryResourceDownloader.java | 38 ++-- src/main/java/dev/dsf/bpe/util/Process.java | 11 ++ .../bpe/util/task/SendTaskErrorConverter.java | 119 ++++++++++++ .../ErrorInputComponentGenerator.java | 1 - .../ErrorOutputComponentGenerator.java | 1 - .../output/generator/PingStatusGenerator.java | 1 - src/main/resources/bpe/ping.bpmn | 131 ++++++------- src/main/resources/bpe/pong.bpmn | 172 +++++++++--------- .../dsf-extension-error.xml | 2 +- .../dsf/fhir/profiles/TaskProfileTest.java | 5 +- 28 files changed, 605 insertions(+), 337 deletions(-) rename src/main/java/dev/dsf/bpe/message/{CleanupPong.java => CleanupPongMessage.java} (65%) rename src/main/java/dev/dsf/bpe/message/{SendPing.java => SendPingMessage.java} (70%) rename src/main/java/dev/dsf/bpe/message/{SendPong.java => SendPongMessage.java} (72%) create mode 100644 src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java create mode 100644 src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java create mode 100644 src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java create mode 100644 src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java create mode 100644 src/main/java/dev/dsf/bpe/util/Process.java create mode 100644 src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 63c9f0ae..a861af7b 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -152,7 +152,15 @@ private ConstantsPing() public static final String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; - public static final String POTENTIAL_FIX_URL_DUMMY = "dsf.dev"; + public static final String POTENTIAL_FIX_URL_BASE = "https://dsf.dev/s"; + public static final String POTENTIAL_FIX_URL_ERROR_HTTP = POTENTIAL_FIX_URL_BASE + "/error-http"; + public static final String POTENTIAL_FIX_URL_READ_TIMEOUT = POTENTIAL_FIX_URL_BASE + "/read-timeout"; + public static final String POTENTIAL_FIX_URL_ERROR_SSL = POTENTIAL_FIX_URL_BASE + "/error-ssl"; + public static final String POTENTIAL_FIX_URL_CONNECTION_TIMEOUT = POTENTIAL_FIX_URL_BASE + "/connection-timeout"; + public static final String POTENTIAL_FIX_URL_CONNECTION_REFUSED = POTENTIAL_FIX_URL_BASE + "/connection-refused"; + public static final String POTENTIAL_FIX_URL_UNKNOWN_HOST = POTENTIAL_FIX_URL_BASE + "/unknown-host"; + + public static final String CLEANUP_ERROR_ACTION = "Deleting generated Binary resource from local DSF FHIR server."; public static String getBpmnExecutionVariableStatusCode() { diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 7b88e96b..2f2d5458 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -2,6 +2,7 @@ import java.io.Serializable; import java.util.List; +import java.util.Objects; import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.Extension; @@ -26,6 +27,12 @@ public boolean equals(Object obj) public static Extension toExtension(ProcessError error) { + Objects.requireNonNull(error); + Objects.requireNonNull(error.action()); + Objects.requireNonNull(error.process()); + Objects.requireNonNull(error.message()); + Objects.requireNonNull(error.processStep()); + Extension extension = new Extension(); extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); @@ -34,8 +41,11 @@ public static Extension toExtension(ProcessError error) extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, error.process(), null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(error.action())); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) - .setValue(new UrlType(error.potentialFixUrl())); + if (Objects.nonNull(error.potentialFixUrl)) + { + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) + .setValue(new UrlType(error.potentialFixUrl())); + } extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(error.message())); return extension; diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPong.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java similarity index 65% rename from src/main/java/dev/dsf/bpe/message/CleanupPong.java rename to src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 2b5ffbbd..37230977 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -11,20 +11,20 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.logging.PingPongLogger; +import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; -import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; -import jakarta.ws.rs.WebApplicationException; -import jakarta.ws.rs.core.Response; -public class CleanupPong extends AbstractTaskMessageSend +public class CleanupPongMessage extends AbstractTaskMessageSend { - private static final Logger logger = LoggerFactory.getLogger(CleanupPong.class); - public CleanupPong(ProcessPluginApi api) + private static final Logger logger = LoggerFactory.getLogger(CleanupPongMessage.class); + + public CleanupPongMessage(ProcessPluginApi api) { super(api); } @@ -54,29 +54,23 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, String errorMessage) { + PingPongLogger logger = new PingPongLogger(CleanupPongMessage.class, variables.getStartTask()); Target target = variables.getTarget(); + ProcessError error = SendTaskErrorConverter.convert(exception, + "Sending cleanup message to " + target.getEndpointUrl()); - String responseCode = exception instanceof WebApplicationException w && w.getResponse() != null - ? Response.Status.fromStatusCode(w.getResponse().getStatus()).toString() - : "unknown"; - String statusCode = ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR; - - execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); - String specialErrorMessage = createErrorMessage(exception); - ProcessError pingSendError = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP_PONG, - "Sending cleanup message to " + target.getEndpointUrl(), ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - specialErrorMessage); try { - execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableError(), - ProcessError.toString(pingSendError)); + execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableError(), ProcessError.toString(error)); + execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode(), + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); } catch (JsonProcessingException e) { throw new RuntimeException(e); } - logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), responseCode); + + logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); } @Override @@ -114,16 +108,4 @@ public String getCorrelationKey() super.sendTask(execution, variables, newTarget, instantiatesCanonical, messageName, businessKey, profile, additionalInputParameters); } - - private String createErrorMessage(Exception exception) - { - if (exception instanceof WebApplicationException w - && (exception.getMessage() == null || exception.getMessage().isBlank())) - { - Response.StatusType statusInfo = w.getResponse().getStatusInfo(); - return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); - } - else - return exception.getMessage(); - } } diff --git a/src/main/java/dev/dsf/bpe/message/SendPing.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java similarity index 70% rename from src/main/java/dev/dsf/bpe/message/SendPing.java rename to src/main/java/dev/dsf/bpe/message/SendPingMessage.java index 6ff4c783..0c05ae44 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -16,6 +16,8 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.logging.PingPongLogger; +import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -23,16 +25,13 @@ import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; import dev.dsf.fhir.client.FhirWebserviceClient; -import jakarta.ws.rs.WebApplicationException; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.StatusType; -public class SendPing extends AbstractTaskMessageSend +public class SendPingMessage extends AbstractTaskMessageSend { - private static final Logger logger = LoggerFactory.getLogger(SendPing.class); + private static final Logger logger = LoggerFactory.getLogger(SendPingMessage.class); private IdType taskId; - public SendPing(ProcessPluginApi api) + public SendPingMessage(ProcessPluginApi api) { super(api); } @@ -81,29 +80,23 @@ protected IdType doSend(FhirWebserviceClient client, Task task) protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, String errorMessage) { + PingPongLogger logger = new PingPongLogger(SendPingMessage.class, variables.getStartTask()); Target target = variables.getTarget(); + ProcessError error = SendTaskErrorConverter.convert(exception, + "Sending ping message to " + target.getEndpointUrl()); - String responseCode = exception instanceof WebApplicationException w && w.getResponse() != null - ? Response.Status.fromStatusCode(w.getResponse().getStatus()).toString() - : "unknown"; - String statusCode = ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR; - - execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode(), statusCode); - String specialErrorMessage = createErrorMessage(exception); - ProcessError pingSendError = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, - "Sending ping message to " + target.getEndpointUrl(), ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - specialErrorMessage); try { - execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableError(), - ProcessError.toString(pingSendError)); + execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableError(), ProcessError.toString(error)); + execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode(), + ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); } catch (JsonProcessingException e) { throw new RuntimeException(e); } - logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), responseCode); + + logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); } @Override @@ -112,18 +105,6 @@ protected void addErrorMessage(Task task, String errorMessage) // error message part of } - private String createErrorMessage(Exception exception) - { - if (exception instanceof WebApplicationException w - && (exception.getMessage() == null || exception.getMessage().isBlank())) - { - StatusType statusInfo = w.getResponse().getStatusInfo(); - return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); - } - else - return exception.getMessage(); - } - private Identifier getLocalEndpointIdentifier() { return api.getEndpointProvider().getLocalEndpointIdentifier() diff --git a/src/main/java/dev/dsf/bpe/message/SendPong.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java similarity index 72% rename from src/main/java/dev/dsf/bpe/message/SendPong.java rename to src/main/java/dev/dsf/bpe/message/SendPongMessage.java index bfa9efd0..612efc77 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPong.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -12,6 +12,7 @@ import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; +import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; @@ -21,15 +22,12 @@ import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; -import jakarta.ws.rs.WebApplicationException; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.StatusType; -public class SendPong extends AbstractTaskMessageSend +public class SendPongMessage extends AbstractTaskMessageSend { private final AggregateErrorMailService errorMailService; - public SendPong(ProcessPluginApi api, AggregateErrorMailService errorMailService) + public SendPongMessage(ProcessPluginApi api, AggregateErrorMailService errorMailService) { super(api); @@ -93,37 +91,19 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, String errorMessage) { - PingPongLogger logger = new PingPongLogger(SendPong.class, variables.getStartTask()); + PingPongLogger logger = new PingPongLogger(SendPongMessage.class, variables.getStartTask()); Target target = variables.getTarget(); Task startTask = variables.getStartTask(); - String statusCode = exception instanceof WebApplicationException w && w.getResponse() != null - ? Response.Status.fromStatusCode(w.getResponse().getStatus()).toString() - : "unknown"; + ProcessError error = SendTaskErrorConverter.convert(exception, + "Sending pong message to " + target.getEndpointUrl()); - String specialErrorMessage = createErrorMessage(exception); - ProcessError pongSendError = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PONG, - "Sending pong message to " + target.getEndpointUrl(), ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - specialErrorMessage); - ErrorListUtils.add(pongSendError, execution); + ErrorListUtils.add(error, execution); PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(), ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); - - logger.info("Request to {} resulted in status {}", target.getEndpointUrl(), statusCode); variables.updateTask(startTask); - } - private String createErrorMessage(Exception exception) - { - if (exception instanceof WebApplicationException w - && (exception.getMessage() == null || exception.getMessage().isBlank())) - { - StatusType statusInfo = w.getResponse().getStatusInfo(); - return statusInfo.getStatusCode() + " " + statusInfo.getReasonPhrase(); - } - else - return exception.getMessage(); + logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); } } diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 064632a0..c1d953d0 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -1,36 +1,73 @@ package dev.dsf.bpe.service; -import org.camunda.bpm.engine.delegate.BpmnError; +import java.net.SocketTimeoutException; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.IdType; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.service.pong.CleanupPong; +import dev.dsf.bpe.util.ErrorListUtils; +import dev.dsf.bpe.util.Process; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; +import jakarta.ws.rs.ProcessingException; +import jakarta.ws.rs.WebApplicationException; -public class Cleanup extends AbstractServiceDelegate +public class Cleanup { - public Cleanup(ProcessPluginApi api) + + private final ProcessPluginApi api; + private final dev.dsf.bpe.util.Process process; + + public Cleanup(ProcessPluginApi api, Process process) { - super(api); + this.api = api; + this.process = process; } - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + public void doExecute(DelegateExecution delegateExecution, Variables variables) { - PingPongLogger logger = new PingPongLogger(Cleanup.class, variables.getStartTask()); + PingPongLogger logger = new PingPongLogger(CleanupPong.class, variables.getStartTask()); logger.debug("Cleaning up..."); String downloadResourceId = new IdType( variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE)).getIdPart(); if (downloadResourceId != null) { - api.getFhirWebserviceClientProvider().getLocalWebserviceClient().delete(Binary.class, downloadResourceId); - api.getFhirWebserviceClientProvider().getLocalWebserviceClient().deletePermanently(Binary.class, - downloadResourceId); - logger.debug("Deleted Binary resource with ID {}", downloadResourceId); + try + { + api.getFhirWebserviceClientProvider().getLocalWebserviceClient().delete(Binary.class, + downloadResourceId); + api.getFhirWebserviceClientProvider().getLocalWebserviceClient().deletePermanently(Binary.class, + downloadResourceId); + logger.debug("Deleted Binary resource with ID {}", downloadResourceId); + } + catch (ProcessingException e) + { + if (e.getCause() instanceof SocketTimeoutException) + { + ProcessError error = new ProcessError(process.toString(), + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP, + ConstantsPing.CLEANUP_ERROR_ACTION, ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT, + e.getCause().getMessage()); + ErrorListUtils.add(error, delegateExecution); + } + else + { + throw new RuntimeException(e); + } + } + catch (WebApplicationException e) + { + ProcessError error = new ProcessError(process.toString(), + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP, + ConstantsPing.CLEANUP_ERROR_ACTION, ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, + "Response from local DSF FHIR server: " + e.getResponse().getStatus()); + ErrorListUtils.add(error, delegateExecution); + } } else { diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index d842d60f..f8f26d31 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -8,24 +8,27 @@ import org.hl7.fhir.r4.model.IdType; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.Process; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; import jakarta.ws.rs.WebApplicationException; -public class GenerateAndStoreResource extends AbstractServiceDelegate +public class GenerateAndStoreResource { + private final ProcessPluginApi api; private final int maxUploadSizeBytes; + private final Process process; - public GenerateAndStoreResource(ProcessPluginApi api, int maxUploadSizeBytes) + public GenerateAndStoreResource(ProcessPluginApi api, int maxUploadSizeBytes, Process process) { - super(api); + this.api = api; this.maxUploadSizeBytes = maxUploadSizeBytes; + this.process = process; } - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + public void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception { PingPongLogger logger = new PingPongLogger(GenerateAndStoreResource.class, variables.getStartTask()); logger.debug("Generating resource..."); @@ -39,7 +42,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable try { - IdType downloadResource = storeBinary(resourceContent); + IdType downloadResource = storeBinary(resourceContent, delegateExecution); String reference = downloadResource.getValueAsString(); @@ -47,9 +50,15 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Stored binary resource for download"); } - catch (Exception e) + catch (WebApplicationException e) { - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_UPLOAD_ERROR, e.getMessage()); + String status = String.valueOf(e.getResponse().getStatus()); + ProcessError error = new ProcessError(process.toString(), + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_GENERATE_AND_STORE_RESOURCE, + "Storing Binary resource on local DSF FHIR server.", ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, + "Local DSF FHIR server responded with status: " + status); + variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR, + ProcessError.toString(error)); } } @@ -76,10 +85,11 @@ private int getDownloadResourceSize(Variables variables) return variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); } - private IdType storeBinary(byte[] downloadResourceContent) + private IdType storeBinary(byte[] downloadResourceContent, DelegateExecution delegateExecution) { return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().createBinary( new ByteArrayInputStream(downloadResourceContent), ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE, api.getOrganizationProvider().getLocalOrganization().get().getIdElement().getValue()); } + } diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index a68ac245..cd3a1ab3 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -1,6 +1,5 @@ package dev.dsf.bpe.service.ping; -import java.util.Map; import java.util.Objects; import org.camunda.bpm.engine.delegate.BpmnError; @@ -47,29 +46,16 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task pingTask = fhirWebserviceClient.withRetry(3, 1000).read(Task.class, taskId.getIdPart()); switch (pingTask.getStatus()) { - case REQUESTED -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, - "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " - + target.getEndpointUrl() + " is " + pingTask.getStatus()); - case INPROGRESS -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, - "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " - + target.getEndpointUrl() + " is " + pingTask.getStatus()); - case FAILED -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, - "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " - + target.getEndpointUrl() + " is " + pingTask.getStatus()); - case COMPLETED -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, - "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " - + target.getEndpointUrl() + " is " + pingTask.getStatus()); + case REQUESTED, INPROGRESS, FAILED, + COMPLETED -> + error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, + "Awaiting pong message", null, + "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + + " from " + target.getEndpointUrl() + " is " + pingTask.getStatus()); default -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, - "Awaiting pong message", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, + "Awaiting pong message", null, "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " + target.getEndpointUrl() + " is " + pingTask.getStatus() + ". Unexpected status. Should be either of " + Task.TaskStatus.REQUESTED + ", " @@ -83,9 +69,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, - "Pong message timed out. Retrieving ping task resource with id " + taskId.getIdPart() + " from " - + target.getEndpointUrl(), - ConstantsPing.POTENTIAL_FIX_URL_DUMMY, e.getMessage()); + "Pong message timed out. Error when retrieving status of ping task resource with id " + + taskId.getIdPart() + " from " + target.getEndpointUrl(), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, e.getMessage()); } ErrorListUtils.add(error, delegateExecution, correlationKey); logger.debug("Saved '{}' to process execution for correlation key '{}'", diff --git a/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java b/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java new file mode 100644 index 00000000..954a59bc --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java @@ -0,0 +1,27 @@ +package dev.dsf.bpe.service.ping; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import dev.dsf.bpe.service.Cleanup; +import dev.dsf.bpe.util.Process; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class CleanupPing extends AbstractServiceDelegate +{ + private final Cleanup delegate; + + public CleanupPing(ProcessPluginApi api) + { + super(api); + delegate = new Cleanup(api, Process.PING); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + delegate.doExecute(delegateExecution, variables); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index b13050a1..3da7ecba 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -5,7 +5,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -50,7 +49,6 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { delegateExecution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR, downloadResult.getError()); - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR); } logger.debug("Completed resource download and measured speed."); diff --git a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java new file mode 100644 index 00000000..cc9d94f5 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java @@ -0,0 +1,27 @@ +package dev.dsf.bpe.service.ping; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import dev.dsf.bpe.service.GenerateAndStoreResource; +import dev.dsf.bpe.util.Process; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class GenerateAndStoreResourcePing extends AbstractServiceDelegate +{ + private final GenerateAndStoreResource delegate; + + public GenerateAndStoreResourcePing(ProcessPluginApi api, int maxUploadSizeBytes) + { + super(api); + delegate = new GenerateAndStoreResource(api, maxUploadSizeBytes, Process.PING); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + delegate.doExecute(delegateExecution, variables); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java index 0cac83c1..c6e8ba3f 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java @@ -6,7 +6,6 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; -import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -25,13 +24,9 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task startTask = variables.getStartTask(); PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPing.class, startTask); - String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR); - ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_GENERATE_AND_STORE_RESOURCE, - "Storing binary resource on local DSF FHIR server", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - errorMessage); - ErrorListUtils.add(error, execution); + ProcessError error = ProcessError + .parse(variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR)); - logger.info("Error while storing binary resource for download: {}", errorMessage); + logger.info("Error while storing binary resource for download: {}", error.message()); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java b/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java new file mode 100644 index 00000000..2540e4e3 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java @@ -0,0 +1,27 @@ +package dev.dsf.bpe.service.pong; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import dev.dsf.bpe.service.Cleanup; +import dev.dsf.bpe.util.Process; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class CleanupPong extends AbstractServiceDelegate +{ + private final Cleanup delegate; + + public CleanupPong(ProcessPluginApi api) + { + super(api); + delegate = new Cleanup(api, Process.PONG); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + delegate.doExecute(delegateExecution, variables); + } +} diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 99f7a15a..f9418865 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -5,12 +5,10 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate @@ -46,7 +44,6 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { delegateExecution.setVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR, downloadResult.getError()); - throw new BpmnError(ConstantsPing.BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR); } logger.debug("Completed resource download and measured speed."); } diff --git a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java new file mode 100644 index 00000000..5568be56 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java @@ -0,0 +1,28 @@ +package dev.dsf.bpe.service.pong; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import dev.dsf.bpe.service.GenerateAndStoreResource; +import dev.dsf.bpe.util.Process; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class GenerateAndStoreResourcePong extends AbstractServiceDelegate +{ + private final GenerateAndStoreResource delegate; + + public GenerateAndStoreResourcePong(ProcessPluginApi api, int maxUploadSizeBytes) + { + super(api); + this.delegate = new GenerateAndStoreResource(api, maxUploadSizeBytes, Process.PONG); + } + + @Override + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + { + delegate.doExecute(delegateExecution, variables); + } + +} diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java index 1bcb6b37..88bb5bcc 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java @@ -25,13 +25,11 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task startTask = variables.getStartTask(); PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPong.class, startTask); - String errorMessage = variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR); - ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_GENERATE_AND_STORE_RESOURCE, - "Storing binary resource for download", ConstantsPing.POTENTIAL_FIX_URL_DUMMY, errorMessage); + ProcessError error = ProcessError + .parse(variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR)); ErrorListUtils.add(error, execution); - logger.info("Error while storing binary resource for download: {}", errorMessage); + logger.info("Error while storing binary resource for download: {}", error.message()); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java index 1acb767d..c6248994 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java @@ -30,8 +30,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP_TIMER_CATCH_EVENT, - "Waiting for cleanup message from " + target.getOrganizationIdentifierValue(), - ConstantsPing.POTENTIAL_FIX_URL_DUMMY, "Timeout while waiting for cleanup message"); + "Waiting for cleanup message from " + target.getOrganizationIdentifierValue(), null, + "Timeout while waiting for cleanup message"); ErrorListUtils.add(error, execution); diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 21f579db..cf54d7a6 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -10,23 +10,25 @@ import dev.dsf.bpe.listener.PingPongDeploymentStateListener; import dev.dsf.bpe.listener.SetCorrelationKeyListener; import dev.dsf.bpe.mail.AggregateErrorMailService; -import dev.dsf.bpe.message.CleanupPong; -import dev.dsf.bpe.message.SendPing; -import dev.dsf.bpe.message.SendPong; +import dev.dsf.bpe.message.CleanupPongMessage; +import dev.dsf.bpe.message.SendPingMessage; +import dev.dsf.bpe.message.SendPongMessage; import dev.dsf.bpe.message.SendStartPing; -import dev.dsf.bpe.service.Cleanup; -import dev.dsf.bpe.service.GenerateAndStoreResource; import dev.dsf.bpe.service.SetDownloadResourceSize; import dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer; import dev.dsf.bpe.service.ping.CheckPingTaskStatus; +import dev.dsf.bpe.service.ping.CleanupPing; import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; +import dev.dsf.bpe.service.ping.GenerateAndStoreResourcePing; import dev.dsf.bpe.service.ping.LogAndSaveError; import dev.dsf.bpe.service.ping.LogAndSaveUploadErrorPing; import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; import dev.dsf.bpe.service.ping.StoreResults; +import dev.dsf.bpe.service.pong.CleanupPong; import dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed; import dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration; +import dev.dsf.bpe.service.pong.GenerateAndStoreResourcePong; import dev.dsf.bpe.service.pong.LogAndSaveAndStoreError; import dev.dsf.bpe.service.pong.LogAndSaveUploadErrorPong; import dev.dsf.bpe.service.pong.LogPing; @@ -133,9 +135,9 @@ public SelectPingTargets selectPingTargets() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public SendPing sendPing() + public SendPingMessage sendPing() { - return new SendPing(api); + return new SendPingMessage(api); } @Bean @@ -168,9 +170,9 @@ public SelectPongTarget selectPongTarget() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public SendPong sendPong() + public SendPongMessage sendPong() { - return new SendPong(api, pongErrorLogger()); + return new SendPongMessage(api, pongErrorLogger()); } @Bean @@ -182,9 +184,9 @@ public CheckPingTaskStatus logAndSaveNoResponse() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public CleanupPong cleanupPong() + public CleanupPongMessage cleanupPongMessage() { - return new CleanupPong(api); + return new CleanupPongMessage(api); } @Bean @@ -203,9 +205,16 @@ public DownloadResourceAndMeasureSpeedInSubProcess downloadResourceAndMeasureSpe @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public Cleanup cleanup() + public CleanupPing cleanupPing() + { + return new CleanupPing(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public CleanupPong cleanupPong() { - return new Cleanup(api); + return new CleanupPong(api); } @Bean @@ -280,9 +289,16 @@ public dev.dsf.bpe.service.ping.LogAndSaveSendError logAndSaveSendError() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public GenerateAndStoreResource generateAndStoreResource() + public GenerateAndStoreResourcePing generateAndStoreResourcePing() + { + return new GenerateAndStoreResourcePing(api, maxUploadSizeBytes); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public GenerateAndStoreResourcePong generateAndStoreResourcePong() { - return new GenerateAndStoreResource(api, maxUploadSizeBytes); + return new GenerateAndStoreResourcePong(api, maxUploadSizeBytes); } @Bean diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 4c0d3068..989943ca 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.io.InputStream; +import java.net.SocketTimeoutException; import java.util.Optional; import org.hl7.fhir.r4.model.IdType; @@ -13,6 +14,7 @@ import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Variables; +import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.WebApplicationException; public class BinaryResourceDownloader @@ -41,8 +43,8 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t { ProcessError error = new ProcessError(process, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, - "Extracting binary resource reference from task " + task.getIdElement().getValue(), - ConstantsPing.POTENTIAL_FIX_URL_DUMMY, "No reference provided in task"); + "Extracting binary resource reference from task " + task.getIdElement().getValue(), null, + "No reference provided in task"); downloadResult = new DownloadResult(error); return downloadResult; } @@ -51,6 +53,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t IdType downloadResourceReferenceIdType = new IdType(downloadResourceReference.getReference()); String downloadResourceReferenceId = downloadResourceReferenceIdType.getIdPart(); String webserviceUrl = downloadResourceReferenceIdType.getBaseUrl(); + String action = "Downloading binary resource from " + webserviceUrl; try { InputStream binaryResourceInputStream = api.getFhirWebserviceClientProvider() @@ -78,8 +81,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t String errorMessage = e.getMessage(); ProcessError error = new ProcessError(process, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, - "Downloading binary resource from " + webserviceUrl, ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - errorMessage); + action, null, errorMessage); logger.error("Encountered an error while downloading resource: {}", errorMessage); downloadResult = new DownloadResult(error); } @@ -88,19 +90,33 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t { String errorMessage = (e.getResponse().getStatusInfo().getStatusCode() + " " + e.getMessage()).trim(); ProcessError error = new ProcessError(process, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, - "Downloading binary resource from " + webserviceUrl, ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - errorMessage); + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, errorMessage); logger.error("Encountered an error while downloading resource: {}", errorMessage); downloadResult = new DownloadResult(error); } - catch (Exception e) + catch (ProcessingException e) + { + if (e.getCause() instanceof SocketTimeoutException) + { + String errorMessage = e.getCause().getMessage(); + ProcessError error = new ProcessError(process, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, + action, ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT, errorMessage); + logger.error("Encountered an error while downloading resource: {}", errorMessage); + downloadResult = new DownloadResult(error); + } + else + { + throw e; + } + } + catch (IOException e) { String errorMessage = e.getMessage(); ProcessError error = new ProcessError(process, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, - "Downloading binary resource from " + webserviceUrl, ConstantsPing.POTENTIAL_FIX_URL_DUMMY, - errorMessage); + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, + null, errorMessage); logger.error("Encountered an error while downloading resource: {}", errorMessage); downloadResult = new DownloadResult(error); } diff --git a/src/main/java/dev/dsf/bpe/util/Process.java b/src/main/java/dev/dsf/bpe/util/Process.java new file mode 100644 index 00000000..21b20f40 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/Process.java @@ -0,0 +1,11 @@ +package dev.dsf.bpe.util; + +public enum Process +{ + PING, PONG; + + public String toString() + { + return this.name().toLowerCase(); + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java new file mode 100644 index 00000000..6a99e717 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -0,0 +1,119 @@ +package dev.dsf.bpe.util.task; + +import java.net.UnknownHostException; +import java.util.Map; +import java.util.Objects; +import java.util.function.BiFunction; + +import javax.net.ssl.SSLHandshakeException; + +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.conn.HttpHostConnectException; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; +import jakarta.ws.rs.ProcessingException; +import jakarta.ws.rs.WebApplicationException; +import jakarta.ws.rs.core.Response; + +public class SendTaskErrorConverter +{ + private static final Map<Class<? extends Throwable>, BiFunction<? extends Throwable, String, ProcessError>> EXPECTED_CAUSES_WITH_CONVERTERS = Map + .of(SSLHandshakeException.class, convertSSLHandshakeException(), ConnectTimeoutException.class, + convertConnectTimeoutException(), UnknownHostException.class, convertUnknownHostException(), + HttpHostConnectException.class, convertConnectTimeoutException()); + + public static ProcessError convert(Exception exception, String action) + { + ProcessError processError; + if (exception instanceof WebApplicationException e) + { + processError = convertWebApplicationException().apply(e, action); + } + else if (exception instanceof SSLHandshakeException e) + { + processError = convertSSLHandshakeException().apply(e, action); + } + else if (exception instanceof ConnectTimeoutException e) + { + processError = convertConnectTimeoutException().apply(e, action); + } + else if (exception instanceof HttpHostConnectException e) + { + processError = convertHttpHostConnectException().apply(e, action); + } + else if (exception instanceof ProcessingException e) + { + processError = EXPECTED_CAUSES_WITH_CONVERTERS.keySet().stream() + .map(causeClass -> getExpectedCauseInstanceFromStack(causeClass, e)).filter(Objects::nonNull) + .findFirst().map(ex -> applyConverter(ex, action)).orElse(applyConverter(e, action)); + } + else + { + processError = convertExceptionFallback().apply(exception, action); + } + + return processError; + } + + private static BiFunction<SSLHandshakeException, String, ProcessError> convertSSLHandshakeException() + { + return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL, e.getMessage()); + } + + private static BiFunction<Exception, String, ProcessError> convertExceptionFallback() + { + return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, null, e.getMessage()); + } + + private static BiFunction<ConnectTimeoutException, String, ProcessError> convertConnectTimeoutException() + { + return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT, e.getMessage()); + } + + private static BiFunction<WebApplicationException, String, ProcessError> convertWebApplicationException() + { + return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, + "Response from remote DSF FHIR server: " + e.getResponse().getStatus() + " " + + Response.Status.fromStatusCode(e.getResponse().getStatus()).toString()); + } + + private static BiFunction<HttpHostConnectException, String, ProcessError> convertHttpHostConnectException() + { + return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED, e.getMessage()); + } + + private static BiFunction<UnknownHostException, String, ProcessError> convertUnknownHostException() + { + return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, + ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST, e.getMessage()); + } + + private static <T extends Throwable> ProcessError applyConverter(T ex, String action) + { + @SuppressWarnings("unchecked") + BiFunction<T, String, ProcessError> converter = (BiFunction<T, String, ProcessError>) EXPECTED_CAUSES_WITH_CONVERTERS + .getOrDefault(ex.getClass(), convertExceptionFallback()); + return converter.apply(ex, action); + } + + + private static <T extends Throwable> T getExpectedCauseInstanceFromStack(Class<T> expectedCause, Throwable e) + { + if (Objects.isNull(e)) + return null; + if (expectedCause.isInstance(e)) + return expectedCause.cast(e); + return getExpectedCauseInstanceFromStack(expectedCause, e.getCause()); + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java index a025a12a..688ade1e 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java @@ -9,7 +9,6 @@ import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; -import ca.uhn.fhir.model.primitive.CodeDt; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java index d26ef6f3..f5b0e915 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java @@ -9,7 +9,6 @@ import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; -import ca.uhn.fhir.model.primitive.CodeDt; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index fb1c71f0..dae52b33 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -6,7 +6,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; -import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 5796e77f..12448656 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0abzurc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.17.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.20.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0abzurc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.35.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.20.0"> <bpmn:message id="Message_1pklz6t" name="startPing" /> <bpmn:message id="Message_10o3b8y" name="pong" /> <bpmn:error id="Error_1jmenbm" name="resourceDownloadError" errorCode="resourceDownloadError" /> @@ -58,7 +58,7 @@ </bpmn:extensionElements> <bpmn:incoming>Flow_1ho1hys</bpmn:incoming> </bpmn:endEvent> - <bpmn:sendTask id="Activity_0ri6fnv" name="Ping" camunda:class="dev.dsf.bpe.message.SendPing"> + <bpmn:sendTask id="Activity_0ri6fnv" name="Ping" camunda:class="dev.dsf.bpe.message.SendPingMessage"> <bpmn:extensionElements> <camunda:field name="instantiatesCanonical"> <camunda:string>http://dsf.dev/bpe/Process/pong|#{version}</camunda:string> @@ -80,9 +80,9 @@ </bpmn:exclusiveGateway> <bpmn:serviceTask id="Activity_0h9o9u7" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess"> <bpmn:incoming>Flow_1yt9547</bpmn:incoming> - <bpmn:outgoing>Flow_1v37fff</bpmn:outgoing> + <bpmn:outgoing>Flow_1ncztgo</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sendTask id="Activity_0vw65a2" name="Cleanup Pong" camunda:class="dev.dsf.bpe.message.CleanupPong"> + <bpmn:sendTask id="Activity_0vw65a2" name="Cleanup Pong" camunda:class="dev.dsf.bpe.message.CleanupPongMessage"> <bpmn:extensionElements> <camunda:field name="profile"> <camunda:string>http://dsf.dev/fhir/StructureDefinition/task-cleanup-pong|#{version}</camunda:string> @@ -94,12 +94,12 @@ <camunda:string>http://dsf.dev/bpe/Process/pong|#{version}</camunda:string> </camunda:field> </bpmn:extensionElements> - <bpmn:incoming>Flow_1v37fff</bpmn:incoming> <bpmn:incoming>Flow_0jcfur3</bpmn:incoming> + <bpmn:incoming>Flow_18wxsor</bpmn:incoming> <bpmn:outgoing>Flow_0klalf8</bpmn:outgoing> </bpmn:sendTask> <bpmn:serviceTask id="Activity_0akr23c" name="Log and Save Error" camunda:class="dev.dsf.bpe.service.ping.LogAndSaveError"> - <bpmn:incoming>Flow_10h6pqh</bpmn:incoming> + <bpmn:incoming>Flow_0qif01p</bpmn:incoming> <bpmn:outgoing>Flow_0jcfur3</bpmn:outgoing> </bpmn:serviceTask> <bpmn:exclusiveGateway id="Gateway_02orad4"> @@ -113,10 +113,6 @@ </bpmn:extensionElements> <bpmn:incoming>Flow_03nx6rk</bpmn:incoming> </bpmn:endEvent> - <bpmn:boundaryEvent id="Event_0i4slcz" attachedToRef="Activity_0h9o9u7"> - <bpmn:outgoing>Flow_10h6pqh</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0f1pn8k" errorRef="Error_1jmenbm" camunda:errorMessageVariable="resourceDownloadError" /> - </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_10epxa2" sourceRef="SubProcessStartEvent" targetRef="Activity_0ri6fnv" /> <bpmn:sequenceFlow id="Flow_0y9usku" sourceRef="EventBasedGateway" targetRef="PongTimer" /> <bpmn:sequenceFlow id="Flow_1fjeq2h" sourceRef="PongTimer" targetRef="LogNoResponse" /> @@ -132,9 +128,7 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1yt9547" sourceRef="Gateway_0p0be0a" targetRef="Activity_0h9o9u7" /> - <bpmn:sequenceFlow id="Flow_1v37fff" sourceRef="Activity_0h9o9u7" targetRef="Activity_0vw65a2" /> <bpmn:sequenceFlow id="Flow_0jcfur3" sourceRef="Activity_0akr23c" targetRef="Activity_0vw65a2" /> - <bpmn:sequenceFlow id="Flow_10h6pqh" sourceRef="Event_0i4slcz" targetRef="Activity_0akr23c" /> <bpmn:sequenceFlow id="Flow_0klalf8" sourceRef="Activity_0vw65a2" targetRef="Gateway_02orad4" /> <bpmn:sequenceFlow id="Flow_1ewmc79" sourceRef="PongCatchEvent" targetRef="Activity_081me01" /> <bpmn:serviceTask id="Activity_081me01" name="Save Pong" camunda:class="dev.dsf.bpe.service.ping.SavePong"> @@ -148,6 +142,16 @@ <bpmn:incoming>Flow_101sqed</bpmn:incoming> <bpmn:outgoing>Flow_0upu487</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:exclusiveGateway id="Gateway_0de83s3" default="Flow_18wxsor"> + <bpmn:incoming>Flow_1ncztgo</bpmn:incoming> + <bpmn:outgoing>Flow_0qif01p</bpmn:outgoing> + <bpmn:outgoing>Flow_18wxsor</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_1ncztgo" sourceRef="Activity_0h9o9u7" targetRef="Gateway_0de83s3" /> + <bpmn:sequenceFlow id="Flow_0qif01p" sourceRef="Gateway_0de83s3" targetRef="Activity_0akr23c"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('resourceDownloadError')}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_18wxsor" sourceRef="Gateway_0de83s3" targetRef="Activity_0vw65a2" /> <bpmn:textAnnotation id="TextAnnotation_0uc8utt"> <bpmn:text>Information in message: - dowloadResourceSize: long @@ -165,11 +169,11 @@ <bpmn:association id="Association_14iteoh" sourceRef="Activity_0vw65a2" targetRef="TextAnnotation_0smygq5" /> <bpmn:association id="Association_0l3n1oc" sourceRef="TextAnnotation_08ic0l2" targetRef="Activity_0h9o9u7" /> </bpmn:subProcess> - <bpmn:serviceTask id="Activity_0nwtf8o" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.GenerateAndStoreResource"> + <bpmn:serviceTask id="Activity_0nwtf8o" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.ping.GenerateAndStoreResourcePing"> <bpmn:incoming>Flow_152nb9r</bpmn:incoming> - <bpmn:outgoing>Flow_1qz7z39</bpmn:outgoing> + <bpmn:outgoing>Flow_1op4sei</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0802w0b" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> + <bpmn:serviceTask id="Activity_0802w0b" name="Cleanup" camunda:class="dev.dsf.bpe.service.ping.CleanupPing"> <bpmn:incoming>Flow_1bfs68o</bpmn:incoming> <bpmn:outgoing>Flow_0gubpgz</bpmn:outgoing> </bpmn:serviceTask> @@ -182,8 +186,8 @@ </bpmn:endEvent> <bpmn:exclusiveGateway id="Gateway_0bifi5h"> <bpmn:incoming>Flow_0iuuyo1</bpmn:incoming> - <bpmn:incoming>Flow_1qz7z39</bpmn:incoming> <bpmn:incoming>Flow_0ejw9k5</bpmn:incoming> + <bpmn:incoming>Flow_1qyomuj</bpmn:incoming> <bpmn:outgoing>Flow_1c15ef2</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:serviceTask id="SelectPingTargets" name="Select Targets" camunda:class="dev.dsf.bpe.service.ping.SelectPingTargets"> @@ -201,7 +205,6 @@ </bpmn:startEvent> <bpmn:sequenceFlow id="Flow_0j92st0" sourceRef="SelectPingTargets" targetRef="SubProcess" /> <bpmn:sequenceFlow id="Flow_1bfs68o" sourceRef="SubProcess" targetRef="Activity_0802w0b" /> - <bpmn:sequenceFlow id="Flow_1qz7z39" sourceRef="Activity_0nwtf8o" targetRef="Gateway_0bifi5h" /> <bpmn:sequenceFlow id="Flow_152nb9r" sourceRef="Gateway_0xw5i5v" targetRef="Activity_0nwtf8o" /> <bpmn:sequenceFlow id="Flow_0gubpgz" sourceRef="Activity_0802w0b" targetRef="SaveResults" /> <bpmn:sequenceFlow id="Flow_1du5wys" sourceRef="SaveResults" targetRef="EndEvent" /> @@ -215,16 +218,21 @@ <bpmn:outgoing>Flow_0fxlsv3</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_0e35w2m" sourceRef="StartPingMessageStartEvent" targetRef="Activity_1wdftvk" /> - <bpmn:boundaryEvent id="Event_159rcwi" name="Failed to create resource" attachedToRef="Activity_0nwtf8o"> - <bpmn:outgoing>Flow_0ql2dtr</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_1f41ql6" errorRef="Error_0tkfq65" camunda:errorMessageVariable="resourceUploadError" /> - </bpmn:boundaryEvent> - <bpmn:sequenceFlow id="Flow_0ql2dtr" sourceRef="Event_159rcwi" targetRef="Activity_1ddl5dm" /> <bpmn:sequenceFlow id="Flow_0ejw9k5" sourceRef="Activity_1ddl5dm" targetRef="Gateway_0bifi5h" /> <bpmn:serviceTask id="Activity_1ddl5dm" name="Log And Save Error" camunda:class="dev.dsf.bpe.service.ping.LogAndSaveUploadErrorPing"> - <bpmn:incoming>Flow_0ql2dtr</bpmn:incoming> + <bpmn:incoming>Flow_0z3dgxw</bpmn:incoming> <bpmn:outgoing>Flow_0ejw9k5</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:exclusiveGateway id="Gateway_1nb10cc" default="Flow_1qyomuj"> + <bpmn:incoming>Flow_1op4sei</bpmn:incoming> + <bpmn:outgoing>Flow_0z3dgxw</bpmn:outgoing> + <bpmn:outgoing>Flow_1qyomuj</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_1op4sei" sourceRef="Activity_0nwtf8o" targetRef="Gateway_1nb10cc" /> + <bpmn:sequenceFlow id="Flow_0z3dgxw" sourceRef="Gateway_1nb10cc" targetRef="Activity_1ddl5dm"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('resourceUploadError')}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_1qyomuj" sourceRef="Gateway_1nb10cc" targetRef="Gateway_0bifi5h" /> <bpmn:textAnnotation id="TextAnnotation_1ig0151"> <bpmn:text>Includes download speeds and errors of all pongs</bpmn:text> </bpmn:textAnnotation> @@ -253,6 +261,12 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:error id="Error_0tkfq65" name="resourceUploadError" errorCode="resourceUploadError" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> + <bpmndi:BPMNShape id="BPMNShape_0a51zrr" bpmnElement="Gateway_1nb10cc" isMarkerVisible="true"> + <dc:Bounds x="665" y="475" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0v585g9_di" bpmnElement="Activity_1ddl5dm"> + <dc:Bounds x="790" y="580" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> <dc:Bounds x="1040" y="180" width="1820" height="560" /> </bpmndi:BPMNShape> @@ -303,7 +317,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0djpma6" bpmnElement="Activity_0akr23c"> - <dc:Bounds x="2210" y="600" width="100" height="80" /> + <dc:Bounds x="2280" y="600" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> @@ -319,6 +333,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Activity_0p0eucz_di" bpmnElement="Activity_0p5edt9"> <dc:Bounds x="1520" y="520" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0de83s3_di" bpmnElement="Gateway_0de83s3" isMarkerVisible="true"> + <dc:Bounds x="2195" y="495" width="50" height="50" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> <dc:Bounds x="1270" y="220" width="250" height="70" /> <bpmndi:BPMNLabel /> @@ -331,12 +348,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="1980" y="622" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0968qvb" bpmnElement="Event_0i4slcz"> - <dc:Bounds x="2152" y="542" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2198" y="546" width="83" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_1hlvqjb" bpmnElement="Flow_10epxa2"> <di:waypoint x="1098" y="360" /> <di:waypoint x="1170" y="360" /> @@ -387,21 +398,12 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1990" y="520" /> <di:waypoint x="2070" y="520" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1omiu15" bpmnElement="Flow_1v37fff"> - <di:waypoint x="2170" y="520" /> - <di:waypoint x="2510" y="520" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1lmv30e" bpmnElement="Flow_0jcfur3"> - <di:waypoint x="2310" y="640" /> + <di:waypoint x="2380" y="640" /> <di:waypoint x="2410" y="640" /> <di:waypoint x="2410" y="520" /> <di:waypoint x="2510" y="520" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1figpr1" bpmnElement="Flow_10h6pqh"> - <di:waypoint x="2170" y="578" /> - <di:waypoint x="2170" y="640" /> - <di:waypoint x="2210" y="640" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0klalf8_di" bpmnElement="Flow_0klalf8"> <di:waypoint x="2610" y="520" /> <di:waypoint x="2710" y="520" /> @@ -424,6 +426,19 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1780" y="560" /> <di:waypoint x="1780" y="475" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1ncztgo_di" bpmnElement="Flow_1ncztgo"> + <di:waypoint x="2170" y="520" /> + <di:waypoint x="2195" y="520" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0qif01p_di" bpmnElement="Flow_0qif01p"> + <di:waypoint x="2220" y="545" /> + <di:waypoint x="2220" y="640" /> + <di:waypoint x="2280" y="640" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_18wxsor_di" bpmnElement="Flow_18wxsor"> + <di:waypoint x="2245" y="520" /> + <di:waypoint x="2510" y="520" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> <di:waypoint x="1252" y="320" /> <di:waypoint x="1276" y="290" /> @@ -470,9 +485,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="260" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0v585g9_di" bpmnElement="Activity_1ddl5dm"> - <dc:Bounds x="700" y="580" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> <dc:Bounds x="2990" y="239" width="160" height="49" /> <bpmndi:BPMNLabel /> @@ -493,12 +505,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="230" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_11osfov" bpmnElement="Event_159rcwi"> - <dc:Bounds x="612" y="522" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="652" y="516" width="76" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_09zmq8d" bpmnElement="Flow_0j92st0"> <di:waypoint x="1000" y="360" /> <di:waypoint x="1040" y="360" /> @@ -507,11 +513,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2860" y="370" /> <di:waypoint x="2920" y="370" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_1ttfs4u" bpmnElement="Flow_1qz7z39"> - <di:waypoint x="630" y="500" /> - <di:waypoint x="840" y="500" /> - <di:waypoint x="840" y="385" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0u9gpv1" bpmnElement="Flow_152nb9r"> <di:waypoint x="460" y="385" /> <di:waypoint x="460" y="500" /> @@ -541,14 +542,8 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="188" y="360" /> <di:waypoint x="260" y="360" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0ql2dtr_di" bpmnElement="Flow_0ql2dtr"> - <di:waypoint x="630" y="558" /> - <di:waypoint x="630" y="620" /> - <di:waypoint x="700" y="620" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0ejw9k5_di" bpmnElement="Flow_0ejw9k5"> - <di:waypoint x="800" y="620" /> - <di:waypoint x="840" y="620" /> + <di:waypoint x="840" y="580" /> <di:waypoint x="840" y="385" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> @@ -563,6 +558,20 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="3079" y="330" /> <di:waypoint x="3058" y="288" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1op4sei_di" bpmnElement="Flow_1op4sei"> + <di:waypoint x="630" y="500" /> + <di:waypoint x="665" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0z3dgxw_di" bpmnElement="Flow_0z3dgxw"> + <di:waypoint x="690" y="525" /> + <di:waypoint x="690" y="620" /> + <di:waypoint x="790" y="620" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1qyomuj_di" bpmnElement="Flow_1qyomuj"> + <di:waypoint x="715" y="500" /> + <di:waypoint x="840" y="500" /> + <di:waypoint x="840" y="385" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 9a8fd34c..15aa3067 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_127i10h" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.17.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.20.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bioc="http://bpmn.io/schema/bpmn/biocolor/1.0" xmlns:color="http://www.omg.org/spec/BPMN/non-normative/color/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_127i10h" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.35.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.20.0"> <bpmn:process id="dsfdev_pong" isExecutable="true" camunda:versionTag="#{version}" camunda:historyTimeToLive="180"> <bpmn:startEvent id="PingMessageStartEvent" name="ping"> <bpmn:outgoing>Flow_19b3cp4</bpmn:outgoing> @@ -12,7 +12,7 @@ </bpmn:exclusiveGateway> <bpmn:serviceTask id="Activity_095j2gg" name="Download Resource And Measure Speed" camunda:class="dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed"> <bpmn:incoming>Flow_10z0d4x</bpmn:incoming> - <bpmn:outgoing>Flow_0crmxc2</bpmn:outgoing> + <bpmn:outgoing>Flow_0vqsjzn</bpmn:outgoing> </bpmn:serviceTask> <bpmn:exclusiveGateway id="Gateway_1ggdr8l"> <bpmn:incoming>Flow_08gidyv</bpmn:incoming> @@ -20,7 +20,7 @@ <bpmn:incoming>Flow_0dp8f59</bpmn:incoming> <bpmn:outgoing>Flow_1o3n9u6</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sendTask id="Activity_005ywv2" name="Pong" camunda:class="dev.dsf.bpe.message.SendPong"> + <bpmn:sendTask id="Activity_005ywv2" name="Pong" camunda:class="dev.dsf.bpe.message.SendPongMessage"> <bpmn:extensionElements> <camunda:field name="instantiatesCanonical"> <camunda:string>http://dsf.dev/bpe/Process/ping|#{version}</camunda:string> @@ -64,27 +64,23 @@ <bpmn:outgoing>Flow_0x7t1ii</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:serviceTask id="Activity_1umihbr" name="Log and Save And Store Error" camunda:class="dev.dsf.bpe.service.pong.LogAndSaveAndStoreError"> - <bpmn:incoming>Flow_0uj7rm3</bpmn:incoming> + <bpmn:incoming>Flow_1w3kcjh</bpmn:incoming> <bpmn:outgoing>Flow_1jehvly</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0otptjn" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> + <bpmn:serviceTask id="Activity_0otptjn" name="Cleanup" camunda:class="dev.dsf.bpe.service.pong.CleanupPong"> <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> <bpmn:incoming>Flow_1lfcycx</bpmn:incoming> <bpmn:incoming>Flow_0h8flp6</bpmn:incoming> <bpmn:outgoing>Flow_0zib7wr</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_1m4wavi" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.GenerateAndStoreResource"> + <bpmn:serviceTask id="Activity_1m4wavi" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.pong.GenerateAndStoreResourcePong"> <bpmn:incoming>Flow_0x7t1ii</bpmn:incoming> - <bpmn:outgoing>Flow_1w09zt7</bpmn:outgoing> + <bpmn:outgoing>Flow_033lqly</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Activity_0xcqxjs" name="Estimate Cleanup Timer Duration" camunda:class="dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration"> - <bpmn:incoming>Flow_1w09zt7</bpmn:incoming> + <bpmn:incoming>Flow_17wqhp8</bpmn:incoming> <bpmn:outgoing>Flow_0gvrnxd</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:boundaryEvent id="Event_0olr5yw" attachedToRef="Activity_095j2gg"> - <bpmn:outgoing>Flow_0uj7rm3</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0h8zmzk" errorRef="Error_1jmenbm" /> - </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_10z0d4x" sourceRef="Gateway_1jwjxzn" targetRef="Activity_095j2gg" /> <bpmn:sequenceFlow id="Flow_08gidyv" sourceRef="Gateway_1jwjxzn" targetRef="Gateway_1ggdr8l"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> @@ -100,11 +96,8 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${downloadResourceSizeBytes < 0}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_0rj915n" sourceRef="Gateway_1l5dkpz" targetRef="Event_1xvd4tr" /> - <bpmn:sequenceFlow id="Flow_17x98wg" sourceRef="Gateway_1l5dkpz" targetRef="Event_0o4l2t4" /> <bpmn:sequenceFlow id="Flow_1jehvly" sourceRef="Activity_1umihbr" targetRef="Gateway_0fvmtve" /> <bpmn:sequenceFlow id="Flow_0x7t1ii" sourceRef="Gateway_0fvmtve" targetRef="Activity_1m4wavi" /> - <bpmn:sequenceFlow id="Flow_0uj7rm3" sourceRef="Event_0olr5yw" targetRef="Activity_1umihbr" /> - <bpmn:sequenceFlow id="Flow_1w09zt7" sourceRef="Activity_1m4wavi" targetRef="Activity_0xcqxjs" /> <bpmn:serviceTask id="Activity_1wdftvk" name="Set Download Resource Size" camunda:class="dev.dsf.bpe.service.SetDownloadResourceSize"> <bpmn:incoming>Flow_1j5lf0u</bpmn:incoming> <bpmn:outgoing>Flow_1oo1n55</bpmn:outgoing> @@ -132,9 +125,8 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1eh8lho" sourceRef="Activity_1gd1tfz" targetRef="Gateway_1wktaap" /> <bpmn:sequenceFlow id="Flow_1lfcycx" sourceRef="Gateway_1wktaap" targetRef="Activity_0otptjn" /> - <bpmn:sequenceFlow id="Flow_0crmxc2" sourceRef="Activity_095j2gg" targetRef="Activity_0i998dm" /> <bpmn:serviceTask id="Activity_0i998dm" name="Store Download Speed" camunda:class="dev.dsf.bpe.service.pong.StoreDownloadSpeed"> - <bpmn:incoming>Flow_0crmxc2</bpmn:incoming> + <bpmn:incoming>Flow_0pp3r2w</bpmn:incoming> <bpmn:outgoing>Flow_0yujsot</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_0yujsot" sourceRef="Activity_0i998dm" targetRef="Gateway_0fvmtve" /> @@ -153,16 +145,6 @@ <bpmn:outgoing>Flow_1j5lf0u</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1j5lf0u" sourceRef="Activity_02rqshk" targetRef="Activity_1wdftvk" /> - <bpmn:boundaryEvent id="Event_0c5a0v4" name="Failed to create resource" attachedToRef="Activity_1m4wavi"> - <bpmn:outgoing>Flow_0mgrru4</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0rltnl2" errorRef="Error_0y0cd8c" camunda:errorMessageVariable="resourceUploadError" /> - </bpmn:boundaryEvent> - <bpmn:serviceTask id="Activity_1kb1v81" name="Log And Save Error" camunda:class="dev.dsf.bpe.service.pong.LogAndSaveUploadErrorPong"> - <bpmn:incoming>Flow_0mgrru4</bpmn:incoming> - <bpmn:outgoing>Flow_0dp8f59</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0mgrru4" sourceRef="Event_0c5a0v4" targetRef="Activity_1kb1v81" /> - <bpmn:sequenceFlow id="Flow_0dp8f59" sourceRef="Activity_1kb1v81" targetRef="Gateway_1ggdr8l" /> <bpmn:serviceTask id="Activity_0n0we3y" name="Select Pong Target" camunda:class="dev.dsf.bpe.service.pong.SelectPongTarget"> <bpmn:incoming>Flow_1fzloso</bpmn:incoming> <bpmn:outgoing>Flow_1gap0hi</bpmn:outgoing> @@ -177,6 +159,32 @@ <bpmn:sequenceFlow id="Flow_0qxt5zo" sourceRef="Event_1jkcqo6" targetRef="Event_11q3y8a" /> <bpmn:sequenceFlow id="Flow_1fzloso" sourceRef="Activity_13ypt7i" targetRef="Activity_0n0we3y" /> <bpmn:sequenceFlow id="Flow_1gap0hi" sourceRef="Activity_0n0we3y" targetRef="Gateway_1jwjxzn" /> + <bpmn:exclusiveGateway id="Gateway_0ynhobb" default="Flow_0pp3r2w"> + <bpmn:incoming>Flow_0vqsjzn</bpmn:incoming> + <bpmn:outgoing>Flow_0pp3r2w</bpmn:outgoing> + <bpmn:outgoing>Flow_1w3kcjh</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_0vqsjzn" sourceRef="Activity_095j2gg" targetRef="Gateway_0ynhobb" /> + <bpmn:sequenceFlow id="Flow_0pp3r2w" sourceRef="Gateway_0ynhobb" targetRef="Activity_0i998dm" /> + <bpmn:sequenceFlow id="Flow_1w3kcjh" sourceRef="Gateway_0ynhobb" targetRef="Activity_1umihbr"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('resourceDownloadError')}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_17x98wg" sourceRef="Gateway_1l5dkpz" targetRef="Event_0o4l2t4" /> + <bpmn:sequenceFlow id="Flow_033lqly" sourceRef="Activity_1m4wavi" targetRef="Gateway_06066hd" /> + <bpmn:exclusiveGateway id="Gateway_06066hd" default="Flow_17wqhp8"> + <bpmn:incoming>Flow_033lqly</bpmn:incoming> + <bpmn:outgoing>Flow_17wqhp8</bpmn:outgoing> + <bpmn:outgoing>Flow_15xatzp</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_17wqhp8" sourceRef="Gateway_06066hd" targetRef="Activity_0xcqxjs" /> + <bpmn:sequenceFlow id="Flow_15xatzp" sourceRef="Gateway_06066hd" targetRef="Activity_1kb1v81"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('resourceUploadError')}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:serviceTask id="Activity_1kb1v81" name="Log And Save Error" camunda:class="dev.dsf.bpe.service.pong.LogAndSaveUploadErrorPong"> + <bpmn:incoming>Flow_15xatzp</bpmn:incoming> + <bpmn:outgoing>Flow_0dp8f59</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_0dp8f59" sourceRef="Activity_1kb1v81" targetRef="Gateway_1ggdr8l" /> <bpmn:textAnnotation id="TextAnnotation_02e4h2c"> <bpmn:text>Log = logger Save = save as execution variable @@ -256,9 +264,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Event_0o4l2t4_di" bpmnElement="Event_0o4l2t4"> <dc:Bounds x="2472" y="482" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> - <dc:Bounds x="1285" y="435" width="50" height="50" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1imd3tw_di" bpmnElement="Activity_1umihbr"> <dc:Bounds x="1170" y="540" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -290,10 +295,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2590" y="370" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> - <dc:Bounds x="1140" y="420" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0e5vsn7_di" bpmnElement="Activity_1wt8irk"> <dc:Bounds x="2590" y="460" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -306,10 +307,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="260" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0pjdm6v_di" bpmnElement="Activity_1kb1v81"> - <dc:Bounds x="1590" y="600" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_022yft3" bpmnElement="Activity_0n0we3y"> <dc:Bounds x="750" y="270" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -317,6 +314,27 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="BPMNShape_0nbrkyz" bpmnElement="Event_11q3y8a"> <dc:Bounds x="832" y="595" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> + <dc:Bounds x="1325" y="435" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> + <dc:Bounds x="1190" y="420" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0ynhobb_di" bpmnElement="Gateway_0ynhobb" isMarkerVisible="true"> + <dc:Bounds x="1105" y="435" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0pjdm6v_di" bpmnElement="Activity_1kb1v81"> + <dc:Bounds x="1660" y="600" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_06066hd_di" bpmnElement="Gateway_06066hd" isMarkerVisible="true"> + <dc:Bounds x="1565" y="435" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> + <di:waypoint x="1790" y="459" /> + <di:waypoint x="1768" y="486" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> <dc:Bounds x="360" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> @@ -333,10 +351,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2940" y="439" width="200" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> - <dc:Bounds x="1610" y="520" width="275" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> <dc:Bounds x="1370" y="544" width="170" height="40" /> <bpmndi:BPMNLabel /> @@ -351,18 +365,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="746" y="373" width="87" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0xroqjg_di" bpmnElement="Event_0c5a0v4"> - <dc:Bounds x="1502" y="482" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1542" y="476" width="76" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_14ee8kb" bpmnElement="Event_0olr5yw"> - <dc:Bounds x="1062" y="482" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="770" y="516" width="83" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Flow_10z0d4x_di" bpmnElement="Flow_10z0d4x"> <di:waypoint x="930" y="335" /> <di:waypoint x="930" y="460" /> @@ -410,22 +412,13 @@ Store = store on DSF FHIR server either as separate resource or output parameter </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> <di:waypoint x="1270" y="580" /> - <di:waypoint x="1310" y="580" /> - <di:waypoint x="1310" y="485" /> + <di:waypoint x="1350" y="580" /> + <di:waypoint x="1350" y="485" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0x7t1ii_di" bpmnElement="Flow_0x7t1ii"> - <di:waypoint x="1335" y="460" /> + <di:waypoint x="1375" y="460" /> <di:waypoint x="1420" y="460" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0uj7rm3_di" bpmnElement="Flow_0uj7rm3"> - <di:waypoint x="1080" y="518" /> - <di:waypoint x="1080" y="580" /> - <di:waypoint x="1170" y="580" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1w09zt7_di" bpmnElement="Flow_1w09zt7"> - <di:waypoint x="1520" y="460" /> - <di:waypoint x="1740" y="460" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1oo1n55_di" bpmnElement="Flow_1oo1n55"> <di:waypoint x="530" y="310" /> <di:waypoint x="590" y="310" /> @@ -454,13 +447,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2790" y="385" /> <di:waypoint x="2790" y="350" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0crmxc2_di" bpmnElement="Flow_0crmxc2"> - <di:waypoint x="1080" y="460" /> - <di:waypoint x="1140" y="460" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0yujsot_di" bpmnElement="Flow_0yujsot"> - <di:waypoint x="1240" y="460" /> - <di:waypoint x="1285" y="460" /> + <di:waypoint x="1290" y="460" /> + <di:waypoint x="1325" y="460" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1n4fb8d_di" bpmnElement="Flow_1n4fb8d"> <di:waypoint x="2690" y="500" /> @@ -475,13 +464,8 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="360" y="310" /> <di:waypoint x="430" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0mgrru4_di" bpmnElement="Flow_0mgrru4"> - <di:waypoint x="1520" y="518" /> - <di:waypoint x="1520" y="640" /> - <di:waypoint x="1590" y="640" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0dp8f59_di" bpmnElement="Flow_0dp8f59"> - <di:waypoint x="1690" y="640" /> + <di:waypoint x="1760" y="640" /> <di:waypoint x="1920" y="640" /> <di:waypoint x="1920" y="335" /> </bpmndi:BPMNEdge> @@ -513,9 +497,35 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1458" y="544" /> <di:waypoint x="1464" y="500" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> - <di:waypoint x="1740" y="491" /> - <di:waypoint x="1694" y="520" /> + <bpmndi:BPMNEdge id="Flow_0vqsjzn_di" bpmnElement="Flow_0vqsjzn"> + <di:waypoint x="1080" y="460" /> + <di:waypoint x="1105" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0pp3r2w_di" bpmnElement="Flow_0pp3r2w"> + <di:waypoint x="1155" y="460" /> + <di:waypoint x="1190" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1w3kcjh_di" bpmnElement="Flow_1w3kcjh"> + <di:waypoint x="1130" y="485" /> + <di:waypoint x="1130" y="580" /> + <di:waypoint x="1170" y="580" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> + <dc:Bounds x="1630" y="520" width="275" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_033lqly_di" bpmnElement="Flow_033lqly"> + <di:waypoint x="1520" y="460" /> + <di:waypoint x="1565" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_17wqhp8_di" bpmnElement="Flow_17wqhp8"> + <di:waypoint x="1615" y="460" /> + <di:waypoint x="1740" y="460" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_15xatzp_di" bpmnElement="Flow_15xatzp"> + <di:waypoint x="1590" y="485" /> + <di:waypoint x="1590" y="640" /> + <di:waypoint x="1660" y="640" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml index 3b3f55ed..be51c7f7 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml @@ -132,7 +132,7 @@ <element id="Extension.extension:potential-fix"> <path value="Extension.extension"/> <sliceName value="potential-fix"/> - <min value="1"/> + <min value="0"/> <max value="1"/> </element> <element id="Extension.extension:potential-fix.url"> diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 9bdd0d5c..14b550b2 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -12,7 +12,6 @@ import java.util.Arrays; import java.util.Date; import java.util.List; -import java.util.Random; import java.util.TimeZone; import java.util.UUID; @@ -218,8 +217,8 @@ private List<ProcessError> processErrors(int amount) for (int i = 0; i < amount; i++) { errors.add(new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, UUID.randomUUID().toString(), - ConstantsPing.POTENTIAL_FIX_URL_DUMMY, UUID.randomUUID().toString())); + ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, UUID.randomUUID().toString(), null, + UUID.randomUUID().toString())); } return errors; } From 1dd8fe4447a8c55a3756e20c44679d71a4636ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 22 Jul 2025 14:52:00 +0200 Subject: [PATCH 296/382] Made static utility classes final with private constructor to limit usage to static methods and removed unused methods in PingStatusGenerator --- .../bpe/util/task/NetworkSpeedCalculator.java | 6 +- .../bpe/util/task/SendTaskErrorConverter.java | 7 +- .../bpe/util/task/input/ErrorInputParser.java | 6 +- .../DownloadResourceReferenceGenerator.java | 6 +- .../DownloadResourceSizeGenerator.java | 6 +- .../generator/DownloadedBytesGenerator.java | 6 +- .../DownloadedDurationMillisGenerator.java | 6 +- .../ErrorInputComponentGenerator.java | 6 +- .../NetworkSpeedMetricGenerator.java | 6 +- .../ErrorOutputComponentGenerator.java | 6 +- .../output/generator/PingStatusGenerator.java | 312 +----------------- 11 files changed, 53 insertions(+), 320 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index fe8389be..7e9f047a 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -5,8 +5,12 @@ import dev.dsf.bpe.ConstantsPing; -public class NetworkSpeedCalculator +public final class NetworkSpeedCalculator { + private NetworkSpeedCalculator() + { + } + public static BigDecimal calculate(int bytes, long duration, String unit) { if (bytes == 0) diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index 6a99e717..927a7fbb 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -16,8 +16,13 @@ import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.Response; -public class SendTaskErrorConverter +public final class SendTaskErrorConverter { + + private SendTaskErrorConverter() + { + } + private static final Map<Class<? extends Throwable>, BiFunction<? extends Throwable, String, ProcessError>> EXPECTED_CAUSES_WITH_CONVERTERS = Map .of(SSLHandshakeException.class, convertSSLHandshakeException(), ConnectTimeoutException.class, convertConnectTimeoutException(), UnknownHostException.class, convertUnknownHostException(), diff --git a/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java b/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java index fa356928..9822c482 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java @@ -7,8 +7,12 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; -public class ErrorInputParser +public final class ErrorInputParser { + private ErrorInputParser() + { + } + public static List<ProcessError> parseInputs(Task task) { List<Task.ParameterComponent> inputs = task.getInput().stream() diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java index 0857e824..b3d3aabf 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java @@ -6,8 +6,12 @@ import dev.dsf.bpe.ConstantsPing; -public class DownloadResourceReferenceGenerator +public final class DownloadResourceReferenceGenerator { + private DownloadResourceReferenceGenerator() + { + } + public static Task.ParameterComponent create(String uri) { Reference reference = new Reference(uri); diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java index 8071fc20..d631baa7 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java @@ -6,8 +6,12 @@ import dev.dsf.bpe.ConstantsPing; -public class DownloadResourceSizeGenerator +public final class DownloadResourceSizeGenerator { + private DownloadResourceSizeGenerator() + { + } + public static Task.ParameterComponent create(int sizeBytes) { Task.ParameterComponent param = new Task.ParameterComponent(); diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java index e75d0705..ce00aeee 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java @@ -5,8 +5,12 @@ import dev.dsf.bpe.ConstantsPing; -public class DownloadedBytesGenerator +public final class DownloadedBytesGenerator { + private DownloadedBytesGenerator() + { + } + public static Task.ParameterComponent create(int bytes) { Task.ParameterComponent param = new Task.ParameterComponent(); diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java index 313155c3..4d8acfbc 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java @@ -5,8 +5,12 @@ import dev.dsf.bpe.ConstantsPing; -public class DownloadedDurationMillisGenerator +public final class DownloadedDurationMillisGenerator { + private DownloadedDurationMillisGenerator() + { + } + public static Task.ParameterComponent create(long durationMillis) { Task.ParameterComponent param = new Task.ParameterComponent(); diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java index 688ade1e..67e78ca3 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java @@ -12,8 +12,12 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; -public class ErrorInputComponentGenerator +public final class ErrorInputComponentGenerator { + private ErrorInputComponentGenerator() + { + } + public static List<Task.ParameterComponent> create(List<ProcessError> errors) { if (errors == null || errors.isEmpty()) diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java index b1d33761..c8859f54 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java @@ -7,8 +7,12 @@ import dev.dsf.bpe.ConstantsPing; -public class NetworkSpeedMetricGenerator +public final class NetworkSpeedMetricGenerator { + private NetworkSpeedMetricGenerator() + { + } + public static Task.ParameterComponent createDownloadedDurationMillis(long duration) { Task.ParameterComponent downloadedDuration = new Task.ParameterComponent(); diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java index f5b0e915..ed8c61bf 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java @@ -12,8 +12,12 @@ import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; -public class ErrorOutputComponentGenerator +public final class ErrorOutputComponentGenerator { + private ErrorOutputComponentGenerator() + { + } + public static List<Task.TaskOutputComponent> create(List<ProcessError> errors) { if (errors == null || errors.isEmpty()) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index dae52b33..4f00dff4 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -23,31 +23,10 @@ import dev.dsf.bpe.v1.constants.NamingSystems.OrganizationIdentifier; import dev.dsf.bpe.v1.variables.Target; -public class PingStatusGenerator +public final class PingStatusGenerator { - public static Task updatePingStatusOutput(Task task, String correlationKey, List<ProcessError> errors) + private PingStatusGenerator() { - List<TaskOutputComponent> outputs = filterByCorrelationKey( - getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), - correlationKey); - - if (outputs.isEmpty()) - { - task.addOutput(updateStatusOutput(new TaskOutputComponent(), errors)); - } - else - { - if (outputs.size() == 1) - { - updateStatusOutput(outputs.get(0), errors); - } - else - { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() - + " with correlation key " + correlationKey); - } - } - return task; } public static Task updatePongStatusOutput(Task task, List<ProcessError> errors) @@ -93,44 +72,6 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent output, return output; } - public static Task updatePingStatusOutput(Task task, String correlationKey, String statusCode) - { - List<Task.TaskOutputComponent> pingStatusOutputs = filterByCorrelationKey( - getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), - correlationKey); - if (pingStatusOutputs.isEmpty()) - { - task.addOutput(updatePingStatusOutput(new TaskOutputComponent(), statusCode)); - } - else - { - if (pingStatusOutputs.size() == 1) - { - updatePingStatusOutput(pingStatusOutputs.get(0), statusCode); - } - else - { - throw new RuntimeException("There is more than one ping status output for task " + task.getId() - + " with correlation key " + correlationKey); - } - } - - return task; - } - - public static TaskOutputComponent updatePingStatusOutput(TaskOutputComponent outputComponent, String statusCode) - { - if (hasStatusCodeSet(outputComponent)) - { - updateStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode); - } - else - { - addStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode); - } - - return outputComponent; - } public static Task updatePongStatusOutput(Task task, String statusCode) { @@ -169,30 +110,6 @@ public static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent out return outputComponent; } - public static Task updatePingStatusOutput(Task task, Target target) - { - List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( - getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), - target.getCorrelationKey()); - if (outputs.isEmpty()) - { - task.addOutput(updateStatusOutput(new TaskOutputComponent(), target)); - } - else - { - if (outputs.size() == 1) - { - updateStatusOutput(outputs.get(0), target); - } - else - { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() - + " with correlation key " + target.getCorrelationKey()); - } - } - return task; - } - public static Task updatePongStatusOutput(Task task, Target target) { List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, @@ -229,104 +146,6 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputC return outputComponent; } - public static Task updatePingStatusOutput(Task task, String correlationKey, BigDecimal downloadSpeed, - BigDecimal uploadSpeed, String statusCode) - { - List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( - getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), - correlationKey); - if (outputs.isEmpty()) - { - task.addOutput(updateStatusOutput(new TaskOutputComponent(), downloadSpeed, uploadSpeed, statusCode)); - } - else - { - if (outputs.size() == 1) - { - updateStatusOutput(outputs.get(0), downloadSpeed, uploadSpeed, statusCode); - } - else - { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() - + " with correlation key " + correlationKey); - } - } - return task; - } - - public static Task updatePongStatusOutput(Task task, BigDecimal downloadSpeed, BigDecimal uploadSpeed, - String statusCode) - { - List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); - if (outputs.isEmpty()) - { - task.addOutput(updateStatusOutput(new TaskOutputComponent(), downloadSpeed, uploadSpeed, statusCode)); - } - else - { - if (outputs.size() == 1) - { - updateStatusOutput(outputs.get(0), downloadSpeed, uploadSpeed, statusCode); - } - else - { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId()); - } - } - - return task; - } - - public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, - BigDecimal uploadSpeed, String networkSpeedUnit) - { - if (hasDownloadSpeedSet(outputComponent)) - { - updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); - } - else - { - addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); - } - - if (hasUploadSpeedSet(outputComponent)) - { - updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); - } - else - { - addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); - } - - return outputComponent; - } - - public static Task updatePingStatusOutputDownloadSpeed(Task task, String correlationKey, BigDecimal downloadSpeed, - String networkSpeedUnit) - { - List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( - getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), - correlationKey); - if (outputs.isEmpty()) - { - task.addOutput(updateStatusOutputDownloadSpeed(new TaskOutputComponent(), downloadSpeed, networkSpeedUnit)); - } - else - { - if (outputs.size() == 1) - { - updateStatusOutputDownloadSpeed(outputs.get(0), downloadSpeed, networkSpeedUnit); - } - else - { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() - + " with correlation key " + correlationKey); - } - } - return task; - } - public static Task updatePongStatusOutputDownloadSpeed(Task task, BigDecimal downloadSpeed, String networkSpeedUnit) { List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, @@ -365,32 +184,6 @@ public static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComp return outputComponent; } - public static Task updatePingStatusOutputUploadSpeed(Task task, String correlationKey, BigDecimal uploadSpeed, - String networkSpeedUnit) - { - List<Task.TaskOutputComponent> outputs = filterByCorrelationKey( - getOutputsByExtensionUrlAndCodes(task, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS), - correlationKey); - if (outputs.isEmpty()) - { - task.addOutput(updateStatusOutputUploadSpeed(new TaskOutputComponent(), uploadSpeed, networkSpeedUnit)); - } - else - { - if (outputs.size() == 1) - { - updateStatusOutputUploadSpeed(outputs.get(0), uploadSpeed, networkSpeedUnit); - } - else - { - throw new RuntimeException("There is more than one ping/pong status output for task " + task.getId() - + " with correlation key " + correlationKey); - } - } - - return task; - } - public static Task updatePongStatusOutputUploadSpeed(Task task, BigDecimal uploadSpeed, String networkSpeedUnit) { List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, @@ -452,11 +245,6 @@ private static boolean hasStatusCodeSet(TaskOutputComponent outputComponent) .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); } - private static boolean hasNetworkSpeedSet(TaskOutputComponent outputComponent) - { - return hasDownloadSpeedSet(outputComponent) && hasUploadSpeedSet(outputComponent); - } - private static boolean hasDownloadSpeedSet(TaskOutputComponent outputComponent) { Extension extension = getOrCreatePingStatusExtension(outputComponent); @@ -465,19 +253,6 @@ private static boolean hasDownloadSpeedSet(TaskOutputComponent outputComponent) return downloadSpeedExtension != null; } - private static boolean hasUploadSpeedSet(TaskOutputComponent outputComponent) - { - Extension extension = getOrCreatePingStatusExtension(outputComponent); - Extension uploadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); - - return uploadSpeedExtension != null; - } - - public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode) - { - return createPingStatusOutput(target, statusCode, null); - } - public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) { @@ -503,12 +278,6 @@ public static TaskOutputComponent createPongStatusOutput(Target target, String s return createPongStatusOutput(target, statusCode, null); } - public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, BigDecimal downloadSpeed, - BigDecimal uploadSpeed, String unit) - { - return createPongStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); - } - public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, List<ProcessError> errors) { @@ -516,13 +285,6 @@ public static TaskOutputComponent createPongStatusOutput(Target target, String s null, null); } - public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, - List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) - { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errors, - downloadSpeed, uploadSpeed, unit); - } - private static TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) { @@ -693,14 +455,6 @@ private static TaskOutputComponent addNetworkSpeed(TaskOutputComponent outputCom return outputComponent; } - private static TaskOutputComponent updateNetworkSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, - BigDecimal uploadSpeed, String unit) - { - updateDownloadSpeed(outputComponent, downloadSpeed, unit); - updateUploadSpeed(outputComponent, uploadSpeed, unit); - return outputComponent; - } - private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, String unit) { @@ -829,23 +583,6 @@ private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outp } } - private static Optional<Extension> getPingStatusExtension(Task task) - { - Optional<TaskOutputComponent> optPingStatusOutput = task.getOutput().stream() - .filter(outputComponent -> outputComponent.getExtension().stream() - .anyMatch(extension -> ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS - .equals(extension.getUrl()))) - .findFirst(); - if (optPingStatusOutput.isPresent()) - { - return getPingStatusExtension(optPingStatusOutput.get()); - } - else - { - return Optional.empty(); - } - } - private static Optional<Extension> getPingStatusExtension(TaskOutputComponent outputComponent) { List<Extension> pingStatusExtensions = outputComponent.getExtension().stream() @@ -883,51 +620,6 @@ private static List<Task.TaskOutputComponent> getOutputsByExtensionUrlAndCodes(T .collect(Collectors.toCollection(ArrayList::new)); } - private static List<Task.TaskOutputComponent> filterByCorrelationKey(List<TaskOutputComponent> outputs, - String correlationKey) - { - return outputs.stream().filter(outputComponent -> - { - List<Extension> outputExtensions = outputComponent.getExtension(); - if (outputExtensions.isEmpty()) - return false; - List<Extension> pingStatusExtensions = outputExtensions.stream() - .filter(extension -> ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS - .equals(extension.getUrl())) - .toList(); - if (pingStatusExtensions.isEmpty()) - return false; - List<Extension> extensionsMatchingCorrelationKey = pingStatusExtensions.stream() - .filter(extension -> extension.getExtension().stream().anyMatch( - extension1 -> ConstantsPing.EXTENSION_URL_CORRELATION_KEY.equals(extension1.getUrl()) - && correlationKey.equals(((StringType) extension1.getValue()).getValue()))) - .toList(); - if (extensionsMatchingCorrelationKey.isEmpty()) - return false; - if (extensionsMatchingCorrelationKey.size() == 1) - { - return true; - } - else - { - throw new RuntimeException( - "Only one Task.output.extension.extension with correlationKey is allowed but found " - + extensionsMatchingCorrelationKey.size()); - } - }).collect(Collectors.toCollection(ArrayList::new)); - } - - private static void sortStatusOutputExtensions(Task task) - { - List<TaskOutputComponent> outputs = task.getOutput().stream() - .filter(outputComponent -> ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS - .equals(outputComponent.getType().getCodingFirstRep().getCode()) - || ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS - .equals(outputComponent.getType().getCodingFirstRep().getCode())) - .toList(); - outputs.forEach(PingStatusGenerator::sortStatusOutputExtensions); - } - private static void sortStatusOutputExtensions(TaskOutputComponent outputComponent) { Optional<Extension> optPingStatusExtension = getPingStatusExtension(outputComponent); From e78cdbcabcc5f400b1b4fcdb5e3e02638398811c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 24 Jul 2025 16:32:52 +0200 Subject: [PATCH 297/382] Fixed NullPointerException and added test case for fix --- src/main/java/dev/dsf/bpe/ProcessError.java | 31 ++-- .../dev/dsf/library/ProcessErrorTest.java | 146 ++++++++++++++++++ 2 files changed, 167 insertions(+), 10 deletions(-) create mode 100644 src/test/java/dev/dsf/library/ProcessErrorTest.java diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 2f2d5458..5d5b1ed8 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -53,16 +53,27 @@ public static Extension toExtension(ProcessError error) public static ProcessError toError(Extension extension) { - String process = ((Coding) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_PROCESS).getValue()) - .getCode(); - String processStep = ((Coding) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP).getValue()) - .getCode(); - String action = ((StringType) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_ACTION).getValue()) - .getValue(); - String potentialFixUrl = ((UrlType) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) - .getValue()).getValue(); - String message = ((StringType) extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_MESSAGE).getValue()) - .getValue(); + Extension processExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_PROCESS); + Objects.requireNonNull(processExtension); + String process = ((Coding) processExtension.getValue()).getCode(); + + + Extension processStepExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP); + Objects.requireNonNull(processStepExtension); + String processStep = ((Coding) processStepExtension.getValue()).getCode(); + + Extension actionExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_ACTION); + Objects.requireNonNull(actionExtension); + String action = ((StringType) actionExtension.getValue()).getValue(); + + Extension potentalFixUrlExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX); + String potentialFixUrl = Objects.nonNull(potentalFixUrlExtension) + ? ((UrlType) potentalFixUrlExtension.getValue()).getValue() + : null; + + Extension messageExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_MESSAGE); + Objects.requireNonNull(messageExtension); + String message = ((StringType) messageExtension.getValue()).getValue(); return new ProcessError(process, processStep, action, potentialFixUrl, message); } diff --git a/src/test/java/dev/dsf/library/ProcessErrorTest.java b/src/test/java/dev/dsf/library/ProcessErrorTest.java new file mode 100644 index 00000000..dae53ae8 --- /dev/null +++ b/src/test/java/dev/dsf/library/ProcessErrorTest.java @@ -0,0 +1,146 @@ +package dev.dsf.library; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; + +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.UrlType; +import org.junit.Test; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; + +public class ProcessErrorTest +{ + private static final String testString = "foo"; + + @Test + public void ExtensionToErrorTest() + { + ProcessError expected = new ProcessError(testString, testString, testString, testString, testString); + assertEquals(expected, ProcessError.toError(getExtensionFull())); + } + + @Test + public void ExtensionWithoutFixUrlToErrorTest() + { + ProcessError expected = new ProcessError(testString, testString, testString, null, testString); + assertEquals(expected, ProcessError.toError(getExtensionMissingFixUrl())); + } + + @Test + public void ExtensionWithoutProcessToErrorTest() + { + assertThrows(NullPointerException.class, () -> ProcessError.toError(getExtensionMissingProcess())); + } + + @Test + public void ExtensionWithoutProcessStepToErrorTest() + { + assertThrows(NullPointerException.class, () -> ProcessError.toError(getExtensionMissingProcessStep())); + } + + @Test + public void ExtensionWithoutActionToErrorTest() + { + assertThrows(NullPointerException.class, () -> ProcessError.toError(getExtensionMissingAction())); + } + + @Test + public void ExtensionWithoutMessageToErrorTest() + { + assertThrows(NullPointerException.class, () -> ProcessError.toError(getExtensionMissingMessage())); + } + + + private Extension getExtensionFull() + { + Extension extension = new Extension(); + extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); + + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, testString, null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, testString, null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); + + return extension; + } + + private Extension getExtensionMissingFixUrl() + { + Extension extension = new Extension(); + extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); + + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, testString, null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, testString, null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); + + return extension; + } + + private Extension getExtensionMissingProcess() + { + Extension extension = new Extension(); + extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); + + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, testString, null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); + + return extension; + } + + private Extension getExtensionMissingProcessStep() + { + Extension extension = new Extension(); + extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); + + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, testString, null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); + + return extension; + } + + private Extension getExtensionMissingAction() + { + Extension extension = new Extension(); + extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); + + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, testString, null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, testString, null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); + + return extension; + } + + private Extension getExtensionMissingMessage() + { + Extension extension = new Extension(); + extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); + + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, testString, null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) + .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, testString, null)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); + + return extension; + } +} From 0a56451ed57cd72c2e3f1d02ba762b2588d815b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 24 Jul 2025 16:37:04 +0200 Subject: [PATCH 298/382] Changed order of extensions. Correlation key should be last because it is the least relevant to the user --- .../task/output/generator/PingStatusGenerator.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 4f00dff4..c1589fb3 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -355,12 +355,12 @@ private static TaskOutputComponent addTarget(TaskOutputComponent outputComponent { Extension extension = getOrCreatePingStatusExtension(outputComponent); - extension.addExtension(ConstantsPing.EXTENSION_URL_CORRELATION_KEY, - new StringType(target.getCorrelationKey())); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER) .setValue(OrganizationIdentifier.withValue(target.getOrganizationIdentifierValue())); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER) .setValue(EndpointIdentifier.withValue(target.getEndpointIdentifierValue())); + extension.addExtension(ConstantsPing.EXTENSION_URL_CORRELATION_KEY, + new StringType(target.getCorrelationKey())); sortStatusOutputExtensions(outputComponent); } @@ -639,11 +639,6 @@ private static void sortStatusOutputExtensions(TaskOutputComponent outputCompone Optional<Extension> endpointIdentifierExtension = extensions.stream() .filter(extension -> ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER.equals(extension.getUrl())) .findFirst(); - if (correlationKeyExtension.isPresent()) - { - extensions.remove(correlationKeyExtension.get()); - sortedExtensions.add(correlationKeyExtension.get()); - } if (organizationIdentifierExtension.isPresent()) { extensions.remove(organizationIdentifierExtension.get()); @@ -654,6 +649,11 @@ private static void sortStatusOutputExtensions(TaskOutputComponent outputCompone extensions.remove(endpointIdentifierExtension.get()); sortedExtensions.add(endpointIdentifierExtension.get()); } + if (correlationKeyExtension.isPresent()) + { + extensions.remove(correlationKeyExtension.get()); + sortedExtensions.add(correlationKeyExtension.get()); + } Optional<Extension> downloadSpeedExtension = extensions.stream() .filter(extension -> ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED.equals(extension.getUrl())) From 06226c55e200e533625b7da77d4901b81bfaf51a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 24 Jul 2025 18:10:08 +0200 Subject: [PATCH 299/382] Introduced RandomByteInputStream to replace creating an array of random bytes. This is to prepare for resource streaming changes coming with DSF 2.0 which allow binary resources to be streamed directly into the db. This means no arrays need to be allocated -> no running out of heap size -> no artificial limit on ping pong binary resource generation --- .../bpe/service/GenerateAndStoreResource.java | 41 ++--- .../bpe/service/RandomByteInputStream.java | 149 ++++++++++++++++ .../library/RandomByteInputStreamTest.java | 162 ++++++++++++++++++ 3 files changed, 326 insertions(+), 26 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/service/RandomByteInputStream.java create mode 100644 src/test/java/dev/dsf/library/RandomByteInputStreamTest.java diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index f8f26d31..854c52ac 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -1,8 +1,5 @@ package dev.dsf.bpe.service; -import java.io.ByteArrayInputStream; -import java.util.Random; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.IdType; @@ -33,10 +30,20 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) PingPongLogger logger = new PingPongLogger(GenerateAndStoreResource.class, variables.getStartTask()); logger.debug("Generating resource..."); int downloadResourceSizeBytes = getDownloadResourceSize(variables); - - byte[] resourceContent = generateRandomBinaryContent(downloadResourceSizeBytes, logger); + RandomByteInputStream resourceContent; + if (downloadResourceSizeBytes > maxUploadSizeBytes) + { + logger.info( + "Requested resource size of {} bytes exceeds configured maximum upload size of {} bytes. Trimmed to maximum upload size.", + downloadResourceSizeBytes, maxUploadSizeBytes); + resourceContent = new RandomByteInputStream(maxUploadSizeBytes / 3 * 2); + } + else + { + resourceContent = new RandomByteInputStream(downloadResourceSizeBytes / 3 * 2); + } variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, - resourceContent.length); + downloadResourceSizeBytes); logger.debug("Generated resource."); logger.debug("Storing binary resource for download..."); @@ -62,33 +69,15 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) } } - private byte[] generateRandomBinaryContent(int desiredSizeBytes, PingPongLogger logger) - { - int sizeBytes = Math.min(maxUploadSizeBytes, desiredSizeBytes); - byte[] bytes = generateRandomByteArray(sizeBytes); - logger.info( - "Generated binary content for network speed measurement. Requested size was: {} bytes, generated size was : {}", - desiredSizeBytes, bytes.length); - return bytes; - } - - private byte[] generateRandomByteArray(int sizeBytes) - { - Random rand = new Random(); - byte[] randomBytes = new byte[sizeBytes]; - rand.nextBytes(randomBytes); - return randomBytes; - } - private int getDownloadResourceSize(Variables variables) { return variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); } - private IdType storeBinary(byte[] downloadResourceContent, DelegateExecution delegateExecution) + private IdType storeBinary(RandomByteInputStream downloadResourceContent, DelegateExecution delegateExecution) { return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().createBinary( - new ByteArrayInputStream(downloadResourceContent), ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE, + downloadResourceContent, ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE, api.getOrganizationProvider().getLocalOrganization().get().getIdElement().getValue()); } diff --git a/src/main/java/dev/dsf/bpe/service/RandomByteInputStream.java b/src/main/java/dev/dsf/bpe/service/RandomByteInputStream.java new file mode 100644 index 00000000..91dc1ead --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/RandomByteInputStream.java @@ -0,0 +1,149 @@ +package dev.dsf.bpe.service; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Random; + +public class RandomByteInputStream extends InputStream +{ + private final long numBytes; + private long numBytesRead = 0; + private final Random random; + private boolean closed = false; + + public RandomByteInputStream(long numBytes) + { + this.numBytes = numBytes; + this.random = new Random(); + } + + @Override + public synchronized int read() + { + if (!closed && numBytesRead < numBytes) + { + int next = random.nextInt(255); + numBytesRead++; + return next; + } + else + { + this.close(); + return -1; + } + } + + @Override + public int read(byte[] b) throws IOException + { + return read(b, 0, b.length); + } + + @Override + public synchronized int read(byte[] b, int off, int len) + { + if (len == 0) + return 0; + if (closed || numBytesRead >= numBytes) + { + this.close(); + return -1; + } + int localNumBytesRead = 0; + for (int i = 0; i < Math.min(len, b.length - off); i++) + { + if (!closed && numBytesRead < numBytes) + { + byte next = (byte) random.nextInt(255); + b[off + localNumBytesRead] = next; + localNumBytesRead++; + numBytesRead++; + } + else + { + this.close(); + break; + } + } + if (localNumBytesRead == numBytes) this.close(); + return localNumBytesRead; + } + + @Override + public synchronized byte[] readAllBytes() + { + if (numBytes <= Integer.MAX_VALUE) + { + byte[] b = new byte[(int) numBytes]; + read(b, 0, (int) (numBytes - numBytesRead)); + return b; + } + else + { + throw new UnsupportedOperationException( + "JVM does not support array lengths longer than Integer.MAX_VALUE values"); + } + } + + @Override + public int readNBytes(byte[] b, int off, int len) + { + return read(b, off, len); + } + + @Override + public synchronized long transferTo(OutputStream out) throws IOException + { + return super.transferTo(out); + } + + @Override + public synchronized long skip(long n) + { + if (n <= 0) + return 0; + long skippableBytes = numBytes - numBytesRead; + if (skippableBytes < n) + { + numBytesRead += skippableBytes; + return skippableBytes; + } + else + { + numBytesRead += n; + return n; + } + } + + @Override + public synchronized int available() throws IOException + { + if (closed || numBytesRead >= numBytes) + throw new IOException("Stream is closed"); + return (int) (numBytes - numBytesRead); + } + + @Override + public void mark(int readAheadLimit) + { + throw new UnsupportedOperationException("RandomByteInputStream does not support mark/reset"); + } + + @Override + public synchronized void reset() + { + throw new UnsupportedOperationException("RandomByteInputStream does not support mark/reset"); + } + + @Override + public void close() + { + this.closed = true; + } + + public boolean isClosed() + { + return closed; + } +} diff --git a/src/test/java/dev/dsf/library/RandomByteInputStreamTest.java b/src/test/java/dev/dsf/library/RandomByteInputStreamTest.java new file mode 100644 index 00000000..7d4325d0 --- /dev/null +++ b/src/test/java/dev/dsf/library/RandomByteInputStreamTest.java @@ -0,0 +1,162 @@ +package dev.dsf.library; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Ignore; +import org.junit.Test; + +import dev.dsf.bpe.service.RandomByteInputStream; + +public class RandomByteInputStreamTest +{ + @Test + @Ignore + public void ReadLargeLongValueTest() + { + try (RandomByteInputStream inputStream = new RandomByteInputStream(10000000000L)) + { + int out; + long mod = 10; + long count = 0; + while ((out = inputStream.read()) >= 0) + { + count++; + if (count % mod == 0) + { + mod *= 10; + System.out.println(count); + } + } + assertEquals(-1, out); + assertTrue(inputStream.isClosed()); + } catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @Test + public void ReadSmallLongValueTest() + { + try (RandomByteInputStream inputStream = new RandomByteInputStream(1000000L)) + { + int out; + long mod = 10; + long count = 0; + while ((out = inputStream.read()) >= 0) + { + count++; + if (count % mod == 0) + { + mod *= 10; + System.out.println(count); + } + } + assertEquals(-1, out); + assertTrue(inputStream.isClosed()); + } catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @Test + public void ReadPartIntoArrayTest() + { + try (RandomByteInputStream inputStream = new RandomByteInputStream(1000000L)) + { + byte[] bytes = new byte[10000]; + int out = inputStream.read(bytes); + assertEquals(bytes.length, out); + assertFalse(inputStream.isClosed()); + } catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @Test + public void ReadAllIntoArrayTest() + { + try (RandomByteInputStream inputStream = new RandomByteInputStream(1000000L)) + { + byte[] bytes = new byte[1000000]; + int out = inputStream.read(bytes); + assertEquals(bytes.length, out); + assertTrue(inputStream.isClosed()); + } catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @Test + public void ReadPartIntoArrayOffsetTest() + { + try (RandomByteInputStream inputStream = new RandomByteInputStream(1000000L)) + { + byte[] bytes = new byte[10000]; + int offset = bytes.length / 2; + int amount = bytes.length / 10; + int out = inputStream.read(bytes, offset, amount); + assertEquals(amount, out); + assertFalse(inputStream.isClosed()); + } catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @Test + public void ReadHalfIntoArrayOffsetTest() + { + try (RandomByteInputStream inputStream = new RandomByteInputStream(1000000L)) + { + byte[] bytes = new byte[1000000]; + int offset = bytes.length / 2; + int amount = bytes.length / 2; + int out = inputStream.read(bytes, offset, amount); + assertEquals(amount, out); + assertFalse(inputStream.isClosed()); + } catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @Test + public void ReadAllIntoArrayOffsetTest() + { + try (RandomByteInputStream inputStream = new RandomByteInputStream(1000000L)) + { + byte[] bytes = new byte[1000000]; + int offset = 0; + int amount = bytes.length; + int out = inputStream.read(bytes, offset, amount); + assertEquals(amount, out); + assertTrue(inputStream.isClosed()); + } catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @Test + public void ReadAllIntoArrayOffsetAmountTooHighTest() + { + try (RandomByteInputStream inputStream = new RandomByteInputStream(1000000L)) + { + byte[] bytes = new byte[1000000]; + int offset = bytes.length / 2; + int amount = bytes.length; + int out = inputStream.read(bytes, offset, amount); + assertEquals(offset, out); + assertFalse(inputStream.isClosed()); + } catch (Exception e) + { + throw new RuntimeException(e); + } + } +} From 1788ad3fce7ac8a26d41c00001fe62b2b078cc45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 24 Jul 2025 18:15:13 +0200 Subject: [PATCH 300/382] Ran format and sort --- .../bpe/service/RandomByteInputStream.java | 3 ++- .../library/RandomByteInputStreamTest.java | 24 ++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/RandomByteInputStream.java b/src/main/java/dev/dsf/bpe/service/RandomByteInputStream.java index 91dc1ead..c651df36 100644 --- a/src/main/java/dev/dsf/bpe/service/RandomByteInputStream.java +++ b/src/main/java/dev/dsf/bpe/service/RandomByteInputStream.java @@ -66,7 +66,8 @@ public synchronized int read(byte[] b, int off, int len) break; } } - if (localNumBytesRead == numBytes) this.close(); + if (localNumBytesRead == numBytes) + this.close(); return localNumBytesRead; } diff --git a/src/test/java/dev/dsf/library/RandomByteInputStreamTest.java b/src/test/java/dev/dsf/library/RandomByteInputStreamTest.java index 7d4325d0..8d923ce6 100644 --- a/src/test/java/dev/dsf/library/RandomByteInputStreamTest.java +++ b/src/test/java/dev/dsf/library/RandomByteInputStreamTest.java @@ -31,7 +31,8 @@ public void ReadLargeLongValueTest() } assertEquals(-1, out); assertTrue(inputStream.isClosed()); - } catch (Exception e) + } + catch (Exception e) { throw new RuntimeException(e); } @@ -56,7 +57,8 @@ public void ReadSmallLongValueTest() } assertEquals(-1, out); assertTrue(inputStream.isClosed()); - } catch (Exception e) + } + catch (Exception e) { throw new RuntimeException(e); } @@ -71,7 +73,8 @@ public void ReadPartIntoArrayTest() int out = inputStream.read(bytes); assertEquals(bytes.length, out); assertFalse(inputStream.isClosed()); - } catch (Exception e) + } + catch (Exception e) { throw new RuntimeException(e); } @@ -86,7 +89,8 @@ public void ReadAllIntoArrayTest() int out = inputStream.read(bytes); assertEquals(bytes.length, out); assertTrue(inputStream.isClosed()); - } catch (Exception e) + } + catch (Exception e) { throw new RuntimeException(e); } @@ -103,7 +107,8 @@ public void ReadPartIntoArrayOffsetTest() int out = inputStream.read(bytes, offset, amount); assertEquals(amount, out); assertFalse(inputStream.isClosed()); - } catch (Exception e) + } + catch (Exception e) { throw new RuntimeException(e); } @@ -120,7 +125,8 @@ public void ReadHalfIntoArrayOffsetTest() int out = inputStream.read(bytes, offset, amount); assertEquals(amount, out); assertFalse(inputStream.isClosed()); - } catch (Exception e) + } + catch (Exception e) { throw new RuntimeException(e); } @@ -137,7 +143,8 @@ public void ReadAllIntoArrayOffsetTest() int out = inputStream.read(bytes, offset, amount); assertEquals(amount, out); assertTrue(inputStream.isClosed()); - } catch (Exception e) + } + catch (Exception e) { throw new RuntimeException(e); } @@ -154,7 +161,8 @@ public void ReadAllIntoArrayOffsetAmountTooHighTest() int out = inputStream.read(bytes, offset, amount); assertEquals(offset, out); assertFalse(inputStream.isClosed()); - } catch (Exception e) + } + catch (Exception e) { throw new RuntimeException(e); } From 626f447d01d16a5006989c6ad9a1aad31f2b3620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 28 Jul 2025 10:50:37 +0200 Subject: [PATCH 301/382] Extension.url should not contain version --- src/main/java/dev/dsf/bpe/util/VersionUtils.java | 16 ---------------- .../output/generator/PingStatusGenerator.java | 12 +++++------- .../dsf-extension-ping-status.xml | 2 +- 3 files changed, 6 insertions(+), 24 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/util/VersionUtils.java diff --git a/src/main/java/dev/dsf/bpe/util/VersionUtils.java b/src/main/java/dev/dsf/bpe/util/VersionUtils.java deleted file mode 100644 index b112adef..00000000 --- a/src/main/java/dev/dsf/bpe/util/VersionUtils.java +++ /dev/null @@ -1,16 +0,0 @@ -package dev.dsf.bpe.util; - -import dev.dsf.bpe.PingProcessPluginDefinition; - -public class VersionUtils -{ - public static String appendFhirResourceVersion(String toAppend) - { - return toAppend + "|" + getFhirResourceVersion(); - } - - public static String getFhirResourceVersion() - { - return new PingProcessPluginDefinition().getVersion().substring(0, 3); - } -} diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index c1589fb3..1d31b09c 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -1,7 +1,5 @@ package dev.dsf.bpe.util.task.output.generator; -import static dev.dsf.bpe.util.VersionUtils.appendFhirResourceVersion; - import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -578,7 +576,7 @@ private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outp else { Extension extension = outputComponent.addExtension(); - extension.setUrl(appendFhirResourceVersion(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS)); + extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS); return extension; } } @@ -586,8 +584,8 @@ private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outp private static Optional<Extension> getPingStatusExtension(TaskOutputComponent outputComponent) { List<Extension> pingStatusExtensions = outputComponent.getExtension().stream() - .filter(extension -> appendFhirResourceVersion( - ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS).equals(extension.getUrl())) + .filter(extension -> + ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS.equals(extension.getUrl())) .toList(); if (pingStatusExtensions.isEmpty()) { @@ -614,8 +612,8 @@ private static List<Task.TaskOutputComponent> getOutputsByExtensionUrlAndCodes(T .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem()) && Stream.of(codes).anyMatch(code -> code.equals(coding.getCode()))) || outputComponent.getExtension().stream() - .anyMatch(extension -> appendFhirResourceVersion( - ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS) + .anyMatch(extension -> + ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS .equals(extension.getUrl()))) .collect(Collectors.toCollection(ArrayList::new)); } diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 541ad8dc..aff75036 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -211,7 +211,7 @@ </element> <element id="Extension.url"> <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2|#{version}"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"/> </element> <element id="Extension.value[x]"> <path value="Extension.value[x]"/> From 01d1072b10fab2c7ce516490f5e556e6872ee026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 28 Jul 2025 11:03:02 +0200 Subject: [PATCH 302/382] - Changed instances of integer to long (or decimal in case of FHIR) to support larger resource generation than Integer.MAX_VALUE bytes - Removed hard-coded resource size limit of 100 MB --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 +- .../PingPongDeploymentStateListener.java | 21 ------------------- .../dsf/bpe/message/CleanupPongMessage.java | 3 +-- .../dev/dsf/bpe/message/SendPingMessage.java | 6 +++--- .../dev/dsf/bpe/message/SendPongMessage.java | 6 +++--- .../bpe/service/GenerateAndStoreResource.java | 18 ++++++++-------- .../bpe/service/SetDownloadResourceSize.java | 18 ++++++++-------- .../bpe/service/ping/CheckPingTaskStatus.java | 14 ++++++------- ...adResourceAndMeasureSpeedInSubProcess.java | 6 +++--- .../ping/GenerateAndStoreResourcePing.java | 2 +- .../bpe/service/ping/LogAndSaveSendError.java | 2 +- .../dev/dsf/bpe/service/ping/SavePong.java | 10 ++++----- .../dsf/bpe/service/ping/StoreResults.java | 12 +++++------ .../pong/DownloadResourceAndMeasureSpeed.java | 6 +++--- .../pong/GenerateAndStoreResourcePong.java | 2 +- .../bpe/service/pong/StoreDownloadSpeed.java | 2 +- .../bpe/service/pong/StoreUploadSpeed.java | 10 ++++----- .../dev/dsf/bpe/spring/config/PingConfig.java | 16 +++++++------- .../bpe/util/BinaryResourceDownloader.java | 20 +++++++++--------- .../bpe/util/task/NetworkSpeedCalculator.java | 2 +- .../DownloadResourceSizeGenerator.java | 6 +++--- .../generator/DownloadedBytesGenerator.java | 6 +++--- .../NetworkSpeedMetricGenerator.java | 5 ++--- .../dsf-task-cleanup-pong.xml | 2 +- .../StructureDefinition/dsf-task-ping.xml | 2 +- .../StructureDefinition/dsf-task-pong.xml | 2 +- .../Task/dsf-task-start-ping-autostart.xml | 2 +- .../fhir/Task/dsf-task-start-ping.xml | 2 +- .../dsf/fhir/profiles/TaskProfileTest.java | 4 ++-- 29 files changed, 93 insertions(+), 116 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index a861af7b..c4a79d25 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -146,7 +146,7 @@ private ConstantsPing() public static final String PONG_ERROR_MESSAGE_CLEANUP_TIMEOUT = "Timeout while waiting for cleanup message"; - public static final int DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT = 10000000; + public static final long DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT = 10000000L; public static final MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; diff --git a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java index 91902f8d..ef61cbcf 100644 --- a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java +++ b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java @@ -40,27 +40,6 @@ public void onProcessesDeployed(List<String> processes) ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND); } - // TODO: fixme - int maxDownloadSizeBytes = pingConfig.getMaxDownloadSizeBytes(); - int maxDownloadSizeBytesHeapFix = 100000000; - if (maxDownloadSizeBytes > maxDownloadSizeBytesHeapFix) - { - pingConfig.setMaxDownloadSizeBytes(maxDownloadSizeBytesHeapFix); - logger.debug( - "MaxDownloadSizeBytes is too large. Setting maxDownloadSizeBytes to {}. This avoids Java running out of memory and will be fixed in a future release", - maxDownloadSizeBytesHeapFix); - } - - int maxUploadSizeBytes = pingConfig.getMaxUploadSizeBytes(); - int maxUploadSizeBytesHeapFix = 100000000; - if (maxUploadSizeBytes > maxUploadSizeBytesHeapFix) - { - pingConfig.setMaxUploadSizeBytes(maxUploadSizeBytesHeapFix); - logger.debug( - "MaxUploadSizeBytes is too large. Setting maxUploadSizeBytes to {}. This avoids Java running out of memory and will be fixed in a future release", - maxUploadSizeBytesHeapFix); - } - logger.debug("Configuration validation complete."); } diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 37230977..161a544f 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -35,8 +35,7 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE { Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - Integer downloadedBytes = variables - .getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); + Long downloadedBytes = variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); Long downloadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index 0c05ae44..691b69f0 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -41,8 +41,8 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut { String downloadResourceReference = variables .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); - int downloadResourceSizeBytes = variables - .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + long downloadResourceSizeBytes = variables + .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); Stream<ParameterComponent> downloadResourceReferenceStream = downloadResourceReference == null ? Stream.empty() : Stream.of(DownloadResourceReferenceGenerator.create(downloadResourceReference)); @@ -65,7 +65,7 @@ protected void sendTask(DelegateExecution execution, Variables variables, Target additionalInputParameters); if (taskId != null) { - execution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_PING_TASK_ID, taskId); + execution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_PING_TASK_ID, taskId.getIdPart()); } } diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index 612efc77..4b579d54 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -47,11 +47,11 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE Variables variables) { List<ProcessError> errorList = ErrorListUtils.getErrorMessageList(execution); - int downloadResourceSizeBytes = variables - .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + long downloadResourceSizeBytes = variables + .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); if (downloadResourceSizeBytes >= 0) { - Integer downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); + Long downloadedBytes = variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); Long downloadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); String downloadResourceReference = variables diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 854c52ac..c8a37232 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -15,10 +15,10 @@ public class GenerateAndStoreResource { private final ProcessPluginApi api; - private final int maxUploadSizeBytes; + private final long maxUploadSizeBytes; private final Process process; - public GenerateAndStoreResource(ProcessPluginApi api, int maxUploadSizeBytes, Process process) + public GenerateAndStoreResource(ProcessPluginApi api, long maxUploadSizeBytes, Process process) { this.api = api; this.maxUploadSizeBytes = maxUploadSizeBytes; @@ -29,20 +29,20 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) { PingPongLogger logger = new PingPongLogger(GenerateAndStoreResource.class, variables.getStartTask()); logger.debug("Generating resource..."); - int downloadResourceSizeBytes = getDownloadResourceSize(variables); + long downloadResourceSizeBytes = getDownloadResourceSize(variables); RandomByteInputStream resourceContent; if (downloadResourceSizeBytes > maxUploadSizeBytes) { logger.info( "Requested resource size of {} bytes exceeds configured maximum upload size of {} bytes. Trimmed to maximum upload size.", downloadResourceSizeBytes, maxUploadSizeBytes); - resourceContent = new RandomByteInputStream(maxUploadSizeBytes / 3 * 2); + resourceContent = new RandomByteInputStream(maxUploadSizeBytes); } else { - resourceContent = new RandomByteInputStream(downloadResourceSizeBytes / 3 * 2); + resourceContent = new RandomByteInputStream(downloadResourceSizeBytes); } - variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, + variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, downloadResourceSizeBytes); logger.debug("Generated resource."); logger.debug("Storing binary resource for download..."); @@ -51,7 +51,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) { IdType downloadResource = storeBinary(resourceContent, delegateExecution); - String reference = downloadResource.getValueAsString(); + String reference = downloadResource.toVersionless().getValueAsString(); variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); @@ -69,9 +69,9 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) } } - private int getDownloadResourceSize(Variables variables) + private long getDownloadResourceSize(Variables variables) { - return variables.getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + return variables.getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); } private IdType storeBinary(RandomByteInputStream downloadResourceContent, DelegateExecution delegateExecution) diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index 31e5d7c1..789d09d6 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -4,7 +4,7 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.DecimalType; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -14,9 +14,9 @@ public class SetDownloadResourceSize extends AbstractServiceDelegate { - private final int maxDownloadResourceSizeBytes; + private final long maxDownloadResourceSizeBytes; - public SetDownloadResourceSize(ProcessPluginApi api, int maxDownloadResourceSizeBytes) + public SetDownloadResourceSize(ProcessPluginApi api, long maxDownloadResourceSizeBytes) { super(api); this.maxDownloadResourceSizeBytes = maxDownloadResourceSizeBytes; @@ -28,19 +28,19 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable PingPongLogger logger = new PingPongLogger(SetDownloadResourceSize.class, variables.getStartTask()); logger.debug("Setting download resource size..."); - variables.setInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, + variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, getDownloadResourceSize(variables)); logger.debug("Set download resource size to " + maxDownloadResourceSizeBytes); } - private int getDownloadResourceSize(Variables variables) + private long getDownloadResourceSize(Variables variables) { - Optional<IntegerType> downloadResourceSizeType = api.getTaskHelper().getFirstInputParameterValue( + Optional<DecimalType> downloadResourceSizeType = api.getTaskHelper().getFirstInputParameterValue( variables.getStartTask(), ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, IntegerType.class); + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, DecimalType.class); - return downloadResourceSizeType.isPresent() ? downloadResourceSizeType.get().getValue() - : Math.min(maxDownloadResourceSizeBytes, ConstantsPing.DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT); + return downloadResourceSizeType.map(decimalType -> decimalType.getValue().longValue()).orElseGet( + () -> Math.min(maxDownloadResourceSizeBytes, ConstantsPing.DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT)); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index cd3a1ab3..7cc557ac 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -34,7 +34,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - IdType taskId = (IdType) delegateExecution.getVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_PING_TASK_ID); + String taskId = (String) delegateExecution.getVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_PING_TASK_ID); Objects.requireNonNull(taskId); FhirWebserviceClient fhirWebserviceClient = api.getFhirWebserviceClientProvider() @@ -43,7 +43,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable try { - Task pingTask = fhirWebserviceClient.withRetry(3, 1000).read(Task.class, taskId.getIdPart()); + Task pingTask = fhirWebserviceClient.withRetry(3, 1000).read(Task.class, taskId); switch (pingTask.getStatus()) { case REQUESTED, INPROGRESS, FAILED, @@ -51,12 +51,12 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, "Awaiting pong message", null, - "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() - + " from " + target.getEndpointUrl() + " is " + pingTask.getStatus()); + "Pong message timed out. Status of ping task resource with id " + taskId + " from " + + target.getEndpointUrl() + " is " + pingTask.getStatus()); default -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, "Awaiting pong message", null, - "Pong message timed out. Status of ping task resource with id " + taskId.getIdPart() + " from " + "Pong message timed out. Status of ping task resource with id " + taskId + " from " + target.getEndpointUrl() + " is " + pingTask.getStatus() + ". Unexpected status. Should be either of " + Task.TaskStatus.REQUESTED + ", " + Task.TaskStatus.INPROGRESS + ", " + Task.TaskStatus.COMPLETED + " or " @@ -69,8 +69,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, - "Pong message timed out. Error when retrieving status of ping task resource with id " - + taskId.getIdPart() + " from " + target.getEndpointUrl(), + "Pong message timed out. Error when retrieving status of ping task resource with id " + taskId + + " from " + target.getEndpointUrl(), ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, e.getMessage()); } ErrorListUtils.add(error, delegateExecution, correlationKey); diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 3da7ecba..ef755fa1 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -14,9 +14,9 @@ public class DownloadResourceAndMeasureSpeedInSubProcess extends AbstractServiceDelegate { - private final int maxDownloadSizeBytes; + private final long maxDownloadSizeBytes; - public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api, int maxDownloadSizeBytes) + public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api, long maxDownloadSizeBytes) { super(api); this.maxDownloadSizeBytes = maxDownloadSizeBytes; @@ -40,7 +40,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable if (downloadResult.getError() == null) { - variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey), + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey), downloadResult.getDownloadedBytes()); variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), downloadResult.getDownloadedDurationMillis()); diff --git a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java index cc9d94f5..d08b5a8e 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java @@ -13,7 +13,7 @@ public class GenerateAndStoreResourcePing extends AbstractServiceDelegate { private final GenerateAndStoreResource delegate; - public GenerateAndStoreResourcePing(ProcessPluginApi api, int maxUploadSizeBytes) + public GenerateAndStoreResourcePing(ProcessPluginApi api, long maxUploadSizeBytes) { super(api); delegate = new GenerateAndStoreResource(api, maxUploadSizeBytes, Process.PING); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 0375671f..82a2e500 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -31,7 +31,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw ProcessError error = ProcessError .parse((String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableError())); ErrorListUtils.add(error, execution, correlationKey); - variables.setInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0); + variables.setLong(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0L); variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); logger.debug("Saved error when trying to send ping message. Error message: {}", error.message()); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 5c9bdcab..7413a530 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -6,7 +6,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.DecimalType; -import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; @@ -45,11 +44,12 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey), decimalType.getValue().longValue())); - Optional<IntegerType> optDownloadedBytes = api.getTaskHelper().getFirstInputParameterValue(pong, + Optional<DecimalType> optDownloadedBytes = api.getTaskHelper().getFirstInputParameterValue(pong, ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, - IntegerType.class); - optDownloadedBytes.ifPresent(integerType -> variables.setInteger( - ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), integerType.getValue())); + DecimalType.class); + optDownloadedBytes.ifPresent( + decimalType -> variables.setLong(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), + decimalType.getValue().longValue())); List<ProcessError> errorList = ErrorInputParser.parseInputs(pong); diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 559c1534..5f904007 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -63,13 +63,13 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw List<ProcessError> errors = ErrorListUtils.getErrorMessageList(execution, correlationKey); String statusCode = errors.isEmpty() ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR; - int downloadResourceSizeBytes = variables - .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + long downloadResourceSizeBytes = variables + .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); List<ProcessError> errorMessageList = ErrorListUtils.getErrorMessageList(execution, correlationKey); if (downloadResourceSizeBytes >= 0) // if fat-ping { - Integer downloadedBytes = variables - .getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); + Long downloadedBytes = variables + .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); Long downloadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); @@ -77,8 +77,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw ? NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit) : null; - Integer uploadedBytes = variables - .getInteger(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey)); + Long uploadedBytes = variables + .getLong(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey)); Long uploadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey)); diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index f9418865..fca5d45e 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -13,9 +13,9 @@ public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate { - private final int maxDownloadSizeBytes; + private final long maxDownloadSizeBytes; - public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, int maxDownloadSizeBytes) + public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, long maxDownloadSizeBytes) { super(api); this.maxDownloadSizeBytes = maxDownloadSizeBytes; @@ -35,7 +35,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable if (downloadResult.getError() == null) { - variables.setInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(), + variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(), downloadResult.getDownloadedBytes()); variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(), downloadResult.getDownloadedDurationMillis()); diff --git a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java index 5568be56..7c728718 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java @@ -13,7 +13,7 @@ public class GenerateAndStoreResourcePong extends AbstractServiceDelegate { private final GenerateAndStoreResource delegate; - public GenerateAndStoreResourcePong(ProcessPluginApi api, int maxUploadSizeBytes) + public GenerateAndStoreResourcePong(ProcessPluginApi api, long maxUploadSizeBytes) { super(api); this.delegate = new GenerateAndStoreResource(api, maxUploadSizeBytes, Process.PONG); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 00014aa1..3b561a8c 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -31,7 +31,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(StoreDownloadSpeed.class, startTask); logger.debug("Storing download speed..."); - int downloadedBytes = variables.getInteger(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); + long downloadedBytes = variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); long downloadedDurationMillis = variables .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index e38b4d8f..debb2967 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -6,7 +6,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.DecimalType; -import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.PrimitiveType; import org.hl7.fhir.r4.model.Task; @@ -36,9 +35,10 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable PingPongLogger logger = new PingPongLogger(LogPing.class, startTask); logger.debug("Storing upload speed..."); - Optional<IntegerType> uploadedBytesTaskInput = getUploadedBytes(cleanup); + Optional<DecimalType> uploadedBytesTaskInput = getUploadedBytes(cleanup); Optional<DecimalType> uploadedDurationMillisTaskInput = getUploadedDurationMillis(cleanup); - int uploadedBytes = uploadedBytesTaskInput.map(PrimitiveType::getValue).orElse(0); + long uploadedBytes = uploadedBytesTaskInput.map(PrimitiveType::getValue).orElse(BigDecimal.valueOf(0)) + .longValue(); long uploadedDurationMillis = uploadedDurationMillisTaskInput .map(decimalType -> decimalType.getValue().longValue()).orElse(0L); @@ -51,10 +51,10 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Stored upload speed: " + uploadSpeed + " " + networkSpeedUnit); } - private Optional<IntegerType> getUploadedBytes(Task task) + private Optional<DecimalType> getUploadedBytes(Task task) { return api.getTaskHelper().getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, IntegerType.class); + ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, DecimalType.class); } private Optional<DecimalType> getUploadedDurationMillis(Task task) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index cf54d7a6..8bd37035 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -57,12 +57,12 @@ public class PingConfig @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.", processNames = "dsfdev_ping, dsfdev_pong") @Value("${dev.dsf.bpe.ping.maxDownloadSizeBytes:10000000}") - private int maxDownloadSizeBytes; + private long maxDownloadSizeBytes; @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.", processNames = { "dsfdev_ping", "dsfdev_pong" }) @Value("${dev.dsf.bpe.ping.maxUploadSizeBytes:10000000}") - private int maxUploadSizeBytes; + private long maxUploadSizeBytes; @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values be: \"bits-per-second\", \"bytes-per-second\", \"megabits-per-second\", \"megabytes-per-second\". Default is \"megabytes-per-second\".", processNames = { "dsfdev_ping", "dsfdev_pong" }) @@ -79,22 +79,22 @@ public void setNetworkSpeedUnit(String networkSpeedUnit) this.networkSpeedUnit = networkSpeedUnit; } - public int getMaxDownloadSizeBytes() + public long getMaxDownloadSizeBytes() { return maxDownloadSizeBytes; } - public void setMaxDownloadSizeBytes(int maxDownloadSizeBytes) + public void setMaxDownloadSizeBytes(long maxDownloadSizeBytes) { this.maxDownloadSizeBytes = maxDownloadSizeBytes; } - public int getMaxUploadSizeBytes() + public long getMaxUploadSizeBytes() { return maxUploadSizeBytes; } - public void setMaxUploadSizeBytes(int maxUploadSizeBytes) + public void setMaxUploadSizeBytes(long maxUploadSizeBytes) { this.maxUploadSizeBytes = maxUploadSizeBytes; } @@ -193,14 +193,14 @@ public CleanupPongMessage cleanupPongMessage() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public DownloadResourceAndMeasureSpeed downloadResourceAndMeasureSpeed() { - return new DownloadResourceAndMeasureSpeed(api, (int) maxDownloadSizeBytes); + return new DownloadResourceAndMeasureSpeed(api, maxDownloadSizeBytes); } @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public DownloadResourceAndMeasureSpeedInSubProcess downloadResourceAndMeasureSpeedInSubProcess() { - return new DownloadResourceAndMeasureSpeedInSubProcess(api, (int) maxDownloadSizeBytes); + return new DownloadResourceAndMeasureSpeedInSubProcess(api, maxDownloadSizeBytes); } @Bean diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 989943ca..243303e9 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -28,12 +28,12 @@ public BinaryResourceDownloader(PingPongLogger logger, String process) this.process = process; } - public DownloadResult download(Variables variables, ProcessPluginApi api, Task task, int maxDownloadSizeBytes) + public DownloadResult download(Variables variables, ProcessPluginApi api, Task task, long maxDownloadSizeBytes) { DownloadResult downloadResult; - int downloadResourceSizeBytes = variables - .getInteger(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + long downloadResourceSizeBytes = variables + .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); Optional<Reference> optDownloadResourceReference = api.getTaskHelper().getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, @@ -66,7 +66,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t "Downloading resource for: '{}'. Requested resource size is {} bytes, maximum downloadable size is {} bytes...", downloadResourceReference.getReference(), downloadResourceSizeBytes, maxDownloadSizeBytes); long downloadStartTime = System.currentTimeMillis(); - int numBytes = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); + long numBytes = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); binaryResourceInputStream.skipNBytes(numBytes); long downloadEndTime = System.currentTimeMillis(); long downloadedDurationMillis = downloadEndTime - downloadStartTime; @@ -78,7 +78,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t catch (IOException e) { binaryResourceInputStream.close(); - String errorMessage = e.getMessage(); + String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); ProcessError error = new ProcessError(process, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, null, errorMessage); @@ -99,7 +99,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t { if (e.getCause() instanceof SocketTimeoutException) { - String errorMessage = e.getCause().getMessage(); + String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); ProcessError error = new ProcessError(process, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT, errorMessage); @@ -113,7 +113,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t } catch (IOException e) { - String errorMessage = e.getMessage(); + String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); ProcessError error = new ProcessError(process, ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, null, errorMessage); @@ -134,11 +134,11 @@ private String toHoursMinutesSecondsMilliseconds(long millis) public static class DownloadResult { - private final int downloadedBytes; + private final long downloadedBytes; private final long downloadedDurationMillis; private final ProcessError error; - public DownloadResult(int downloadedBytes, long downloadedDurationMillis) + public DownloadResult(long downloadedBytes, long downloadedDurationMillis) { this.downloadedBytes = downloadedBytes; this.downloadedDurationMillis = downloadedDurationMillis; @@ -152,7 +152,7 @@ public DownloadResult(ProcessError error) this.error = error; } - public int getDownloadedBytes() + public long getDownloadedBytes() { return downloadedBytes; } diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 7e9f047a..2e924132 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -11,7 +11,7 @@ private NetworkSpeedCalculator() { } - public static BigDecimal calculate(int bytes, long duration, String unit) + public static BigDecimal calculate(long bytes, long duration, String unit) { if (bytes == 0) return BigDecimal.ZERO; diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java index d631baa7..aaa85c02 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java @@ -1,7 +1,7 @@ package dev.dsf.bpe.util.task.input.generator; import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; @@ -12,10 +12,10 @@ private DownloadResourceSizeGenerator() { } - public static Task.ParameterComponent create(int sizeBytes) + public static Task.ParameterComponent create(long sizeBytes) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(new IntegerType(sizeBytes)).getType().addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, + param.setValue(new DecimalType(sizeBytes)).getType().addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, null)); return param; } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java index ce00aeee..f4892634 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java @@ -1,6 +1,6 @@ package dev.dsf.bpe.util.task.input.generator; -import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; @@ -11,10 +11,10 @@ private DownloadedBytesGenerator() { } - public static Task.ParameterComponent create(int bytes) + public static Task.ParameterComponent create(long bytes) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(new IntegerType(bytes)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + param.setValue(new DecimalType(bytes)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES); return param; } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java index c8859f54..233163f2 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java @@ -2,7 +2,6 @@ import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.DecimalType; -import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; @@ -22,10 +21,10 @@ public static Task.ParameterComponent createDownloadedDurationMillis(long durati return downloadedDuration; } - public static Task.ParameterComponent createDownloadedBytes(int bytes) + public static Task.ParameterComponent createDownloadedBytes(long bytes) { Task.ParameterComponent downloadedBytes = new Task.ParameterComponent(); - downloadedBytes.setValue(new IntegerType(bytes)).getType().addCoding(new Coding( + downloadedBytes.setValue(new DecimalType(bytes)).getType().addCoding(new Coding( ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, null)); return downloadedBytes; } diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index 7cca3bda..ccca246b 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -97,7 +97,7 @@ <min value="1"/> <max value="1"/> <type> - <code value="integer"/> + <code value="decimal"/> </type> </element> <element id="Task.input:downloaded-duration-millis"> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index 8080b9dd..db1804a8 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -154,7 +154,7 @@ <min value="1"/> <max value="1"/> <type> - <code value="integer"/> + <code value="decimal"/> </type> </element> <element id="Task.input:download-resource-reference"> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index 6ae2aab7..c8af794a 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -148,7 +148,7 @@ <min value="1"/> <max value="1"/> <type> - <code value="integer"/> + <code value="decimal"/> </type> </element> <element id="Task.input:downloaded-duration-millis"> diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml index 0cff04de..86636765 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml @@ -60,6 +60,6 @@ <code value="download-resource-size-bytes"/> </coding> </type> - <valueInteger value="10000000"/> + <valueDecimal value="10000000"/> </input> </Task> diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping.xml b/src/main/resources/fhir/Task/dsf-task-start-ping.xml index 29011e26..1ab93850 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping.xml @@ -42,7 +42,7 @@ <code value="download-resource-size-bytes" /> </coding> </type> - <valueInteger value="1000000"/> + <valueDecimal value="1000000"/> </input> <input> <type> diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 14b550b2..a5210eaa 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -15,7 +15,7 @@ import java.util.TimeZone; import java.util.UUID; -import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.StringType; @@ -396,7 +396,7 @@ private Task createValidTaskStartPingProcess() task.addInput().setValue(new StringType(ConstantsPing.PROFILE_DSF_TASK_START_PING_MESSAGE_NAME)).getType() .addCoding(BpmnMessage.messageName()); - task.addInput().setValue(new IntegerType(1)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) + task.addInput().setValue(new DecimalType(1)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES); return task; From c53288f783d6d6abbfb64a077d41f50c4dcd3041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 28 Jul 2025 11:04:02 +0200 Subject: [PATCH 303/382] Was fixed in 5260f516adf5534bee7c4cd5480d7165854855fa --- src/main/java/dev/dsf/bpe/service/ping/StoreResults.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 5f904007..4a22af5c 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -96,8 +96,6 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw errors.forEach(error -> errorMailService.addError(target, error)); }); - // TODO only send one combined status mail - variables.updateTask(task); errorMailService.send(task.getIdElement()); From 3fdbc036a4659966abebdb14c2a38b764cb5f2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 29 Jul 2025 17:01:44 +0200 Subject: [PATCH 304/382] Refactored execution variable string constants in ConstantsPing to be an enum instead to reduce the number of constants in ConstantsPing --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 92 ------------------- .../java/dev/dsf/bpe/ExecutionVariables.java | 38 ++++++++ .../dsf/bpe/message/CleanupPongMessage.java | 9 +- .../dev/dsf/bpe/message/SendPingMessage.java | 12 +-- .../dev/dsf/bpe/message/SendPongMessage.java | 13 ++- .../java/dev/dsf/bpe/service/Cleanup.java | 3 +- .../bpe/service/GenerateAndStoreResource.java | 11 +-- .../bpe/service/SetDownloadResourceSize.java | 3 +- .../autostart/SetTargetAndConfigureTimer.java | 6 +- .../bpe/service/ping/CheckPingTaskStatus.java | 3 +- ...adResourceAndMeasureSpeedInSubProcess.java | 7 +- .../dsf/bpe/service/ping/LogAndSaveError.java | 3 +- .../bpe/service/ping/LogAndSaveSendError.java | 7 +- .../ping/LogAndSaveUploadErrorPing.java | 3 +- .../dev/dsf/bpe/service/ping/SavePong.java | 8 +- .../dsf/bpe/service/ping/StoreResults.java | 11 ++- .../pong/DownloadResourceAndMeasureSpeed.java | 8 +- .../pong/EstimateCleanupTimerDuration.java | 4 +- .../service/pong/LogAndSaveAndStoreError.java | 3 +- .../pong/LogAndSaveUploadErrorPong.java | 3 +- .../bpe/service/pong/SelectPongTarget.java | 3 +- .../service/pong/SetEndpointIdentifier.java | 4 +- .../bpe/service/pong/StoreDownloadSpeed.java | 6 +- .../bpe/util/BinaryResourceDownloader.java | 4 +- .../java/dev/dsf/bpe/util/ErrorListUtils.java | 14 +-- .../output/generator/PingStatusGenerator.java | 8 +- 26 files changed, 120 insertions(+), 166 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/ExecutionVariables.java diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index c4a79d25..d269836b 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -124,28 +124,6 @@ private ConstantsPing() public static final String EXTENSION_URL_POTENTIAL_FIX = "potential-fix"; public static final String EXTENSION_URL_MESSAGE = "message"; - public static final String BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL = "timerInterval"; - public static final String BPMN_EXECUTION_VARIABLE_STOP_TIMER = "stopTimer"; - public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES = "downloadResourceSizeBytes"; - public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE = "downloadResource"; - public static final String BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE = "downloadResourceReference"; - private static final String BPMN_EXECUTION_VARIABLE_STATUS_CODE = "statusCode"; - private static final String BPMN_EXECUTION_VARIABLE_ERROR = "error"; - private static final String BPMN_EXECUTION_VARIABLE_ERROR_LIST = "errors"; - private static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES = "downloadedBytes"; - private static final String BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS = "downloadedDurationMillis"; - public static final String BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER = "targetEndpointIdentifier"; - private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_BYTES = "uploadedBytes"; - private static final String BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS = "uploadedDurationMillis"; - public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR = "resourceDownloadError"; - public static final String BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR = "resourceUploadError"; - public static final String BPMN_EXECUTION_VARIABLE_PING_TASK_ID = "pingTaskId"; - - public static final String BPMN_ERROR_CODE_RESOURCE_DOWNLOAD_ERROR = "resourceDownloadError"; - public static final String BPMN_ERROR_CODE_RESOURCE_UPLOAD_ERROR = "resourceUploadError"; - - public static final String PONG_ERROR_MESSAGE_CLEANUP_TIMEOUT = "Timeout while waiting for cleanup message"; - public static final long DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT = 10000000L; public static final MediaType DOWNLOAD_RESOURCE_MIME_TYPE = MediaType.APPLICATION_OCTET_STREAM_TYPE; @@ -161,74 +139,4 @@ private ConstantsPing() public static final String POTENTIAL_FIX_URL_UNKNOWN_HOST = POTENTIAL_FIX_URL_BASE + "/unknown-host"; public static final String CLEANUP_ERROR_ACTION = "Deleting generated Binary resource from local DSF FHIR server."; - - public static String getBpmnExecutionVariableStatusCode() - { - return BPMN_EXECUTION_VARIABLE_STATUS_CODE; - } - - public static String getBpmnExecutionVariableStatusCode(String correlationKey) - { - return BPMN_EXECUTION_VARIABLE_STATUS_CODE + "_" + correlationKey; - } - - public static String getBpmnExecutionVariableError() - { - return BPMN_EXECUTION_VARIABLE_ERROR; - } - - public static String getBpmnExecutionVariableErrorMessage(String correlationKey) - { - return BPMN_EXECUTION_VARIABLE_ERROR + "_" + correlationKey; - } - - public static String getBpmnExecutionVariableDownloadedBytes() - { - return BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES; - } - - public static String getBpmnExecutionVariableDownloadedBytes(String correlationKey) - { - return BPMN_EXECUTION_VARIABLE_DOWNLOADED_BYTES + "_" + correlationKey; - } - - public static String getBpmnExecutionVariableDownloadedDurationMillis() - { - return BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS; - } - - public static String getBpmnExecutionVariableDownloadedDurationMillis(String correlationKey) - { - return BPMN_EXECUTION_VARIABLE_DOWNLOADED_DURATION_MILLIS + "_" + correlationKey; - } - - public static String getBpmnExecutionVariableUploadedBytes() - { - return BPMN_EXECUTION_VARIABLE_UPLOADED_BYTES; - } - - public static String getBpmnExecutionVariableUploadedBytes(String correlationKey) - { - return BPMN_EXECUTION_VARIABLE_UPLOADED_BYTES + "_" + correlationKey; - } - - public static String getBpmnExecutionVariableUploadedDurationMillis() - { - return BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS; - } - - public static String getBpmnExecutionVariableUploadedDurationMillis(String correlationKey) - { - return BPMN_EXECUTION_VARIABLE_UPLOADED_DURATION_MILLIS + "_" + correlationKey; - } - - public static String getBpmnExecutionVariableErrorList() - { - return BPMN_EXECUTION_VARIABLE_ERROR_LIST; - } - - public static String getBpmnExecutionVariableErrorMessageList(String correlationKey) - { - return getBpmnExecutionVariableErrorList() + "_" + correlationKey; - } } diff --git a/src/main/java/dev/dsf/bpe/ExecutionVariables.java b/src/main/java/dev/dsf/bpe/ExecutionVariables.java new file mode 100644 index 00000000..785482a7 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/ExecutionVariables.java @@ -0,0 +1,38 @@ +package dev.dsf.bpe; + +public enum ExecutionVariables +{ + TIMER_INTERVAL("timerInterval"), + STOP_TIMER("stopTimer"), + DOWNLOAD_RESOURCE_SIZE_BYTES("downloadResourceSizeBytes"), + DOWNLOAD_RESOURCE("downloadResource"), + DOWNLOAD_RESOURCE_REFERENCE("downloadResourceReference"), + STATUS_CODE("statusCode"), + ERROR("error"), + ERROR_LIST("errors"), + DOWNLOADED_BYTES("downloadedBytes"), + DOWNLOADED_DURATION_MILLIS("downloadedDurationMillis"), + PONG_TARGET_ENDPOINT_IDENTIFIER("targetEndpointIdentifier"), + UPLOADED_BYTES("uploadedBytes"), + UPLOADED_DURATION_MILLIS("uploadedDurationMillis"), + RESOURCE_DOWNLOAD_ERROR("resourceDownloadError"), + RESOURCE_UPLOAD_ERROR("resourceUploadError"), + PING_TASK_ID("pingTaskId"); + + private final String value; + + ExecutionVariables(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + + public String correlatedValue(String correlationKey) + { + return getValue() + "_" + correlationKey; + } +} diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 161a544f..4db03d7b 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.SendTaskErrorConverter; @@ -35,9 +36,9 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE { Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - Long downloadedBytes = variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); + Long downloadedBytes = variables.getLong(ExecutionVariables.DOWNLOADED_BYTES.correlatedValue(correlationKey)); Long downloadedDurationMillis = variables - .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); + .getLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.correlatedValue(correlationKey)); Stream<Task.ParameterComponent> downloadedBytesParameter = downloadedBytes != null ? Stream.of(DownloadedBytesGenerator.create(downloadedBytes)) @@ -60,8 +61,8 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab try { - execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableError(), ProcessError.toString(error)); - execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode(), + execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), ProcessError.toString(error)); + execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); } catch (JsonProcessingException e) diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index 691b69f0..bc561c1c 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -15,6 +15,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.SendTaskErrorConverter; @@ -40,9 +41,8 @@ public SendPingMessage(ProcessPluginApi api) protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { String downloadResourceReference = variables - .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); - long downloadResourceSizeBytes = variables - .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + .getString(ExecutionVariables.DOWNLOAD_RESOURCE_REFERENCE.getValue()); + long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); Stream<ParameterComponent> downloadResourceReferenceStream = downloadResourceReference == null ? Stream.empty() : Stream.of(DownloadResourceReferenceGenerator.create(downloadResourceReference)); @@ -65,7 +65,7 @@ protected void sendTask(DelegateExecution execution, Variables variables, Target additionalInputParameters); if (taskId != null) { - execution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_PING_TASK_ID, taskId.getIdPart()); + execution.setVariableLocal(ExecutionVariables.PING_TASK_ID.getValue(), taskId.getIdPart()); } } @@ -87,8 +87,8 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab try { - execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableError(), ProcessError.toString(error)); - execution.setVariableLocal(ConstantsPing.getBpmnExecutionVariableStatusCode(), + execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), ProcessError.toString(error)); + execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); } catch (JsonProcessingException e) diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index 4b579d54..5083bbd8 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -8,6 +8,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorListUtils; @@ -47,15 +48,13 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE Variables variables) { List<ProcessError> errorList = ErrorListUtils.getErrorMessageList(execution); - long downloadResourceSizeBytes = variables - .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); if (downloadResourceSizeBytes >= 0) { - Long downloadedBytes = variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); - Long downloadedDurationMillis = variables - .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); + Long downloadedBytes = variables.getLong(ExecutionVariables.DOWNLOADED_BYTES.getValue()); + Long downloadedDurationMillis = variables.getLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.getValue()); String downloadResourceReference = variables - .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE); + .getString(ExecutionVariables.DOWNLOAD_RESOURCE_REFERENCE.getValue()); Stream<Task.ParameterComponent> downloadedBytesParameter = downloadedBytes != null ? Stream.of(DownloadedBytesGenerator.create(downloadedBytes)) @@ -100,7 +99,7 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab ErrorListUtils.add(error, execution); PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); - variables.setString(ConstantsPing.getBpmnExecutionVariableStatusCode(), + variables.setString(ExecutionVariables.STATUS_CODE.getValue(), ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); variables.updateTask(startTask); diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index c1d953d0..e906fdf7 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -7,6 +7,7 @@ import org.hl7.fhir.r4.model.IdType; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.service.pong.CleanupPong; import dev.dsf.bpe.util.ErrorListUtils; @@ -34,7 +35,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) PingPongLogger logger = new PingPongLogger(CleanupPong.class, variables.getStartTask()); logger.debug("Cleaning up..."); String downloadResourceId = new IdType( - variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE)).getIdPart(); + variables.getString(ExecutionVariables.DOWNLOAD_RESOURCE_REFERENCE.getValue())).getIdPart(); if (downloadResourceId != null) { try diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index c8a37232..f9b3f07a 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -5,6 +5,7 @@ import org.hl7.fhir.r4.model.IdType; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.Process; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -42,8 +43,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) { resourceContent = new RandomByteInputStream(downloadResourceSizeBytes); } - variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, - downloadResourceSizeBytes); + variables.setLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), downloadResourceSizeBytes); logger.debug("Generated resource."); logger.debug("Storing binary resource for download..."); @@ -53,7 +53,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) String reference = downloadResource.toVersionless().getValueAsString(); - variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_REFERENCE, reference); + variables.setString(ExecutionVariables.DOWNLOAD_RESOURCE_REFERENCE.getValue(), reference); logger.debug("Stored binary resource for download"); } @@ -64,14 +64,13 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_GENERATE_AND_STORE_RESOURCE, "Storing Binary resource on local DSF FHIR server.", ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, "Local DSF FHIR server responded with status: " + status); - variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR, - ProcessError.toString(error)); + variables.setString(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue(), ProcessError.toString(error)); } } private long getDownloadResourceSize(Variables variables) { - return variables.getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + return variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); } private IdType storeBinary(RandomByteInputStream downloadResourceContent, DelegateExecution delegateExecution) diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index 789d09d6..97019261 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -7,6 +7,7 @@ import org.hl7.fhir.r4.model.DecimalType; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -28,7 +29,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable PingPongLogger logger = new PingPongLogger(SetDownloadResourceSize.class, variables.getStartTask()); logger.debug("Setting download resource size..."); - variables.setLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES, + variables.setLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), getDownloadResourceSize(variables)); logger.debug("Set download resource size to " + maxDownloadResourceSizeBytes); diff --git a/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java b/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java index a594a7e1..18ec38d3 100644 --- a/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java +++ b/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java @@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -23,10 +24,9 @@ public SetTargetAndConfigureTimer(ProcessPluginApi api) protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { String timerInterval = getTimerInterval(variables); - logger.debug("Setting variable '{}' to {}", ConstantsPing.BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL, - timerInterval); + logger.debug("Setting variable '{}' to {}", ExecutionVariables.TIMER_INTERVAL.getValue(), timerInterval); - variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL, timerInterval); + variables.setString(ExecutionVariables.TIMER_INTERVAL.getValue(), timerInterval); variables.setTarget( variables.createTarget(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().get(), api.getEndpointProvider().getLocalEndpointIdentifierValue().get(), diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index 7cc557ac..85bf4f56 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -8,6 +8,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -34,7 +35,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - String taskId = (String) delegateExecution.getVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_PING_TASK_ID); + String taskId = (String) delegateExecution.getVariableLocal(ExecutionVariables.PING_TASK_ID.getValue()); Objects.requireNonNull(taskId); FhirWebserviceClient fhirWebserviceClient = api.getFhirWebserviceClientProvider() diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index ef755fa1..046267c6 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -5,6 +5,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -40,14 +41,14 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable if (downloadResult.getError() == null) { - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey), + variables.setLong(ExecutionVariables.DOWNLOADED_BYTES.correlatedValue(correlationKey), downloadResult.getDownloadedBytes()); - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), + variables.setLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.correlatedValue(correlationKey), downloadResult.getDownloadedDurationMillis()); } else { - delegateExecution.setVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR, + delegateExecution.setVariableLocal(ExecutionVariables.RESOURCE_DOWNLOAD_ERROR.getValue(), downloadResult.getError()); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index f6f610fd..3f7f81f0 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -4,6 +4,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -26,7 +27,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); ProcessError error = (ProcessError) delegateExecution - .getVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR); + .getVariableLocal(ExecutionVariables.RESOURCE_DOWNLOAD_ERROR.getValue()); ErrorListUtils.add(error, delegateExecution, target.getCorrelationKey()); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 82a2e500..d4682f8a 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -29,10 +30,10 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw try { ProcessError error = ProcessError - .parse((String) execution.getVariableLocal(ConstantsPing.getBpmnExecutionVariableError())); + .parse((String) execution.getVariableLocal(ExecutionVariables.ERROR.getValue())); ErrorListUtils.add(error, execution, correlationKey); - variables.setLong(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), 0L); - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey), 0L); + variables.setLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), 0L); + variables.setLong(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), 0L); logger.debug("Saved error when trying to send ping message. Error message: {}", error.message()); } catch (JsonProcessingException e) diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java index c6e8ba3f..244ec599 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java @@ -5,6 +5,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -25,7 +26,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPing.class, startTask); ProcessError error = ProcessError - .parse(variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR)); + .parse(variables.getString(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue())); logger.info("Error while storing binary resource for download: {}", error.message()); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 7413a530..fb82c517 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -9,6 +9,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -41,15 +42,14 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, DecimalType.class); optDownloadedDurationMillis.ifPresent(decimalType -> variables.setLong( - ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey), + ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), decimalType.getValue().longValue())); Optional<DecimalType> optDownloadedBytes = api.getTaskHelper().getFirstInputParameterValue(pong, ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, DecimalType.class); - optDownloadedBytes.ifPresent( - decimalType -> variables.setLong(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey), - decimalType.getValue().longValue())); + optDownloadedBytes.ifPresent(decimalType -> variables.setLong( + ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), decimalType.getValue().longValue())); List<ProcessError> errorList = ErrorInputParser.parseInputs(pong); diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 4a22af5c..c61f30aa 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -11,6 +11,7 @@ import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorListUtils; @@ -64,23 +65,23 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw String statusCode = errors.isEmpty() ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR; long downloadResourceSizeBytes = variables - .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + .getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); List<ProcessError> errorMessageList = ErrorListUtils.getErrorMessageList(execution, correlationKey); if (downloadResourceSizeBytes >= 0) // if fat-ping { Long downloadedBytes = variables - .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(correlationKey)); + .getLong(ExecutionVariables.DOWNLOADED_BYTES.correlatedValue(correlationKey)); Long downloadedDurationMillis = variables - .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(correlationKey)); + .getLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.correlatedValue(correlationKey)); BigDecimal downloadSpeed = downloadedBytes != null && downloadedDurationMillis != null ? NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit) : null; Long uploadedBytes = variables - .getLong(ConstantsPing.getBpmnExecutionVariableUploadedBytes(correlationKey)); + .getLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey)); Long uploadedDurationMillis = variables - .getLong(ConstantsPing.getBpmnExecutionVariableUploadedDurationMillis(correlationKey)); + .getLong(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey)); BigDecimal uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null ? NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit) diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index fca5d45e..22a9fcea 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -5,6 +5,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -35,14 +36,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable if (downloadResult.getError() == null) { - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes(), - downloadResult.getDownloadedBytes()); - variables.setLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis(), + variables.setLong(ExecutionVariables.DOWNLOADED_BYTES.getValue(), downloadResult.getDownloadedBytes()); + variables.setLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.getValue(), downloadResult.getDownloadedDurationMillis()); } else { - delegateExecution.setVariable(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR, + delegateExecution.setVariable(ExecutionVariables.RESOURCE_DOWNLOAD_ERROR.getValue(), downloadResult.getError()); } logger.debug("Completed resource download and measured speed."); diff --git a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java index 49fffc6f..e3322038 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java @@ -7,6 +7,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -27,8 +28,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Estimating cleanup timer duration..."); final long minTimerDurationMillis = 20000; long downloadedDurationMillis = Optional - .ofNullable(variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis())) - .orElse(0L); + .ofNullable(variables.getLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.getValue())).orElse(0L); long timerDurationMillis = downloadedDurationMillis > Long.MAX_VALUE / 10 - minTimerDurationMillis ? Long.MAX_VALUE : downloadedDurationMillis * 10 + minTimerDurationMillis; diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 0a5676a5..2aaa4f15 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -5,6 +5,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -29,7 +30,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task startTask = variables.getStartTask(); ProcessError error = (ProcessError) delegateExecution - .getVariableLocal(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_DOWNLOAD_ERROR); + .getVariableLocal(ExecutionVariables.RESOURCE_DOWNLOAD_ERROR.getValue()); ErrorListUtils.add(error, delegateExecution); PingStatusGenerator.updatePongStatusOutput(startTask, ErrorListUtils.getErrorMessageList(delegateExecution)); diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java index 88bb5bcc..60468bbb 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java @@ -5,6 +5,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -26,7 +27,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPong.class, startTask); ProcessError error = ProcessError - .parse(variables.getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_RESOURCE_UPLOAD_ERROR)); + .parse(variables.getString(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue())); ErrorListUtils.add(error, execution); diff --git a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java index efd40d45..91b02633 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java @@ -6,6 +6,7 @@ import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.service.ping.SelectPingTargets; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -32,7 +33,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw .getFirstInputParameterStringValue(task, BpmnMessage.URL, BpmnMessage.Codes.CORRELATION_KEY).get(); String targetOrganizationIdentifierValue = task.getRequester().getIdentifier().getValue(); String targetEndpointIdentifierValue = variables - .getString(ConstantsPing.BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER); + .getString(ExecutionVariables.PONG_TARGET_ENDPOINT_IDENTIFIER.getValue()); String targetEndpointAddress = api.getEndpointProvider().getEndpointAddress(targetEndpointIdentifierValue) .orElseThrow(() -> diff --git a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java index e2673630..e25b6d68 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java @@ -7,6 +7,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -27,8 +28,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task task = variables.getStartTask(); String endpointIdentifierValue = getEndpointIdentifierValue(task); - variables.setString(ConstantsPing.BPMN_EXECUTION_VARIABLE_PONG_TARGET_ENDPOINT_IDENTIFIER, - endpointIdentifierValue); + variables.setString(ExecutionVariables.PONG_TARGET_ENDPOINT_IDENTIFIER.getValue(), endpointIdentifierValue); logger.debug("Set endpoint identifier to " + endpointIdentifierValue); } diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 3b561a8c..41c15368 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -7,6 +7,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; @@ -31,9 +32,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(StoreDownloadSpeed.class, startTask); logger.debug("Storing download speed..."); - long downloadedBytes = variables.getLong(ConstantsPing.getBpmnExecutionVariableDownloadedBytes()); - long downloadedDurationMillis = variables - .getLong(ConstantsPing.getBpmnExecutionVariableDownloadedDurationMillis()); + long downloadedBytes = variables.getLong(ExecutionVariables.DOWNLOADED_BYTES.getValue()); + long downloadedDurationMillis = variables.getLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.getValue()); BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit); diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 243303e9..ecbae470 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -10,6 +10,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -32,8 +33,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t { DownloadResult downloadResult; - long downloadResourceSizeBytes = variables - .getLong(ConstantsPing.BPMN_EXECUTION_VARIABLE_DOWNLOAD_RESOURCE_SIZE_BYTES); + long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); Optional<Reference> optDownloadResourceReference = api.getTaskHelper().getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, diff --git a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java index c9a1c3fe..24f3a8a3 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; public class ErrorListUtils @@ -42,11 +43,11 @@ public static void add(ProcessError error, DelegateExecution execution, String c { if (correlationKey != null) { - add(error, ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), execution); + add(error, ExecutionVariables.ERROR_LIST.correlatedValue(correlationKey), execution); } else { - add(error, ConstantsPing.getBpmnExecutionVariableErrorList(), execution); + add(error, ExecutionVariables.ERROR_LIST.getValue(), execution); } } @@ -59,12 +60,11 @@ public static List<ProcessError> getErrorMessageList(DelegateExecution execution { if (correlationKey != null) { - return getErrorMessageList(ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), - execution); + return getErrorMessageList(ExecutionVariables.ERROR_LIST.correlatedValue(correlationKey), execution); } else { - return getErrorMessageList(ConstantsPing.getBpmnExecutionVariableErrorList(), execution); + return getErrorMessageList(ExecutionVariables.ERROR_LIST.getValue(), execution); } } @@ -108,11 +108,11 @@ private static void saveErrorList(List<ProcessError> errors, DelegateExecution e { if (correlationKey != null) { - saveErrorList(errors, ConstantsPing.getBpmnExecutionVariableErrorMessageList(correlationKey), execution); + saveErrorList(errors, ExecutionVariables.ERROR_LIST.correlatedValue(correlationKey), execution); } else { - saveErrorList(errors, ConstantsPing.getBpmnExecutionVariableErrorList(), execution); + saveErrorList(errors, ExecutionVariables.ERROR_LIST.getValue(), execution); } } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 1d31b09c..2606a152 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -583,9 +583,8 @@ private static Extension getOrCreatePingStatusExtension(TaskOutputComponent outp private static Optional<Extension> getPingStatusExtension(TaskOutputComponent outputComponent) { - List<Extension> pingStatusExtensions = outputComponent.getExtension().stream() - .filter(extension -> - ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS.equals(extension.getUrl())) + List<Extension> pingStatusExtensions = outputComponent.getExtension().stream().filter( + extension -> ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS.equals(extension.getUrl())) .toList(); if (pingStatusExtensions.isEmpty()) { @@ -612,8 +611,7 @@ private static List<Task.TaskOutputComponent> getOutputsByExtensionUrlAndCodes(T .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem()) && Stream.of(codes).anyMatch(code -> code.equals(coding.getCode()))) || outputComponent.getExtension().stream() - .anyMatch(extension -> - ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS + .anyMatch(extension -> ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS .equals(extension.getUrl()))) .collect(Collectors.toCollection(ArrayList::new)); } From 62edd05f9680c57f161d610bf320ce3f7d6fd997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 30 Jul 2025 13:46:39 +0200 Subject: [PATCH 305/382] Update formatter config to always have enum constant declarations on a new line --- eclipse-formatter-config.xml | 366 +++++++++++++++++++---------------- 1 file changed, 194 insertions(+), 172 deletions(-) diff --git a/eclipse-formatter-config.xml b/eclipse-formatter-config.xml index 0c015e33..f87f179d 100644 --- a/eclipse-formatter-config.xml +++ b/eclipse-formatter-config.xml @@ -1,380 +1,402 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<profiles version="20"> - <profile kind="CodeFormatterProfile" name="dsf" version="20"> +<profiles version="23"> + <profile kind="CodeFormatterProfile" name="dsf" version="23"> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/> <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/> <setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/> <setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="separate_lines_if_wrapped"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/> <setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/> <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/> - <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> - <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/> <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="49"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/> <setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/> <setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/> <setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/> - <setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line"/> <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/> <setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/> <setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/> <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/> <setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/> <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line"/> - <setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line"/> - <setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line"/> <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/> - <setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/> <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> <setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="2"/> <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="49"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/> <setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/> <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/> <setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/> <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/> <setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> <setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/> - <setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/> <setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/> <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/> <setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/> - <setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/> <setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> - <setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_if_empty"/> <setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="49"/> <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="0"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_permitted_types_in_type_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.javadoc_do_not_separate_block_tags" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/> <setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> <setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/> - <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/> - <setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case_after_arrow" value="end_of_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="49"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/> + <setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="2"/> + <setting id="org.eclipse.jdt.core.formatter.align_arrows_in_switch_on_columns" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="49"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="49"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="49"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.join_line_comments" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_if_empty"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="49"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/> <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line"/> <setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/> - <setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> - <setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/> <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/> <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/> - <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/> - <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/> <setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> From 302d975fe49f4e4cc06639dec48619ff6bb9c2b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 31 Jul 2025 16:42:01 +0200 Subject: [PATCH 306/382] Refactored CodeSystem string constants in ConstantsPing to be available in CodeSystem.[CodeSystemName].Code and CodeSystem URLs to be available in CodeSystem.[CodeSystemName].URL --- src/main/java/dev/dsf/bpe/CodeSystem.java | 272 ++++++++++++++++++ src/main/java/dev/dsf/bpe/ConstantsPing.java | 61 ---- src/main/java/dev/dsf/bpe/ProcessError.java | 15 +- .../PingPongDeploymentStateListener.java | 52 ---- .../bpe/mail/AggregateErrorMailService.java | 3 +- .../dsf/bpe/message/CleanupPongMessage.java | 3 +- .../dev/dsf/bpe/message/SendPingMessage.java | 5 +- .../dev/dsf/bpe/message/SendPongMessage.java | 6 +- .../dev/dsf/bpe/message/SendStartPing.java | 13 +- .../java/dev/dsf/bpe/service/Cleanup.java | 12 +- .../bpe/service/GenerateAndStoreResource.java | 11 +- .../bpe/service/SetDownloadResourceSize.java | 5 +- .../autostart/SetTargetAndConfigureTimer.java | 5 +- .../bpe/service/ping/CheckPingTaskStatus.java | 24 +- .../dev/dsf/bpe/service/ping/CleanupPing.java | 4 +- ...adResourceAndMeasureSpeedInSubProcess.java | 4 +- .../ping/GenerateAndStoreResourcePing.java | 4 +- .../dev/dsf/bpe/service/ping/SavePong.java | 6 +- .../bpe/service/ping/SelectPingTargets.java | 5 +- .../dsf/bpe/service/ping/StoreResults.java | 10 +- .../dev/dsf/bpe/service/pong/CleanupPong.java | 4 +- .../pong/DownloadResourceAndMeasureSpeed.java | 4 +- .../pong/GenerateAndStoreResourcePong.java | 4 +- .../dev/dsf/bpe/service/pong/LogPing.java | 6 +- .../bpe/service/pong/SaveTimeoutError.java | 5 +- .../service/pong/SetEndpointIdentifier.java | 5 +- .../bpe/service/pong/StoreDownloadSpeed.java | 7 +- .../dev/dsf/bpe/service/pong/StoreErrors.java | 6 +- .../bpe/service/pong/StoreUploadSpeed.java | 13 +- .../dev/dsf/bpe/spring/config/PingConfig.java | 32 ++- .../bpe/util/BinaryResourceDownloader.java | 23 +- .../util/CodeSystemDsfPingUnitsConverter.java | 15 + src/main/java/dev/dsf/bpe/util/Process.java | 11 - .../dsf/bpe/util/ReadAccessTagGenerator.java | 3 +- .../bpe/util/task/NetworkSpeedCalculator.java | 11 +- .../bpe/util/task/SendTaskErrorConverter.java | 34 +-- .../bpe/util/task/input/ErrorInputParser.java | 6 +- .../DownloadResourceReferenceGenerator.java | 5 +- .../DownloadResourceSizeGenerator.java | 5 +- .../generator/DownloadedBytesGenerator.java | 5 +- .../DownloadedDurationMillisGenerator.java | 6 +- .../ErrorInputComponentGenerator.java | 4 +- .../NetworkSpeedMetricGenerator.java | 10 +- .../ErrorOutputComponentGenerator.java | 4 +- .../output/generator/PingStatusGenerator.java | 103 ++++--- .../start/PingTtpsFromDic1ExampleStarter.java | 5 +- ...utostartPing3DicFromTtpExampleStarter.java | 10 +- .../dsf/fhir/profiles/TaskProfileTest.java | 45 ++- .../dev/dsf/library/ProcessErrorTest.java | 27 +- 49 files changed, 565 insertions(+), 373 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/CodeSystem.java delete mode 100644 src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java create mode 100644 src/main/java/dev/dsf/bpe/util/CodeSystemDsfPingUnitsConverter.java delete mode 100644 src/main/java/dev/dsf/bpe/util/Process.java diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java new file mode 100644 index 00000000..40570364 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -0,0 +1,272 @@ +package dev.dsf.bpe; + +public final class CodeSystem +{ + private CodeSystem() + { + } + + interface SingleStringValueEnum + { + String getValue(); + } + + protected static class SingleStringValueEnumParser<T extends Enum<T> & SingleStringValueEnum> + { + private final Class<T> enumClass; + + public SingleStringValueEnumParser(Class<T> enumClass) + { + this.enumClass = enumClass; + } + + public T ofValue(String value) + { + try + { + return T.valueOf(enumClass, value); + } + catch (IllegalArgumentException e) + { + for (T t : enumClass.getEnumConstants()) + { + if (t.getValue().equals(value)) + { + return t; + } + } + throw new IllegalArgumentException("Unable to convert " + value + " to " + enumClass.getName()); + } + } + } + + + public static final class DsfPing + { + public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-v2"; + + private DsfPing() + { + } + + public enum Code implements SingleStringValueEnum + { + PING_STATUS("ping-status"), + PONG_STATUS("pong-status"), + ENDPOINT_IDENTIFIER("endpoint-identifier"), + TARGET_ENDPOINTS("target-endpoints"), + TIMER_INTERVAL("timer-interval"), + DOWNLOAD_RESOURCE_SIZE_BYTES("download-resource-size-bytes"), + DOWNLOADED_DURATION_MILLIS("downloaded-duration-millis"), + DOWNLOADED_BYTES("downloaded-bytes"), + DOWNLOAD_RESOURCE_REFERENCE("download-resource-reference"), + ERROR("error"); + + private final String value; + + Code(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + + public static Code ofValue(String value) + { + return new SingleStringValueEnumParser<>(Code.class).ofValue(value); + } + } + } + + public static final class DsfPingStatus + { + public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-status-v2"; + + private DsfPingStatus() + { + } + + public enum Code implements SingleStringValueEnum + { + COMPLETED("completed"), + PENDING("pending"), + ERROR("error"); + + private final String value; + + Code(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + + public static Code ofValue(String value) + { + return new SingleStringValueEnumParser<>(Code.class).ofValue(value); + } + } + + } + + public static final class DsfPingProcesses + { + public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-processes-v2"; + + private DsfPingProcesses() + { + } + + public enum Code implements SingleStringValueEnum + { + PING("ping"), + PONG("pong"); + + private final String value; + + Code(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + + public static Code ofValue(String value) + { + return new SingleStringValueEnumParser<>(Code.class).ofValue(value); + } + } + } + + public static final class DsfPingProcessSteps + { + public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2"; + + private DsfPingProcessSteps() + { + } + + public enum Code implements SingleStringValueEnum + { + SET_DOWNLOAD_RESOURCE_SIZE("set-download-resource-size"), + GENERATE_AND_STORE_RESOURCE("generate-and-store-resource"), + LOG_AND_SAVE_ERROR("log-and-save-error"), + SELECT_TARGETS("select-targets"), + PING("ping"), + LOG_AND_SAVE_SEND_ERROR("log-and-save-send-error"), + LOG_AND_SAVE_NO_RESPONSE("log-and-save-no-response"), + SAVE_PONG("save-pong"), + DOWNLOAD_RESOURCE_AND_MEASURE_SPEED("download-resource-and-measure-speed"), + CLEANUP_PONG("cleanup-pong"), + CLEANUP("cleanup"), + STORE_RESULTS("store-results"), + LOG_PING("log-ping"), + SET_ENDPOINT_IDENTIFIER("set-endpoint-identifier"), + SELECT_PONG_TARGET("select-pong-target"), + STORE_DOWNLOAD_SPEED("store-download-speed"), + LOG_AND_SAVE_AND_STORE_ERROR("log-and-save-and-store-error"), + ESTIMATE_CLEANUP_TIMER_DURATION("estimate-cleanup-timer-duration"), + PONG("pong"), + STORE_UPLOAD_SPEED("store-upload-speed"), + SAVE_TIMEOUT_ERROR("save-timeout-error"), + STORE_ERRORS("store-errors"), + CLEANUP_TIMER_CATCH_EVENT("cleanup-timer-catch-event"), + PONG_MESSAGE_TIMEOUT_TIMER_CATCH_EVENT("pong-timer-catch-event"), + CHECK_PING_TASK_STATUS("check-ping-task-status"); + + private final String value; + + Code(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + + public static Code ofValue(String value) + { + return new SingleStringValueEnumParser<>(Code.class).ofValue(value); + } + } + } + + public static final class DsfPingUnits + { + public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-units-v2"; + + private DsfPingUnits() + { + } + + public enum Code implements SingleStringValueEnum + { + BITS_PER_SECOND("bits-per-second"), + BYTES_PER_SECOND("bytes-per-second"), + MEGABITS_PER_SECOND("megabits-per-second"), + MEGABYTES_PER_SECOND("megabytes-per-second"); + + private final String value; + + Code(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + + public static Code ofValue(String value) + { + return new SingleStringValueEnumParser<>(Code.class).ofValue(value); + } + } + } + + public static final class ReadAccessTag + { + public static final String URL = "http://dsf.dev/fhir/CodeSystem/read-access-tag"; + + private ReadAccessTag() + { + } + + public enum Code implements SingleStringValueEnum + { + ALL("ALL"), + LOCAL("LOCAL"), + ORGANIZATION("ORGANIZATION"), + ROLE("ROLE"); + + private final String value; + + Code(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + + public static Code ofValue(String value) + { + return new SingleStringValueEnumParser<>(Code.class).ofValue(value); + } + } + } +} diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index d269836b..c56bda27 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -45,67 +45,6 @@ private ConstantsPing() public static final String PROFILE_DSF_TASK_CLEANUP_PONG_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PONG; public static final String PROFILE_DSF_TASK_CLEANUP_PONG_MESSAGE_NAME = "cleanupPong"; - public static final String CODESYSTEM_DSF_PING = "http://dsf.dev/fhir/CodeSystem/ping-v2"; - public static final String CODESYSTEM_DSF_PING_VALUE_PING_STATUS = "ping-status"; - public static final String CODESYSTEM_DSF_PING_VALUE_PONG_STATUS = "pong-status"; - public static final String CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER = "endpoint-identifier"; - public static final String CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS = "target-endpoints"; - public static final String CODESYSTEM_DSF_PING_VALUE_TIMER_INTERVAL = "timer-interval"; - public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES = "download-resource-size-bytes"; - public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS = "downloaded-duration-millis"; - public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES = "downloaded-bytes"; - public static final String CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE = "download-resource-reference"; - public static final String CODESYSTEM_DSF_PING_VALUE_ERROR = "error"; - - public static final String CODESYSTEM_DSF_PING_STATUS = "http://dsf.dev/fhir/CodeSystem/ping-status-v2"; - public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED = "completed"; - public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_PENDING = "pending"; - public static final String CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR = "error"; - - public static final String CODESYSTEM_DSF_PING_PROCESSES = "http://dsf.dev/fhir/CodeSystem/ping-processes-v2"; - public static final String CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING = "ping"; - public static final String CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG = "pong"; - - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS = "http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SET_DOWNLOAD_RESOURCE_SIZE = "set-download-resource-size"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_GENERATE_AND_STORE_RESOURCE = "generate-and-store-resource"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_LOG_AND_SAVE_ERROR = "log-and-save-error"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SELECT_TARGETS = "select-targets"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING = "ping"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_LOG_AND_SAVE_SEND_ERROR = "log-and-save-send-error"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_LOG_AND_SAVE_NO_RESPONSE = "log-and-save-no-response"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SAVE_PONG = "save-pong"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED = "download-resource-and-measure-speed"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP_PONG = "cleanup-pong"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP = "cleanup"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_STORE_RESULTS = "store-results"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_LOG_PING = "log-ping"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SET_ENDPOINT_IDENTIFIER = "set-endpoint-identifier"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SELECT_PONG_TARGET = "select-pong-target"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_STORE_DOWNLOAD_SPEED = "store-download-speed"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_LOG_AND_SAVE_AND_STORE_ERROR = "log-and-save-and-store-error"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_ESTIMATE_CLEANUP_TIMER_DURATION = "estimate-cleanup-timer-duration"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PONG = "pong"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_STORE_UPLOAD_SPEED = "store-upload-speed"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_SAVE_TIMEOUT_ERROR = "save-timeout-error"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_STORE_ERRORS = "store-errors"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP_TIMER_CATCH_EVENT = "cleanup-timer-catch-event"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PONG_MESSAGE_TIMEOUT_TIMER_CATCH_EVENT = "pong-timer-catch-event"; - public static final String CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS = "check-ping-task-status"; - - public static final String CODESYSTEM_DSF_PING_UNITS = "http://dsf.dev/fhir/CodeSystem/ping-units-v2"; - public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND = "bits-per-second"; - public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND = "bytes-per-second"; - public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND = "megabits-per-second"; - public static final String CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND = "megabytes-per-second"; - - public static final List<String> CODESYSTEM_DSF_PING_UNITS_VALUES = List.of( - CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND, CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND, - CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND, CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND); - - public static final String CODESYSTEM_READ_ACCESS_TAG = "http://dsf.dev/fhir/CodeSystem/read-access-tag"; - public static final String CODESYSTEM_READ_ACCESS_TAG_VALUE_ALL = "ALL"; - public static final String STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"; public static final String STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; public static final String STRUCTURE_DEFINITION_URL_EXTENSION_ERROR = "http://dsf.dev/fhir/StructureDefinition/extension-error"; diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 5d5b1ed8..7ccbdc5f 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -13,8 +13,10 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -public record ProcessError(String process, String processStep, String action, String potentialFixUrl, String message) - implements Serializable +import dev.dsf.bpe.util.CodeSystemDsfPingUnitsConverter; + +public record ProcessError(CodeSystem.DsfPingProcesses.Code process, CodeSystem.DsfPingProcessSteps.Code processStep, + String action, String potentialFixUrl, String message) implements Serializable { @Override public boolean equals(Object obj) @@ -37,9 +39,9 @@ public static Extension toExtension(ProcessError error) extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, error.process(), null)); + .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, error.process().getValue(), null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, error.process(), null)); + .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, error.process().getValue(), null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(error.action())); if (Objects.nonNull(error.potentialFixUrl)) { @@ -75,7 +77,10 @@ public static ProcessError toError(Extension extension) Objects.requireNonNull(messageExtension); String message = ((StringType) messageExtension.getValue()).getValue(); - return new ProcessError(process, processStep, action, potentialFixUrl, message); + CodeSystem.DsfPingProcesses.Code processCode = CodeSystem.DsfPingProcesses.Code.ofValue(process); + CodeSystem.DsfPingProcessSteps.Code stepCode = CodeSystem.DsfPingProcessSteps.Code.ofValue(processStep); + + return new ProcessError(processCode, stepCode, action, potentialFixUrl, message); } public static String toString(List<ProcessError> errors) throws JsonProcessingException diff --git a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java b/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java deleted file mode 100644 index ef61cbcf..00000000 --- a/src/main/java/dev/dsf/bpe/listener/PingPongDeploymentStateListener.java +++ /dev/null @@ -1,52 +0,0 @@ -package dev.dsf.bpe.listener; - -import java.util.List; -import java.util.Objects; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.InitializingBean; - -import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.spring.config.PingConfig; -import dev.dsf.bpe.v1.ProcessPluginDeploymentStateListener; - -public class PingPongDeploymentStateListener implements ProcessPluginDeploymentStateListener, InitializingBean -{ - private static final Logger logger = LoggerFactory.getLogger(PingPongDeploymentStateListener.class); - - private final PingConfig pingConfig; - private final String networkSpeedUnit; - - public PingPongDeploymentStateListener(PingConfig pingConfig) - { - this.pingConfig = pingConfig; - this.networkSpeedUnit = pingConfig.getNetworkSpeedUnit(); - } - - @Override - public void onProcessesDeployed(List<String> processes) - { - logger.debug("Validating plugin configuration..."); - if (ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES.contains(networkSpeedUnit)) - { - logger.debug("Network speed unit is valid: {}", networkSpeedUnit); - } - else - { - pingConfig.setNetworkSpeedUnit(ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND); - logger.debug("Network speed unit \"{}\" is not valid. Valid values are: {}. Defaulting to \"{}\"", - networkSpeedUnit, ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUES, - ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND); - } - - logger.debug("Configuration validation complete."); - } - - @Override - public void afterPropertiesSet() throws Exception - { - Objects.requireNonNull(networkSpeedUnit); - Objects.requireNonNull(pingConfig); - } -} diff --git a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java index aced3fdb..4304fea7 100644 --- a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java +++ b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java @@ -7,6 +7,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -71,7 +72,7 @@ protected String createMessage(Target target, ProcessError error) if (error != null && error.process() != null) { - if (ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING.equals(error.process())) + if (CodeSystem.DsfPingProcesses.Code.PING.getValue().equals(error.process())) { b.append(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().orElse("?")); b.append('/'); diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 4db03d7b..44bd1fc3 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; @@ -63,7 +64,7 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab { execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), ProcessError.toString(error)); execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); + CodeSystem.DsfPing.Code.ERROR.getValue()); } catch (JsonProcessingException e) { diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index bc561c1c..a6d1f23c 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.core.JsonProcessingException; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; @@ -50,7 +51,7 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut .of(DownloadResourceSizeGenerator.create(downloadResourceSizeBytes)); Stream<ParameterComponent> endpointIdentifierStream = Stream.of(api.getTaskHelper().createInput( new Reference().setIdentifier(getLocalEndpointIdentifier()).setType(ResourceType.Endpoint.name()), - ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER)); + CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.ENDPOINT_IDENTIFIER.getValue())); return Stream.concat(endpointIdentifierStream, Stream.concat(downloadResourceReferenceStream, downloadResourceSizeBytesStream)); @@ -89,7 +90,7 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab { execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), ProcessError.toString(error)); execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); + CodeSystem.DsfPing.Code.ERROR.getValue()); } catch (JsonProcessingException e) { diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index 5083bbd8..2d154141 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -7,6 +7,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; @@ -98,9 +99,8 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab "Sending pong message to " + target.getEndpointUrl()); ErrorListUtils.add(error, execution); - PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); - variables.setString(ExecutionVariables.STATUS_CODE.getValue(), - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); + PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.ERROR); + variables.setString(ExecutionVariables.STATUS_CODE.getValue(), CodeSystem.DsfPing.Code.ERROR.getValue()); variables.updateTask(startTask); logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); diff --git a/src/main/java/dev/dsf/bpe/message/SendStartPing.java b/src/main/java/dev/dsf/bpe/message/SendStartPing.java index c7cdeadc..8bb4c9b5 100644 --- a/src/main/java/dev/dsf/bpe/message/SendStartPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendStartPing.java @@ -7,6 +7,7 @@ import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.ParameterComponent; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; @@ -24,10 +25,10 @@ public SendStartPing(ProcessPluginApi api) protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { return Stream.concat( - variables.getStartTask().getInput().stream().filter(Task.ParameterComponent::hasType).filter(i -> i - .getType().getCoding().stream() - .anyMatch(c -> ConstantsPing.CODESYSTEM_DSF_PING.equals(c.getSystem()) - && ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS.equals(c.getCode()))), + variables.getStartTask().getInput().stream().filter(Task.ParameterComponent::hasType) + .filter(i -> i.getType().getCoding().stream() + .anyMatch(c -> CodeSystem.DsfPing.URL.equals(c.getSystem()) + && CodeSystem.DsfPing.Code.TARGET_ENDPOINTS.getValue().equals(c.getCode()))), Stream.of(getDownloadResourceSizeInputParameter(variables))); } @@ -40,8 +41,8 @@ private ParameterComponent getDownloadResourceSizeInputParameter(Variables varia private boolean isDownloadResourceSizeParameter(ParameterComponent parameterComponent) { return parameterComponent.getType().getCoding().stream() - .anyMatch(t -> ConstantsPing.CODESYSTEM_DSF_PING.equals(t.getSystem()) - && ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES.equals(t.getCode())); + .anyMatch(t -> CodeSystem.DsfPing.URL.equals(t.getSystem()) + && CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue().equals(t.getCode())); } @Override diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index e906fdf7..1b2248fd 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -6,12 +6,12 @@ import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.IdType; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.service.pong.CleanupPong; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.Process; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Variables; @@ -22,9 +22,9 @@ public class Cleanup { private final ProcessPluginApi api; - private final dev.dsf.bpe.util.Process process; + private final CodeSystem.DsfPingProcesses.Code process; - public Cleanup(ProcessPluginApi api, Process process) + public Cleanup(ProcessPluginApi api, CodeSystem.DsfPingProcesses.Code process) { this.api = api; this.process = process; @@ -50,8 +50,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) { if (e.getCause() instanceof SocketTimeoutException) { - ProcessError error = new ProcessError(process.toString(), - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP, + ProcessError error = new ProcessError(process, CodeSystem.DsfPingProcessSteps.Code.CLEANUP, ConstantsPing.CLEANUP_ERROR_ACTION, ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT, e.getCause().getMessage()); ErrorListUtils.add(error, delegateExecution); @@ -63,8 +62,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) } catch (WebApplicationException e) { - ProcessError error = new ProcessError(process.toString(), - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP, + ProcessError error = new ProcessError(process, CodeSystem.DsfPingProcessSteps.Code.CLEANUP, ConstantsPing.CLEANUP_ERROR_ACTION, ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, "Response from local DSF FHIR server: " + e.getResponse().getStatus()); ErrorListUtils.add(error, delegateExecution); diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index f9b3f07a..d9ef5baa 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -4,10 +4,10 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.IdType; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; -import dev.dsf.bpe.util.Process; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Variables; @@ -17,9 +17,10 @@ public class GenerateAndStoreResource { private final ProcessPluginApi api; private final long maxUploadSizeBytes; - private final Process process; + private final CodeSystem.DsfPingProcesses.Code process; - public GenerateAndStoreResource(ProcessPluginApi api, long maxUploadSizeBytes, Process process) + public GenerateAndStoreResource(ProcessPluginApi api, long maxUploadSizeBytes, + CodeSystem.DsfPingProcesses.Code process) { this.api = api; this.maxUploadSizeBytes = maxUploadSizeBytes; @@ -60,8 +61,8 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) catch (WebApplicationException e) { String status = String.valueOf(e.getResponse().getStatus()); - ProcessError error = new ProcessError(process.toString(), - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_GENERATE_AND_STORE_RESOURCE, + ProcessError error = new ProcessError(process, + CodeSystem.DsfPingProcessSteps.Code.GENERATE_AND_STORE_RESOURCE, "Storing Binary resource on local DSF FHIR server.", ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, "Local DSF FHIR server responded with status: " + status); variables.setString(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue(), ProcessError.toString(error)); diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index 97019261..111453c1 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -6,6 +6,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.DecimalType; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -38,8 +39,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable private long getDownloadResourceSize(Variables variables) { Optional<DecimalType> downloadResourceSizeType = api.getTaskHelper().getFirstInputParameterValue( - variables.getStartTask(), ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, DecimalType.class); + variables.getStartTask(), CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), DecimalType.class); return downloadResourceSizeType.map(decimalType -> decimalType.getValue().longValue()).orElseGet( () -> Math.min(maxDownloadResourceSizeBytes, ConstantsPing.DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT)); diff --git a/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java b/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java index 18ec38d3..2bb9c5be 100644 --- a/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java +++ b/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java @@ -5,6 +5,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -36,8 +37,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw private String getTimerInterval(Variables variables) { return api.getTaskHelper() - .getFirstInputParameterStringValue(variables.getStartTask(), ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TIMER_INTERVAL) + .getFirstInputParameterStringValue(variables.getStartTask(), CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.TIMER_INTERVAL.getValue()) .orElse(ConstantsPing.TIMER_INTERVAL_DEFAULT_VALUE); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index 85bf4f56..7f7bf8ff 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -7,6 +7,7 @@ import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; @@ -47,16 +48,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task pingTask = fhirWebserviceClient.withRetry(3, 1000).read(Task.class, taskId); switch (pingTask.getStatus()) { - case REQUESTED, INPROGRESS, FAILED, - COMPLETED -> - error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, - "Awaiting pong message", null, - "Pong message timed out. Status of ping task resource with id " + taskId + " from " - + target.getEndpointUrl() + " is " + pingTask.getStatus()); - default -> error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, - "Awaiting pong message", null, + case REQUESTED, INPROGRESS, FAILED, COMPLETED -> error = new ProcessError( + CodeSystem.DsfPingProcesses.Code.PING, + CodeSystem.DsfPingProcessSteps.Code.CHECK_PING_TASK_STATUS, "Awaiting pong message", null, + "Pong message timed out. Status of ping task resource with id " + taskId + " from " + + target.getEndpointUrl() + " is " + pingTask.getStatus()); + default -> error = new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, + CodeSystem.DsfPingProcessSteps.Code.CHECK_PING_TASK_STATUS, "Awaiting pong message", null, "Pong message timed out. Status of ping task resource with id " + taskId + " from " + target.getEndpointUrl() + " is " + pingTask.getStatus() + ". Unexpected status. Should be either of " + Task.TaskStatus.REQUESTED + ", " @@ -68,14 +66,14 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } catch (WebApplicationException e) { - error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CHECK_PING_TASK_STATUS, + error = new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, + CodeSystem.DsfPingProcessSteps.Code.CHECK_PING_TASK_STATUS, "Pong message timed out. Error when retrieving status of ping task resource with id " + taskId + " from " + target.getEndpointUrl(), ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, e.getMessage()); } ErrorListUtils.add(error, delegateExecution, correlationKey); logger.debug("Saved '{}' to process execution for correlation key '{}'", - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR, correlationKey); + CodeSystem.DsfPing.Code.ERROR.getValue(), correlationKey); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java b/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java index 954a59bc..7efb751f 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java @@ -3,8 +3,8 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.service.Cleanup; -import dev.dsf.bpe.util.Process; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -16,7 +16,7 @@ public class CleanupPing extends AbstractServiceDelegate public CleanupPing(ProcessPluginApi api) { super(api); - delegate = new Cleanup(api, Process.PING); + delegate = new Cleanup(api, CodeSystem.DsfPingProcesses.Code.PING); } @Override diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 046267c6..35295318 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -4,6 +4,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.BinaryResourceDownloader; @@ -36,8 +37,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING) - .download(variables, api, task, maxDownloadSizeBytes); + CodeSystem.DsfPingProcesses.Code.PING).download(variables, api, task, maxDownloadSizeBytes); if (downloadResult.getError() == null) { diff --git a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java index d08b5a8e..77e72ee6 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java @@ -3,8 +3,8 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.service.GenerateAndStoreResource; -import dev.dsf.bpe.util.Process; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -16,7 +16,7 @@ public class GenerateAndStoreResourcePing extends AbstractServiceDelegate public GenerateAndStoreResourcePing(ProcessPluginApi api, long maxUploadSizeBytes) { super(api); - delegate = new GenerateAndStoreResource(api, maxUploadSizeBytes, Process.PING); + delegate = new GenerateAndStoreResource(api, maxUploadSizeBytes, CodeSystem.DsfPingProcesses.Code.PING); } @Override diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index fb82c517..36c479ac 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -8,6 +8,7 @@ import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; @@ -39,15 +40,14 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task pong = variables.getLatestTask(); Optional<DecimalType> optDownloadedDurationMillis = api.getTaskHelper().getFirstInputParameterValue(pong, - ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, + CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue(), DecimalType.class); optDownloadedDurationMillis.ifPresent(decimalType -> variables.setLong( ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), decimalType.getValue().longValue())); Optional<DecimalType> optDownloadedBytes = api.getTaskHelper().getFirstInputParameterValue(pong, - ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, - DecimalType.class); + CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue(), DecimalType.class); optDownloadedBytes.ifPresent(decimalType -> variables.setLong( ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), decimalType.getValue().longValue())); diff --git a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java index 28563877..2f43220c 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java @@ -26,6 +26,7 @@ import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponentsBuilder; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -78,8 +79,8 @@ private Optional<UriComponents> getTargetEndpointsSearchParameter(Variables vari { Task mainTask = variables.getStartTask(); return api.getTaskHelper() - .getFirstInputParameterStringValue(mainTask, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS) + .getFirstInputParameterStringValue(mainTask, CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.TARGET_ENDPOINTS.getValue()) .map(requestUrl -> UriComponentsBuilder.fromUriString(requestUrl).build()); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index c61f30aa..ea624575 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -10,6 +10,7 @@ import org.hl7.fhir.r4.model.Task; import org.springframework.beans.factory.InitializingBean; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; @@ -28,9 +29,10 @@ public class StoreResults extends AbstractServiceDelegate implements InitializingBean { private final AggregateErrorMailService errorMailService; - private final String networkSpeedUnit; + private final CodeSystem.DsfPingUnits.Code networkSpeedUnit; - public StoreResults(ProcessPluginApi api, AggregateErrorMailService errorMailService, String networkSpeedUnit) + public StoreResults(ProcessPluginApi api, AggregateErrorMailService errorMailService, + CodeSystem.DsfPingUnits.Code networkSpeedUnit) { super(api); this.networkSpeedUnit = networkSpeedUnit; @@ -62,8 +64,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw String correlationKey = target.getCorrelationKey(); List<ProcessError> errors = ErrorListUtils.getErrorMessageList(execution, correlationKey); - String statusCode = errors.isEmpty() ? ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED - : ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR; + CodeSystem.DsfPingStatus.Code statusCode = errors.isEmpty() ? CodeSystem.DsfPingStatus.Code.COMPLETED + : CodeSystem.DsfPingStatus.Code.ERROR; long downloadResourceSizeBytes = variables .getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); List<ProcessError> errorMessageList = ErrorListUtils.getErrorMessageList(execution, correlationKey); diff --git a/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java b/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java index 2540e4e3..80374a44 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java @@ -3,8 +3,8 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.service.Cleanup; -import dev.dsf.bpe.util.Process; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -16,7 +16,7 @@ public class CleanupPong extends AbstractServiceDelegate public CleanupPong(ProcessPluginApi api) { super(api); - delegate = new Cleanup(api, Process.PONG); + delegate = new Cleanup(api, CodeSystem.DsfPingProcesses.Code.PONG); } @Override diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 22a9fcea..0c6ca47b 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -4,6 +4,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.BinaryResourceDownloader; @@ -31,8 +32,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task task = variables.getStartTask(); BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG) - .download(variables, api, task, maxDownloadSizeBytes); + CodeSystem.DsfPingProcesses.Code.PONG).download(variables, api, task, maxDownloadSizeBytes); if (downloadResult.getError() == null) { diff --git a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java index 7c728718..50945142 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java @@ -3,8 +3,8 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.service.GenerateAndStoreResource; -import dev.dsf.bpe.util.Process; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -16,7 +16,7 @@ public class GenerateAndStoreResourcePong extends AbstractServiceDelegate public GenerateAndStoreResourcePong(ProcessPluginApi api, long maxUploadSizeBytes) { super(api); - this.delegate = new GenerateAndStoreResource(api, maxUploadSizeBytes, Process.PONG); + this.delegate = new GenerateAndStoreResource(api, maxUploadSizeBytes, CodeSystem.DsfPingProcesses.Code.PONG); } @Override diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogPing.java b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java index 54ce1e91..54d97e1a 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogPing.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java @@ -6,7 +6,7 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; -import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -33,8 +33,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw private String getEndpointIdentifierValue(Task task) { return api.getTaskHelper() - .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER, Reference.class) + .getFirstInputParameterValue(task, CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.ENDPOINT_IDENTIFIER.getValue(), Reference.class) .map(Reference::getIdentifier).map(Identifier::getValue).get(); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java index c6248994..4f6fa988 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java @@ -4,6 +4,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; @@ -28,8 +29,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(SaveTimeoutError.class, startTask); logger.debug("Storing timeout error..."); - ProcessError error = new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PONG, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_CLEANUP_TIMER_CATCH_EVENT, + ProcessError error = new ProcessError(CodeSystem.DsfPingProcesses.Code.PONG, + CodeSystem.DsfPingProcessSteps.Code.CLEANUP_TIMER_CATCH_EVENT, "Waiting for cleanup message from " + target.getOrganizationIdentifierValue(), null, "Timeout while waiting for cleanup message"); diff --git a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java index e25b6d68..eeedaf63 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java @@ -6,6 +6,7 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -36,8 +37,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw private String getEndpointIdentifierValue(Task task) { return api.getTaskHelper() - .getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER, Reference.class) + .getFirstInputParameterValue(task, CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.ENDPOINT_IDENTIFIER.getValue(), Reference.class) .map(Reference::getIdentifier).map(Identifier::getValue).get(); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 41c15368..dae4b9d4 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -6,6 +6,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -17,9 +18,9 @@ public class StoreDownloadSpeed extends AbstractServiceDelegate { - private final String networkSpeedUnit; + private final CodeSystem.DsfPingUnits.Code networkSpeedUnit; - public StoreDownloadSpeed(ProcessPluginApi api, String networkSpeedUnit) + public StoreDownloadSpeed(ProcessPluginApi api, CodeSystem.DsfPingUnits.Code networkSpeedUnit) { super(api); this.networkSpeedUnit = networkSpeedUnit; @@ -38,7 +39,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit); - PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_PENDING); + PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.PENDING); PingStatusGenerator.updatePongStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); variables.updateTask(startTask); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java index bec6dc69..1f5e57ad 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java @@ -6,6 +6,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; @@ -34,12 +35,11 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw if (!errors.isEmpty()) { - PingStatusGenerator.updatePongStatusOutput(startTask, ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR); + PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.ERROR); } else { - PingStatusGenerator.updatePongStatusOutput(startTask, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED); + PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.COMPLETED); } variables.updateTask(startTask); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index debb2967..f7b760c9 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -9,6 +9,7 @@ import org.hl7.fhir.r4.model.PrimitiveType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; @@ -19,9 +20,9 @@ public class StoreUploadSpeed extends AbstractServiceDelegate { - private final String networkSpeedUnit; + private final CodeSystem.DsfPingUnits.Code networkSpeedUnit; - public StoreUploadSpeed(ProcessPluginApi api, String networkSpeedUnit) + public StoreUploadSpeed(ProcessPluginApi api, CodeSystem.DsfPingUnits.Code networkSpeedUnit) { super(api); this.networkSpeedUnit = networkSpeedUnit; @@ -53,13 +54,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable private Optional<DecimalType> getUploadedBytes(Task task) { - return api.getTaskHelper().getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, DecimalType.class); + return api.getTaskHelper().getFirstInputParameterValue(task, CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue(), DecimalType.class); } private Optional<DecimalType> getUploadedDurationMillis(Task task) { - return api.getTaskHelper().getFirstInputParameterValue(task, ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, DecimalType.class); + return api.getTaskHelper().getFirstInputParameterValue(task, CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue(), DecimalType.class); } } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 8bd37035..271be2ac 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -1,13 +1,20 @@ package dev.dsf.bpe.spring.config; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; +import org.springframework.core.convert.ConversionService; +import org.springframework.core.convert.converter.Converter; +import org.springframework.core.convert.converter.ConverterRegistry; +import org.springframework.core.convert.support.DefaultConversionService; -import dev.dsf.bpe.listener.PingPongDeploymentStateListener; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.listener.SetCorrelationKeyListener; import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.message.CleanupPongMessage; @@ -38,6 +45,7 @@ import dev.dsf.bpe.service.pong.StoreDownloadSpeed; import dev.dsf.bpe.service.pong.StoreErrors; import dev.dsf.bpe.service.pong.StoreUploadSpeed; +import dev.dsf.bpe.util.CodeSystemDsfPingUnitsConverter; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; @@ -67,14 +75,14 @@ public class PingConfig @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values be: \"bits-per-second\", \"bytes-per-second\", \"megabits-per-second\", \"megabytes-per-second\". Default is \"megabytes-per-second\".", processNames = { "dsfdev_ping", "dsfdev_pong" }) @Value("${dev.dsf.bpe.ping.networkSpeedUnit:megabits-per-second}") - private String networkSpeedUnit; + private CodeSystem.DsfPingUnits.Code networkSpeedUnit; - public String getNetworkSpeedUnit() + public CodeSystem.DsfPingUnits.Code getNetworkSpeedUnit() { return networkSpeedUnit; } - public void setNetworkSpeedUnit(String networkSpeedUnit) + public void setNetworkSpeedUnit(CodeSystem.DsfPingUnits.Code networkSpeedUnit) { this.networkSpeedUnit = networkSpeedUnit; } @@ -266,13 +274,6 @@ public SetEndpointIdentifier setEndpointIdentifier() return new SetEndpointIdentifier(api); } - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public PingPongDeploymentStateListener pingPongDeploymentStateListener() - { - return new PingPongDeploymentStateListener(this); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public StoreDownloadSpeed storeDownloadSpeed() @@ -328,4 +329,13 @@ public LogAndSaveUploadErrorPong logAndSaveUploadErrorPong() { return new LogAndSaveUploadErrorPong(api); } + + @Bean + public static ConversionService conversionService() + { + DefaultConversionService conversionService = new DefaultConversionService(); + DefaultConversionService.addDefaultConverters(conversionService); + conversionService.addConverter(new CodeSystemDsfPingUnitsConverter()); + return conversionService; + } } diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index ecbae470..2b2d248b 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -9,6 +9,7 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; @@ -21,9 +22,9 @@ public class BinaryResourceDownloader { private final PingPongLogger logger; - private final String process; + private final CodeSystem.DsfPingProcesses.Code process; - public BinaryResourceDownloader(PingPongLogger logger, String process) + public BinaryResourceDownloader(PingPongLogger logger, CodeSystem.DsfPingProcesses.Code process) { this.logger = logger; this.process = process; @@ -36,13 +37,13 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); Optional<Reference> optDownloadResourceReference = api.getTaskHelper().getFirstInputParameterValue(task, - ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, + CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_REFERENCE.getValue(), Reference.class); if (optDownloadResourceReference.isEmpty()) { ProcessError error = new ProcessError(process, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, + CodeSystem.DsfPingProcessSteps.Code.DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, "Extracting binary resource reference from task " + task.getIdElement().getValue(), null, "No reference provided in task"); downloadResult = new DownloadResult(error); @@ -80,8 +81,8 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t binaryResourceInputStream.close(); String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); ProcessError error = new ProcessError(process, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, - action, null, errorMessage); + CodeSystem.DsfPingProcessSteps.Code.DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, null, + errorMessage); logger.error("Encountered an error while downloading resource: {}", errorMessage); downloadResult = new DownloadResult(error); } @@ -90,7 +91,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t { String errorMessage = (e.getResponse().getStatusInfo().getStatusCode() + " " + e.getMessage()).trim(); ProcessError error = new ProcessError(process, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, + CodeSystem.DsfPingProcessSteps.Code.DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, errorMessage); logger.error("Encountered an error while downloading resource: {}", errorMessage); downloadResult = new DownloadResult(error); @@ -101,8 +102,8 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t { String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); ProcessError error = new ProcessError(process, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, - action, ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT, errorMessage); + CodeSystem.DsfPingProcessSteps.Code.DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT, errorMessage); logger.error("Encountered an error while downloading resource: {}", errorMessage); downloadResult = new DownloadResult(error); } @@ -115,8 +116,8 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t { String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); ProcessError error = new ProcessError(process, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, - null, errorMessage); + CodeSystem.DsfPingProcessSteps.Code.DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, null, + errorMessage); logger.error("Encountered an error while downloading resource: {}", errorMessage); downloadResult = new DownloadResult(error); } diff --git a/src/main/java/dev/dsf/bpe/util/CodeSystemDsfPingUnitsConverter.java b/src/main/java/dev/dsf/bpe/util/CodeSystemDsfPingUnitsConverter.java new file mode 100644 index 00000000..ef09af83 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/CodeSystemDsfPingUnitsConverter.java @@ -0,0 +1,15 @@ +package dev.dsf.bpe.util; + +import org.springframework.core.convert.converter.Converter; +import org.springframework.lang.NonNull; + +import dev.dsf.bpe.CodeSystem; + +public class CodeSystemDsfPingUnitsConverter implements Converter<String, CodeSystem.DsfPingUnits.Code> +{ + @Override + public CodeSystem.DsfPingUnits.Code convert(@NonNull String source) + { + return CodeSystem.DsfPingUnits.Code.ofValue(source); + } +} diff --git a/src/main/java/dev/dsf/bpe/util/Process.java b/src/main/java/dev/dsf/bpe/util/Process.java deleted file mode 100644 index 21b20f40..00000000 --- a/src/main/java/dev/dsf/bpe/util/Process.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.dsf.bpe.util; - -public enum Process -{ - PING, PONG; - - public String toString() - { - return this.name().toLowerCase(); - } -} diff --git a/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java b/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java index cf2c51df..93073a74 100644 --- a/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java @@ -2,6 +2,7 @@ import org.hl7.fhir.r4.model.Coding; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; public class ReadAccessTagGenerator @@ -9,7 +10,7 @@ public class ReadAccessTagGenerator public static Coding create(String accessLevel) { Coding tag = new Coding(); - tag.setSystem(ConstantsPing.CODESYSTEM_READ_ACCESS_TAG); + tag.setSystem(CodeSystem.ReadAccessTag.URL); tag.setCode(accessLevel); return tag; } diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 2e924132..80f29727 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -3,6 +3,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; public final class NetworkSpeedCalculator @@ -11,7 +12,7 @@ private NetworkSpeedCalculator() { } - public static BigDecimal calculate(long bytes, long duration, String unit) + public static BigDecimal calculate(long bytes, long duration, CodeSystem.DsfPingUnits.Code unit) { if (bytes == 0) return BigDecimal.ZERO; @@ -23,23 +24,23 @@ public static BigDecimal calculate(long bytes, long duration, String unit) return switch (unit) { - case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND -> + case BITS_PER_SECOND -> { BigDecimal bits = new BigDecimal(bytes * 8L).setScale(3, RoundingMode.HALF_UP); yield bits.divide(seconds, 2, RoundingMode.HALF_UP); } - case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABITS_PER_SECOND -> + case MEGABITS_PER_SECOND -> { BigDecimal megabits = new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); yield megabits.divide(seconds, 2, RoundingMode.HALF_UP); } - case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BYTES_PER_SECOND -> + case BYTES_PER_SECOND -> { BigDecimal bytesLocal = new BigDecimal(bytes).setScale(3, RoundingMode.HALF_UP); yield bytesLocal.divide(seconds, 2, RoundingMode.HALF_UP); } - case ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_MEGABYTES_PER_SECOND -> + case MEGABYTES_PER_SECOND -> { BigDecimal megabytes = new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); yield megabytes.divide(seconds, 2, RoundingMode.HALF_UP); diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index 927a7fbb..26221b9f 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -10,6 +10,7 @@ import org.apache.http.conn.ConnectTimeoutException; import org.apache.http.conn.HttpHostConnectException; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import jakarta.ws.rs.ProcessingException; @@ -63,45 +64,44 @@ else if (exception instanceof ProcessingException e) private static BiFunction<SSLHandshakeException, String, ProcessError> convertSSLHandshakeException() { - return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, - ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL, e.getMessage()); + return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, + CodeSystem.DsfPingProcessSteps.Code.PING, action, ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL, + e.getMessage()); } private static BiFunction<Exception, String, ProcessError> convertExceptionFallback() { - return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, null, e.getMessage()); + return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, + CodeSystem.DsfPingProcessSteps.Code.PING, action, null, e.getMessage()); } private static BiFunction<ConnectTimeoutException, String, ProcessError> convertConnectTimeoutException() { - return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT, e.getMessage()); + return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, + CodeSystem.DsfPingProcessSteps.Code.PING, action, ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT, + e.getMessage()); } private static BiFunction<WebApplicationException, String, ProcessError> convertWebApplicationException() { - return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, - ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, + return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, + CodeSystem.DsfPingProcessSteps.Code.PING, action, ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, "Response from remote DSF FHIR server: " + e.getResponse().getStatus() + " " + Response.Status.fromStatusCode(e.getResponse().getStatus()).toString()); } private static BiFunction<HttpHostConnectException, String, ProcessError> convertHttpHostConnectException() { - return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED, e.getMessage()); + return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, + CodeSystem.DsfPingProcessSteps.Code.PING, action, ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED, + e.getMessage()); } private static BiFunction<UnknownHostException, String, ProcessError> convertUnknownHostException() { - return (e, action) -> new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, action, - ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST, e.getMessage()); + return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, + CodeSystem.DsfPingProcessSteps.Code.PING, action, ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST, + e.getMessage()); } private static <T extends Throwable> ProcessError applyConverter(T ex, String action) diff --git a/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java b/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java index 9822c482..b1ec7abd 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java @@ -4,6 +4,7 @@ import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; @@ -15,9 +16,8 @@ private ErrorInputParser() public static List<ProcessError> parseInputs(Task task) { - List<Task.ParameterComponent> inputs = task.getInput().stream() - .filter(input -> ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR - .equals(input.getType().getCodingFirstRep().getCode())) + List<Task.ParameterComponent> inputs = task.getInput().stream().filter( + input -> CodeSystem.DsfPing.Code.ERROR.getValue().equals(input.getType().getCodingFirstRep().getCode())) .toList(); return inputs.stream() diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java index b3d3aabf..78c2b7d8 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java @@ -4,6 +4,7 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; public final class DownloadResourceReferenceGenerator @@ -22,8 +23,8 @@ public static Task.ParameterComponent create(String uri) public static Task.ParameterComponent create(Reference reference) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(reference).getType().addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_REFERENCE, null)); + param.setValue(reference).getType().addCoding(new Coding(CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_REFERENCE.getValue(), null)); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java index aaa85c02..31b40c86 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java @@ -4,6 +4,7 @@ import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; public final class DownloadResourceSizeGenerator @@ -15,8 +16,8 @@ private DownloadResourceSizeGenerator() public static Task.ParameterComponent create(long sizeBytes) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(new DecimalType(sizeBytes)).getType().addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES, null)); + param.setValue(new DecimalType(sizeBytes)).getType().addCoding(new Coding(CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), null)); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java index f4892634..8bdcff0c 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java @@ -3,6 +3,7 @@ import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; public final class DownloadedBytesGenerator @@ -14,8 +15,8 @@ private DownloadedBytesGenerator() public static Task.ParameterComponent create(long bytes) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(new DecimalType(bytes)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES); + param.setValue(new DecimalType(bytes)).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue()); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java index 4d8acfbc..bf284c37 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java @@ -3,6 +3,7 @@ import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; public final class DownloadedDurationMillisGenerator @@ -14,9 +15,8 @@ private DownloadedDurationMillisGenerator() public static Task.ParameterComponent create(long durationMillis) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(new DecimalType(durationMillis)).getType().addCoding() - .setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS); + param.setValue(new DecimalType(durationMillis)).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue()); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java index 67e78ca3..77c2bc50 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java @@ -9,6 +9,7 @@ import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; @@ -29,8 +30,7 @@ public static Task.ParameterComponent create(ProcessError error) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.getType().addCoding( - new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR, null)); + param.getType().addCoding(new Coding(CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.ERROR.getValue(), null)); param.addExtension(ProcessError.toExtension(error)); Extension dataAbsentReason = new Extension() .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java index 233163f2..678d3fcf 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java @@ -4,6 +4,7 @@ import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; public final class NetworkSpeedMetricGenerator @@ -15,17 +16,16 @@ private NetworkSpeedMetricGenerator() public static Task.ParameterComponent createDownloadedDurationMillis(long duration) { Task.ParameterComponent downloadedDuration = new Task.ParameterComponent(); - downloadedDuration.setValue(new DecimalType(duration)).getType() - .addCoding(new Coding(ConstantsPing.CODESYSTEM_DSF_PING, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_DURATION_MILLIS, null)); + downloadedDuration.setValue(new DecimalType(duration)).getType().addCoding(new Coding(CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue(), null)); return downloadedDuration; } public static Task.ParameterComponent createDownloadedBytes(long bytes) { Task.ParameterComponent downloadedBytes = new Task.ParameterComponent(); - downloadedBytes.setValue(new DecimalType(bytes)).getType().addCoding(new Coding( - ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOADED_BYTES, null)); + downloadedBytes.setValue(new DecimalType(bytes)).getType().addCoding( + new Coding(CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue(), null)); return downloadedBytes; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java index ed8c61bf..d71d337c 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java @@ -9,6 +9,7 @@ import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; @@ -29,8 +30,7 @@ public static Task.TaskOutputComponent create(ProcessError error) { Task.TaskOutputComponent param = new Task.TaskOutputComponent(); - param.getType().addCoding( - new Coding(ConstantsPing.CODESYSTEM_DSF_PING, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ERROR, null)); + param.getType().addCoding(new Coding(CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.ERROR.getValue(), null)); param.addExtension(ProcessError.toExtension(error)); Extension dataAbsentReason = new Extension() .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 2606a152..c9d75113 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -15,6 +15,7 @@ import org.hl7.fhir.r4.model.Task.TaskOutputComponent; import org.hl7.fhir.r4.model.Type; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; @@ -30,7 +31,7 @@ private PingStatusGenerator() public static Task updatePongStatusOutput(Task task, List<ProcessError> errors) { List<Task.TaskOutputComponent> pongStatusOutputs = getOutputsByExtensionUrlAndCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + CodeSystem.DsfPing.Code.PONG_STATUS.getValue()); if (pongStatusOutputs.isEmpty()) { task.addOutput(updateStatusOutput(new TaskOutputComponent(), errors)); @@ -70,11 +71,10 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent output, return output; } - - public static Task updatePongStatusOutput(Task task, String statusCode) + public static Task updatePongStatusOutput(Task task, CodeSystem.DsfPingStatus.Code statusCode) { List<Task.TaskOutputComponent> pongStatusOutputs = getOutputsByExtensionUrlAndCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + CodeSystem.DsfPing.Code.PONG_STATUS.getValue()); if (pongStatusOutputs.isEmpty()) { task.addOutput(updatePongStatusOutput(new TaskOutputComponent(), statusCode)); @@ -94,15 +94,16 @@ public static Task updatePongStatusOutput(Task task, String statusCode) return task; } - public static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent outputComponent, String statusCode) + public static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent outputComponent, + CodeSystem.DsfPingStatus.Code statusCode) { if (hasStatusCodeSet(outputComponent)) { - updateStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode); + updateStatus(outputComponent, CodeSystem.DsfPing.Code.PONG_STATUS.getValue(), statusCode.getValue()); } else { - addStatus(outputComponent, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode); + addStatus(outputComponent, CodeSystem.DsfPing.Code.PONG_STATUS.getValue(), statusCode.getValue()); } return outputComponent; @@ -111,7 +112,7 @@ public static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent out public static Task updatePongStatusOutput(Task task, Target target) { List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + CodeSystem.DsfPing.Code.PONG_STATUS.getValue()); if (outputs.isEmpty()) { task.addOutput(updateStatusOutput(new TaskOutputComponent(), target)); @@ -144,10 +145,11 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputC return outputComponent; } - public static Task updatePongStatusOutputDownloadSpeed(Task task, BigDecimal downloadSpeed, String networkSpeedUnit) + public static Task updatePongStatusOutputDownloadSpeed(Task task, BigDecimal downloadSpeed, + CodeSystem.DsfPingUnits.Code networkSpeedUnit) { List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + CodeSystem.DsfPing.Code.PONG_STATUS.getValue()); if (outputs.isEmpty()) { task.addOutput(updateStatusOutputDownloadSpeed(new TaskOutputComponent(), downloadSpeed, networkSpeedUnit)); @@ -168,24 +170,25 @@ public static Task updatePongStatusOutputDownloadSpeed(Task task, BigDecimal dow } public static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComponent outputComponent, - BigDecimal downloadSpeed, String networkSpeedUnit) + BigDecimal downloadSpeed, CodeSystem.DsfPingUnits.Code networkSpeedUnit) { if (hasDownloadSpeedSet(outputComponent)) { - updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); + updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.getValue()); } else { - addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit); + addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.getValue()); } return outputComponent; } - public static Task updatePongStatusOutputUploadSpeed(Task task, BigDecimal uploadSpeed, String networkSpeedUnit) + public static Task updatePongStatusOutputUploadSpeed(Task task, BigDecimal uploadSpeed, + CodeSystem.DsfPingUnits.Code networkSpeedUnit) { List<Task.TaskOutputComponent> outputs = getOutputsByExtensionUrlAndCodes(task, - ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS); + CodeSystem.DsfPing.Code.PONG_STATUS.getValue()); if (outputs.isEmpty()) { task.addOutput(updateStatusOutputUploadSpeed(new TaskOutputComponent(), uploadSpeed, networkSpeedUnit)); @@ -206,15 +209,15 @@ public static Task updatePongStatusOutputUploadSpeed(Task task, BigDecimal uploa } public static TaskOutputComponent updateStatusOutputUploadSpeed(TaskOutputComponent outputComponent, - BigDecimal uploadSpeed, String networkSpeedUnit) + BigDecimal uploadSpeed, CodeSystem.DsfPingUnits.Code networkSpeedUnit) { if (hasDownloadSpeedSet(outputComponent)) { - updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); + updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.getValue()); } else { - addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit); + addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.getValue()); } return outputComponent; @@ -237,10 +240,8 @@ private static boolean hasStatusCodeSet(TaskOutputComponent outputComponent) Type valueType = outputComponent.getValue(); List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); - return (valueType instanceof Coding coding - && ConstantsPing.CODESYSTEM_DSF_PING_STATUS.equals(coding.getSystem())) - || outputTypeCodings.stream() - .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem())); + return (valueType instanceof Coding coding && CodeSystem.DsfPingStatus.URL.equals(coding.getSystem())) + || outputTypeCodings.stream().anyMatch(coding -> CodeSystem.DsfPing.URL.equals(coding.getSystem())); } private static boolean hasDownloadSpeedSet(TaskOutputComponent outputComponent) @@ -251,36 +252,37 @@ private static boolean hasDownloadSpeedSet(TaskOutputComponent outputComponent) return downloadSpeedExtension != null; } - public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, BigDecimal downloadSpeed, - BigDecimal uploadSpeed, String unit) + public static TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, + BigDecimal downloadSpeed, BigDecimal uploadSpeed, CodeSystem.DsfPingUnits.Code unit) { return createPingStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); } - public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, + public static TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errors, null, - null, null); + return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS.getValue(), statusCode.getValue(), errors, + null, null, null); } - public static TaskOutputComponent createPingStatusOutput(Target target, String statusCode, - List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) + public static TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, + List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, + CodeSystem.DsfPingUnits.Code unit) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PING_STATUS, statusCode, errors, - downloadSpeed, uploadSpeed, unit); + return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS.getValue(), statusCode.getValue(), errors, + downloadSpeed, uploadSpeed, unit.getValue()); } - public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode) + public static TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode) { return createPongStatusOutput(target, statusCode, null); } - public static TaskOutputComponent createPongStatusOutput(Target target, String statusCode, + public static TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors) { - return createStatusOutput(target, ConstantsPing.CODESYSTEM_DSF_PING_VALUE_PONG_STATUS, statusCode, errors, null, - null, null); + return createStatusOutput(target, CodeSystem.DsfPing.Code.PONG_STATUS.getValue(), statusCode.getValue(), errors, + null, null, null); } private static TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, @@ -300,9 +302,8 @@ private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent { if (outputParameter != null && statusCode != null) { - outputComponent - .setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); - outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + outputComponent.setValue(new Coding().setSystem(CodeSystem.DsfPingStatus.URL).setCode(statusCode)); + outputComponent.getType().addCoding().setSystem(CodeSystem.DsfPing.URL).setCode(outputParameter); sortStatusOutputExtensions(outputComponent); } @@ -315,31 +316,29 @@ private static TaskOutputComponent updateStatus(TaskOutputComponent outputCompon Type valueType = outputComponent.getValue(); if (valueType instanceof Coding coding) { - coding.setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode); + coding.setSystem(CodeSystem.DsfPingStatus.URL).setCode(statusCode); } else { - outputComponent - .setValue(new Coding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING_STATUS).setCode(statusCode)); + outputComponent.setValue(new Coding().setSystem(CodeSystem.DsfPingStatus.URL).setCode(statusCode)); } List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); if (outputTypeCodings.isEmpty()) { - outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + outputComponent.getType().addCoding().setSystem(CodeSystem.DsfPing.URL).setCode(outputParameter); } else { if (outputTypeCodings.size() == 1) { Coding coding = outputTypeCodings.get(0); - coding.setSystem(ConstantsPing.CODESYSTEM_DSF_PING).setCode(outputParameter); + coding.setSystem(CodeSystem.DsfPing.URL).setCode(outputParameter); } else { outputComponent.getType().setCoding(null); - outputComponent.getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(outputParameter); + outputComponent.getType().addCoding().setSystem(CodeSystem.DsfPing.URL).setCode(outputParameter); } } sortStatusOutputExtensions(outputComponent); @@ -466,7 +465,7 @@ private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputCo networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + .setValue(new Coding(CodeSystem.DsfPingUnits.URL, unit, null)); } sortStatusOutputExtensions(outputComponent); @@ -491,7 +490,7 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, new DecimalType(downloadSpeed))); extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, - new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); + new Coding(CodeSystem.DsfPingUnits.URL, unit, null))); } } else @@ -502,7 +501,7 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(downloadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + .setValue(new Coding(CodeSystem.DsfPingUnits.URL, unit, null)); } } sortStatusOutputExtensions(outputComponent); @@ -522,7 +521,7 @@ private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComp networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(uploadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + .setValue(new Coding(CodeSystem.DsfPingUnits.URL, unit, null)); } sortStatusOutputExtensions(outputComponent); @@ -547,7 +546,7 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, new DecimalType(uploadSpeed))); extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, - new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null))); + new Coding(CodeSystem.DsfPingUnits.URL, unit, null))); } } else @@ -558,7 +557,7 @@ private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputC networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) .setValue(new DecimalType(uploadSpeed)); networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_UNITS, unit, null)); + .setValue(new Coding(CodeSystem.DsfPingUnits.URL, unit, null)); } } sortStatusOutputExtensions(outputComponent); @@ -608,7 +607,7 @@ private static List<Task.TaskOutputComponent> getOutputsByExtensionUrlAndCodes(T { return task.getOutput().stream() .filter(outputComponent -> outputComponent.getType().getCoding().stream() - .anyMatch(coding -> ConstantsPing.CODESYSTEM_DSF_PING.equals(coding.getSystem()) + .anyMatch(coding -> CodeSystem.DsfPing.URL.equals(coding.getSystem()) && Stream.of(codes).anyMatch(code -> code.equals(coding.getCode()))) || outputComponent.getExtension().stream() .anyMatch(extension -> ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS diff --git a/src/test/java/dev/dsf/bpe/start/PingTtpsFromDic1ExampleStarter.java b/src/test/java/dev/dsf/bpe/start/PingTtpsFromDic1ExampleStarter.java index 180b015f..ceec3006 100644 --- a/src/test/java/dev/dsf/bpe/start/PingTtpsFromDic1ExampleStarter.java +++ b/src/test/java/dev/dsf/bpe/start/PingTtpsFromDic1ExampleStarter.java @@ -6,6 +6,7 @@ import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; @@ -45,8 +46,8 @@ private static Task task() "OrganizationAffiliation?primary-organization:identifier=http://dsf.dev/sid/organization-identifier|highmed.org" + "&role=http://dsf.dev/fhir/CodeSystem/organization-role|TTP" + "&_include=OrganizationAffiliation:endpoint")) - .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS); + .getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.TARGET_ENDPOINTS.getValue()); return task; } diff --git a/src/test/java/dev/dsf/bpe/start/StartAutostartPing3DicFromTtpExampleStarter.java b/src/test/java/dev/dsf/bpe/start/StartAutostartPing3DicFromTtpExampleStarter.java index f2896072..396f424e 100644 --- a/src/test/java/dev/dsf/bpe/start/StartAutostartPing3DicFromTtpExampleStarter.java +++ b/src/test/java/dev/dsf/bpe/start/StartAutostartPing3DicFromTtpExampleStarter.java @@ -6,6 +6,7 @@ import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; @@ -42,11 +43,10 @@ private static Task task() task.addInput().setValue(new StringType(ConstantsPing.PROFILE_DSF_TASK_START_PING_AUTOSTART_MESSAGE_NAME)) .getType().addCoding(BpmnMessage.messageName()); task.addInput().setValue(new StringType("Endpoint?identifier=http://dsf.dev/sid/endpoint-identifier|")) - .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS); - task.addInput().setValue(new StringType("PT7M")).getType().addCoding() - .setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TIMER_INTERVAL); + .getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.TARGET_ENDPOINTS.getValue()); + task.addInput().setValue(new StringType("PT7M")).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.TIMER_INTERVAL.getValue()); return task; } diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index a5210eaa..123768f9 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -31,6 +31,7 @@ import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.validation.ResultSeverityEnum; import ca.uhn.fhir.validation.ValidationResult; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.PingProcessPluginDefinition; import dev.dsf.bpe.ProcessError; @@ -91,8 +92,8 @@ public void testTaskStartAutostartProcessProfileValidWithTargetEndpoints() throw task.addInput() .setValue(new StringType( "Endpoint?identifier=http://dsf.dev/sid/endpoint-identifier|endpoint.target.org")) - .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS); + .getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.TARGET_ENDPOINTS.getValue()); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -105,9 +106,8 @@ public void testTaskStartAutostartProcessProfileValidWithTargetEndpoints() throw public void testTaskStartAutostartProcessProfileValidTimerInterval() throws Exception { Task task = createValidTaskStartAutostartProcess(); - task.addInput().setValue(new StringType("PT24H")).getType().addCoding() - .setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TIMER_INTERVAL); + task.addInput().setValue(new StringType("PT24H")).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.TIMER_INTERVAL.getValue()); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -121,8 +121,7 @@ public void testTaskStartAutostartProcessProfileNotValidTimerInterval() throws E { Task task = createValidTaskStartAutostartProcess(); task.addInput().setValue(new StringType("invalid_duration")).getType().addCoding() - .setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TIMER_INTERVAL); + .setSystem(CodeSystem.DsfPing.URL).setCode(CodeSystem.DsfPing.Code.TIMER_INTERVAL.getValue()); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -216,9 +215,8 @@ private List<ProcessError> processErrors(int amount) List<ProcessError> errors = new ArrayList<>(); for (int i = 0; i < amount; i++) { - errors.add(new ProcessError(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES_VALUE_PING, - ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS_VALUE_PING, UUID.randomUUID().toString(), null, - UUID.randomUUID().toString())); + errors.add(new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, CodeSystem.DsfPingProcessSteps.Code.PING, + UUID.randomUUID().toString(), null, UUID.randomUUID().toString())); } return errors; } @@ -230,8 +228,8 @@ public void testTaskStartPingProcessProfileValidWithTargetEndpoints() throws Exc task.addInput() .setValue(new StringType( "Endpoint?identifier=http://dsf.dev/sid/endpoint-identifier|endpoint.target.org")) - .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_TARGET_ENDPOINTS); + .getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.TARGET_ENDPOINTS.getValue()); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -287,8 +285,8 @@ public String getCorrelationKey() Task task = createValidTaskStartPingProcess(); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_ERROR, processErrors(5))); + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, CodeSystem.DsfPingStatus.Code.ERROR, + processErrors(5))); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -331,9 +329,8 @@ public String getCorrelationKey() Task task = createValidTaskStartPingProcess(); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED, BigDecimal.ZERO, BigDecimal.ZERO, - ConstantsPing.CODESYSTEM_DSF_PING_UNITS_VALUE_BITS_PER_SECOND)); + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED, + BigDecimal.ZERO, BigDecimal.ZERO, CodeSystem.DsfPingUnits.Code.BITS_PER_SECOND)); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -396,8 +393,8 @@ private Task createValidTaskStartPingProcess() task.addInput().setValue(new StringType(ConstantsPing.PROFILE_DSF_TASK_START_PING_MESSAGE_NAME)).getType() .addCoding(BpmnMessage.messageName()); - task.addInput().setValue(new DecimalType(1)).getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_DOWNLOAD_RESOURCE_SIZE_BYTES); + task.addInput().setValue(new DecimalType(1)).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); return task; } @@ -444,8 +441,7 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(PingStatusGenerator.createPongStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED)); + task.addOutput(PingStatusGenerator.createPongStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED)); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -485,8 +481,7 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(PingStatusGenerator.createPongStatusOutput(target, - ConstantsPing.CODESYSTEM_DSF_PING_STATUS_VALUE_COMPLETED)); + task.addOutput(PingStatusGenerator.createPongStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED)); task.addInput(DownloadResourceSizeGenerator.create(1000)); task.addInput(DownloadResourceReferenceGenerator.create("https://test.endpoint.org/fhir/Binary")); @@ -520,8 +515,8 @@ private Task createValidTaskPing() task.addInput() .setValue(new Reference().setType(ResourceType.Endpoint.name()) .setIdentifier(EndpointIdentifier.withValue("endpoint.target.org"))) - .getType().addCoding().setSystem(ConstantsPing.CODESYSTEM_DSF_PING) - .setCode(ConstantsPing.CODESYSTEM_DSF_PING_VALUE_ENDPOINT_IDENTIFIER); + .getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.ENDPOINT_IDENTIFIER.getValue()); return task; } diff --git a/src/test/java/dev/dsf/library/ProcessErrorTest.java b/src/test/java/dev/dsf/library/ProcessErrorTest.java index dae53ae8..6d30574b 100644 --- a/src/test/java/dev/dsf/library/ProcessErrorTest.java +++ b/src/test/java/dev/dsf/library/ProcessErrorTest.java @@ -9,24 +9,27 @@ import org.hl7.fhir.r4.model.UrlType; import org.junit.Test; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; public class ProcessErrorTest { private static final String testString = "foo"; + private static final CodeSystem.DsfPingProcesses.Code testProcess = CodeSystem.DsfPingProcesses.Code.PING; + private static final CodeSystem.DsfPingProcessSteps.Code testStep = CodeSystem.DsfPingProcessSteps.Code.CHECK_PING_TASK_STATUS; @Test public void ExtensionToErrorTest() { - ProcessError expected = new ProcessError(testString, testString, testString, testString, testString); + ProcessError expected = new ProcessError(testProcess, testStep, testString, testString, testString); assertEquals(expected, ProcessError.toError(getExtensionFull())); } @Test public void ExtensionWithoutFixUrlToErrorTest() { - ProcessError expected = new ProcessError(testString, testString, testString, null, testString); + ProcessError expected = new ProcessError(testProcess, testStep, testString, null, testString); assertEquals(expected, ProcessError.toError(getExtensionMissingFixUrl())); } @@ -61,9 +64,9 @@ private Extension getExtensionFull() extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, testString, null)); + .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, testProcess.getValue(), null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, testString, null)); + .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, testStep.getValue(), null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); @@ -77,9 +80,9 @@ private Extension getExtensionMissingFixUrl() extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, testString, null)); + .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, testProcess.getValue(), null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, testString, null)); + .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, testStep.getValue(), null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); @@ -92,7 +95,7 @@ private Extension getExtensionMissingProcess() extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, testString, null)); + .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, testString, null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); @@ -106,7 +109,7 @@ private Extension getExtensionMissingProcessStep() extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, testString, null)); + .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, testString, null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); @@ -120,9 +123,9 @@ private Extension getExtensionMissingAction() extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, testString, null)); + .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, testString, null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, testString, null)); + .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, testString, null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); @@ -135,9 +138,9 @@ private Extension getExtensionMissingMessage() extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESSES, testString, null)); + .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, testString, null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(ConstantsPing.CODESYSTEM_DSF_PING_PROCESS_STEPS, testString, null)); + .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, testString, null)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); From 00a70c57304d6d919d2b30e6e69f3d2f06af7f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 31 Jul 2025 17:01:23 +0200 Subject: [PATCH 307/382] Moved "error handling" for XML parsing in ProcessError into the respective methods there since "error handling" usually just consisted of throwing the error further or turning it into a RuntimeException --- src/main/java/dev/dsf/bpe/ProcessError.java | 54 ++++++++++++++----- .../dsf/bpe/message/CleanupPongMessage.java | 12 +---- .../dev/dsf/bpe/message/SendPingMessage.java | 12 +---- .../bpe/service/GenerateAndStoreResource.java | 4 +- .../bpe/service/SetDownloadResourceSize.java | 2 +- .../autostart/SetTargetAndConfigureTimer.java | 2 +- .../bpe/service/ping/CheckPingTaskStatus.java | 2 +- .../dev/dsf/bpe/service/ping/CleanupPing.java | 2 +- ...adResourceAndMeasureSpeedInSubProcess.java | 2 +- .../ping/GenerateAndStoreResourcePing.java | 4 +- .../dsf/bpe/service/ping/LogAndSaveError.java | 2 +- .../bpe/service/ping/LogAndSaveSendError.java | 21 +++----- .../ping/LogAndSaveUploadErrorPing.java | 2 +- .../dev/dsf/bpe/service/ping/SavePong.java | 2 +- .../bpe/service/ping/SelectPingTargets.java | 2 +- .../dsf/bpe/service/ping/StoreResults.java | 2 +- .../dev/dsf/bpe/service/pong/CleanupPong.java | 2 +- .../pong/DownloadResourceAndMeasureSpeed.java | 2 +- .../pong/EstimateCleanupTimerDuration.java | 2 +- .../pong/GenerateAndStoreResourcePong.java | 4 +- .../service/pong/LogAndSaveAndStoreError.java | 2 +- .../pong/LogAndSaveUploadErrorPong.java | 4 +- .../dev/dsf/bpe/service/pong/LogPing.java | 2 +- .../bpe/service/pong/SaveTimeoutError.java | 2 +- .../bpe/service/pong/SelectPongTarget.java | 2 +- .../service/pong/SetEndpointIdentifier.java | 2 +- .../bpe/service/pong/StoreDownloadSpeed.java | 2 +- .../dev/dsf/bpe/service/pong/StoreErrors.java | 2 +- .../bpe/service/pong/StoreUploadSpeed.java | 2 +- .../java/dev/dsf/bpe/util/ErrorListUtils.java | 27 ++-------- 30 files changed, 88 insertions(+), 96 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 7ccbdc5f..91310f84 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -83,29 +83,57 @@ public static ProcessError toError(Extension extension) return new ProcessError(processCode, stepCode, action, potentialFixUrl, message); } - public static String toString(List<ProcessError> errors) throws JsonProcessingException + public static String toString(List<ProcessError> errors) { - ObjectMapper objectMapper = new ObjectMapper(); - return objectMapper.writeValueAsString(errors); + try + { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.writeValueAsString(errors); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } } - public static String toString(ProcessError error) throws JsonProcessingException + public static String toString(ProcessError error) { - ObjectMapper objectMapper = new ObjectMapper(); - return objectMapper.writeValueAsString(error); + try + { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.writeValueAsString(error); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } } - public static List<ProcessError> parseList(String json) throws JsonProcessingException + public static List<ProcessError> parseList(String json) { - ObjectMapper objectMapper = new ObjectMapper(); - return objectMapper.readValue(json, new TypeReference<List<ProcessError>>() + try { - }); + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.readValue(json, new TypeReference<>() + { + }); + } + catch (JsonProcessingException e) + { + throw new IllegalArgumentException("Unable to parse [" + json + "] to List<ProcessError>", e); + } } - public static ProcessError parse(String json) throws JsonProcessingException + public static ProcessError parse(String json) { - ObjectMapper objectMapper = new ObjectMapper(); - return objectMapper.readValue(json, ProcessError.class); + try + { + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.readValue(json, ProcessError.class); + } + catch (JsonProcessingException e) + { + throw new IllegalArgumentException("Unable to parse [" + json + "] to ProcessError", e); + } } } diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 44bd1fc3..40de84eb 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -60,16 +60,8 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab ProcessError error = SendTaskErrorConverter.convert(exception, "Sending cleanup message to " + target.getEndpointUrl()); - try - { - execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), ProcessError.toString(error)); - execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), - CodeSystem.DsfPing.Code.ERROR.getValue()); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } + execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), ProcessError.toString(error)); + execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), CodeSystem.DsfPing.Code.ERROR.getValue()); logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); } diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index a6d1f23c..9a00d404 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -86,16 +86,8 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab ProcessError error = SendTaskErrorConverter.convert(exception, "Sending ping message to " + target.getEndpointUrl()); - try - { - execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), ProcessError.toString(error)); - execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), - CodeSystem.DsfPing.Code.ERROR.getValue()); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } + execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), ProcessError.toString(error)); + execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), CodeSystem.DsfPing.Code.ERROR.getValue()); logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); } diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index d9ef5baa..2624b89f 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -4,6 +4,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.IdType; +import com.fasterxml.jackson.core.JsonProcessingException; + import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; @@ -27,7 +29,7 @@ public GenerateAndStoreResource(ProcessPluginApi api, long maxUploadSizeBytes, this.process = process; } - public void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + public void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(GenerateAndStoreResource.class, variables.getStartTask()); logger.debug("Generating resource..."); diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index 111453c1..7e04441b 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -25,7 +25,7 @@ public SetDownloadResourceSize(ProcessPluginApi api, long maxDownloadResourceSiz } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(SetDownloadResourceSize.class, variables.getStartTask()); logger.debug("Setting download resource size..."); diff --git a/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java b/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java index 2bb9c5be..79c44c4f 100644 --- a/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java +++ b/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java @@ -22,7 +22,7 @@ public SetTargetAndConfigureTimer(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { String timerInterval = getTimerInterval(variables); logger.debug("Setting variable '{}' to {}", ExecutionVariables.TIMER_INTERVAL.getValue(), timerInterval); diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index 7f7bf8ff..c28392d3 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -28,7 +28,7 @@ public CheckPingTaskStatus(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(CheckPingTaskStatus.class, variables.getStartTask()); logger.debug("Checking status of ping task..."); diff --git a/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java b/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java index 7efb751f..645dce5f 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java @@ -20,7 +20,7 @@ public CleanupPing(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { delegate.doExecute(delegateExecution, variables); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 35295318..84555fb2 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -25,7 +25,7 @@ public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api, long ma } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(DownloadResourceAndMeasureSpeedInSubProcess.class, variables.getStartTask()); diff --git a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java index 77e72ee6..997772e2 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java @@ -3,6 +3,8 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import com.fasterxml.jackson.core.JsonProcessingException; + import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.service.GenerateAndStoreResource; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -20,7 +22,7 @@ public GenerateAndStoreResourcePing(ProcessPluginApi api, long maxUploadSizeByte } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { delegate.doExecute(delegateExecution, variables); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index 3f7f81f0..acb8c44e 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -21,7 +21,7 @@ public LogAndSaveError(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(LogAndSaveError.class, variables.getStartTask()); Target target = variables.getTarget(); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index d4682f8a..7956be92 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -22,23 +22,16 @@ public LogAndSaveSendError(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(LogAndSaveSendError.class, variables.getStartTask()); String correlationKey = variables.getTarget().getCorrelationKey(); - try - { - ProcessError error = ProcessError - .parse((String) execution.getVariableLocal(ExecutionVariables.ERROR.getValue())); - ErrorListUtils.add(error, execution, correlationKey); - variables.setLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), 0L); - variables.setLong(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), 0L); - logger.debug("Saved error when trying to send ping message. Error message: {}", error.message()); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } + ProcessError error = ProcessError + .parse((String) execution.getVariableLocal(ExecutionVariables.ERROR.getValue())); + ErrorListUtils.add(error, execution, correlationKey); + variables.setLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), 0L); + variables.setLong(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), 0L); + logger.debug("Saved error when trying to send ping message. Error message: {}", error.message()); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java index 244ec599..c078ce8d 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java @@ -20,7 +20,7 @@ public LogAndSaveUploadErrorPing(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { Task startTask = variables.getStartTask(); PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPing.class, startTask); diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 36c479ac..a53220d5 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -28,7 +28,7 @@ public SavePong(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(SavePong.class, variables.getStartTask()); diff --git a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java index 2f43220c..de58d94a 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java @@ -48,7 +48,7 @@ public SelectPingTargets(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { Task startTask = variables.getStartTask(); Stream<Endpoint> targetEndpoints = getTargetEndpointsSearchParameter(variables) diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index ea624575..dba6571b 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -48,7 +48,7 @@ public void afterPropertiesSet() throws Exception } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(StoreResults.class, variables.getStartTask()); diff --git a/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java b/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java index 80374a44..7b9eaa7c 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java @@ -20,7 +20,7 @@ public CleanupPong(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { delegate.doExecute(delegateExecution, variables); } diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 0c6ca47b..3f806314 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -24,7 +24,7 @@ public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, long maxDownloadSiz } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(DownloadResourceAndMeasureSpeed.class, variables.getStartTask()); logger.debug("Starting resource download to measure speed..."); diff --git a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java index e3322038..77934537 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java @@ -21,7 +21,7 @@ public EstimateCleanupTimerDuration(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(EstimateCleanupTimerDuration.class, variables.getStartTask()); diff --git a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java index 50945142..9ef429bc 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java @@ -3,6 +3,8 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import com.fasterxml.jackson.core.JsonProcessingException; + import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.service.GenerateAndStoreResource; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -20,7 +22,7 @@ public GenerateAndStoreResourcePong(ProcessPluginApi api, long maxUploadSizeByte } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { delegate.doExecute(delegateExecution, variables); } diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 2aaa4f15..11ba0bda 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -23,7 +23,7 @@ public LogAndSaveAndStoreError(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(LogAndSaveAndStoreError.class, variables.getStartTask()); Target target = variables.getTarget(); diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java index 60468bbb..220be761 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java @@ -4,6 +4,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import com.fasterxml.jackson.core.JsonProcessingException; + import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; @@ -21,7 +23,7 @@ public LogAndSaveUploadErrorPong(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { Task startTask = variables.getStartTask(); PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPong.class, startTask); diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogPing.java b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java index 54d97e1a..873f12f3 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogPing.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java @@ -20,7 +20,7 @@ public LogPing(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(LogPing.class, variables.getStartTask()); diff --git a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java index 4f6fa988..bccc5cc5 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java @@ -22,7 +22,7 @@ public SaveTimeoutError(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { Task startTask = variables.getStartTask(); Target target = variables.getTarget(); diff --git a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java index 91b02633..65d04e2e 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java @@ -22,7 +22,7 @@ public SelectPongTarget(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(SelectPingTargets.class, variables.getStartTask()); logger.debug("Selecting pong targets..."); diff --git a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java index eeedaf63..3b84b37e 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java @@ -22,7 +22,7 @@ public SetEndpointIdentifier(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { PingPongLogger logger = new PingPongLogger(SetEndpointIdentifier.class, variables.getStartTask()); logger.debug("Setting endpoint identifier..."); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index dae4b9d4..e945c208 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -27,7 +27,7 @@ public StoreDownloadSpeed(ProcessPluginApi api, CodeSystem.DsfPingUnits.Code net } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { Task startTask = variables.getStartTask(); PingPongLogger logger = new PingPongLogger(StoreDownloadSpeed.class, startTask); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java index 1f5e57ad..916ed1c3 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java @@ -24,7 +24,7 @@ public StoreErrors(ProcessPluginApi api) } @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { Task startTask = variables.getStartTask(); PingPongLogger logger = new PingPongLogger(StoreErrors.class, startTask); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index f7b760c9..942f2d6f 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -29,7 +29,7 @@ public StoreUploadSpeed(ProcessPluginApi api, CodeSystem.DsfPingUnits.Code netwo } @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError, Exception + protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { Task startTask = variables.getStartTask(); Task cleanup = variables.getLatestTask(); diff --git a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java index 24f3a8a3..8101234c 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java @@ -74,26 +74,12 @@ public static List<ProcessError> getErrorMessageList(String variableName, Delega if (errorJson == null) { List<ProcessError> errors = new Vector<>(); - try - { - execution.setVariable(variableName, ProcessError.toString(errors)); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } + execution.setVariable(variableName, ProcessError.toString(errors)); return errors; } else { - try - { - return ProcessError.parseList(errorJson); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } + return ProcessError.parseList(errorJson); } } @@ -118,13 +104,6 @@ private static void saveErrorList(List<ProcessError> errors, DelegateExecution e private static void saveErrorList(List<ProcessError> errors, String variableName, DelegateExecution execution) { - try - { - execution.setVariable(variableName, ProcessError.toString(errors)); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } + execution.setVariable(variableName, ProcessError.toString(errors)); } } From 849e3b7de3df47c7b2c0836125fbfb7945a9e5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 31 Jul 2025 17:04:57 +0200 Subject: [PATCH 308/382] Removed unused imports --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 -- src/main/java/dev/dsf/bpe/ProcessError.java | 2 -- .../java/dev/dsf/bpe/mail/AggregateErrorMailService.java | 1 - src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java | 3 --- src/main/java/dev/dsf/bpe/message/SendPingMessage.java | 3 --- src/main/java/dev/dsf/bpe/message/SendPongMessage.java | 1 - src/main/java/dev/dsf/bpe/message/SendStartPing.java | 1 - .../java/dev/dsf/bpe/service/GenerateAndStoreResource.java | 2 -- .../java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java | 1 - .../ping/DownloadResourceAndMeasureSpeedInSubProcess.java | 1 - .../dsf/bpe/service/ping/GenerateAndStoreResourcePing.java | 2 -- src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java | 1 - .../java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java | 3 --- .../dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java | 1 - src/main/java/dev/dsf/bpe/service/ping/SavePong.java | 1 - .../java/dev/dsf/bpe/service/ping/SelectPingTargets.java | 1 - src/main/java/dev/dsf/bpe/service/ping/StoreResults.java | 1 - .../bpe/service/pong/DownloadResourceAndMeasureSpeed.java | 1 - .../dsf/bpe/service/pong/EstimateCleanupTimerDuration.java | 1 - .../dsf/bpe/service/pong/GenerateAndStoreResourcePong.java | 2 -- .../dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java | 1 - .../dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java | 3 --- src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java | 1 - src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java | 1 - .../java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java | 1 - .../java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java | 1 - src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java | 1 - src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java | 1 - src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 5 ----- src/main/java/dev/dsf/bpe/util/ErrorListUtils.java | 3 --- src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java | 1 - .../java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java | 1 - .../input/generator/DownloadResourceReferenceGenerator.java | 1 - .../task/input/generator/DownloadResourceSizeGenerator.java | 1 - .../util/task/input/generator/DownloadedBytesGenerator.java | 1 - .../input/generator/DownloadedDurationMillisGenerator.java | 1 - .../task/input/generator/ErrorInputComponentGenerator.java | 1 - .../task/input/generator/NetworkSpeedMetricGenerator.java | 1 - .../task/output/generator/ErrorOutputComponentGenerator.java | 1 - 39 files changed, 58 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index c56bda27..18f3e8e2 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -1,7 +1,5 @@ package dev.dsf.bpe; -import java.util.List; - import jakarta.ws.rs.core.MediaType; public final class ConstantsPing diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 91310f84..7b98e166 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -13,8 +13,6 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import dev.dsf.bpe.util.CodeSystemDsfPingUnitsConverter; - public record ProcessError(CodeSystem.DsfPingProcesses.Code process, CodeSystem.DsfPingProcessSteps.Code processStep, String action, String potentialFixUrl, String message) implements Serializable { diff --git a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java index 4304fea7..16b36903 100644 --- a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java +++ b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java @@ -8,7 +8,6 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Target; diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 40de84eb..0b0be590 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -7,10 +7,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.core.JsonProcessingException; - import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index 9a00d404..93a18938 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -12,10 +12,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.fasterxml.jackson.core.JsonProcessingException; - import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index 2d154141..2316f512 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -8,7 +8,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.mail.AggregateErrorMailService; diff --git a/src/main/java/dev/dsf/bpe/message/SendStartPing.java b/src/main/java/dev/dsf/bpe/message/SendStartPing.java index 8bb4c9b5..42772b92 100644 --- a/src/main/java/dev/dsf/bpe/message/SendStartPing.java +++ b/src/main/java/dev/dsf/bpe/message/SendStartPing.java @@ -8,7 +8,6 @@ import org.hl7.fhir.r4.model.Task.ParameterComponent; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 2624b89f..7b52678e 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -4,8 +4,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.IdType; -import com.fasterxml.jackson.core.JsonProcessingException; - import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index c28392d3..e7bc9928 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -4,7 +4,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 84555fb2..deffeb30 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -5,7 +5,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java index 997772e2..fc6a40d2 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java @@ -3,8 +3,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import com.fasterxml.jackson.core.JsonProcessingException; - import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.service.GenerateAndStoreResource; import dev.dsf.bpe.v1.ProcessPluginApi; diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index acb8c44e..62c4eac1 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -3,7 +3,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 7956be92..09a0f2c5 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -3,9 +3,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import com.fasterxml.jackson.core.JsonProcessingException; - -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java index c078ce8d..618cb95c 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java @@ -4,7 +4,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index a53220d5..81c586dd 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -9,7 +9,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; diff --git a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java index de58d94a..173b3ae2 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java @@ -27,7 +27,6 @@ import org.springframework.web.util.UriComponentsBuilder; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index dba6571b..4295a157 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -11,7 +11,6 @@ import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.mail.AggregateErrorMailService; diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 3f806314..29b63426 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -5,7 +5,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java index 77934537..27406eb7 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java @@ -6,7 +6,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; diff --git a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java index 9ef429bc..fdfbcbe1 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java @@ -3,8 +3,6 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import com.fasterxml.jackson.core.JsonProcessingException; - import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.service.GenerateAndStoreResource; import dev.dsf.bpe.v1.ProcessPluginApi; diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 11ba0bda..5570bec2 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -4,7 +4,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java index 220be761..91ab8d17 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java @@ -4,9 +4,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import com.fasterxml.jackson.core.JsonProcessingException; - -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; diff --git a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java index bccc5cc5..487fa3a1 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java @@ -5,7 +5,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java index 65d04e2e..317a3bdc 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java @@ -5,7 +5,6 @@ import org.hl7.fhir.r4.model.Task; import org.springframework.beans.factory.InitializingBean; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.service.ping.SelectPingTargets; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java index 3b84b37e..7d58d0ef 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java @@ -7,7 +7,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index e945c208..2a7b0363 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -7,7 +7,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java index 916ed1c3..4b53acd7 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java @@ -7,7 +7,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index 942f2d6f..37db4a96 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -10,7 +10,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 271be2ac..2706f9af 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -1,8 +1,5 @@ package dev.dsf.bpe.spring.config; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -10,8 +7,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; import org.springframework.core.convert.ConversionService; -import org.springframework.core.convert.converter.Converter; -import org.springframework.core.convert.converter.ConverterRegistry; import org.springframework.core.convert.support.DefaultConversionService; import dev.dsf.bpe.CodeSystem; diff --git a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java index 8101234c..c1a3ebb2 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java @@ -5,9 +5,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; -import com.fasterxml.jackson.core.JsonProcessingException; - -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; diff --git a/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java b/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java index 93073a74..9a54a85b 100644 --- a/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java @@ -3,7 +3,6 @@ import org.hl7.fhir.r4.model.Coding; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; public class ReadAccessTagGenerator { diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 80f29727..9204d0f2 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -4,7 +4,6 @@ import java.math.RoundingMode; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; public final class NetworkSpeedCalculator { diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java index 78c2b7d8..83d8cbe1 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java @@ -5,7 +5,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; public final class DownloadResourceReferenceGenerator { diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java index 31b40c86..48c91381 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java @@ -5,7 +5,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; public final class DownloadResourceSizeGenerator { diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java index 8bdcff0c..690b5399 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java @@ -4,7 +4,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; public final class DownloadedBytesGenerator { diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java index bf284c37..1df99ec4 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java @@ -4,7 +4,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; public final class DownloadedDurationMillisGenerator { diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java index 77c2bc50..5ee726cc 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java @@ -10,7 +10,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; public final class ErrorInputComponentGenerator diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java index 678d3fcf..58f87430 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java @@ -5,7 +5,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; public final class NetworkSpeedMetricGenerator { diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java index d71d337c..901d16c6 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java @@ -10,7 +10,6 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; public final class ErrorOutputComponentGenerator From faffe7c378425195365b340120199af97ced8a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 31 Jul 2025 17:08:42 +0200 Subject: [PATCH 309/382] Fixed always false condition --- src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java index 16b36903..0e6bc71d 100644 --- a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java +++ b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java @@ -71,7 +71,7 @@ protected String createMessage(Target target, ProcessError error) if (error != null && error.process() != null) { - if (CodeSystem.DsfPingProcesses.Code.PING.getValue().equals(error.process())) + if (CodeSystem.DsfPingProcesses.Code.PING.equals(error.process())) { b.append(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().orElse("?")); b.append('/'); From 6a62d811955b6c815ed15d0a7fb5ea6831529b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 31 Jul 2025 17:13:34 +0200 Subject: [PATCH 310/382] Removed "throws Exception" from methods where no exception gets thrown --- .../dsf/fhir/profiles/TaskProfileTest.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 123768f9..c18ce8aa 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -74,7 +74,7 @@ public class TaskProfileTest validationRule.getValidationSupport()); @Test - public void testTaskStartAutostartProcessProfileValid() throws Exception + public void testTaskStartAutostartProcessProfileValid() { Task task = createValidTaskStartAutostartProcess(); @@ -86,7 +86,7 @@ public void testTaskStartAutostartProcessProfileValid() throws Exception } @Test - public void testTaskStartAutostartProcessProfileValidWithTargetEndpoints() throws Exception + public void testTaskStartAutostartProcessProfileValidWithTargetEndpoints() { Task task = createValidTaskStartAutostartProcess(); task.addInput() @@ -103,7 +103,7 @@ public void testTaskStartAutostartProcessProfileValidWithTargetEndpoints() throw } @Test - public void testTaskStartAutostartProcessProfileValidTimerInterval() throws Exception + public void testTaskStartAutostartProcessProfileValidTimerInterval() { Task task = createValidTaskStartAutostartProcess(); task.addInput().setValue(new StringType("PT24H")).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) @@ -117,7 +117,7 @@ public void testTaskStartAutostartProcessProfileValidTimerInterval() throws Exce } @Test - public void testTaskStartAutostartProcessProfileNotValidTimerInterval() throws Exception + public void testTaskStartAutostartProcessProfileNotValidTimerInterval() { Task task = createValidTaskStartAutostartProcess(); task.addInput().setValue(new StringType("invalid_duration")).getType().addCoding() @@ -153,7 +153,7 @@ private Task createValidTaskStartAutostartProcess() } @Test - public void testTaskStopAutostartProcessProfileValid() throws Exception + public void testTaskStopAutostartProcessProfileValid() { Task task = createValidTaskStopAutostartProcess(); @@ -185,7 +185,7 @@ private Task createValidTaskStopAutostartProcess() } @Test - public void testTaskStartPingProcessProfileValid() throws Exception + public void testTaskStartPingProcessProfileValid() { Task task = createValidTaskStartPingProcess(); @@ -197,7 +197,7 @@ public void testTaskStartPingProcessProfileValid() throws Exception } @Test - public void testTaskStartPingProcessProfileValidWithErrorMessages() throws Exception + public void testTaskStartPingProcessProfileValidWithErrorMessages() { Task task = createValidTaskStartPingProcess(); @@ -222,7 +222,7 @@ private List<ProcessError> processErrors(int amount) } @Test - public void testTaskStartPingProcessProfileValidWithTargetEndpoints() throws Exception + public void testTaskStartPingProcessProfileValidWithTargetEndpoints() { Task task = createValidTaskStartPingProcess(); task.addInput() @@ -239,7 +239,7 @@ public void testTaskStartPingProcessProfileValidWithTargetEndpoints() throws Exc } @Test - public void testTaskStartPingProcessProfileValidWithBuisnessKeyOutput() throws Exception + public void testTaskStartPingProcessProfileValidWithBuisnessKeyOutput() { Task task = createValidTaskStartPingProcess(); task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType() @@ -340,7 +340,7 @@ public String getCorrelationKey() } @Test - public void testTaskStartPingProcessProfileNotValid1() throws Exception + public void testTaskStartPingProcessProfileNotValid1() { Task task = createValidTaskStartPingProcess(); task.setInstantiatesCanonical("http://dsf.dev/bpe/Process/ping/0.1.0"); // not valid @@ -353,7 +353,7 @@ public void testTaskStartPingProcessProfileNotValid1() throws Exception } @Test - public void testTaskStartPingProcessProfileNotValid2() throws Exception + public void testTaskStartPingProcessProfileNotValid2() { Task task = createValidTaskStartPingProcess(); task.setIntent(TaskIntent.FILLERORDER); @@ -366,7 +366,7 @@ public void testTaskStartPingProcessProfileNotValid2() throws Exception } @Test - public void testTaskStartPingProcessProfileNotValid3() throws Exception + public void testTaskStartPingProcessProfileNotValid3() { Task task = createValidTaskStartPingProcess(); task.setAuthoredOn(null); @@ -400,7 +400,7 @@ private Task createValidTaskStartPingProcess() } @Test - public void testTaskPingValid() throws Exception + public void testTaskPingValid() { Task task = createValidTaskPing(); @@ -522,7 +522,7 @@ private Task createValidTaskPing() } @Test - public void testTaskPongValid() throws Exception + public void testTaskPongValid() { Task task = createValidTaskPong(); From dec7466213ae9861aec4e5ec7b67aeffc8fed4b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 31 Jul 2025 17:13:53 +0200 Subject: [PATCH 311/382] Removed unused logger --- src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java | 2 -- src/main/java/dev/dsf/bpe/message/SendPingMessage.java | 1 - 2 files changed, 3 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 0b0be590..efccdd6a 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -21,8 +21,6 @@ public class CleanupPongMessage extends AbstractTaskMessageSend { - private static final Logger logger = LoggerFactory.getLogger(CleanupPongMessage.class); - public CleanupPongMessage(ProcessPluginApi api) { super(api); diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index 93a18938..a9384621 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -27,7 +27,6 @@ public class SendPingMessage extends AbstractTaskMessageSend { - private static final Logger logger = LoggerFactory.getLogger(SendPingMessage.class); private IdType taskId; public SendPingMessage(ProcessPluginApi api) From 2e29179b9ac449641ad1ecc5851e122928c094bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 31 Jul 2025 17:14:26 +0200 Subject: [PATCH 312/382] Removed unnecessary type declaration --- src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java index 173b3ae2..18244a87 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java @@ -98,7 +98,7 @@ private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters, int if (resourceType.isEmpty()) return Stream.empty(); - Map<String, List<String>> queryParameters = new HashMap<String, List<String>>(); + Map<String, List<String>> queryParameters = new HashMap<>(); queryParameters.putAll(searchParameters.getQueryParams()); queryParameters.put("_page", Collections.singletonList(String.valueOf(page))); From fabcec3161044d5f9d50b737f90d7970cb3b0d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 31 Jul 2025 17:14:36 +0200 Subject: [PATCH 313/382] Removed unnecessary default --- src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 9204d0f2..2d62d50c 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -44,7 +44,6 @@ public static BigDecimal calculate(long bytes, long duration, CodeSystem.DsfPing BigDecimal megabytes = new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); yield megabytes.divide(seconds, 2, RoundingMode.HALF_UP); } - default -> BigDecimal.ZERO; }; } } From 9c367d54f41ad181098001499dc981f2ab11d467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 31 Jul 2025 17:14:50 +0200 Subject: [PATCH 314/382] Removed unused parameter --- .../java/dev/dsf/bpe/service/GenerateAndStoreResource.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 7b52678e..2a9c079c 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -50,7 +50,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) try { - IdType downloadResource = storeBinary(resourceContent, delegateExecution); + IdType downloadResource = storeBinary(resourceContent); String reference = downloadResource.toVersionless().getValueAsString(); @@ -74,7 +74,7 @@ private long getDownloadResourceSize(Variables variables) return variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); } - private IdType storeBinary(RandomByteInputStream downloadResourceContent, DelegateExecution delegateExecution) + private IdType storeBinary(RandomByteInputStream downloadResourceContent) { return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().createBinary( downloadResourceContent, ConstantsPing.DOWNLOAD_RESOURCE_MIME_TYPE, From d707b529ce2e4542a933c8368788078e4c05060c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 31 Jul 2025 17:15:01 +0200 Subject: [PATCH 315/382] Removed unused exception --- .../java/dev/dsf/bpe/util/BinaryResourceDownloader.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 2b2d248b..92a69aee 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -168,12 +168,4 @@ public ProcessError getError() return error; } } - - public static class MissingReferenceException extends Exception - { - public MissingReferenceException(String message) - { - super(message); - } - } } From 4c2db494cb508517d09078e564008249c8c2fce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 5 Aug 2025 09:20:47 +0200 Subject: [PATCH 316/382] Removed empty lines that didn't serve a purpose --- src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java index 0e6bc71d..488e208e 100644 --- a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java +++ b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java @@ -84,7 +84,6 @@ protected String createMessage(Target target, ProcessError error) b.append(target.getEndpointIdentifierValue()); b.append(":"); - } else { @@ -100,7 +99,6 @@ protected String createMessage(Target target, ProcessError error) b.append(": "); } - b.append("\n\t"); b.append("Process: ").append(error.process()); b.append("\n\t"); From 11ccdd6c4fd96a82a7d9c8545cd683f0c3bfb7f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 5 Aug 2025 09:42:15 +0200 Subject: [PATCH 317/382] Fixed wrong bean method names --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 2706f9af..59b54c7b 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -117,13 +117,13 @@ public SendStartPing sendStartPing() } @Bean - public AggregateErrorMailService pingErrorLogger() + public AggregateErrorMailService aggregateErrorMailServicePing() { return new AggregateErrorMailService(api, sendPingProcessFailedMail); } @Bean - public AggregateErrorMailService pongErrorLogger() + public AggregateErrorMailService aggregateErrorMailServicePong() { return new AggregateErrorMailService(api, sendPongProcessFailedMail); } @@ -154,7 +154,7 @@ public SetCorrelationKeyListener setCorrelationKeyListener() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public StoreResults savePingResults() { - return new StoreResults(api, pingErrorLogger(), networkSpeedUnit); + return new StoreResults(api, aggregateErrorMailServicePing(), networkSpeedUnit); } @Bean @@ -175,7 +175,7 @@ public SelectPongTarget selectPongTarget() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SendPongMessage sendPong() { - return new SendPongMessage(api, pongErrorLogger()); + return new SendPongMessage(api, aggregateErrorMailServicePong()); } @Bean From 21c9e18db8c16768fae4e2cbaaa7b4eaddc76bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 5 Aug 2025 09:43:23 +0200 Subject: [PATCH 318/382] Removed empty line --- src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 92a69aee..c8cfe6c0 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -74,7 +74,6 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t downloadResult = new DownloadResult(numBytes, downloadedDurationMillis); logger.info("Finished downloading {} bytes. Took {}", numBytes, toHoursMinutesSecondsMilliseconds(downloadedDurationMillis)); - } catch (IOException e) { From b68bd68cf00b6736a4863f2bcda8620e3e034b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 5 Aug 2025 14:26:55 +0200 Subject: [PATCH 319/382] Made AggregateErrorMailService stateless --- .../bpe/mail/AggregateErrorMailService.java | 37 ++++++++++--------- .../dsf/bpe/service/ping/StoreResults.java | 7 +++- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java index 488e208e..b61e9b97 100644 --- a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java +++ b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java @@ -1,18 +1,20 @@ package dev.dsf.bpe.mail; -import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.Objects; import org.hl7.fhir.r4.model.IdType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Target; -public class AggregateErrorMailService +public class AggregateErrorMailService implements InitializingBean { private static final Logger errorMailServiceLogger = LoggerFactory.getLogger("error-mail-service-logger"); private static final String MAIL_MESSAGE_INTRO = "Error(s) while executing ping-pong process:"; @@ -21,46 +23,45 @@ public class AggregateErrorMailService private final ProcessPluginApi api; private final boolean sendProcessFailedMail; - private List<String> errorMessages; - public AggregateErrorMailService(ProcessPluginApi api, boolean sendProcessFailedMail) { this.api = api; this.sendProcessFailedMail = sendProcessFailedMail; - errorMessages = new ArrayList<>(); } - public void addError(Target target, ProcessError error) + @Override + public void afterPropertiesSet() { - errorMessages.add(createMessage(target, error)); + Objects.requireNonNull(api, "api"); } - public void send(IdType taskId) + public void send(IdType taskId, Map<Target, List<ProcessError>> errorsPerTarget) { if (sendProcessFailedMail) { - api.getMailService().send(PING_PROCESS_HAS_ERRORS, buildMailMessage(taskId)); - errorMessages = new ArrayList<>(); + api.getMailService().send(PING_PROCESS_HAS_ERRORS, buildMailMessage(taskId, errorsPerTarget)); errorMailServiceLogger.info("Sent e-mail with process errors"); } } - protected String buildMailMessage(IdType taskId) + protected String buildMailMessage(IdType taskId, Map<Target, List<ProcessError>> errorsPerTarget) { StringBuilder mailMessage = new StringBuilder(); mailMessage.append(MAIL_MESSAGE_INTRO); mailMessage.append("\n\n"); - errorMessages.forEach(errorMessage -> - { - mailMessage.append(errorMessage); - mailMessage.append("\n\n"); - }); + errorsPerTarget.entrySet().stream() + .map(entry -> entry.getValue().stream().map(error -> createMessage(entry.getKey(), error))) + .forEach(messageStream -> messageStream.forEach(message -> + { + mailMessage.append(message); + mailMessage.append("\n\n"); + })); mailMessage.append("Process started by: "); - mailMessage.append(taskId.toVersionless() - .withServerBase(api.getEndpointProvider().getLocalEndpointAddress(), "Task").getValue()); + mailMessage.append( + taskId.toVersionless().withServerBase(api.getEndpointProvider().getLocalEndpointAddress(), "Task").getValue()); return mailMessage.toString(); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 4295a157..2e41fbba 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -2,7 +2,9 @@ import java.math.BigDecimal; import java.util.Comparator; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; import org.camunda.bpm.engine.delegate.BpmnError; @@ -55,6 +57,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw variables.getStartTask().getIdElement().getValue()); Task task = variables.getStartTask(); Targets targets = variables.getTargets(); + Map<Target, List<ProcessError>> errorsPerTarget = new HashMap<>(); ErrorOutputComponentGenerator.create(ErrorListUtils.getErrorMessageList(execution)).forEach(task::addOutput); @@ -95,12 +98,12 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw { task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList)); } - errors.forEach(error -> errorMailService.addError(target, error)); + errorsPerTarget.put(target, errors); }); variables.updateTask(task); - errorMailService.send(task.getIdElement()); + errorMailService.send(task.getIdElement(), errorsPerTarget); logger.debug("Successfully stored results for task {}", variables.getStartTask().getIdElement().getValue()); } From da52a5fa6843a48aee696925a4fcd1c431fc59e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 5 Aug 2025 16:22:21 +0200 Subject: [PATCH 320/382] Add todo --- src/main/java/dev/dsf/bpe/ProcessError.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 7b98e166..4fb0e441 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -13,6 +13,10 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; +//todo: remove process and processStep + CodeSystems, make message never contain e.getMessage() becaus security +// ping status codesystem should extend old ping status codesystem, map every possible error to a unique name in a new codesystem +// that repaces process + processStep, display values should contain the exact text that is now contained in action +// remove equals method public record ProcessError(CodeSystem.DsfPingProcesses.Code process, CodeSystem.DsfPingProcessSteps.Code processStep, String action, String potentialFixUrl, String message) implements Serializable { From 45d86676a5a0cc6908dbc389031aa714d1225f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 5 Aug 2025 16:22:53 +0200 Subject: [PATCH 321/382] Completed comment --- src/main/java/dev/dsf/bpe/message/SendPingMessage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index a9384621..9b6aee88 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -91,7 +91,7 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab @Override protected void addErrorMessage(Task task, String errorMessage) { - // error message part of + // error message part of status extension } private Identifier getLocalEndpointIdentifier() From 6b92c63bbf51225d4141f53e6c6c3e5afb57ff50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 13 Aug 2025 10:47:31 +0200 Subject: [PATCH 322/382] Reformat --- src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java index b61e9b97..b064a324 100644 --- a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java +++ b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java @@ -60,8 +60,8 @@ protected String buildMailMessage(IdType taskId, Map<Target, List<ProcessError>> })); mailMessage.append("Process started by: "); - mailMessage.append( - taskId.toVersionless().withServerBase(api.getEndpointProvider().getLocalEndpointAddress(), "Task").getValue()); + mailMessage.append(taskId.toVersionless() + .withServerBase(api.getEndpointProvider().getLocalEndpointAddress(), "Task").getValue()); return mailMessage.toString(); } From 8d16f041bf4d28ca39cce3875bd9745ede9c85df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 13 Aug 2025 11:06:04 +0200 Subject: [PATCH 323/382] Removed unused imports --- src/main/java/dev/dsf/bpe/message/SendPingMessage.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index 9b6aee88..858d2be5 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -9,8 +9,6 @@ import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.ParameterComponent; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; From e2caa1424cc6797e3d6bb26f8164fc0a48150a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 13 Aug 2025 11:08:00 +0200 Subject: [PATCH 324/382] Download and Upload durations now use java.time.Duration during execution and https://www.hl7.org/fhir/R4/datatypes.html#Duration for the FHIR interface --- pom.xml | 39 ++++++++++ src/main/java/dev/dsf/bpe/CodeSystem.java | 2 +- .../java/dev/dsf/bpe/ExecutionVariables.java | 2 +- .../dsf/bpe/message/CleanupPongMessage.java | 15 ++-- .../dev/dsf/bpe/message/SendPongMessage.java | 12 +-- ...adResourceAndMeasureSpeedInSubProcess.java | 5 +- .../dev/dsf/bpe/service/ping/SavePong.java | 13 ++-- .../dsf/bpe/service/ping/StoreResults.java | 13 ++-- .../pong/DownloadResourceAndMeasureSpeed.java | 5 +- .../pong/EstimateCleanupTimerDuration.java | 9 ++- .../bpe/service/pong/StoreDownloadSpeed.java | 6 +- .../bpe/service/pong/StoreUploadSpeed.java | 14 ++-- .../dev/dsf/bpe/spring/config/PingConfig.java | 7 ++ .../bpe/util/BinaryResourceDownloader.java | 29 +++---- .../bpe/util/task/NetworkSpeedCalculator.java | 9 ++- .../DownloadedDurationGenerator.java | 26 +++++++ .../DownloadedDurationMillisGenerator.java | 21 ----- .../dev/dsf/bpe/variables/DurationValue.java | 9 +++ .../dsf/bpe/variables/DurationValueImpl.java | 16 ++++ .../variables/DurationValueSerializer.java | 76 +++++++++++++++++++ .../bpe/variables/DurationValueTypeImpl.java | 30 ++++++++ src/main/resources/bpe/pong.bpmn | 2 +- .../resources/fhir/CodeSystem/dsf-ping.xml | 4 +- .../dsf-task-cleanup-pong.xml | 18 ++--- .../StructureDefinition/dsf-task-pong.xml | 18 ++--- 25 files changed, 292 insertions(+), 108 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationGenerator.java delete mode 100644 src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java create mode 100644 src/main/java/dev/dsf/bpe/variables/DurationValue.java create mode 100644 src/main/java/dev/dsf/bpe/variables/DurationValueImpl.java create mode 100644 src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java create mode 100644 src/main/java/dev/dsf/bpe/variables/DurationValueTypeImpl.java diff --git a/pom.xml b/pom.xml index 6900fa68..7af530e6 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,26 @@ <scope>provided</scope> </dependency> + <dependency> + <groupId>com.fasterxml.jackson.datatype</groupId> + <artifactId>jackson-datatype-jsr310</artifactId> + <version>2.19.0</version> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + </exclusion> + </exclusions> + </dependency> + <!-- testing --> <dependency> <groupId>dev.dsf</groupId> @@ -115,6 +135,25 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.5.0</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <createDependencyReducedPom>false</createDependencyReducedPom> + <filters> + <filter> + <artifact>com.fasterxml.jackson.datatype:jackson-datatype-jsr310</artifact> + <includes> + <include>**</include> + </includes> + </filter> + </filters> + </configuration> + </execution> + </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index 40570364..c9800217 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -57,7 +57,7 @@ public enum Code implements SingleStringValueEnum TARGET_ENDPOINTS("target-endpoints"), TIMER_INTERVAL("timer-interval"), DOWNLOAD_RESOURCE_SIZE_BYTES("download-resource-size-bytes"), - DOWNLOADED_DURATION_MILLIS("downloaded-duration-millis"), + DOWNLOADED_DURATION_MILLIS("downloaded-duration"), DOWNLOADED_BYTES("downloaded-bytes"), DOWNLOAD_RESOURCE_REFERENCE("download-resource-reference"), ERROR("error"); diff --git a/src/main/java/dev/dsf/bpe/ExecutionVariables.java b/src/main/java/dev/dsf/bpe/ExecutionVariables.java index 785482a7..6b2ace58 100644 --- a/src/main/java/dev/dsf/bpe/ExecutionVariables.java +++ b/src/main/java/dev/dsf/bpe/ExecutionVariables.java @@ -11,7 +11,7 @@ public enum ExecutionVariables ERROR("error"), ERROR_LIST("errors"), DOWNLOADED_BYTES("downloadedBytes"), - DOWNLOADED_DURATION_MILLIS("downloadedDurationMillis"), + DOWNLOADED_DURATION("downloadedDuration"), PONG_TARGET_ENDPOINT_IDENTIFIER("targetEndpointIdentifier"), UPLOADED_BYTES("uploadedBytes"), UPLOADED_DURATION_MILLIS("uploadedDurationMillis"), diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index efccdd6a..b69d81ee 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -1,11 +1,10 @@ package dev.dsf.bpe.message; +import java.time.Duration; import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; @@ -13,7 +12,7 @@ import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; -import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadedDurationGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; @@ -33,17 +32,17 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); Long downloadedBytes = variables.getLong(ExecutionVariables.DOWNLOADED_BYTES.correlatedValue(correlationKey)); - Long downloadedDurationMillis = variables - .getLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.correlatedValue(correlationKey)); + Duration downloadedDuration = (Duration) variables + .getVariable(ExecutionVariables.DOWNLOADED_DURATION.correlatedValue(correlationKey)); Stream<Task.ParameterComponent> downloadedBytesParameter = downloadedBytes != null ? Stream.of(DownloadedBytesGenerator.create(downloadedBytes)) : Stream.empty(); - Stream<Task.ParameterComponent> downloadedDurationMillisParameter = downloadedDurationMillis != null - ? Stream.of(DownloadedDurationMillisGenerator.create(downloadedDurationMillis)) + Stream<Task.ParameterComponent> downloadedDurationParameter = downloadedDuration != null + ? Stream.of(DownloadedDurationGenerator.create(downloadedDuration)) : Stream.empty(); - return Stream.of(downloadedBytesParameter, downloadedDurationMillisParameter).flatMap(s -> s); + return Stream.of(downloadedBytesParameter, downloadedDurationParameter).flatMap(s -> s); } @Override diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index 2316f512..1b6086c2 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -1,5 +1,6 @@ package dev.dsf.bpe.message; +import java.time.Duration; import java.util.List; import java.util.Objects; import java.util.stream.Stream; @@ -16,7 +17,7 @@ import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; -import dev.dsf.bpe.util.task.input.generator.DownloadedDurationMillisGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadedDurationGenerator; import dev.dsf.bpe.util.task.input.generator.ErrorInputComponentGenerator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -52,21 +53,22 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE if (downloadResourceSizeBytes >= 0) { Long downloadedBytes = variables.getLong(ExecutionVariables.DOWNLOADED_BYTES.getValue()); - Long downloadedDurationMillis = variables.getLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.getValue()); + Duration downloadedDuration = (Duration) variables + .getVariable(ExecutionVariables.DOWNLOADED_DURATION.getValue()); String downloadResourceReference = variables .getString(ExecutionVariables.DOWNLOAD_RESOURCE_REFERENCE.getValue()); Stream<Task.ParameterComponent> downloadedBytesParameter = downloadedBytes != null ? Stream.of(DownloadedBytesGenerator.create(downloadedBytes)) : Stream.empty(); - Stream<Task.ParameterComponent> downloadedDurationMillisParameter = downloadedDurationMillis != null - ? Stream.of(DownloadedDurationMillisGenerator.create(downloadedDurationMillis)) + Stream<Task.ParameterComponent> downloadedDurationParameter = downloadedDuration != null + ? Stream.of(DownloadedDurationGenerator.create(downloadedDuration)) : Stream.empty(); Stream<Task.ParameterComponent> downloadedResourceReferenceParameter = downloadResourceReference != null ? Stream.of(DownloadResourceReferenceGenerator.create(downloadResourceReference)) : Stream.empty(); - return Stream.of(downloadedBytesParameter, downloadedDurationMillisParameter, + return Stream.of(downloadedBytesParameter, downloadedDurationParameter, downloadedResourceReferenceParameter, ErrorInputComponentGenerator.create(errorList).stream()) .flatMap(stream -> stream); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index deffeb30..6c491b84 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -12,6 +12,7 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.DurationValueImpl; public class DownloadResourceAndMeasureSpeedInSubProcess extends AbstractServiceDelegate { @@ -42,8 +43,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { variables.setLong(ExecutionVariables.DOWNLOADED_BYTES.correlatedValue(correlationKey), downloadResult.getDownloadedBytes()); - variables.setLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.correlatedValue(correlationKey), - downloadResult.getDownloadedDurationMillis()); + variables.setVariable(ExecutionVariables.DOWNLOADED_DURATION.correlatedValue(correlationKey), + new DurationValueImpl(downloadResult.getDownloadedDuration())); } else { diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 81c586dd..8a5d90e5 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -1,5 +1,6 @@ package dev.dsf.bpe.service.ping; +import java.time.Duration; import java.util.List; import java.util.Optional; @@ -18,6 +19,7 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.DurationValueImpl; public class SavePong extends AbstractServiceDelegate { @@ -38,12 +40,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task pong = variables.getLatestTask(); - Optional<DecimalType> optDownloadedDurationMillis = api.getTaskHelper().getFirstInputParameterValue(pong, - CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue(), - DecimalType.class); - optDownloadedDurationMillis.ifPresent(decimalType -> variables.setLong( + Optional<org.hl7.fhir.r4.model.Duration> optDownloadedDuration = api.getTaskHelper() + .getFirstInputParameterValue(pong, CodeSystem.DsfPing.URL, + CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue(), + org.hl7.fhir.r4.model.Duration.class); + optDownloadedDuration.ifPresent(duration -> variables.setVariable( ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), - decimalType.getValue().longValue())); + new DurationValueImpl(Duration.ofMillis(duration.getValue().longValue())))); Optional<DecimalType> optDownloadedBytes = api.getTaskHelper().getFirstInputParameterValue(pong, CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue(), DecimalType.class); diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 2e41fbba..4441a9e7 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -1,6 +1,7 @@ package dev.dsf.bpe.service.ping; import java.math.BigDecimal; +import java.time.Duration; import java.util.Comparator; import java.util.HashMap; import java.util.List; @@ -75,17 +76,17 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw { Long downloadedBytes = variables .getLong(ExecutionVariables.DOWNLOADED_BYTES.correlatedValue(correlationKey)); - Long downloadedDurationMillis = variables - .getLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.correlatedValue(correlationKey)); + Duration downloadedDuration = (Duration) variables + .getVariable(ExecutionVariables.DOWNLOADED_DURATION.correlatedValue(correlationKey)); - BigDecimal downloadSpeed = downloadedBytes != null && downloadedDurationMillis != null - ? NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, networkSpeedUnit) + BigDecimal downloadSpeed = downloadedBytes != null && downloadedDuration != null + ? NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDuration, networkSpeedUnit) : null; Long uploadedBytes = variables .getLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey)); - Long uploadedDurationMillis = variables - .getLong(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey)); + Duration uploadedDurationMillis = (Duration) variables + .getVariable(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey)); BigDecimal uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null ? NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit) diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 29b63426..68d64cd8 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -11,6 +11,7 @@ import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.DurationValueImpl; public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate { @@ -36,8 +37,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable if (downloadResult.getError() == null) { variables.setLong(ExecutionVariables.DOWNLOADED_BYTES.getValue(), downloadResult.getDownloadedBytes()); - variables.setLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.getValue(), - downloadResult.getDownloadedDurationMillis()); + variables.setVariable(ExecutionVariables.DOWNLOADED_DURATION.getValue(), + new DurationValueImpl(downloadResult.getDownloadedDuration())); } else { diff --git a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java index 27406eb7..83b17903 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java @@ -26,11 +26,12 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Estimating cleanup timer duration..."); final long minTimerDurationMillis = 20000; - long downloadedDurationMillis = Optional - .ofNullable(variables.getLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.getValue())).orElse(0L); - long timerDurationMillis = downloadedDurationMillis > Long.MAX_VALUE / 10 - minTimerDurationMillis + Duration downloadedDuration = Optional + .ofNullable((Duration) variables.getVariable(ExecutionVariables.DOWNLOADED_DURATION.getValue())) + .orElse(Duration.ZERO); + long timerDurationMillis = downloadedDuration.toMillis() > Long.MAX_VALUE / 10 - minTimerDurationMillis ? Long.MAX_VALUE - : downloadedDurationMillis * 10 + minTimerDurationMillis; + : downloadedDuration.toMillis() * 10 + minTimerDurationMillis; String cleanUpTimerDuration = Duration.ofMillis(timerDurationMillis).toString(); variables.setString("cleanupTimerDuration", cleanUpTimerDuration); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 2a7b0363..0739a42a 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -1,6 +1,7 @@ package dev.dsf.bpe.service.pong; import java.math.BigDecimal; +import java.time.Duration; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -33,9 +34,10 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw logger.debug("Storing download speed..."); long downloadedBytes = variables.getLong(ExecutionVariables.DOWNLOADED_BYTES.getValue()); - long downloadedDurationMillis = variables.getLong(ExecutionVariables.DOWNLOADED_DURATION_MILLIS.getValue()); + Duration downloadedDuration = (Duration) variables + .getVariable(ExecutionVariables.DOWNLOADED_DURATION.getValue()); - BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDurationMillis, + BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDuration, networkSpeedUnit); PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.PENDING); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index 37db4a96..3d837a2b 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -1,6 +1,7 @@ package dev.dsf.bpe.service.pong; import java.math.BigDecimal; +import java.time.Duration; import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; @@ -36,14 +37,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Storing upload speed..."); Optional<DecimalType> uploadedBytesTaskInput = getUploadedBytes(cleanup); - Optional<DecimalType> uploadedDurationMillisTaskInput = getUploadedDurationMillis(cleanup); + Optional<org.hl7.fhir.r4.model.Duration> uploadedDurationTaskInput = getUploadedDuration(cleanup); long uploadedBytes = uploadedBytesTaskInput.map(PrimitiveType::getValue).orElse(BigDecimal.valueOf(0)) .longValue(); - long uploadedDurationMillis = uploadedDurationMillisTaskInput - .map(decimalType -> decimalType.getValue().longValue()).orElse(0L); + Duration uploadedDuration = uploadedDurationTaskInput + .map(duration -> Duration.ofMillis(duration.getValue().longValue())).orElse(Duration.ZERO); - BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, - networkSpeedUnit); + BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDuration, networkSpeedUnit); PingStatusGenerator.updatePongStatusOutputUploadSpeed(startTask, uploadSpeed, networkSpeedUnit); @@ -57,9 +57,9 @@ private Optional<DecimalType> getUploadedBytes(Task task) CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue(), DecimalType.class); } - private Optional<DecimalType> getUploadedDurationMillis(Task task) + private Optional<org.hl7.fhir.r4.model.Duration> getUploadedDuration(Task task) { return api.getTaskHelper().getFirstInputParameterValue(task, CodeSystem.DsfPing.URL, - CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue(), DecimalType.class); + CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue(), org.hl7.fhir.r4.model.Duration.class); } } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 59b54c7b..076f2a96 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -43,6 +43,7 @@ import dev.dsf.bpe.util.CodeSystemDsfPingUnitsConverter; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; +import dev.dsf.bpe.variables.DurationValueSerializer; @Configuration public class PingConfig @@ -325,6 +326,12 @@ public LogAndSaveUploadErrorPong logAndSaveUploadErrorPong() return new LogAndSaveUploadErrorPong(api); } + @Bean + public DurationValueSerializer durationValueSerializer() + { + return new DurationValueSerializer(); + } + @Bean public static ConversionService conversionService() { diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index c8cfe6c0..39aa7a7f 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -3,6 +3,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.SocketTimeoutException; +import java.time.Duration; import java.util.Optional; import org.hl7.fhir.r4.model.IdType; @@ -70,10 +71,9 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t long numBytes = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); binaryResourceInputStream.skipNBytes(numBytes); long downloadEndTime = System.currentTimeMillis(); - long downloadedDurationMillis = downloadEndTime - downloadStartTime; - downloadResult = new DownloadResult(numBytes, downloadedDurationMillis); - logger.info("Finished downloading {} bytes. Took {}", numBytes, - toHoursMinutesSecondsMilliseconds(downloadedDurationMillis)); + Duration downloadedDuration = Duration.ofMillis(downloadEndTime - downloadStartTime); + downloadResult = new DownloadResult(numBytes, downloadedDuration); + logger.info("Finished downloading {} bytes. Took {}", numBytes, downloadedDuration.toString()); } catch (IOException e) { @@ -123,32 +123,23 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t return downloadResult; } - private String toHoursMinutesSecondsMilliseconds(long millis) - { - long hours = (millis / 1000) / 60 / 60 % 24; - long minutes = (millis / 1000) / 60 % 60; - long seconds = (millis / 1000) % 60; - long milliSeconds = millis % 1000; - return String.format("%02d:%02d:%02d:%03d (h:m:s:ms)", hours, minutes, seconds, milliSeconds); - } - public static class DownloadResult { private final long downloadedBytes; - private final long downloadedDurationMillis; + private final Duration downloadedDuration; private final ProcessError error; - public DownloadResult(long downloadedBytes, long downloadedDurationMillis) + public DownloadResult(long downloadedBytes, Duration downloadedDuration) { this.downloadedBytes = downloadedBytes; - this.downloadedDurationMillis = downloadedDurationMillis; + this.downloadedDuration = downloadedDuration; error = null; } public DownloadResult(ProcessError error) { downloadedBytes = 0; - downloadedDurationMillis = 0; + downloadedDuration = Duration.ZERO; this.error = error; } @@ -157,9 +148,9 @@ public long getDownloadedBytes() return downloadedBytes; } - public long getDownloadedDurationMillis() + public Duration getDownloadedDuration() { - return downloadedDurationMillis; + return downloadedDuration; } public ProcessError getError() diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 2d62d50c..7d319940 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -2,6 +2,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; +import java.time.Duration; import dev.dsf.bpe.CodeSystem; @@ -11,17 +12,17 @@ private NetworkSpeedCalculator() { } - public static BigDecimal calculate(long bytes, long duration, CodeSystem.DsfPingUnits.Code unit) + public static BigDecimal calculate(long bytes, Duration duration, CodeSystem.DsfPingUnits.Code unit) { if (bytes == 0) return BigDecimal.ZERO; - if (duration == 0) + if (duration.isZero()) return BigDecimal.valueOf(Long.MAX_VALUE); - BigDecimal seconds = BigDecimal.valueOf(duration).setScale(3, RoundingMode.HALF_UP) + BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); - return switch (unit) + return switch (unit) // todo: unit can implement calculate for each entry { case BITS_PER_SECOND -> { diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationGenerator.java new file mode 100644 index 00000000..72fee158 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationGenerator.java @@ -0,0 +1,26 @@ +package dev.dsf.bpe.util.task.input.generator; + +import java.time.Duration; + +import org.hl7.fhir.r4.model.Task; + +import dev.dsf.bpe.CodeSystem; + +public final class DownloadedDurationGenerator +{ + private static final String CODESYSTEM_UCUM = "http://unitsofmeasure.org"; + private static final String CODESYSTEM_UCUM_CODE_MILLISECONDS = "ms"; + + private DownloadedDurationGenerator() + { + } + + public static Task.ParameterComponent create(Duration duration) + { + Task.ParameterComponent param = new Task.ParameterComponent(); + param.setValue(new org.hl7.fhir.r4.model.Duration().setValue(duration.toMillis()).setSystem(CODESYSTEM_UCUM) + .setCode(CODESYSTEM_UCUM_CODE_MILLISECONDS)).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) + .setCode(CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue()); + return param; + } +} diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java deleted file mode 100644 index 1df99ec4..00000000 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationMillisGenerator.java +++ /dev/null @@ -1,21 +0,0 @@ -package dev.dsf.bpe.util.task.input.generator; - -import org.hl7.fhir.r4.model.DecimalType; -import org.hl7.fhir.r4.model.Task; - -import dev.dsf.bpe.CodeSystem; - -public final class DownloadedDurationMillisGenerator -{ - private DownloadedDurationMillisGenerator() - { - } - - public static Task.ParameterComponent create(long durationMillis) - { - Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(new DecimalType(durationMillis)).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) - .setCode(CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue()); - return param; - } -} diff --git a/src/main/java/dev/dsf/bpe/variables/DurationValue.java b/src/main/java/dev/dsf/bpe/variables/DurationValue.java new file mode 100644 index 00000000..6e0df837 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/DurationValue.java @@ -0,0 +1,9 @@ +package dev.dsf.bpe.variables; + +import java.time.Duration; + +import org.camunda.bpm.engine.variable.value.PrimitiveValue; + +public interface DurationValue extends PrimitiveValue<Duration> +{ +} diff --git a/src/main/java/dev/dsf/bpe/variables/DurationValueImpl.java b/src/main/java/dev/dsf/bpe/variables/DurationValueImpl.java new file mode 100644 index 00000000..3029c6e0 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/DurationValueImpl.java @@ -0,0 +1,16 @@ +package dev.dsf.bpe.variables; + +import java.time.Duration; + +import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; + +public class DurationValueImpl extends PrimitiveTypeValueImpl<Duration> implements DurationValue +{ + private static final PrimitiveValueType DURATION_VALUE_TYPE = new DurationValueTypeImpl(); + + public DurationValueImpl(Duration value) + { + super(value, DURATION_VALUE_TYPE); + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java b/src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java new file mode 100644 index 00000000..2359c6a9 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java @@ -0,0 +1,76 @@ +package dev.dsf.bpe.variables; + +import java.time.Duration; +import java.util.Objects; + +import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; +import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; +import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +public class DurationValueSerializer extends PrimitiveValueSerializer<DurationValue> implements InitializingBean +{ + private static final PrimitiveValueType DURATION_VALUE_TYPE = new DurationValueTypeImpl(); + private final ObjectMapper objectMapper; + + public DurationValueSerializer() + { + super(DURATION_VALUE_TYPE); + this.objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(objectMapper, "objectMapper"); + } + + @Override + public void writeValue(DurationValue value, ValueFields valueFields) + { + try + { + valueFields.setByteArrayValue(objectMapper.writeValueAsBytes(value.getValue())); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + } + + @Override + public DurationValueImpl readValue(ValueFields valueFields, boolean asTransientValue) + { + try + { + byte[] bytes = valueFields.getByteArrayValue(); + return (bytes == null || bytes.length == 0) ? null + : new DurationValueImpl(objectMapper.readValue(bytes, Duration.class)); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @Override + public DurationValueImpl convertToTypedValue(UntypedValueImpl untypedValue) + { + if (untypedValue != null && untypedValue.getValue() instanceof Duration duration) + { + return new DurationValueImpl(duration); + } + else if (untypedValue != null) + { + throw new IllegalArgumentException( + "Cannot convert " + untypedValue.getValue().getClass().getSimpleName() + " to DurationValueImpl"); + } + throw new IllegalArgumentException("Cannot convert " + untypedValue + " to DurationValueImpl"); + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/DurationValueTypeImpl.java b/src/main/java/dev/dsf/bpe/variables/DurationValueTypeImpl.java new file mode 100644 index 00000000..7dbe452f --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/DurationValueTypeImpl.java @@ -0,0 +1,30 @@ +package dev.dsf.bpe.variables; + +import java.time.Duration; +import java.util.Map; + +import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; + +public class DurationValueTypeImpl extends PrimitiveValueTypeImpl +{ + private static final Class<Duration> DURATION_CLASS = Duration.class; + + public DurationValueTypeImpl() + { + super(DURATION_CLASS); + } + + @Override + public DurationValueImpl createValue(Object o, Map<String, Object> map) + { + if (o instanceof Duration duration) + { + return new DurationValueImpl(duration); + } + else + { + throw new IllegalArgumentException("Cannot create value of type " + DURATION_CLASS.getSimpleName() + + " from type " + o.getClass().getSimpleName()); + } + } +} diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 15aa3067..477be2a0 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -196,7 +196,7 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:textAnnotation id="TextAnnotation_1o7v81w"> <bpmn:text>Information in message: - downloadedBytes: long -- downloadedDurationMillis: long +- downloadedDuration: Duration - downloadResourceReference: Reference - errors: List</bpmn:text> </bpmn:textAnnotation> diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping.xml b/src/main/resources/fhir/CodeSystem/dsf-ping.xml index 97a2fb11..8306e246 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping.xml @@ -67,8 +67,8 @@ <definition value="Amount of bytes downloaded to measure network speed"/> </concept> <concept> - <code value="downloaded-duration-millis"/> - <display value="Downloaded Duration Millis"/> + <code value="downloaded-duration"/> + <display value="Downloaded Duration"/> <definition value="Duration it took for the resource to be downloaded to measure network speed"/> </concept> <concept> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index ccca246b..6d951732 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -100,13 +100,13 @@ <code value="decimal"/> </type> </element> - <element id="Task.input:downloaded-duration-millis"> + <element id="Task.input:downloaded-duration"> <path value="Task.input"/> - <sliceName value="downloaded-duration-millis"/> + <sliceName value="downloaded-duration"/> <min value="0"/> <max value="1"/> </element> - <element id="Task.input:downloaded-duration-millis.type"> + <element id="Task.input:downloaded-duration.type"> <path value="Task.input.type"/> <min value="1"/> <max value="1"/> @@ -115,29 +115,29 @@ <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> </binding> </element> - <element id="Task.input:downloaded-duration-millis.type.coding"> + <element id="Task.input:downloaded-duration.type.coding"> <path value="Task.input.type.coding"/> <min value="1"/> <max value="1"/> </element> - <element id="Task.input:downloaded-duration-millis.type.coding.system"> + <element id="Task.input:downloaded-duration.type.coding.system"> <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> - <element id="Task.input:downloaded-duration-millis.type.coding.code"> + <element id="Task.input:downloaded-duration.type.coding.code"> <path value="Task.input.type.coding.code"/> <min value="1"/> <max value="1"/> - <fixedCode value="downloaded-duration-millis"/> + <fixedCode value="downloaded-duration"/> </element> - <element id="Task.input:downloaded-duration-millis.value[x]"> + <element id="Task.input:downloaded-duration.value[x]"> <path value="Task.input.value[x]"/> <min value="1"/> <max value="1"/> <type> - <code value="decimal"/> + <code value="Duration"/> </type> </element> </differential> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index c8af794a..fbe1d2c2 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -151,13 +151,13 @@ <code value="decimal"/> </type> </element> - <element id="Task.input:downloaded-duration-millis"> + <element id="Task.input:downloaded-duration"> <path value="Task.input"/> - <sliceName value="downloaded-duration-millis"/> + <sliceName value="downloaded-duration"/> <min value="0"/> <max value="1"/> </element> - <element id="Task.input:downloaded-duration-millis.type"> + <element id="Task.input:downloaded-duration.type"> <path value="Task.input.type"/> <min value="1"/> <max value="1"/> @@ -166,29 +166,29 @@ <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> </binding> </element> - <element id="Task.input:downloaded-duration-millis.type.coding"> + <element id="Task.input:downloaded-duration.type.coding"> <path value="Task.input.type.coding"/> <min value="1"/> <max value="1"/> </element> - <element id="Task.input:downloaded-duration-millis.type.coding.system"> + <element id="Task.input:downloaded-duration.type.coding.system"> <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> </element> - <element id="Task.input:downloaded-duration-millis.type.coding.code"> + <element id="Task.input:downloaded-duration.type.coding.code"> <path value="Task.input.type.coding.code"/> <min value="1"/> <max value="1"/> - <fixedCode value="downloaded-duration-millis"/> + <fixedCode value="downloaded-duration"/> </element> - <element id="Task.input:downloaded-duration-millis.value[x]"> + <element id="Task.input:downloaded-duration.value[x]"> <path value="Task.input.value[x]"/> <min value="1"/> <max value="1"/> <type> - <code value="decimal"/> + <code value="Duration"/> </type> </element> <element id="Task.input:process-error"> From ce7887256d0d12857c392fa3f9cd95e7f078d252 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 13 Aug 2025 13:15:19 +0200 Subject: [PATCH 325/382] Removed unused class --- .../dev/dsf/bpe/util/ReadAccessTagGenerator.java | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java diff --git a/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java b/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java deleted file mode 100644 index 9a54a85b..00000000 --- a/src/main/java/dev/dsf/bpe/util/ReadAccessTagGenerator.java +++ /dev/null @@ -1,16 +0,0 @@ -package dev.dsf.bpe.util; - -import org.hl7.fhir.r4.model.Coding; - -import dev.dsf.bpe.CodeSystem; - -public class ReadAccessTagGenerator -{ - public static Coding create(String accessLevel) - { - Coding tag = new Coding(); - tag.setSystem(CodeSystem.ReadAccessTag.URL); - tag.setCode(accessLevel); - return tag; - } -} From 5291c84e26e4f7410c3b80bf43d3db677eae0dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 13 Aug 2025 18:15:00 +0200 Subject: [PATCH 326/382] Removed duplicated generator class used only in tests and replaced it with DownloadedBytesGenerator and DownloadedDurationGenerator --- .../NetworkSpeedMetricGenerator.java | 30 ------------------- .../dsf/fhir/profiles/TaskProfileTest.java | 16 +++++----- 2 files changed, 9 insertions(+), 37 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java deleted file mode 100644 index 58f87430..00000000 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/NetworkSpeedMetricGenerator.java +++ /dev/null @@ -1,30 +0,0 @@ -package dev.dsf.bpe.util.task.input.generator; - -import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.DecimalType; -import org.hl7.fhir.r4.model.Task; - -import dev.dsf.bpe.CodeSystem; - -public final class NetworkSpeedMetricGenerator -{ - private NetworkSpeedMetricGenerator() - { - } - - public static Task.ParameterComponent createDownloadedDurationMillis(long duration) - { - Task.ParameterComponent downloadedDuration = new Task.ParameterComponent(); - downloadedDuration.setValue(new DecimalType(duration)).getType().addCoding(new Coding(CodeSystem.DsfPing.URL, - CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue(), null)); - return downloadedDuration; - } - - public static Task.ParameterComponent createDownloadedBytes(long bytes) - { - Task.ParameterComponent downloadedBytes = new Task.ParameterComponent(); - downloadedBytes.setValue(new DecimalType(bytes)).getType().addCoding( - new Coding(CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue(), null)); - return downloadedBytes; - } -} diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index c18ce8aa..996e4e6f 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; +import java.time.Duration; import java.time.Instant; import java.time.LocalDate; import java.time.format.DateTimeFormatter; @@ -37,8 +38,9 @@ import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; +import dev.dsf.bpe.util.task.input.generator.DownloadedDurationGenerator; import dev.dsf.bpe.util.task.input.generator.ErrorInputComponentGenerator; -import dev.dsf.bpe.util.task.input.generator.NetworkSpeedMetricGenerator; import dev.dsf.bpe.util.task.output.generator.ErrorOutputComponentGenerator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; @@ -539,8 +541,8 @@ public void testTaskPongValidWithReferenceAndDownloadedDurationMillisAndDownload Task task = createValidTaskPong(); task.addInput(DownloadResourceReferenceGenerator.create("https://test.endpoint.org/fhir/Binary")); - task.addInput(NetworkSpeedMetricGenerator.createDownloadedBytes(1000)); - task.addInput(NetworkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); + task.addInput(DownloadedBytesGenerator.create(1000)); + task.addInput(DownloadedDurationGenerator.create(Duration.ofMillis(1000))); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -555,8 +557,8 @@ public void testTaskPongValidWithMultipleErrorMessages() Task task = createValidTaskPong(); task.addInput(DownloadResourceReferenceGenerator.create("https://test.endpoint.org/fhir/Binary")); - task.addInput(NetworkSpeedMetricGenerator.createDownloadedBytes(1000)); - task.addInput(NetworkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); + task.addInput(DownloadedBytesGenerator.create(1000)); + task.addInput(DownloadedDurationGenerator.create(Duration.ofMillis(1000))); task.addInput(ErrorInputComponentGenerator.create(processErrors(1).get(0))); task.addInput(ErrorInputComponentGenerator.create(processErrors(1).get(0))); @@ -621,8 +623,8 @@ private Task createValidTaskCleanupPong() task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); - task.addInput(NetworkSpeedMetricGenerator.createDownloadedBytes(1000)); - task.addInput(NetworkSpeedMetricGenerator.createDownloadedDurationMillis(1000)); + task.addInput(DownloadedBytesGenerator.create(1000)); + task.addInput(DownloadedDurationGenerator.create(Duration.ofMillis(1000))); return task; } From d36dfb46541c283382b3ddf7050979b5ece90cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 14 Aug 2025 09:28:40 +0200 Subject: [PATCH 327/382] Removed unused CodeSystem --- src/main/java/dev/dsf/bpe/CodeSystem.java | 34 ----------------------- 1 file changed, 34 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index c9800217..60376a95 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -235,38 +235,4 @@ public static Code ofValue(String value) } } } - - public static final class ReadAccessTag - { - public static final String URL = "http://dsf.dev/fhir/CodeSystem/read-access-tag"; - - private ReadAccessTag() - { - } - - public enum Code implements SingleStringValueEnum - { - ALL("ALL"), - LOCAL("LOCAL"), - ORGANIZATION("ORGANIZATION"), - ROLE("ROLE"); - - private final String value; - - Code(String value) - { - this.value = value; - } - - public String getValue() - { - return value; - } - - public static Code ofValue(String value) - { - return new SingleStringValueEnumParser<>(Code.class).ofValue(value); - } - } - } } From 905207f3f5e6777621223780d3c12c07fd806bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 14 Aug 2025 09:29:37 +0200 Subject: [PATCH 328/382] Removed empty line --- src/main/java/dev/dsf/bpe/ProcessError.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 4fb0e441..3d8f70fe 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -26,7 +26,6 @@ public boolean equals(Object obj) return obj instanceof ProcessError error && process.equals(error.process()) && processStep.equals(error.processStep()) && action.equals(error.action()) && message.equals(error.message()); - } public static Extension toExtension(ProcessError error) From fdc1c55e42561cde9aba6b6f7423b2786e1b3b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 14 Aug 2025 09:40:44 +0200 Subject: [PATCH 329/382] Removed equals method because it wasn't implemented with a hashCode method as well as not seeming used for anything --- src/main/java/dev/dsf/bpe/ProcessError.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 3d8f70fe..a5d3c884 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -20,14 +20,6 @@ public record ProcessError(CodeSystem.DsfPingProcesses.Code process, CodeSystem.DsfPingProcessSteps.Code processStep, String action, String potentialFixUrl, String message) implements Serializable { - @Override - public boolean equals(Object obj) - { - return obj instanceof ProcessError error && process.equals(error.process()) - && processStep.equals(error.processStep()) && action.equals(error.action()) - && message.equals(error.message()); - } - public static Extension toExtension(ProcessError error) { Objects.requireNonNull(error); From 352ec7104c45041b90553935ad09ffb792483517 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 14 Aug 2025 10:43:49 +0200 Subject: [PATCH 330/382] Removed unused throw statement --- .../java/dev/dsf/bpe/variables/DurationValueSerializer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java b/src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java index 2359c6a9..10622764 100644 --- a/src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java +++ b/src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java @@ -26,7 +26,7 @@ public DurationValueSerializer() } @Override - public void afterPropertiesSet() throws Exception + public void afterPropertiesSet() { Objects.requireNonNull(objectMapper, "objectMapper"); } From 141ef3b43467c52b0867095cc78f38075dae6391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 14 Aug 2025 13:56:55 +0200 Subject: [PATCH 331/382] - Replaced json parsing from ProcessError by camunda typed values and serialization - Introduced ProcessErrors as a wrapper to replace List<ProcessError> for camunda typed values and serialization - Changed ErrorListUtils to use ProcessErrors instead of List<ProcessError> - Moved typed values and serialization code for Duration, ProcessError and ProcessErrors to their own package for better readability --- src/main/java/dev/dsf/bpe/ProcessError.java | 54 ---------- src/main/java/dev/dsf/bpe/ProcessErrors.java | 48 +++++++++ .../dsf/bpe/message/CleanupPongMessage.java | 3 +- .../dev/dsf/bpe/message/SendPingMessage.java | 3 +- .../dev/dsf/bpe/message/SendPongMessage.java | 11 +- .../bpe/service/GenerateAndStoreResource.java | 4 +- ...adResourceAndMeasureSpeedInSubProcess.java | 2 +- .../bpe/service/ping/LogAndSaveSendError.java | 3 +- .../ping/LogAndSaveUploadErrorPing.java | 3 +- .../dev/dsf/bpe/service/ping/SavePong.java | 7 +- .../dsf/bpe/service/ping/StoreResults.java | 13 +-- .../pong/DownloadResourceAndMeasureSpeed.java | 2 +- .../service/pong/LogAndSaveAndStoreError.java | 3 +- .../pong/LogAndSaveUploadErrorPong.java | 3 +- .../dev/dsf/bpe/service/pong/StoreErrors.java | 8 +- .../dev/dsf/bpe/spring/config/PingConfig.java | 35 +++++- .../java/dev/dsf/bpe/util/ErrorListUtils.java | 49 ++++----- .../variables/DurationValueSerializer.java | 76 ------------- .../GenericPrimitiveTypeSerializer.java | 100 ++++++++++++++++++ .../{ => duration}/DurationValue.java | 2 +- .../{ => duration}/DurationValueImpl.java | 7 +- .../duration/DurationValueSerializer.java | 19 ++++ .../{ => duration}/DurationValueTypeImpl.java | 2 +- .../process_error/ProcessErrorValue.java | 9 ++ .../process_error/ProcessErrorValueImpl.java | 21 ++++ .../ProcessErrorValueSerializer.java | 16 +++ .../ProcessErrorValueTypeImpl.java | 32 ++++++ .../process_errors/ProcessErrorsValue.java | 9 ++ .../ProcessErrorsValueImpl.java | 21 ++++ .../ProcessErrorsValueSerializer.java | 16 +++ .../ProcessErrorsValueTypeImpl.java | 32 ++++++ 31 files changed, 418 insertions(+), 195 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/ProcessErrors.java delete mode 100644 src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java create mode 100644 src/main/java/dev/dsf/bpe/variables/GenericPrimitiveTypeSerializer.java rename src/main/java/dev/dsf/bpe/variables/{ => duration}/DurationValue.java (79%) rename src/main/java/dev/dsf/bpe/variables/{ => duration}/DurationValueImpl.java (76%) create mode 100644 src/main/java/dev/dsf/bpe/variables/duration/DurationValueSerializer.java rename src/main/java/dev/dsf/bpe/variables/{ => duration}/DurationValueTypeImpl.java (94%) create mode 100644 src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValue.java create mode 100644 src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueImpl.java create mode 100644 src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueSerializer.java create mode 100644 src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueTypeImpl.java create mode 100644 src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValue.java create mode 100644 src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueImpl.java create mode 100644 src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueSerializer.java create mode 100644 src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueTypeImpl.java diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index a5d3c884..5d857320 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -75,58 +75,4 @@ public static ProcessError toError(Extension extension) return new ProcessError(processCode, stepCode, action, potentialFixUrl, message); } - - public static String toString(List<ProcessError> errors) - { - try - { - ObjectMapper objectMapper = new ObjectMapper(); - return objectMapper.writeValueAsString(errors); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } - } - - public static String toString(ProcessError error) - { - try - { - ObjectMapper objectMapper = new ObjectMapper(); - return objectMapper.writeValueAsString(error); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } - } - - public static List<ProcessError> parseList(String json) - { - try - { - ObjectMapper objectMapper = new ObjectMapper(); - return objectMapper.readValue(json, new TypeReference<>() - { - }); - } - catch (JsonProcessingException e) - { - throw new IllegalArgumentException("Unable to parse [" + json + "] to List<ProcessError>", e); - } - } - - public static ProcessError parse(String json) - { - try - { - ObjectMapper objectMapper = new ObjectMapper(); - return objectMapper.readValue(json, ProcessError.class); - } - catch (JsonProcessingException e) - { - throw new IllegalArgumentException("Unable to parse [" + json + "] to ProcessError", e); - } - } } diff --git a/src/main/java/dev/dsf/bpe/ProcessErrors.java b/src/main/java/dev/dsf/bpe/ProcessErrors.java new file mode 100644 index 00000000..5c2891d7 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/ProcessErrors.java @@ -0,0 +1,48 @@ +package dev.dsf.bpe; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Vector; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class ProcessErrors +{ + private final List<ProcessError> entries; + + public ProcessErrors() + { + entries = new Vector<>(); + } + + @JsonCreator + public ProcessErrors(@JsonProperty("entries") Collection<ProcessError> entries) + { + this.entries = new ArrayList<>(entries); + } + + @JsonProperty("entries") + public List<ProcessError> getEntries() + { + return entries; + } + + public void add(ProcessError error) + { + entries.add(error); + } + + public void addAll(ProcessErrors errors) + { + entries.addAll(errors.getEntries()); + } + + @JsonIgnore + public boolean isEmpty() + { + return entries.isEmpty(); + } +} diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index b69d81ee..4a7022ec 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -17,6 +17,7 @@ import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.process_error.ProcessErrorValueImpl; public class CleanupPongMessage extends AbstractTaskMessageSend { @@ -54,7 +55,7 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab ProcessError error = SendTaskErrorConverter.convert(exception, "Sending cleanup message to " + target.getEndpointUrl()); - execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), ProcessError.toString(error)); + execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), new ProcessErrorValueImpl(error)); execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), CodeSystem.DsfPing.Code.ERROR.getValue()); logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index 858d2be5..6185ba9d 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -21,6 +21,7 @@ import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.process_error.ProcessErrorValueImpl; import dev.dsf.fhir.client.FhirWebserviceClient; public class SendPingMessage extends AbstractTaskMessageSend @@ -80,7 +81,7 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab ProcessError error = SendTaskErrorConverter.convert(exception, "Sending ping message to " + target.getEndpointUrl()); - execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), ProcessError.toString(error)); + execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), new ProcessErrorValueImpl(error)); execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), CodeSystem.DsfPing.Code.ERROR.getValue()); logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index 1b6086c2..a6c37077 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -1,7 +1,6 @@ package dev.dsf.bpe.message; import java.time.Duration; -import java.util.List; import java.util.Objects; import java.util.stream.Stream; @@ -24,6 +23,7 @@ import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.ProcessErrors; public class SendPongMessage extends AbstractTaskMessageSend { @@ -48,7 +48,7 @@ public void afterPropertiesSet() throws Exception protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - List<ProcessError> errorList = ErrorListUtils.getErrorMessageList(execution); + ProcessErrors errorList = ErrorListUtils.getErrorList(execution); long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); if (downloadResourceSizeBytes >= 0) { @@ -68,13 +68,14 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE ? Stream.of(DownloadResourceReferenceGenerator.create(downloadResourceReference)) : Stream.empty(); - return Stream.of(downloadedBytesParameter, downloadedDurationParameter, - downloadedResourceReferenceParameter, ErrorInputComponentGenerator.create(errorList).stream()) + return Stream + .of(downloadedBytesParameter, downloadedDurationParameter, downloadedResourceReferenceParameter, + ErrorInputComponentGenerator.create(errorList.getEntries()).stream()) .flatMap(stream -> stream); } else { - return ErrorInputComponentGenerator.create(errorList).stream(); + return ErrorInputComponentGenerator.create(errorList.getEntries()).stream(); } } diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 2a9c079c..40696041 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -11,6 +11,7 @@ import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.process_error.ProcessErrorValueImpl; import jakarta.ws.rs.WebApplicationException; public class GenerateAndStoreResource @@ -65,7 +66,8 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) CodeSystem.DsfPingProcessSteps.Code.GENERATE_AND_STORE_RESOURCE, "Storing Binary resource on local DSF FHIR server.", ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, "Local DSF FHIR server responded with status: " + status); - variables.setString(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue(), ProcessError.toString(error)); + variables.setVariable(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue(), + new ProcessErrorValueImpl(error)); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 6c491b84..aa1ac4d4 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -12,7 +12,7 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; -import dev.dsf.bpe.variables.DurationValueImpl; +import dev.dsf.bpe.variables.duration.DurationValueImpl; public class DownloadResourceAndMeasureSpeedInSubProcess extends AbstractServiceDelegate { diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 09a0f2c5..859a119b 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -24,8 +24,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(LogAndSaveSendError.class, variables.getStartTask()); String correlationKey = variables.getTarget().getCorrelationKey(); - ProcessError error = ProcessError - .parse((String) execution.getVariableLocal(ExecutionVariables.ERROR.getValue())); + ProcessError error = (ProcessError) execution.getVariableLocal(ExecutionVariables.ERROR.getValue()); ErrorListUtils.add(error, execution, correlationKey); variables.setLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), 0L); variables.setLong(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), 0L); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java index 618cb95c..b05d1f64 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java @@ -24,8 +24,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task startTask = variables.getStartTask(); PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPing.class, startTask); - ProcessError error = ProcessError - .parse(variables.getString(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue())); + ProcessError error = (ProcessError) variables.getVariable(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue()); logger.info("Error while storing binary resource for download: {}", error.message()); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 8a5d90e5..2dddfdc1 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -1,7 +1,6 @@ package dev.dsf.bpe.service.ping; import java.time.Duration; -import java.util.List; import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; @@ -11,7 +10,6 @@ import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; -import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.input.ErrorInputParser; @@ -19,7 +17,8 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; -import dev.dsf.bpe.variables.DurationValueImpl; +import dev.dsf.bpe.variables.duration.DurationValueImpl; +import dev.dsf.bpe.ProcessErrors; public class SavePong extends AbstractServiceDelegate { @@ -54,7 +53,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), decimalType.getValue().longValue())); - List<ProcessError> errorList = ErrorInputParser.parseInputs(pong); + ProcessErrors errorList = new ProcessErrors(ErrorInputParser.parseInputs(pong)); ErrorListUtils.addAll(errorList, delegateExecution, correlationKey); diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 4441a9e7..e704c462 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -27,6 +27,7 @@ import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Targets; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.ProcessErrors; public class StoreResults extends AbstractServiceDelegate implements InitializingBean { @@ -60,18 +61,18 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Targets targets = variables.getTargets(); Map<Target, List<ProcessError>> errorsPerTarget = new HashMap<>(); - ErrorOutputComponentGenerator.create(ErrorListUtils.getErrorMessageList(execution)).forEach(task::addOutput); + ErrorOutputComponentGenerator.create(ErrorListUtils.getErrorList(execution).getEntries()) + .forEach(task::addOutput); targets.getEntries().stream().sorted(Comparator.comparing(Target::getEndpointIdentifierValue)).forEach(target -> { String correlationKey = target.getCorrelationKey(); - List<ProcessError> errors = ErrorListUtils.getErrorMessageList(execution, correlationKey); + ProcessErrors errors = ErrorListUtils.getErrorList(execution, correlationKey); CodeSystem.DsfPingStatus.Code statusCode = errors.isEmpty() ? CodeSystem.DsfPingStatus.Code.COMPLETED : CodeSystem.DsfPingStatus.Code.ERROR; long downloadResourceSizeBytes = variables .getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); - List<ProcessError> errorMessageList = ErrorListUtils.getErrorMessageList(execution, correlationKey); if (downloadResourceSizeBytes >= 0) // if fat-ping { Long downloadedBytes = variables @@ -92,14 +93,14 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw ? NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit) : null; - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList, + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errors.getEntries(), downloadSpeed, uploadSpeed, networkSpeedUnit)); } else // if slim-ping { - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errorMessageList)); + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errors.getEntries())); } - errorsPerTarget.put(target, errors); + errorsPerTarget.put(target, errors.getEntries()); }); variables.updateTask(task); diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 68d64cd8..a306ec2b 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -11,7 +11,7 @@ import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; -import dev.dsf.bpe.variables.DurationValueImpl; +import dev.dsf.bpe.variables.duration.DurationValueImpl; public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate { diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 5570bec2..cb1677d5 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -32,7 +32,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable .getVariableLocal(ExecutionVariables.RESOURCE_DOWNLOAD_ERROR.getValue()); ErrorListUtils.add(error, delegateExecution); - PingStatusGenerator.updatePongStatusOutput(startTask, ErrorListUtils.getErrorMessageList(delegateExecution)); + PingStatusGenerator.updatePongStatusOutput(startTask, + ErrorListUtils.getErrorList(delegateExecution).getEntries()); variables.updateTask(startTask); logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), error.message()); diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java index 91ab8d17..f83198eb 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java @@ -25,8 +25,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task startTask = variables.getStartTask(); PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPong.class, startTask); - ProcessError error = ProcessError - .parse(variables.getString(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue())); + ProcessError error = (ProcessError) variables.getVariable(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue()); ErrorListUtils.add(error, execution); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java index 4b53acd7..ce44270c 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java @@ -1,19 +1,17 @@ package dev.dsf.bpe.service.pong; -import java.util.List; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.ProcessErrors; public class StoreErrors extends AbstractServiceDelegate { @@ -29,8 +27,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw PingPongLogger logger = new PingPongLogger(StoreErrors.class, startTask); logger.debug("Storing errors..."); - List<ProcessError> errors = ErrorListUtils.getErrorMessageList(execution); - PingStatusGenerator.updatePongStatusOutput(startTask, errors); + ProcessErrors errors = ErrorListUtils.getErrorList(execution); + PingStatusGenerator.updatePongStatusOutput(startTask, errors.getEntries()); if (!errors.isEmpty()) { diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 076f2a96..d5b88374 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -1,6 +1,7 @@ package dev.dsf.bpe.spring.config; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Bean; @@ -9,6 +10,9 @@ import org.springframework.core.convert.ConversionService; import org.springframework.core.convert.support.DefaultConversionService; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.listener.SetCorrelationKeyListener; import dev.dsf.bpe.mail.AggregateErrorMailService; @@ -43,7 +47,9 @@ import dev.dsf.bpe.util.CodeSystemDsfPingUnitsConverter; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; -import dev.dsf.bpe.variables.DurationValueSerializer; +import dev.dsf.bpe.variables.duration.DurationValueSerializer; +import dev.dsf.bpe.variables.process_error.ProcessErrorValueSerializer; +import dev.dsf.bpe.variables.process_errors.ProcessErrorsValueSerializer; @Configuration public class PingConfig @@ -327,9 +333,30 @@ public LogAndSaveUploadErrorPong logAndSaveUploadErrorPong() } @Bean - public DurationValueSerializer durationValueSerializer() + public DurationValueSerializer durationValueSerializer( + @Qualifier(OBJECT_MAPPER_WITH_TIME_MODULE) ObjectMapper objectMapper) { - return new DurationValueSerializer(); + return new DurationValueSerializer(objectMapper); + } + + @Bean + public ProcessErrorValueSerializer processErrorValueSerializer() + { + return new ProcessErrorValueSerializer(); + } + + @Bean + public ProcessErrorsValueSerializer processErrorsValueSerializer() + { + return new ProcessErrorsValueSerializer(); + } + + @Bean(name = OBJECT_MAPPER_WITH_TIME_MODULE) + public ObjectMapper objectMapperWithJavaTimeModule() + { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.registerModule(new JavaTimeModule()); + return objectMapper; } @Bean @@ -340,4 +367,6 @@ public static ConversionService conversionService() conversionService.addConverter(new CodeSystemDsfPingUnitsConverter()); return conversionService; } + + private static final String OBJECT_MAPPER_WITH_TIME_MODULE = "objectMapperWithJavaTimeModule"; } diff --git a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java index c1a3ebb2..926de7d9 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java @@ -1,18 +1,17 @@ package dev.dsf.bpe.util; -import java.util.List; -import java.util.Vector; - import org.camunda.bpm.engine.delegate.DelegateExecution; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.ProcessErrors; +import dev.dsf.bpe.variables.process_errors.ProcessErrorsValueImpl; public class ErrorListUtils { - public static void addAll(List<ProcessError> errors, DelegateExecution execution) + public static void addAll(ProcessErrors errors, DelegateExecution execution) { - List<ProcessError> errorList = getErrorMessageList(execution); + ProcessErrors errorList = getErrorList(execution); if (errors != null) { errorList.addAll(errors); @@ -20,10 +19,10 @@ public static void addAll(List<ProcessError> errors, DelegateExecution execution } } - public static void addAll(List<ProcessError> errors, DelegateExecution execution, String correlationKey) + public static void addAll(ProcessErrors errors, DelegateExecution execution, String correlationKey) { - List<ProcessError> errorList = correlationKey != null ? getErrorMessageList(execution, correlationKey) - : getErrorMessageList(execution); + ProcessErrors errorList = correlationKey != null ? getErrorList(execution, correlationKey) + : getErrorList(execution); if (errors != null) { errorList.addAll(errors); @@ -48,46 +47,42 @@ public static void add(ProcessError error, DelegateExecution execution, String c } } - public static List<ProcessError> getErrorMessageList(DelegateExecution execution) + public static ProcessErrors getErrorList(DelegateExecution execution) { - return getErrorMessageList(execution, null); + return getErrorList(execution, null); } - public static List<ProcessError> getErrorMessageList(DelegateExecution execution, String correlationKey) + public static ProcessErrors getErrorList(DelegateExecution execution, String correlationKey) { if (correlationKey != null) { - return getErrorMessageList(ExecutionVariables.ERROR_LIST.correlatedValue(correlationKey), execution); + return getErrorList(ExecutionVariables.ERROR_LIST.correlatedValue(correlationKey), execution); } else { - return getErrorMessageList(ExecutionVariables.ERROR_LIST.getValue(), execution); + return getErrorList(ExecutionVariables.ERROR_LIST.getValue(), execution); } } - public static List<ProcessError> getErrorMessageList(String variableName, DelegateExecution execution) + public static ProcessErrors getErrorList(String variableName, DelegateExecution execution) { - String errorJson = (String) execution.getVariable(variableName); - if (errorJson == null) - { - List<ProcessError> errors = new Vector<>(); - execution.setVariable(variableName, ProcessError.toString(errors)); - return errors; - } - else + ProcessErrors errors = (ProcessErrors) execution.getVariable(variableName); + if (errors == null) { - return ProcessError.parseList(errorJson); + errors = new ProcessErrors(); + saveErrorList(errors, variableName, execution); } + return errors; } public static void add(ProcessError error, String variableName, DelegateExecution execution) { - List<ProcessError> errors = getErrorMessageList(variableName, execution); + ProcessErrors errors = getErrorList(variableName, execution); errors.add(error); saveErrorList(errors, variableName, execution); } - private static void saveErrorList(List<ProcessError> errors, DelegateExecution execution, String correlationKey) + private static void saveErrorList(ProcessErrors errors, DelegateExecution execution, String correlationKey) { if (correlationKey != null) { @@ -99,8 +94,8 @@ private static void saveErrorList(List<ProcessError> errors, DelegateExecution e } } - private static void saveErrorList(List<ProcessError> errors, String variableName, DelegateExecution execution) + private static void saveErrorList(ProcessErrors errors, String variableName, DelegateExecution execution) { - execution.setVariable(variableName, ProcessError.toString(errors)); + execution.setVariable(variableName, new ProcessErrorsValueImpl(errors)); } } diff --git a/src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java b/src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java deleted file mode 100644 index 10622764..00000000 --- a/src/main/java/dev/dsf/bpe/variables/DurationValueSerializer.java +++ /dev/null @@ -1,76 +0,0 @@ -package dev.dsf.bpe.variables; - -import java.time.Duration; -import java.util.Objects; - -import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; -import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; -import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; -import org.camunda.bpm.engine.variable.type.PrimitiveValueType; -import org.springframework.beans.factory.InitializingBean; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; - -public class DurationValueSerializer extends PrimitiveValueSerializer<DurationValue> implements InitializingBean -{ - private static final PrimitiveValueType DURATION_VALUE_TYPE = new DurationValueTypeImpl(); - private final ObjectMapper objectMapper; - - public DurationValueSerializer() - { - super(DURATION_VALUE_TYPE); - this.objectMapper = new ObjectMapper(); - objectMapper.registerModule(new JavaTimeModule()); - } - - @Override - public void afterPropertiesSet() - { - Objects.requireNonNull(objectMapper, "objectMapper"); - } - - @Override - public void writeValue(DurationValue value, ValueFields valueFields) - { - try - { - valueFields.setByteArrayValue(objectMapper.writeValueAsBytes(value.getValue())); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } - } - - @Override - public DurationValueImpl readValue(ValueFields valueFields, boolean asTransientValue) - { - try - { - byte[] bytes = valueFields.getByteArrayValue(); - return (bytes == null || bytes.length == 0) ? null - : new DurationValueImpl(objectMapper.readValue(bytes, Duration.class)); - } - catch (Exception e) - { - throw new RuntimeException(e); - } - } - - @Override - public DurationValueImpl convertToTypedValue(UntypedValueImpl untypedValue) - { - if (untypedValue != null && untypedValue.getValue() instanceof Duration duration) - { - return new DurationValueImpl(duration); - } - else if (untypedValue != null) - { - throw new IllegalArgumentException( - "Cannot convert " + untypedValue.getValue().getClass().getSimpleName() + " to DurationValueImpl"); - } - throw new IllegalArgumentException("Cannot convert " + untypedValue + " to DurationValueImpl"); - } -} diff --git a/src/main/java/dev/dsf/bpe/variables/GenericPrimitiveTypeSerializer.java b/src/main/java/dev/dsf/bpe/variables/GenericPrimitiveTypeSerializer.java new file mode 100644 index 00000000..9702968b --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/GenericPrimitiveTypeSerializer.java @@ -0,0 +1,100 @@ +package dev.dsf.bpe.variables; + +import java.lang.reflect.InvocationTargetException; +import java.util.Objects; + +import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; +import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; +import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; +import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; +import org.camunda.bpm.engine.variable.value.PrimitiveValue; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class GenericPrimitiveTypeSerializer<E, T extends PrimitiveTypeValueImpl<E> & PrimitiveValue<E>> + extends PrimitiveValueSerializer<T> implements InitializingBean +{ + private final ObjectMapper objectMapper; + private final Class<T> typeClass; + private final Class<E> valueClass; + private final PrimitiveValueType primitiveValueType; + + public GenericPrimitiveTypeSerializer(PrimitiveValueType variableType, ObjectMapper objectMapper, + Class<T> typeClass, Class<E> valueClass) + { + super(variableType); + this.objectMapper = objectMapper; + this.typeClass = typeClass; + this.valueClass = valueClass; + this.primitiveValueType = variableType; + } + + @Override + public void afterPropertiesSet() + { + Objects.requireNonNull(objectMapper); + } + + @Override + public T readValue(ValueFields valueFields, boolean asTransientValue) + { + try + { + byte[] bytes = valueFields.getByteArrayValue(); + return (bytes == null || bytes.length == 0) ? null + : typeClass.getConstructor(valueClass, PrimitiveValueType.class) + .newInstance(objectMapper.readValue(bytes, valueClass), primitiveValueType); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + + @Override + public void writeValue(T value, ValueFields valueFields) + { + try + { + valueFields.setByteArrayValue(objectMapper.writeValueAsBytes(value.getValue())); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + } + + @Override + public T convertToTypedValue(UntypedValueImpl untypedValue) + { + try + { + if (untypedValue != null && typeClass.isAssignableFrom(untypedValue.getValue().getClass())) + { + T typedValue = typeClass.cast(untypedValue.getValue()); + + return typeClass.getConstructor(typeClass, primitiveValueType.getClass()).newInstance(typedValue, + primitiveValueType); + + } + else if (untypedValue != null) + { + throw new IllegalArgumentException("Cannot convert " + + untypedValue.getValue().getClass().getSimpleName() + " to " + typeClass.getSimpleName()); + } + throw new IllegalArgumentException("Cannot convert " + null + " to " + typeClass.getSimpleName()); + } + catch (NoSuchMethodException e) + { + throw new IllegalArgumentException("Cannot convert " + untypedValue.getValue().getClass().getSimpleName() + + " to " + typeClass.getSimpleName()); + } + catch (InvocationTargetException | IllegalAccessException | InstantiationException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/DurationValue.java b/src/main/java/dev/dsf/bpe/variables/duration/DurationValue.java similarity index 79% rename from src/main/java/dev/dsf/bpe/variables/DurationValue.java rename to src/main/java/dev/dsf/bpe/variables/duration/DurationValue.java index 6e0df837..531ed68d 100644 --- a/src/main/java/dev/dsf/bpe/variables/DurationValue.java +++ b/src/main/java/dev/dsf/bpe/variables/duration/DurationValue.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.variables; +package dev.dsf.bpe.variables.duration; import java.time.Duration; diff --git a/src/main/java/dev/dsf/bpe/variables/DurationValueImpl.java b/src/main/java/dev/dsf/bpe/variables/duration/DurationValueImpl.java similarity index 76% rename from src/main/java/dev/dsf/bpe/variables/DurationValueImpl.java rename to src/main/java/dev/dsf/bpe/variables/duration/DurationValueImpl.java index 3029c6e0..e5bc5e02 100644 --- a/src/main/java/dev/dsf/bpe/variables/DurationValueImpl.java +++ b/src/main/java/dev/dsf/bpe/variables/duration/DurationValueImpl.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.variables; +package dev.dsf.bpe.variables.duration; import java.time.Duration; @@ -13,4 +13,9 @@ public DurationValueImpl(Duration value) { super(value, DURATION_VALUE_TYPE); } + + public DurationValueImpl(Duration value, PrimitiveValueType type) + { + super(value, type); + } } diff --git a/src/main/java/dev/dsf/bpe/variables/duration/DurationValueSerializer.java b/src/main/java/dev/dsf/bpe/variables/duration/DurationValueSerializer.java new file mode 100644 index 00000000..5e50fb41 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/duration/DurationValueSerializer.java @@ -0,0 +1,19 @@ +package dev.dsf.bpe.variables.duration; + +import java.time.Duration; + +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import dev.dsf.bpe.variables.GenericPrimitiveTypeSerializer; + +public class DurationValueSerializer extends GenericPrimitiveTypeSerializer<Duration, DurationValueImpl> +{ + private static final PrimitiveValueType DURATION_VALUE_TYPE = new DurationValueTypeImpl(); + + public DurationValueSerializer(ObjectMapper objectMapperWithJavaTimeModule) + { + super(DURATION_VALUE_TYPE, objectMapperWithJavaTimeModule, DurationValueImpl.class, Duration.class); + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/DurationValueTypeImpl.java b/src/main/java/dev/dsf/bpe/variables/duration/DurationValueTypeImpl.java similarity index 94% rename from src/main/java/dev/dsf/bpe/variables/DurationValueTypeImpl.java rename to src/main/java/dev/dsf/bpe/variables/duration/DurationValueTypeImpl.java index 7dbe452f..963329f6 100644 --- a/src/main/java/dev/dsf/bpe/variables/DurationValueTypeImpl.java +++ b/src/main/java/dev/dsf/bpe/variables/duration/DurationValueTypeImpl.java @@ -1,4 +1,4 @@ -package dev.dsf.bpe.variables; +package dev.dsf.bpe.variables.duration; import java.time.Duration; import java.util.Map; diff --git a/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValue.java b/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValue.java new file mode 100644 index 00000000..ffe1451e --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValue.java @@ -0,0 +1,9 @@ +package dev.dsf.bpe.variables.process_error; + +import org.camunda.bpm.engine.variable.value.PrimitiveValue; + +import dev.dsf.bpe.ProcessError; + +public interface ProcessErrorValue extends PrimitiveValue<ProcessError> +{ +} diff --git a/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueImpl.java b/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueImpl.java new file mode 100644 index 00000000..9f8e3f2d --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueImpl.java @@ -0,0 +1,21 @@ +package dev.dsf.bpe.variables.process_error; + +import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; + +import dev.dsf.bpe.ProcessError; + +public class ProcessErrorValueImpl extends PrimitiveTypeValueImpl<ProcessError> implements ProcessErrorValue +{ + private static final ProcessErrorValueTypeImpl PROCESS_ERROR_VALUE_TYPE = new ProcessErrorValueTypeImpl(); + + public ProcessErrorValueImpl(ProcessError value) + { + super(value, PROCESS_ERROR_VALUE_TYPE); + } + + public ProcessErrorValueImpl(ProcessError value, PrimitiveValueType type) + { + super(value, type); + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueSerializer.java b/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueSerializer.java new file mode 100644 index 00000000..079990ba --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueSerializer.java @@ -0,0 +1,16 @@ +package dev.dsf.bpe.variables.process_error; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.variables.GenericPrimitiveTypeSerializer; + +public class ProcessErrorValueSerializer extends GenericPrimitiveTypeSerializer<ProcessError, ProcessErrorValueImpl> +{ + private static final ProcessErrorValueTypeImpl PROCESS_ERROR_VALUE_TYPE = new ProcessErrorValueTypeImpl(); + + public ProcessErrorValueSerializer() + { + super(PROCESS_ERROR_VALUE_TYPE, new ObjectMapper(), ProcessErrorValueImpl.class, ProcessError.class); + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueTypeImpl.java b/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueTypeImpl.java new file mode 100644 index 00000000..6a5d628b --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/process_error/ProcessErrorValueTypeImpl.java @@ -0,0 +1,32 @@ +package dev.dsf.bpe.variables.process_error; + +import java.util.Map; + +import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; +import org.camunda.bpm.engine.variable.value.TypedValue; + +import dev.dsf.bpe.ProcessError; + +public class ProcessErrorValueTypeImpl extends PrimitiveValueTypeImpl +{ + private static final Class<ProcessError> PROCESS_ERROR_CLASS = ProcessError.class; + + public ProcessErrorValueTypeImpl() + { + super(PROCESS_ERROR_CLASS); + } + + @Override + public TypedValue createValue(Object value, Map<String, Object> valueInfo) + { + if (value instanceof ProcessError error) + { + return new ProcessErrorValueImpl(error); + } + else + { + throw new IllegalArgumentException("Cannot create value of type " + PROCESS_ERROR_CLASS.getSimpleName() + + " from type " + value.getClass().getSimpleName()); + } + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValue.java b/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValue.java new file mode 100644 index 00000000..75c99472 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValue.java @@ -0,0 +1,9 @@ +package dev.dsf.bpe.variables.process_errors; + +import org.camunda.bpm.engine.variable.value.PrimitiveValue; + +import dev.dsf.bpe.ProcessErrors; + +public interface ProcessErrorsValue extends PrimitiveValue<ProcessErrors> +{ +} diff --git a/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueImpl.java b/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueImpl.java new file mode 100644 index 00000000..ce646bf2 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueImpl.java @@ -0,0 +1,21 @@ +package dev.dsf.bpe.variables.process_errors; + +import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; + +import dev.dsf.bpe.ProcessErrors; + +public class ProcessErrorsValueImpl extends PrimitiveTypeValueImpl<ProcessErrors> implements ProcessErrorsValue +{ + private static final ProcessErrorsValueTypeImpl PROCESS_ERRORS_VALUE_TYPE = new ProcessErrorsValueTypeImpl(); + + public ProcessErrorsValueImpl(ProcessErrors value) + { + super(value, PROCESS_ERRORS_VALUE_TYPE); + } + + public ProcessErrorsValueImpl(ProcessErrors value, PrimitiveValueType type) + { + super(value, type); + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueSerializer.java b/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueSerializer.java new file mode 100644 index 00000000..54dfb15b --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueSerializer.java @@ -0,0 +1,16 @@ +package dev.dsf.bpe.variables.process_errors; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import dev.dsf.bpe.ProcessErrors; +import dev.dsf.bpe.variables.GenericPrimitiveTypeSerializer; + +public class ProcessErrorsValueSerializer extends GenericPrimitiveTypeSerializer<ProcessErrors, ProcessErrorsValueImpl> +{ + private static final ProcessErrorsValueTypeImpl TYPE = new ProcessErrorsValueTypeImpl(); + + public ProcessErrorsValueSerializer() + { + super(TYPE, new ObjectMapper(), ProcessErrorsValueImpl.class, ProcessErrors.class); + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueTypeImpl.java b/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueTypeImpl.java new file mode 100644 index 00000000..d26b497d --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/process_errors/ProcessErrorsValueTypeImpl.java @@ -0,0 +1,32 @@ +package dev.dsf.bpe.variables.process_errors; + +import java.util.Map; + +import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; +import org.camunda.bpm.engine.variable.value.TypedValue; + +import dev.dsf.bpe.ProcessErrors; + +public class ProcessErrorsValueTypeImpl extends PrimitiveValueTypeImpl +{ + private static final Class<ProcessErrors> PROCESS_ERRORS_CLASS = ProcessErrors.class; + + public ProcessErrorsValueTypeImpl() + { + super(PROCESS_ERRORS_CLASS); + } + + @Override + public TypedValue createValue(Object value, Map<String, Object> valueInfo) + { + if (value instanceof ProcessErrors errors) + { + return new ProcessErrorsValueImpl(errors); + } + else + { + throw new IllegalArgumentException("Cannot create value of type " + PROCESS_ERRORS_CLASS.getSimpleName() + + " from type " + value.getClass().getSimpleName()); + } + } +} From 35611f2289c7bbf4299877f3e23cb7e1361bf74e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 14 Aug 2025 14:07:36 +0200 Subject: [PATCH 332/382] Fixed upload duration being saved as long instead of duration --- .../java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 859a119b..5eaca556 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -1,5 +1,7 @@ package dev.dsf.bpe.service.ping; +import java.time.Duration; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -10,6 +12,7 @@ import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.duration.DurationValueImpl; public class LogAndSaveSendError extends AbstractServiceDelegate { @@ -27,7 +30,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw ProcessError error = (ProcessError) execution.getVariableLocal(ExecutionVariables.ERROR.getValue()); ErrorListUtils.add(error, execution, correlationKey); variables.setLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), 0L); - variables.setLong(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), 0L); + variables.setVariable(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), new DurationValueImpl(Duration.ZERO)); logger.debug("Saved error when trying to send ping message. Error message: {}", error.message()); } } From bba10f3c85ba2ee068a84a685f68434c5c699819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 14 Aug 2025 14:47:57 +0200 Subject: [PATCH 333/382] Renamed UPLOADED_DURATION_MILLIS to UPLOADED_DURATION since it is now using Duration instead of long --- src/main/java/dev/dsf/bpe/ExecutionVariables.java | 2 +- .../dev/dsf/bpe/service/ping/LogAndSaveSendError.java | 3 ++- src/main/java/dev/dsf/bpe/service/ping/SavePong.java | 8 ++++---- src/main/java/dev/dsf/bpe/service/ping/StoreResults.java | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ExecutionVariables.java b/src/main/java/dev/dsf/bpe/ExecutionVariables.java index 6b2ace58..f5445064 100644 --- a/src/main/java/dev/dsf/bpe/ExecutionVariables.java +++ b/src/main/java/dev/dsf/bpe/ExecutionVariables.java @@ -14,7 +14,7 @@ public enum ExecutionVariables DOWNLOADED_DURATION("downloadedDuration"), PONG_TARGET_ENDPOINT_IDENTIFIER("targetEndpointIdentifier"), UPLOADED_BYTES("uploadedBytes"), - UPLOADED_DURATION_MILLIS("uploadedDurationMillis"), + UPLOADED_DURATION("uploadedDuration"), RESOURCE_DOWNLOAD_ERROR("resourceDownloadError"), RESOURCE_UPLOAD_ERROR("resourceUploadError"), PING_TASK_ID("pingTaskId"); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 5eaca556..86815630 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -30,7 +30,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw ProcessError error = (ProcessError) execution.getVariableLocal(ExecutionVariables.ERROR.getValue()); ErrorListUtils.add(error, execution, correlationKey); variables.setLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), 0L); - variables.setVariable(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), new DurationValueImpl(Duration.ZERO)); + variables.setVariable(ExecutionVariables.UPLOADED_DURATION.correlatedValue(correlationKey), + new DurationValueImpl(Duration.ZERO)); logger.debug("Saved error when trying to send ping message. Error message: {}", error.message()); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 2dddfdc1..23882753 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -10,6 +10,7 @@ import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; +import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.input.ErrorInputParser; @@ -18,7 +19,6 @@ import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; import dev.dsf.bpe.variables.duration.DurationValueImpl; -import dev.dsf.bpe.ProcessErrors; public class SavePong extends AbstractServiceDelegate { @@ -43,9 +43,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable .getFirstInputParameterValue(pong, CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue(), org.hl7.fhir.r4.model.Duration.class); - optDownloadedDuration.ifPresent(duration -> variables.setVariable( - ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey), - new DurationValueImpl(Duration.ofMillis(duration.getValue().longValue())))); + optDownloadedDuration.ifPresent( + duration -> variables.setVariable(ExecutionVariables.UPLOADED_DURATION.correlatedValue(correlationKey), + new DurationValueImpl(Duration.ofMillis(duration.getValue().longValue())))); Optional<DecimalType> optDownloadedBytes = api.getTaskHelper().getFirstInputParameterValue(pong, CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue(), DecimalType.class); diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index e704c462..4f024207 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -16,6 +16,7 @@ import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -27,7 +28,6 @@ import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Targets; import dev.dsf.bpe.v1.variables.Variables; -import dev.dsf.bpe.ProcessErrors; public class StoreResults extends AbstractServiceDelegate implements InitializingBean { @@ -87,7 +87,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Long uploadedBytes = variables .getLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey)); Duration uploadedDurationMillis = (Duration) variables - .getVariable(ExecutionVariables.UPLOADED_DURATION_MILLIS.correlatedValue(correlationKey)); + .getVariable(ExecutionVariables.UPLOADED_DURATION.correlatedValue(correlationKey)); BigDecimal uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null ? NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit) From 0528ecca626b5545db1b8ff648598e78dddac94d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 14 Aug 2025 14:57:43 +0200 Subject: [PATCH 334/382] Imp sort --- src/main/java/dev/dsf/bpe/message/SendPongMessage.java | 2 +- src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index a6c37077..7e03f065 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -10,6 +10,7 @@ import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; @@ -23,7 +24,6 @@ import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; -import dev.dsf.bpe.ProcessErrors; public class SendPongMessage extends AbstractTaskMessageSend { diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java index ce44270c..0a0d2b62 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java @@ -5,13 +5,13 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; -import dev.dsf.bpe.ProcessErrors; public class StoreErrors extends AbstractServiceDelegate { From 22615c2db92efdf6bb8e17b4f9304693a4545965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 14 Aug 2025 15:35:56 +0200 Subject: [PATCH 335/382] Removed empty line --- src/main/java/dev/dsf/bpe/service/Cleanup.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 1b2248fd..8aaa7e36 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -20,7 +20,6 @@ public class Cleanup { - private final ProcessPluginApi api; private final CodeSystem.DsfPingProcesses.Code process; From f331aa1efe9d6bc80533a30380e6d3c6a070f93c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 14 Aug 2025 17:10:50 +0200 Subject: [PATCH 336/382] Cleanup now uses camunda field injection to know which process it is being used in --- .../java/dev/dsf/bpe/service/Cleanup.java | 32 +++++-- .../dev/dsf/bpe/service/ping/CleanupPing.java | 27 ------ .../dev/dsf/bpe/service/pong/CleanupPong.java | 27 ------ .../dev/dsf/bpe/spring/config/PingConfig.java | 14 +-- src/main/resources/bpe/ping.bpmn | 43 +++++---- src/main/resources/bpe/pong.bpmn | 95 ++++++++++--------- 6 files changed, 101 insertions(+), 137 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java delete mode 100644 src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 8aaa7e36..96779330 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -1,38 +1,42 @@ package dev.dsf.bpe.service; import java.net.SocketTimeoutException; +import java.util.Objects; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.IdType; +import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; -import dev.dsf.bpe.service.pong.CleanupPong; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.WebApplicationException; -public class Cleanup +public class Cleanup extends AbstractServiceDelegate implements InitializingBean { - private final ProcessPluginApi api; - private final CodeSystem.DsfPingProcesses.Code process; + private org.camunda.bpm.engine.delegate.Expression process; - public Cleanup(ProcessPluginApi api, CodeSystem.DsfPingProcesses.Code process) + public Cleanup(ProcessPluginApi api) { - this.api = api; - this.process = process; + super(api); } public void doExecute(DelegateExecution delegateExecution, Variables variables) { - PingPongLogger logger = new PingPongLogger(CleanupPong.class, variables.getStartTask()); + PingPongLogger logger = new PingPongLogger(Cleanup.class, variables.getStartTask()); logger.debug("Cleaning up..."); + + CodeSystem.DsfPingProcesses.Code process = getProcess((String) this.process.getValue(delegateExecution)); + Objects.requireNonNull(process); + String downloadResourceId = new IdType( variables.getString(ExecutionVariables.DOWNLOAD_RESOURCE_REFERENCE.getValue())).getIdPart(); if (downloadResourceId != null) @@ -73,4 +77,16 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) } logger.debug("Cleanup complete."); } + + public void setProcess(org.camunda.bpm.engine.delegate.Expression process) + { + this.process = process; + } + + private CodeSystem.DsfPingProcesses.Code getProcess(String process) + { + if (process == null || process.isEmpty()) + return null; + return CodeSystem.DsfPingProcesses.Code.ofValue(process); + } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java b/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java deleted file mode 100644 index 645dce5f..00000000 --- a/src/main/java/dev/dsf/bpe/service/ping/CleanupPing.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.dsf.bpe.service.ping; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.service.Cleanup; -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Variables; - -public class CleanupPing extends AbstractServiceDelegate -{ - private final Cleanup delegate; - - public CleanupPing(ProcessPluginApi api) - { - super(api); - delegate = new Cleanup(api, CodeSystem.DsfPingProcesses.Code.PING); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError - { - delegate.doExecute(delegateExecution, variables); - } -} diff --git a/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java b/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java deleted file mode 100644 index 7b9eaa7c..00000000 --- a/src/main/java/dev/dsf/bpe/service/pong/CleanupPong.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.dsf.bpe.service.pong; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.service.Cleanup; -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Variables; - -public class CleanupPong extends AbstractServiceDelegate -{ - private final Cleanup delegate; - - public CleanupPong(ProcessPluginApi api) - { - super(api); - delegate = new Cleanup(api, CodeSystem.DsfPingProcesses.Code.PONG); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError - { - delegate.doExecute(delegateExecution, variables); - } -} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index d5b88374..dace81e6 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -20,10 +20,10 @@ import dev.dsf.bpe.message.SendPingMessage; import dev.dsf.bpe.message.SendPongMessage; import dev.dsf.bpe.message.SendStartPing; +import dev.dsf.bpe.service.Cleanup; import dev.dsf.bpe.service.SetDownloadResourceSize; import dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer; import dev.dsf.bpe.service.ping.CheckPingTaskStatus; -import dev.dsf.bpe.service.ping.CleanupPing; import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; import dev.dsf.bpe.service.ping.GenerateAndStoreResourcePing; import dev.dsf.bpe.service.ping.LogAndSaveError; @@ -31,7 +31,6 @@ import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; import dev.dsf.bpe.service.ping.StoreResults; -import dev.dsf.bpe.service.pong.CleanupPong; import dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed; import dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration; import dev.dsf.bpe.service.pong.GenerateAndStoreResourcePong; @@ -215,16 +214,9 @@ public DownloadResourceAndMeasureSpeedInSubProcess downloadResourceAndMeasureSpe @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public CleanupPing cleanupPing() + public Cleanup cleanup() { - return new CleanupPing(api); - } - - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public CleanupPong cleanupPong() - { - return new CleanupPong(api); + return new Cleanup(api); } @Bean diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 12448656..765f55b4 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -173,7 +173,12 @@ <bpmn:incoming>Flow_152nb9r</bpmn:incoming> <bpmn:outgoing>Flow_1op4sei</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0802w0b" name="Cleanup" camunda:class="dev.dsf.bpe.service.ping.CleanupPing"> + <bpmn:serviceTask id="Activity_0802w0b" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> + <bpmn:extensionElements> + <camunda:field name="process"> + <camunda:string>ping</camunda:string> + </camunda:field> + </bpmn:extensionElements> <bpmn:incoming>Flow_1bfs68o</bpmn:incoming> <bpmn:outgoing>Flow_0gubpgz</bpmn:outgoing> </bpmn:serviceTask> @@ -261,12 +266,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmn:error id="Error_0tkfq65" name="resourceUploadError" errorCode="resourceUploadError" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> - <bpmndi:BPMNShape id="BPMNShape_0a51zrr" bpmnElement="Gateway_1nb10cc" isMarkerVisible="true"> - <dc:Bounds x="665" y="475" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0v585g9_di" bpmnElement="Activity_1ddl5dm"> - <dc:Bounds x="790" y="580" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> <dc:Bounds x="1040" y="180" width="1820" height="560" /> </bpmndi:BPMNShape> @@ -485,6 +484,12 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="260" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0v585g9_di" bpmnElement="Activity_1ddl5dm"> + <dc:Bounds x="790" y="580" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BPMNShape_0a51zrr" bpmnElement="Gateway_1nb10cc" isMarkerVisible="true"> + <dc:Bounds x="665" y="475" width="50" height="50" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> <dc:Bounds x="2990" y="239" width="160" height="49" /> <bpmndi:BPMNLabel /> @@ -546,18 +551,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="840" y="580" /> <di:waypoint x="840" y="385" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> - <di:waypoint x="539" y="540" /> - <di:waypoint x="498" y="580" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> - <di:waypoint x="3013" y="490" /> - <di:waypoint x="2984" y="410" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> - <di:waypoint x="3079" y="330" /> - <di:waypoint x="3058" y="288" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1op4sei_di" bpmnElement="Flow_1op4sei"> <di:waypoint x="630" y="500" /> <di:waypoint x="665" y="500" /> @@ -572,6 +565,18 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="840" y="500" /> <di:waypoint x="840" y="385" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> + <di:waypoint x="539" y="540" /> + <di:waypoint x="498" y="580" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> + <di:waypoint x="3013" y="490" /> + <di:waypoint x="2984" y="410" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> + <di:waypoint x="3079" y="330" /> + <di:waypoint x="3058" y="288" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 477be2a0..3f70c6ae 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -67,7 +67,12 @@ <bpmn:incoming>Flow_1w3kcjh</bpmn:incoming> <bpmn:outgoing>Flow_1jehvly</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0otptjn" name="Cleanup" camunda:class="dev.dsf.bpe.service.pong.CleanupPong"> + <bpmn:serviceTask id="Activity_0otptjn" name="Cleanup" camunda:class="dev.dsf.bpe.service.Cleanup"> + <bpmn:extensionElements> + <camunda:field name="process"> + <camunda:string>pong</camunda:string> + </camunda:field> + </bpmn:extensionElements> <bpmn:incoming>Flow_00t1ck1</bpmn:incoming> <bpmn:incoming>Flow_1lfcycx</bpmn:incoming> <bpmn:incoming>Flow_0h8flp6</bpmn:incoming> @@ -264,6 +269,9 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="Event_0o4l2t4_di" bpmnElement="Event_0o4l2t4"> <dc:Bounds x="2472" y="482" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> + <dc:Bounds x="1325" y="435" width="50" height="50" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1imd3tw_di" bpmnElement="Activity_1umihbr"> <dc:Bounds x="1170" y="540" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -295,6 +303,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2590" y="370" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> + <dc:Bounds x="1190" y="420" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0e5vsn7_di" bpmnElement="Activity_1wt8irk"> <dc:Bounds x="2590" y="460" width="100" height="80" /> <bpmndi:BPMNLabel /> @@ -314,27 +326,16 @@ Store = store on DSF FHIR server either as separate resource or output parameter <bpmndi:BPMNShape id="BPMNShape_0nbrkyz" bpmnElement="Event_11q3y8a"> <dc:Bounds x="832" y="595" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0fvmtve_di" bpmnElement="Gateway_0fvmtve" isMarkerVisible="true"> - <dc:Bounds x="1325" y="435" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_04wfxfo_di" bpmnElement="Activity_0i998dm"> - <dc:Bounds x="1190" y="420" width="100" height="80" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0ynhobb_di" bpmnElement="Gateway_0ynhobb" isMarkerVisible="true"> <dc:Bounds x="1105" y="435" width="50" height="50" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_06066hd_di" bpmnElement="Gateway_06066hd" isMarkerVisible="true"> + <dc:Bounds x="1565" y="435" width="50" height="50" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0pjdm6v_di" bpmnElement="Activity_1kb1v81"> <dc:Bounds x="1660" y="600" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_06066hd_di" bpmnElement="Gateway_06066hd" isMarkerVisible="true"> - <dc:Bounds x="1565" y="435" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> - <di:waypoint x="1790" y="459" /> - <di:waypoint x="1768" y="486" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> <dc:Bounds x="360" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> @@ -351,6 +352,10 @@ Store = store on DSF FHIR server either as separate resource or output parameter <dc:Bounds x="2940" y="439" width="200" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> + <dc:Bounds x="1630" y="520" width="275" height="41" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0yki05n" bpmnElement="TextAnnotation_1mo7foe"> <dc:Bounds x="1370" y="544" width="170" height="40" /> <bpmndi:BPMNLabel /> @@ -405,11 +410,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="2275" y="410" /> <di:waypoint x="2472" y="410" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_17x98wg_di" bpmnElement="Flow_17x98wg"> - <di:waypoint x="2250" y="435" /> - <di:waypoint x="2250" y="500" /> - <di:waypoint x="2472" y="500" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jehvly_di" bpmnElement="Flow_1jehvly"> <di:waypoint x="1270" y="580" /> <di:waypoint x="1350" y="580" /> @@ -464,11 +464,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="360" y="310" /> <di:waypoint x="430" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0dp8f59_di" bpmnElement="Flow_0dp8f59"> - <di:waypoint x="1760" y="640" /> - <di:waypoint x="1920" y="640" /> - <di:waypoint x="1920" y="335" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0jfh43l" bpmnElement="Flow_0qxt5zo"> <di:waypoint x="850" y="368" /> <di:waypoint x="850" y="595" /> @@ -481,22 +476,6 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="850" y="310" /> <di:waypoint x="905" y="310" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> - <di:waypoint x="1052" y="420" /> - <di:waypoint x="1068" y="390" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> - <di:waypoint x="2076" y="350" /> - <di:waypoint x="2045" y="439" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> - <di:waypoint x="2838" y="346" /> - <di:waypoint x="2964" y="439" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> - <di:waypoint x="1458" y="544" /> - <di:waypoint x="1464" y="500" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0vqsjzn_di" bpmnElement="Flow_0vqsjzn"> <di:waypoint x="1080" y="460" /> <di:waypoint x="1105" y="460" /> @@ -510,10 +489,11 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1130" y="580" /> <di:waypoint x="1170" y="580" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="TextAnnotation_1bv3jri_di" bpmnElement="TextAnnotation_1bv3jri"> - <dc:Bounds x="1630" y="520" width="275" height="41" /> - <bpmndi:BPMNLabel /> - </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_17x98wg_di" bpmnElement="Flow_17x98wg"> + <di:waypoint x="2250" y="435" /> + <di:waypoint x="2250" y="500" /> + <di:waypoint x="2472" y="500" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_033lqly_di" bpmnElement="Flow_033lqly"> <di:waypoint x="1520" y="460" /> <di:waypoint x="1565" y="460" /> @@ -527,6 +507,31 @@ Store = store on DSF FHIR server either as separate resource or output parameter <di:waypoint x="1590" y="640" /> <di:waypoint x="1660" y="640" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0dp8f59_di" bpmnElement="Flow_0dp8f59"> + <di:waypoint x="1760" y="640" /> + <di:waypoint x="1920" y="640" /> + <di:waypoint x="1920" y="335" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_18psz8j_di" bpmnElement="Association_18psz8j"> + <di:waypoint x="1052" y="420" /> + <di:waypoint x="1068" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1py3u4x_di" bpmnElement="Association_1py3u4x"> + <di:waypoint x="2076" y="350" /> + <di:waypoint x="2045" y="439" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_05fync1_di" bpmnElement="Association_05fync1"> + <di:waypoint x="2838" y="346" /> + <di:waypoint x="2964" y="439" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1thj094_di" bpmnElement="Association_1thj094"> + <di:waypoint x="1458" y="544" /> + <di:waypoint x="1464" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_0wskzb7_di" bpmnElement="Association_0wskzb7"> + <di:waypoint x="1790" y="459" /> + <di:waypoint x="1768" y="486" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From 8efeca476ccb5f50d49e6e5058b49bd32b487745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 18 Aug 2025 16:30:21 +0200 Subject: [PATCH 337/382] Removed PingPongLogger because it will be redundant in API v2 --- src/main/java/dev/dsf/bpe/ProcessError.java | 5 --- .../listener/SetCorrelationKeyListener.java | 6 +-- .../dsf/bpe/message/CleanupPongMessage.java | 6 ++- .../dev/dsf/bpe/message/SendPingMessage.java | 5 ++- .../dev/dsf/bpe/message/SendPongMessage.java | 6 ++- .../java/dev/dsf/bpe/service/Cleanup.java | 5 ++- .../bpe/service/GenerateAndStoreResource.java | 5 ++- .../bpe/service/SetDownloadResourceSize.java | 5 ++- .../bpe/service/ping/CheckPingTaskStatus.java | 6 ++- ...adResourceAndMeasureSpeedInSubProcess.java | 8 ++-- .../dsf/bpe/service/ping/LogAndSaveError.java | 6 ++- .../bpe/service/ping/LogAndSaveSendError.java | 7 ++-- .../ping/LogAndSaveUploadErrorPing.java | 9 ++-- .../dev/dsf/bpe/service/ping/SavePong.java | 7 ++-- .../bpe/service/ping/SelectPingTargets.java | 23 +++++----- .../dsf/bpe/service/ping/StoreResults.java | 6 +-- .../pong/DownloadResourceAndMeasureSpeed.java | 7 ++-- .../pong/EstimateCleanupTimerDuration.java | 7 ++-- .../service/pong/LogAndSaveAndStoreError.java | 6 ++- .../pong/LogAndSaveUploadErrorPong.java | 9 ++-- .../dev/dsf/bpe/service/pong/LogPing.java | 7 ++-- .../bpe/service/pong/SaveTimeoutError.java | 8 ++-- .../bpe/service/pong/SelectPongTarget.java | 7 ++-- .../service/pong/SetEndpointIdentifier.java | 6 ++- .../bpe/service/pong/StoreDownloadSpeed.java | 5 ++- .../dev/dsf/bpe/service/pong/StoreErrors.java | 6 ++- .../bpe/service/pong/StoreUploadSpeed.java | 5 ++- .../bpe/util/BinaryResourceDownloader.java | 8 ++-- .../dsf/bpe/util/logging/PingPongLogger.java | 42 ------------------- .../dsf/bpe/util/logging/TaskIdPrefixer.java | 16 +++++++ 30 files changed, 123 insertions(+), 131 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/util/logging/PingPongLogger.java create mode 100644 src/main/java/dev/dsf/bpe/util/logging/TaskIdPrefixer.java diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 5d857320..3852292a 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -1,7 +1,6 @@ package dev.dsf.bpe; import java.io.Serializable; -import java.util.List; import java.util.Objects; import org.hl7.fhir.r4.model.Coding; @@ -9,10 +8,6 @@ import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.UrlType; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.ObjectMapper; - //todo: remove process and processStep + CodeSystems, make message never contain e.getMessage() becaus security // ping status codesystem should extend old ping status codesystem, map every possible error to a unique name in a new codesystem // that repaces process + processStep, display values should contain the exact text that is now contained in action diff --git a/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java b/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java index ec487ac1..3672cb3d 100644 --- a/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java +++ b/src/main/java/dev/dsf/bpe/listener/SetCorrelationKeyListener.java @@ -4,9 +4,10 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.constants.BpmnExecutionVariables; import dev.dsf.bpe.v1.variables.Target; @@ -14,6 +15,7 @@ public class SetCorrelationKeyListener implements ExecutionListener, InitializingBean { + private static final Logger logger = LoggerFactory.getLogger(SetCorrelationKeyListener.class); private final ProcessPluginApi api; public SetCorrelationKeyListener(ProcessPluginApi api) @@ -30,8 +32,6 @@ public void afterPropertiesSet() throws Exception @Override public void notify(DelegateExecution execution) throws Exception { - PingPongLogger logger = new PingPongLogger(SetCorrelationKeyListener.class, - api.getVariables(execution).getStartTask()); logger.debug("Setting correlation key for subprocess instance {}", execution.getProcessInstanceId()); Variables variables = api.getVariables(execution); Target target = variables.getTarget(); diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 4a7022ec..74ab4088 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -5,11 +5,12 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationGenerator; @@ -21,6 +22,8 @@ public class CleanupPongMessage extends AbstractTaskMessageSend { + private static final Logger logger = LoggerFactory.getLogger(CleanupPongMessage.class); + public CleanupPongMessage(ProcessPluginApi api) { super(api); @@ -50,7 +53,6 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, String errorMessage) { - PingPongLogger logger = new PingPongLogger(CleanupPongMessage.class, variables.getStartTask()); Target target = variables.getTarget(); ProcessError error = SendTaskErrorConverter.convert(exception, "Sending cleanup message to " + target.getEndpointUrl()); diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index 6185ba9d..811f1578 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -9,11 +9,12 @@ import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.ParameterComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; @@ -26,6 +27,7 @@ public class SendPingMessage extends AbstractTaskMessageSend { + private static final Logger logger = LoggerFactory.getLogger(SendPingMessage.class); private IdType taskId; public SendPingMessage(ProcessPluginApi api) @@ -76,7 +78,6 @@ protected IdType doSend(FhirWebserviceClient client, Task task) protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, String errorMessage) { - PingPongLogger logger = new PingPongLogger(SendPingMessage.class, variables.getStartTask()); Target target = variables.getTarget(); ProcessError error = SendTaskErrorConverter.convert(exception, "Sending ping message to " + target.getEndpointUrl()); diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index 7e03f065..1d9bb6bd 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -6,6 +6,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; @@ -13,7 +15,6 @@ import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; @@ -27,6 +28,8 @@ public class SendPongMessage extends AbstractTaskMessageSend { + private static final Logger logger = LoggerFactory.getLogger(SendPongMessage.class); + private final AggregateErrorMailService errorMailService; public SendPongMessage(ProcessPluginApi api, AggregateErrorMailService errorMailService) @@ -93,7 +96,6 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw protected void handleSendTaskError(DelegateExecution execution, Variables variables, Exception exception, String errorMessage) { - PingPongLogger logger = new PingPongLogger(SendPongMessage.class, variables.getStartTask()); Target target = variables.getTarget(); Task startTask = variables.getStartTask(); diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 96779330..7417475e 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -6,6 +6,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.IdType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.CodeSystem; @@ -13,7 +15,6 @@ import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -22,6 +23,7 @@ public class Cleanup extends AbstractServiceDelegate implements InitializingBean { + private static final Logger logger = LoggerFactory.getLogger(Cleanup.class); private org.camunda.bpm.engine.delegate.Expression process; public Cleanup(ProcessPluginApi api) @@ -31,7 +33,6 @@ public Cleanup(ProcessPluginApi api) public void doExecute(DelegateExecution delegateExecution, Variables variables) { - PingPongLogger logger = new PingPongLogger(Cleanup.class, variables.getStartTask()); logger.debug("Cleaning up..."); CodeSystem.DsfPingProcesses.Code process = getProcess((String) this.process.getValue(delegateExecution)); diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 40696041..eb36480f 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -3,12 +3,13 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.IdType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Variables; import dev.dsf.bpe.variables.process_error.ProcessErrorValueImpl; @@ -16,6 +17,7 @@ public class GenerateAndStoreResource { + private static final Logger logger = LoggerFactory.getLogger(GenerateAndStoreResource.class); private final ProcessPluginApi api; private final long maxUploadSizeBytes; private final CodeSystem.DsfPingProcesses.Code process; @@ -30,7 +32,6 @@ public GenerateAndStoreResource(ProcessPluginApi api, long maxUploadSizeBytes, public void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(GenerateAndStoreResource.class, variables.getStartTask()); logger.debug("Generating resource..."); long downloadResourceSizeBytes = getDownloadResourceSize(variables); RandomByteInputStream resourceContent; diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index 7e04441b..e04c0e7e 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -5,17 +5,19 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.DecimalType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class SetDownloadResourceSize extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(SetDownloadResourceSize.class); private final long maxDownloadResourceSizeBytes; public SetDownloadResourceSize(ProcessPluginApi api, long maxDownloadResourceSizeBytes) @@ -27,7 +29,6 @@ public SetDownloadResourceSize(ProcessPluginApi api, long maxDownloadResourceSiz @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(SetDownloadResourceSize.class, variables.getStartTask()); logger.debug("Setting download resource size..."); variables.setLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index e7bc9928..bad12d9a 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -5,13 +5,14 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -21,6 +22,8 @@ public class CheckPingTaskStatus extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(CheckPingTaskStatus.class); + public CheckPingTaskStatus(ProcessPluginApi api) { super(api); @@ -29,7 +32,6 @@ public CheckPingTaskStatus(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(CheckPingTaskStatus.class, variables.getStartTask()); logger.debug("Checking status of ping task..."); Target target = variables.getTarget(); diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index aa1ac4d4..1319f805 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -3,11 +3,12 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.BinaryResourceDownloader; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -16,6 +17,7 @@ public class DownloadResourceAndMeasureSpeedInSubProcess extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(DownloadResourceAndMeasureSpeedInSubProcess.class); private final long maxDownloadSizeBytes; public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api, long maxDownloadSizeBytes) @@ -27,8 +29,6 @@ public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api, long ma @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(DownloadResourceAndMeasureSpeedInSubProcess.class, - variables.getStartTask()); logger.debug("Starting resource download to measure speed..."); Task task = variables.getLatestTask(); @@ -36,7 +36,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable String correlationKey = target.getCorrelationKey(); - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger, + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader( CodeSystem.DsfPingProcesses.Code.PING).download(variables, api, task, maxDownloadSizeBytes); if (downloadResult.getError() == null) diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index 62c4eac1..47e82bee 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -2,11 +2,12 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -14,6 +15,8 @@ public class LogAndSaveError extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(LogAndSaveError.class); + public LogAndSaveError(ProcessPluginApi api) { super(api); @@ -22,7 +25,6 @@ public LogAndSaveError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(LogAndSaveError.class, variables.getStartTask()); Target target = variables.getTarget(); ProcessError error = (ProcessError) delegateExecution diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 86815630..9fbcecf5 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -4,11 +4,12 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -16,6 +17,8 @@ public class LogAndSaveSendError extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(LogAndSaveSendError.class); + public LogAndSaveSendError(ProcessPluginApi api) { super(api); @@ -24,8 +27,6 @@ public LogAndSaveSendError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(LogAndSaveSendError.class, variables.getStartTask()); - String correlationKey = variables.getTarget().getCorrelationKey(); ProcessError error = (ProcessError) execution.getVariableLocal(ExecutionVariables.ERROR.getValue()); ErrorListUtils.add(error, execution, correlationKey); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java index b05d1f64..aa929ad2 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java @@ -2,17 +2,19 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveUploadErrorPing extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(LogAndSaveUploadErrorPing.class); + public LogAndSaveUploadErrorPing(ProcessPluginApi api) { super(api); @@ -21,9 +23,6 @@ public LogAndSaveUploadErrorPing(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - Task startTask = variables.getStartTask(); - PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPing.class, startTask); - ProcessError error = (ProcessError) variables.getVariable(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue()); logger.info("Error while storing binary resource for download: {}", error.message()); diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 23882753..6960ed39 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -7,12 +7,13 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.input.ErrorInputParser; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -22,6 +23,8 @@ public class SavePong extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(SavePong.class); + public SavePong(ProcessPluginApi api) { super(api); @@ -30,8 +33,6 @@ public SavePong(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(SavePong.class, variables.getStartTask()); - Target target = variables.getTarget(); logger.debug("Pong received from {}. Saving pong information...", target.getEndpointUrl()); String correlationKey = target.getCorrelationKey(); diff --git a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java index 18244a87..e9f16e5f 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SelectPingTargets.java @@ -22,12 +22,13 @@ import org.hl7.fhir.r4.model.Organization; import org.hl7.fhir.r4.model.Resource; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.web.util.UriComponents; import org.springframework.web.util.UriComponentsBuilder; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; @@ -37,7 +38,7 @@ public class SelectPingTargets extends AbstractServiceDelegate implements InitializingBean { - + private static final Logger logger = LoggerFactory.getLogger(SelectPingTargets.class); private static final Pattern endpointResouceTypes = Pattern.compile( "Endpoint|HealthcareService|ImagingStudy|InsurancePlan|Location|Organization|OrganizationAffiliation|PractitionerRole"); @@ -51,7 +52,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw { Task startTask = variables.getStartTask(); Stream<Endpoint> targetEndpoints = getTargetEndpointsSearchParameter(variables) - .map(uriComponents -> searchForEndpoints(uriComponents, startTask)).orElse(allEndpoints()) + .map(uriComponents -> searchForEndpoints(uriComponents)).orElse(allEndpoints()) .filter(isLocalEndpoint().negate()); List<Organization> remoteOrganizations = api.getOrganizationProvider().getRemoteOrganizations(); @@ -83,18 +84,17 @@ private Optional<UriComponents> getTargetEndpointsSearchParameter(Variables vari .map(requestUrl -> UriComponentsBuilder.fromUriString(requestUrl).build()); } - private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters, Task startTask) + private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters) { - return searchForEndpoints(searchParameters, 1, 0, startTask); + return searchForEndpoints(searchParameters, 1, 0); } - private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters, int page, int currentTotal, - Task startTask) + private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters, int page, int currentTotal) { if (searchParameters.getPathSegments().isEmpty()) return Stream.empty(); - Optional<Class<? extends Resource>> resourceType = getResourceType(searchParameters, startTask); + Optional<Class<? extends Resource>> resourceType = getResourceType(searchParameters); if (resourceType.isEmpty()) return Stream.empty(); @@ -106,14 +106,14 @@ private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters, int .searchWithStrictHandling(resourceType.get(), queryParameters); if (searchResult.getTotal() > currentTotal + searchResult.getEntry().size()) - return Stream.concat(toEndpoints(searchResult), searchForEndpoints(searchParameters, page + 1, - currentTotal + searchResult.getEntry().size(), startTask)); + return Stream.concat(toEndpoints(searchResult), + searchForEndpoints(searchParameters, page + 1, currentTotal + searchResult.getEntry().size())); else return toEndpoints(searchResult); } @SuppressWarnings("unchecked") - private Optional<Class<? extends Resource>> getResourceType(UriComponents searchParameters, Task startTask) + private Optional<Class<? extends Resource>> getResourceType(UriComponents searchParameters) { if (searchParameters.getPathSegments().isEmpty()) return Optional.empty(); @@ -128,7 +128,6 @@ private Optional<Class<? extends Resource>> getResourceType(UriComponents search } catch (ClassNotFoundException e) { - PingPongLogger logger = new PingPongLogger(SelectPingTargets.class, startTask); logger.error("Unable to find class for FHIR resource type " + type, e); return Optional.empty(); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 4f024207..4a7f48b3 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -11,6 +11,8 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.CodeSystem; @@ -19,7 +21,6 @@ import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.ErrorOutputComponentGenerator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; @@ -31,6 +32,7 @@ public class StoreResults extends AbstractServiceDelegate implements InitializingBean { + private static final Logger logger = LoggerFactory.getLogger(StoreResults.class); private final AggregateErrorMailService errorMailService; private final CodeSystem.DsfPingUnits.Code networkSpeedUnit; @@ -53,8 +55,6 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(StoreResults.class, variables.getStartTask()); - logger.debug("Storing results for process started with Task {}", variables.getStartTask().getIdElement().getValue()); Task task = variables.getStartTask(); diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index a306ec2b..2700402c 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -3,11 +3,12 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.BinaryResourceDownloader; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -15,6 +16,7 @@ public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(DownloadResourceAndMeasureSpeed.class); private final long maxDownloadSizeBytes; public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, long maxDownloadSizeBytes) @@ -26,12 +28,11 @@ public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, long maxDownloadSiz @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(DownloadResourceAndMeasureSpeed.class, variables.getStartTask()); logger.debug("Starting resource download to measure speed..."); Task task = variables.getStartTask(); - BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader(logger, + BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader( CodeSystem.DsfPingProcesses.Code.PONG).download(variables, api, task, maxDownloadSizeBytes); if (downloadResult.getError() == null) diff --git a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java index 83b17903..0e829eef 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java @@ -5,15 +5,18 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.ExecutionVariables; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class EstimateCleanupTimerDuration extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(EstimateCleanupTimerDuration.class); + public EstimateCleanupTimerDuration(ProcessPluginApi api) { super(api); @@ -22,8 +25,6 @@ public EstimateCleanupTimerDuration(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(EstimateCleanupTimerDuration.class, variables.getStartTask()); - logger.debug("Estimating cleanup timer duration..."); final long minTimerDurationMillis = 20000; Duration downloadedDuration = Optional diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index cb1677d5..2838046b 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -3,11 +3,12 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -16,6 +17,8 @@ public class LogAndSaveAndStoreError extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(LogAndSaveAndStoreError.class); + public LogAndSaveAndStoreError(ProcessPluginApi api) { super(api); @@ -24,7 +27,6 @@ public LogAndSaveAndStoreError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(LogAndSaveAndStoreError.class, variables.getStartTask()); Target target = variables.getTarget(); Task startTask = variables.getStartTask(); diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java index f83198eb..bb6c2e4d 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java @@ -2,18 +2,20 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class LogAndSaveUploadErrorPong extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(LogAndSaveUploadErrorPong.class); + public LogAndSaveUploadErrorPong(ProcessPluginApi api) { super(api); @@ -22,9 +24,6 @@ public LogAndSaveUploadErrorPong(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - Task startTask = variables.getStartTask(); - PingPongLogger logger = new PingPongLogger(LogAndSaveUploadErrorPong.class, startTask); - ProcessError error = (ProcessError) variables.getVariable(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue()); ErrorListUtils.add(error, execution); diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogPing.java b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java index 873f12f3..6e6e21c4 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogPing.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogPing.java @@ -5,15 +5,18 @@ import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class LogPing extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(LogPing.class); + public LogPing(ProcessPluginApi api) { super(api); @@ -22,8 +25,6 @@ public LogPing(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(LogPing.class, variables.getStartTask()); - Task task = variables.getLatestTask(); logger.info("PING from {} (endpoint: {})", task.getRequester().getIdentifier().getValue(), diff --git a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java index 487fa3a1..96d0aab9 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java @@ -2,12 +2,12 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -15,6 +15,8 @@ public class SaveTimeoutError extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(SaveTimeoutError.class); + public SaveTimeoutError(ProcessPluginApi api) { super(api); @@ -23,9 +25,7 @@ public SaveTimeoutError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - Task startTask = variables.getStartTask(); Target target = variables.getTarget(); - PingPongLogger logger = new PingPongLogger(SaveTimeoutError.class, startTask); logger.debug("Storing timeout error..."); ProcessError error = new ProcessError(CodeSystem.DsfPingProcesses.Code.PONG, diff --git a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java index 317a3bdc..b5ff9efe 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java @@ -3,11 +3,11 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.ExecutionVariables; -import dev.dsf.bpe.service.ping.SelectPingTargets; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; @@ -15,6 +15,8 @@ public class SelectPongTarget extends AbstractServiceDelegate implements InitializingBean { + private static final Logger logger = LoggerFactory.getLogger(SelectPongTarget.class); + public SelectPongTarget(ProcessPluginApi api) { super(api); @@ -23,7 +25,6 @@ public SelectPongTarget(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(SelectPingTargets.class, variables.getStartTask()); logger.debug("Selecting pong targets..."); Task task = variables.getStartTask(); diff --git a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java index 7d58d0ef..e9b3225e 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java @@ -5,16 +5,19 @@ import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; public class SetEndpointIdentifier extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(SetEndpointIdentifier.class); + public SetEndpointIdentifier(ProcessPluginApi api) { super(api); @@ -23,7 +26,6 @@ public SetEndpointIdentifier(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - PingPongLogger logger = new PingPongLogger(SetEndpointIdentifier.class, variables.getStartTask()); logger.debug("Setting endpoint identifier..."); Task task = variables.getStartTask(); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 0739a42a..0828e7a2 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -6,10 +6,11 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -18,6 +19,7 @@ public class StoreDownloadSpeed extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(StoreDownloadSpeed.class); private final CodeSystem.DsfPingUnits.Code networkSpeedUnit; public StoreDownloadSpeed(ProcessPluginApi api, CodeSystem.DsfPingUnits.Code networkSpeedUnit) @@ -30,7 +32,6 @@ public StoreDownloadSpeed(ProcessPluginApi api, CodeSystem.DsfPingUnits.Code net protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { Task startTask = variables.getStartTask(); - PingPongLogger logger = new PingPongLogger(StoreDownloadSpeed.class, startTask); logger.debug("Storing download speed..."); long downloadedBytes = variables.getLong(ExecutionVariables.DOWNLOADED_BYTES.getValue()); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java index 0a0d2b62..c7da456a 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java @@ -3,11 +3,12 @@ import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -15,6 +16,8 @@ public class StoreErrors extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(StoreErrors.class); + public StoreErrors(ProcessPluginApi api) { super(api); @@ -24,7 +27,6 @@ public StoreErrors(ProcessPluginApi api) protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { Task startTask = variables.getStartTask(); - PingPongLogger logger = new PingPongLogger(StoreErrors.class, startTask); logger.debug("Storing errors..."); ProcessErrors errors = ErrorListUtils.getErrorList(execution); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index 3d837a2b..c53696f7 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -9,9 +9,10 @@ import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.PrimitiveType; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -20,6 +21,7 @@ public class StoreUploadSpeed extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(StoreUploadSpeed.class); private final CodeSystem.DsfPingUnits.Code networkSpeedUnit; public StoreUploadSpeed(ProcessPluginApi api, CodeSystem.DsfPingUnits.Code networkSpeedUnit) @@ -33,7 +35,6 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { Task startTask = variables.getStartTask(); Task cleanup = variables.getLatestTask(); - PingPongLogger logger = new PingPongLogger(LogPing.class, startTask); logger.debug("Storing upload speed..."); Optional<DecimalType> uploadedBytesTaskInput = getUploadedBytes(cleanup); diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 39aa7a7f..a32140f4 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -9,12 +9,13 @@ import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; -import dev.dsf.bpe.util.logging.PingPongLogger; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Variables; import jakarta.ws.rs.ProcessingException; @@ -22,12 +23,11 @@ public class BinaryResourceDownloader { - private final PingPongLogger logger; + private static final Logger logger = LoggerFactory.getLogger(BinaryResourceDownloader.class); private final CodeSystem.DsfPingProcesses.Code process; - public BinaryResourceDownloader(PingPongLogger logger, CodeSystem.DsfPingProcesses.Code process) + public BinaryResourceDownloader(CodeSystem.DsfPingProcesses.Code process) { - this.logger = logger; this.process = process; } diff --git a/src/main/java/dev/dsf/bpe/util/logging/PingPongLogger.java b/src/main/java/dev/dsf/bpe/util/logging/PingPongLogger.java deleted file mode 100644 index e7cf5cdb..00000000 --- a/src/main/java/dev/dsf/bpe/util/logging/PingPongLogger.java +++ /dev/null @@ -1,42 +0,0 @@ -package dev.dsf.bpe.util.logging; - -import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PingPongLogger -{ - private final Logger logger; - private Task task; - - public PingPongLogger(Class<?> clazz, Task task) - { - this.logger = LoggerFactory.getLogger(clazz); - this.task = task; - } - - public void info(String message, Object... args) - { - logger.info(prependProcessInfo(message), args); - } - - public void warn(String message, Object... args) - { - logger.warn(prependProcessInfo(message), args); - } - - public void error(String message, Object... args) - { - logger.error(prependProcessInfo(message), args); - } - - public void debug(String message, Object... args) - { - logger.debug(prependProcessInfo(message), args); - } - - private String prependProcessInfo(String message) - { - return "Process for Task " + task.getIdElement().getValue() + ": " + message; - } -} diff --git a/src/main/java/dev/dsf/bpe/util/logging/TaskIdPrefixer.java b/src/main/java/dev/dsf/bpe/util/logging/TaskIdPrefixer.java new file mode 100644 index 00000000..abf9a659 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/util/logging/TaskIdPrefixer.java @@ -0,0 +1,16 @@ +package dev.dsf.bpe.util.logging; + +import org.hl7.fhir.r4.model.Task; + +public class TaskIdPrefixer +{ + private TaskIdPrefixer() + { + + } + + public static String prefixTaskId(Task task, String message) + { + return "Process for task with id " + task.getIdElement().getValue() + ": " + message; + } +} From 7b8a78d2f3dfcf299a66b30b9d7a2c847dfb1ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 19 Aug 2025 15:26:48 +0200 Subject: [PATCH 338/382] Renamed PingUnits CodeSystem according to https://en.wikipedia.org/wiki/Data-rate_units which allows for the removal of CodeSystemDsfPingUnitsConverter because Spring's DefaultConversionService is now able to map the String to Enum by its name --- src/main/java/dev/dsf/bpe/CodeSystem.java | 117 +++++++++++++++--- .../dev/dsf/bpe/spring/config/PingConfig.java | 14 +-- .../util/CodeSystemDsfPingUnitsConverter.java | 15 --- .../bpe/util/task/NetworkSpeedCalculator.java | 28 +---- .../output/generator/PingStatusGenerator.java | 10 +- .../fhir/CodeSystem/dsf-ping-units.xml | 27 +++- .../dsf/fhir/profiles/TaskProfileTest.java | 2 +- 7 files changed, 128 insertions(+), 85 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/util/CodeSystemDsfPingUnitsConverter.java diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index 60376a95..a7023a80 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -1,5 +1,9 @@ package dev.dsf.bpe; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.Duration; + public final class CodeSystem { private CodeSystem() @@ -210,29 +214,104 @@ private DsfPingUnits() { } - public enum Code implements SingleStringValueEnum + public enum Code { - BITS_PER_SECOND("bits-per-second"), - BYTES_PER_SECOND("bytes-per-second"), - MEGABITS_PER_SECOND("megabits-per-second"), - MEGABYTES_PER_SECOND("megabytes-per-second"); - - private final String value; - - Code(String value) + bps { - this.value = value; - } - - public String getValue() + @Override + public BigDecimal calculateSpeed(long bytes, Duration duration) + { + BigDecimal bits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP); + BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); + return bits.divide(seconds, 2, RoundingMode.HALF_UP); + } + }, + kbps { - return value; - } - - public static Code ofValue(String value) + @Override + public BigDecimal calculateSpeed(long bytes, Duration duration) + { + BigDecimal kiloBits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000), RoundingMode.HALF_UP); + BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); + return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); + } + }, + Mbps { - return new SingleStringValueEnumParser<>(Code.class).ofValue(value); - } + @Override + public BigDecimal calculateSpeed(long bytes, Duration duration) + { + BigDecimal kiloBits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); + BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); + return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); + } + }, + Gbps + { + @Override + public BigDecimal calculateSpeed(long bytes, Duration duration) + { + BigDecimal kiloBits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000000000), RoundingMode.HALF_UP); + BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); + return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); + } + }, + Bps + { + @Override + public BigDecimal calculateSpeed(long bytes, Duration duration) + { + BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP); + BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); + return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); + } + }, + kBps + { + @Override + public BigDecimal calculateSpeed(long bytes, Duration duration) + { + BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000), RoundingMode.HALF_UP); + BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); + return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); + } + }, + MBps + { + @Override + public BigDecimal calculateSpeed(long bytes, Duration duration) + { + BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); + BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); + return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); + } + }, + GBps + { + @Override + public BigDecimal calculateSpeed(long bytes, Duration duration) + { + BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000000000), RoundingMode.HALF_UP); + BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) + .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); + return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); + } + }; + + public abstract BigDecimal calculateSpeed(long bytes, Duration duration); } } } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index dace81e6..38956dbd 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -43,7 +43,6 @@ import dev.dsf.bpe.service.pong.StoreDownloadSpeed; import dev.dsf.bpe.service.pong.StoreErrors; import dev.dsf.bpe.service.pong.StoreUploadSpeed; -import dev.dsf.bpe.util.CodeSystemDsfPingUnitsConverter; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.documentation.ProcessDocumentation; import dev.dsf.bpe.variables.duration.DurationValueSerializer; @@ -73,9 +72,9 @@ public class PingConfig @Value("${dev.dsf.bpe.ping.maxUploadSizeBytes:10000000}") private long maxUploadSizeBytes; - @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values be: \"bits-per-second\", \"bytes-per-second\", \"megabits-per-second\", \"megabytes-per-second\". Default is \"megabytes-per-second\".", processNames = { + @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values are: \"bps\", \"kbps\", \"Mbps\", \"Gbps\", \"Bps\", \"kBps\", \"MBps\", \"GBps\". Default is \"mbps\".", processNames = { "dsfdev_ping", "dsfdev_pong" }) - @Value("${dev.dsf.bpe.ping.networkSpeedUnit:megabits-per-second}") + @Value("${dev.dsf.bpe.ping.networkSpeedUnit:Mbps}") private CodeSystem.DsfPingUnits.Code networkSpeedUnit; public CodeSystem.DsfPingUnits.Code getNetworkSpeedUnit() @@ -351,14 +350,5 @@ public ObjectMapper objectMapperWithJavaTimeModule() return objectMapper; } - @Bean - public static ConversionService conversionService() - { - DefaultConversionService conversionService = new DefaultConversionService(); - DefaultConversionService.addDefaultConverters(conversionService); - conversionService.addConverter(new CodeSystemDsfPingUnitsConverter()); - return conversionService; - } - private static final String OBJECT_MAPPER_WITH_TIME_MODULE = "objectMapperWithJavaTimeModule"; } diff --git a/src/main/java/dev/dsf/bpe/util/CodeSystemDsfPingUnitsConverter.java b/src/main/java/dev/dsf/bpe/util/CodeSystemDsfPingUnitsConverter.java deleted file mode 100644 index ef09af83..00000000 --- a/src/main/java/dev/dsf/bpe/util/CodeSystemDsfPingUnitsConverter.java +++ /dev/null @@ -1,15 +0,0 @@ -package dev.dsf.bpe.util; - -import org.springframework.core.convert.converter.Converter; -import org.springframework.lang.NonNull; - -import dev.dsf.bpe.CodeSystem; - -public class CodeSystemDsfPingUnitsConverter implements Converter<String, CodeSystem.DsfPingUnits.Code> -{ - @Override - public CodeSystem.DsfPingUnits.Code convert(@NonNull String source) - { - return CodeSystem.DsfPingUnits.Code.ofValue(source); - } -} diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java index 7d319940..80ec89da 100644 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java @@ -19,32 +19,6 @@ public static BigDecimal calculate(long bytes, Duration duration, CodeSystem.Dsf if (duration.isZero()) return BigDecimal.valueOf(Long.MAX_VALUE); - BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) - .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); - - return switch (unit) // todo: unit can implement calculate for each entry - { - case BITS_PER_SECOND -> - { - BigDecimal bits = new BigDecimal(bytes * 8L).setScale(3, RoundingMode.HALF_UP); - yield bits.divide(seconds, 2, RoundingMode.HALF_UP); - } - case MEGABITS_PER_SECOND -> - { - BigDecimal megabits = new BigDecimal(bytes * 8L).divide(BigDecimal.valueOf(1000000), - RoundingMode.HALF_UP); - yield megabits.divide(seconds, 2, RoundingMode.HALF_UP); - } - case BYTES_PER_SECOND -> - { - BigDecimal bytesLocal = new BigDecimal(bytes).setScale(3, RoundingMode.HALF_UP); - yield bytesLocal.divide(seconds, 2, RoundingMode.HALF_UP); - } - case MEGABYTES_PER_SECOND -> - { - BigDecimal megabytes = new BigDecimal(bytes).divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); - yield megabytes.divide(seconds, 2, RoundingMode.HALF_UP); - } - }; + return unit.calculateSpeed(bytes, duration); } } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index c9d75113..5533a6b9 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -174,11 +174,11 @@ public static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComp { if (hasDownloadSpeedSet(outputComponent)) { - updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.getValue()); + updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.name()); } else { - addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.getValue()); + addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.name()); } return outputComponent; @@ -213,11 +213,11 @@ public static TaskOutputComponent updateStatusOutputUploadSpeed(TaskOutputCompon { if (hasDownloadSpeedSet(outputComponent)) { - updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.getValue()); + updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.name()); } else { - addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.getValue()); + addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.name()); } return outputComponent; @@ -270,7 +270,7 @@ public static TaskOutputComponent createPingStatusOutput(Target target, CodeSyst CodeSystem.DsfPingUnits.Code unit) { return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS.getValue(), statusCode.getValue(), errors, - downloadSpeed, uploadSpeed, unit.getValue()); + downloadSpeed, uploadSpeed, unit.name()); } public static TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode) diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml index b6109468..d615641a 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml @@ -22,22 +22,37 @@ <versionNeeded value="false" /> <content value="complete" /> <concept> - <code value="bits-per-second"/> + <code value="bps"/> <display value="bps"/> <definition value="Download speed unit in bits per second" /> </concept> <concept> - <code value="bytes-per-second"/> - <display value="Bps"/> - <definition value="Download speed unit in bytes per second" /> + <code value="kbps"/> + <display value="kbps"/> + <definition value="Download speed unit in kilobits per second" /> </concept> <concept> - <code value="megabits-per-second"/> + <code value="Mbps"/> <display value="Mbps"/> <definition value="Download speed unit in megabits per second" /> </concept> <concept> - <code value="megabytes-per-second"/> + <code value="Gbps"/> + <display value="Gbps"/> + <definition value="Download speed unit in gigabits per second" /> + </concept> + <concept> + <code value="Bps"/> + <display value="Bps"/> + <definition value="Download speed unit in bytes per second" /> + </concept> + <concept> + <code value="kBps"/> + <display value="kBps"/> + <definition value="Download speed unit in kilobytes per second" /> + </concept> + <concept> + <code value="MBps"/> <display value="MBps"/> <definition value="Download speed unit in megabytes per second" /> </concept> diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 996e4e6f..3be3007e 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -332,7 +332,7 @@ public String getCorrelationKey() task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED, - BigDecimal.ZERO, BigDecimal.ZERO, CodeSystem.DsfPingUnits.Code.BITS_PER_SECOND)); + BigDecimal.ZERO, BigDecimal.ZERO, CodeSystem.DsfPingUnits.Code.bps)); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); From addccc2e7247d47ff4736c1d2540eb0db5f7fe27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 09:58:09 +0200 Subject: [PATCH 339/382] Added import --- src/main/java/dev/dsf/bpe/service/Cleanup.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 7417475e..0ea47edb 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -4,6 +4,7 @@ import java.util.Objects; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.Expression; import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.IdType; import org.slf4j.Logger; @@ -24,7 +25,7 @@ public class Cleanup extends AbstractServiceDelegate implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(Cleanup.class); - private org.camunda.bpm.engine.delegate.Expression process; + private Expression process; public Cleanup(ProcessPluginApi api) { From de742cb543459e6af7424a15808cac21da4f3c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 11:25:23 +0200 Subject: [PATCH 340/382] GenerateAndStoreResource now also uses Camunda field injection to differentiate the process the service is running in --- .../bpe/service/GenerateAndStoreResource.java | 30 ++++++++++++++----- .../ping/GenerateAndStoreResourcePing.java | 27 ----------------- .../pong/GenerateAndStoreResourcePong.java | 28 ----------------- .../dev/dsf/bpe/spring/config/PingConfig.java | 16 ++-------- src/main/resources/bpe/ping.bpmn | 7 ++++- src/main/resources/bpe/pong.bpmn | 7 ++++- 6 files changed, 37 insertions(+), 78 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java delete mode 100644 src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index eb36480f..bd7f42d1 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -1,33 +1,41 @@ package dev.dsf.bpe.service; +import java.util.Objects; + import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.Expression; import org.hl7.fhir.r4.model.IdType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; import dev.dsf.bpe.variables.process_error.ProcessErrorValueImpl; import jakarta.ws.rs.WebApplicationException; -public class GenerateAndStoreResource +public class GenerateAndStoreResource extends AbstractServiceDelegate implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(GenerateAndStoreResource.class); - private final ProcessPluginApi api; private final long maxUploadSizeBytes; - private final CodeSystem.DsfPingProcesses.Code process; + private Expression process; - public GenerateAndStoreResource(ProcessPluginApi api, long maxUploadSizeBytes, - CodeSystem.DsfPingProcesses.Code process) + public GenerateAndStoreResource(ProcessPluginApi api, long maxUploadSizeBytes) { - this.api = api; + super(api); this.maxUploadSizeBytes = maxUploadSizeBytes; - this.process = process; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); } public void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError @@ -63,7 +71,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) catch (WebApplicationException e) { String status = String.valueOf(e.getResponse().getStatus()); - ProcessError error = new ProcessError(process, + ProcessError error = new ProcessError(getProcess((String) process.getValue(delegateExecution)), CodeSystem.DsfPingProcessSteps.Code.GENERATE_AND_STORE_RESOURCE, "Storing Binary resource on local DSF FHIR server.", ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, "Local DSF FHIR server responded with status: " + status); @@ -84,4 +92,10 @@ private IdType storeBinary(RandomByteInputStream downloadResourceContent) api.getOrganizationProvider().getLocalOrganization().get().getIdElement().getValue()); } + private CodeSystem.DsfPingProcesses.Code getProcess(String process) + { + if (process == null || process.isEmpty()) + return null; + return CodeSystem.DsfPingProcesses.Code.ofValue(process); + } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java b/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java deleted file mode 100644 index fc6a40d2..00000000 --- a/src/main/java/dev/dsf/bpe/service/ping/GenerateAndStoreResourcePing.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.dsf.bpe.service.ping; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.service.GenerateAndStoreResource; -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Variables; - -public class GenerateAndStoreResourcePing extends AbstractServiceDelegate -{ - private final GenerateAndStoreResource delegate; - - public GenerateAndStoreResourcePing(ProcessPluginApi api, long maxUploadSizeBytes) - { - super(api); - delegate = new GenerateAndStoreResource(api, maxUploadSizeBytes, CodeSystem.DsfPingProcesses.Code.PING); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError - { - delegate.doExecute(delegateExecution, variables); - } -} diff --git a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java b/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java deleted file mode 100644 index fdfbcbe1..00000000 --- a/src/main/java/dev/dsf/bpe/service/pong/GenerateAndStoreResourcePong.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.dsf.bpe.service.pong; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; - -import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.service.GenerateAndStoreResource; -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Variables; - -public class GenerateAndStoreResourcePong extends AbstractServiceDelegate -{ - private final GenerateAndStoreResource delegate; - - public GenerateAndStoreResourcePong(ProcessPluginApi api, long maxUploadSizeBytes) - { - super(api); - this.delegate = new GenerateAndStoreResource(api, maxUploadSizeBytes, CodeSystem.DsfPingProcesses.Code.PONG); - } - - @Override - protected void doExecute(DelegateExecution delegateExecution, Variables variables) throws BpmnError - { - delegate.doExecute(delegateExecution, variables); - } - -} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 38956dbd..85db3d4f 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -7,8 +7,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; -import org.springframework.core.convert.ConversionService; -import org.springframework.core.convert.support.DefaultConversionService; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; @@ -21,11 +19,11 @@ import dev.dsf.bpe.message.SendPongMessage; import dev.dsf.bpe.message.SendStartPing; import dev.dsf.bpe.service.Cleanup; +import dev.dsf.bpe.service.GenerateAndStoreResource; import dev.dsf.bpe.service.SetDownloadResourceSize; import dev.dsf.bpe.service.autostart.SetTargetAndConfigureTimer; import dev.dsf.bpe.service.ping.CheckPingTaskStatus; import dev.dsf.bpe.service.ping.DownloadResourceAndMeasureSpeedInSubProcess; -import dev.dsf.bpe.service.ping.GenerateAndStoreResourcePing; import dev.dsf.bpe.service.ping.LogAndSaveError; import dev.dsf.bpe.service.ping.LogAndSaveUploadErrorPing; import dev.dsf.bpe.service.ping.SavePong; @@ -33,7 +31,6 @@ import dev.dsf.bpe.service.ping.StoreResults; import dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed; import dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration; -import dev.dsf.bpe.service.pong.GenerateAndStoreResourcePong; import dev.dsf.bpe.service.pong.LogAndSaveAndStoreError; import dev.dsf.bpe.service.pong.LogAndSaveUploadErrorPong; import dev.dsf.bpe.service.pong.LogPing; @@ -283,16 +280,9 @@ public dev.dsf.bpe.service.ping.LogAndSaveSendError logAndSaveSendError() @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public GenerateAndStoreResourcePing generateAndStoreResourcePing() + public GenerateAndStoreResource generateAndStoreResource() { - return new GenerateAndStoreResourcePing(api, maxUploadSizeBytes); - } - - @Bean - @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public GenerateAndStoreResourcePong generateAndStoreResourcePong() - { - return new GenerateAndStoreResourcePong(api, maxUploadSizeBytes); + return new GenerateAndStoreResource(api, maxUploadSizeBytes); } @Bean diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 765f55b4..4a06be29 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -169,7 +169,12 @@ <bpmn:association id="Association_14iteoh" sourceRef="Activity_0vw65a2" targetRef="TextAnnotation_0smygq5" /> <bpmn:association id="Association_0l3n1oc" sourceRef="TextAnnotation_08ic0l2" targetRef="Activity_0h9o9u7" /> </bpmn:subProcess> - <bpmn:serviceTask id="Activity_0nwtf8o" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.ping.GenerateAndStoreResourcePing"> + <bpmn:serviceTask id="Activity_0nwtf8o" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.GenerateAndStoreResource"> + <bpmn:extensionElements> + <camunda:field name="process"> + <camunda:string>ping</camunda:string> + </camunda:field> + </bpmn:extensionElements> <bpmn:incoming>Flow_152nb9r</bpmn:incoming> <bpmn:outgoing>Flow_1op4sei</bpmn:outgoing> </bpmn:serviceTask> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index 3f70c6ae..ae1ee5fb 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -78,7 +78,12 @@ <bpmn:incoming>Flow_0h8flp6</bpmn:incoming> <bpmn:outgoing>Flow_0zib7wr</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_1m4wavi" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.pong.GenerateAndStoreResourcePong"> + <bpmn:serviceTask id="Activity_1m4wavi" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.GenerateAndStoreResource"> + <bpmn:extensionElements> + <camunda:field name="process"> + <camunda:string>pong</camunda:string> + </camunda:field> + </bpmn:extensionElements> <bpmn:incoming>Flow_0x7t1ii</bpmn:incoming> <bpmn:outgoing>Flow_033lqly</bpmn:outgoing> </bpmn:serviceTask> From 7ab388125cbe236575b467bafc2f3b9369d96a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 13:57:18 +0200 Subject: [PATCH 341/382] - moved maxDownloadResourceSizeBytes calculation to constructor to only ever be able to access the correct value - fixed log message containing wrong resource size if resource size was chosen from input parameters - renamed method to refer to byte size consistently --- .../dsf/bpe/service/SetDownloadResourceSize.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index e04c0e7e..1c04baac 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -23,7 +23,7 @@ public class SetDownloadResourceSize extends AbstractServiceDelegate public SetDownloadResourceSize(ProcessPluginApi api, long maxDownloadResourceSizeBytes) { super(api); - this.maxDownloadResourceSizeBytes = maxDownloadResourceSizeBytes; + this.maxDownloadResourceSizeBytes = Math.min(maxDownloadResourceSizeBytes, ConstantsPing.DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT); } @Override @@ -31,19 +31,20 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable { logger.debug("Setting download resource size..."); + long downloadResourceSizeBytes = getDownloadResourceSizeBytes(variables); variables.setLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), - getDownloadResourceSize(variables)); + downloadResourceSizeBytes); - logger.debug("Set download resource size to " + maxDownloadResourceSizeBytes); + logger.debug("Set download resource size to " + downloadResourceSizeBytes); } - private long getDownloadResourceSize(Variables variables) + private long getDownloadResourceSizeBytes(Variables variables) { Optional<DecimalType> downloadResourceSizeType = api.getTaskHelper().getFirstInputParameterValue( variables.getStartTask(), CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), DecimalType.class); - return downloadResourceSizeType.map(decimalType -> decimalType.getValue().longValue()).orElseGet( - () -> Math.min(maxDownloadResourceSizeBytes, ConstantsPing.DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT)); + return downloadResourceSizeType.map(decimalType -> decimalType.getValue().longValue()).orElse( + maxDownloadResourceSizeBytes); } } From f73e1eb18acd9a6b741353dbd53734def2bc6098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 14:32:41 +0200 Subject: [PATCH 342/382] Removed empty lines and ran format and sort --- .../dev/dsf/bpe/service/SetDownloadResourceSize.java | 10 +++++----- .../dev/dsf/bpe/service/ping/CheckPingTaskStatus.java | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index 1c04baac..8dcce2b3 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -23,7 +23,8 @@ public class SetDownloadResourceSize extends AbstractServiceDelegate public SetDownloadResourceSize(ProcessPluginApi api, long maxDownloadResourceSizeBytes) { super(api); - this.maxDownloadResourceSizeBytes = Math.min(maxDownloadResourceSizeBytes, ConstantsPing.DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT); + this.maxDownloadResourceSizeBytes = Math.min(maxDownloadResourceSizeBytes, + ConstantsPing.DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT); } @Override @@ -32,8 +33,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Setting download resource size..."); long downloadResourceSizeBytes = getDownloadResourceSizeBytes(variables); - variables.setLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), - downloadResourceSizeBytes); + variables.setLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), downloadResourceSizeBytes); logger.debug("Set download resource size to " + downloadResourceSizeBytes); } @@ -44,7 +44,7 @@ private long getDownloadResourceSizeBytes(Variables variables) variables.getStartTask(), CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), DecimalType.class); - return downloadResourceSizeType.map(decimalType -> decimalType.getValue().longValue()).orElse( - maxDownloadResourceSizeBytes); + return downloadResourceSizeType.map(decimalType -> decimalType.getValue().longValue()) + .orElse(maxDownloadResourceSizeBytes); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index bad12d9a..1dc813c2 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -45,7 +45,6 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable ProcessError error; try { - Task pingTask = fhirWebserviceClient.withRetry(3, 1000).read(Task.class, taskId); switch (pingTask.getStatus()) { @@ -62,8 +61,6 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable + Task.TaskStatus.INPROGRESS + ", " + Task.TaskStatus.COMPLETED + " or " + Task.TaskStatus.FAILED); } - - } catch (WebApplicationException e) { From f48526629437110e77bb01db78afe3ce96dc1a66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 14:43:11 +0200 Subject: [PATCH 343/382] Applied suggested simplification --- .../dev/dsf/bpe/service/ping/CheckPingTaskStatus.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index 1dc813c2..9769e916 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -46,21 +46,20 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable try { Task pingTask = fhirWebserviceClient.withRetry(3, 1000).read(Task.class, taskId); - switch (pingTask.getStatus()) + error = switch (pingTask.getStatus()) { - case REQUESTED, INPROGRESS, FAILED, COMPLETED -> error = new ProcessError( - CodeSystem.DsfPingProcesses.Code.PING, + case REQUESTED, INPROGRESS, FAILED, COMPLETED -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, CodeSystem.DsfPingProcessSteps.Code.CHECK_PING_TASK_STATUS, "Awaiting pong message", null, "Pong message timed out. Status of ping task resource with id " + taskId + " from " + target.getEndpointUrl() + " is " + pingTask.getStatus()); - default -> error = new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, + default -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, CodeSystem.DsfPingProcessSteps.Code.CHECK_PING_TASK_STATUS, "Awaiting pong message", null, "Pong message timed out. Status of ping task resource with id " + taskId + " from " + target.getEndpointUrl() + " is " + pingTask.getStatus() + ". Unexpected status. Should be either of " + Task.TaskStatus.REQUESTED + ", " + Task.TaskStatus.INPROGRESS + ", " + Task.TaskStatus.COMPLETED + " or " + Task.TaskStatus.FAILED); - } + }; } catch (WebApplicationException e) { From 20a387520c6e747a54557a3c70b2f1988a0fb6f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 15:42:58 +0200 Subject: [PATCH 344/382] Removed maxDownloadSizeBytes parameter because downloadResourceSizeBytes is already calculated using the maximum resource size and cannot exceed it --- ...wnloadResourceAndMeasureSpeedInSubProcess.java | 6 ++---- .../pong/DownloadResourceAndMeasureSpeed.java | 6 ++---- .../dev/dsf/bpe/spring/config/PingConfig.java | 4 ++-- .../dsf/bpe/util/BinaryResourceDownloader.java | 15 +++++++-------- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 1319f805..4c9cd177 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -18,12 +18,10 @@ public class DownloadResourceAndMeasureSpeedInSubProcess extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(DownloadResourceAndMeasureSpeedInSubProcess.class); - private final long maxDownloadSizeBytes; - public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api, long maxDownloadSizeBytes) + public DownloadResourceAndMeasureSpeedInSubProcess(ProcessPluginApi api) { super(api); - this.maxDownloadSizeBytes = maxDownloadSizeBytes; } @Override @@ -37,7 +35,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader( - CodeSystem.DsfPingProcesses.Code.PING).download(variables, api, task, maxDownloadSizeBytes); + CodeSystem.DsfPingProcesses.Code.PING).download(variables, api, task); if (downloadResult.getError() == null) { diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 2700402c..e5bf6cb0 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -17,12 +17,10 @@ public class DownloadResourceAndMeasureSpeed extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(DownloadResourceAndMeasureSpeed.class); - private final long maxDownloadSizeBytes; - public DownloadResourceAndMeasureSpeed(ProcessPluginApi api, long maxDownloadSizeBytes) + public DownloadResourceAndMeasureSpeed(ProcessPluginApi api) { super(api); - this.maxDownloadSizeBytes = maxDownloadSizeBytes; } @Override @@ -33,7 +31,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task task = variables.getStartTask(); BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader( - CodeSystem.DsfPingProcesses.Code.PONG).download(variables, api, task, maxDownloadSizeBytes); + CodeSystem.DsfPingProcesses.Code.PONG).download(variables, api, task); if (downloadResult.getError() == null) { diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 85db3d4f..9df90528 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -198,14 +198,14 @@ public CleanupPongMessage cleanupPongMessage() @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public DownloadResourceAndMeasureSpeed downloadResourceAndMeasureSpeed() { - return new DownloadResourceAndMeasureSpeed(api, maxDownloadSizeBytes); + return new DownloadResourceAndMeasureSpeed(api); } @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public DownloadResourceAndMeasureSpeedInSubProcess downloadResourceAndMeasureSpeedInSubProcess() { - return new DownloadResourceAndMeasureSpeedInSubProcess(api, maxDownloadSizeBytes); + return new DownloadResourceAndMeasureSpeedInSubProcess(api); } @Bean diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index a32140f4..0bf6067a 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -31,7 +31,7 @@ public BinaryResourceDownloader(CodeSystem.DsfPingProcesses.Code process) this.process = process; } - public DownloadResult download(Variables variables, ProcessPluginApi api, Task task, long maxDownloadSizeBytes) + public DownloadResult download(Variables variables, ProcessPluginApi api, Task task) { DownloadResult downloadResult; @@ -64,16 +64,15 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t try (binaryResourceInputStream) { - logger.info( - "Downloading resource for: '{}'. Requested resource size is {} bytes, maximum downloadable size is {} bytes...", - downloadResourceReference.getReference(), downloadResourceSizeBytes, maxDownloadSizeBytes); + logger.info("Downloading resource for: '{}'. Requested resource size is {} bytes...", + downloadResourceReference.getReference(), downloadResourceSizeBytes); long downloadStartTime = System.currentTimeMillis(); - long numBytes = Math.min(downloadResourceSizeBytes, maxDownloadSizeBytes); - binaryResourceInputStream.skipNBytes(numBytes); + binaryResourceInputStream.skipNBytes(downloadResourceSizeBytes); long downloadEndTime = System.currentTimeMillis(); Duration downloadedDuration = Duration.ofMillis(downloadEndTime - downloadStartTime); - downloadResult = new DownloadResult(numBytes, downloadedDuration); - logger.info("Finished downloading {} bytes. Took {}", numBytes, downloadedDuration.toString()); + downloadResult = new DownloadResult(downloadResourceSizeBytes, downloadedDuration); + logger.info("Finished downloading {} bytes. Took {}", downloadResourceSizeBytes, + downloadedDuration.toString()); } catch (IOException e) { From 1dcc472cc80785d74ca5834b49fddf755f50d644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 16:31:26 +0200 Subject: [PATCH 345/382] Deleted ErrorOutputComponentGenerator and moved create method to ProcessError class --- src/main/java/dev/dsf/bpe/ProcessError.java | 26 ++++++++++++ .../dsf/bpe/service/ping/StoreResults.java | 4 +- .../ErrorOutputComponentGenerator.java | 42 ------------------- 3 files changed, 27 insertions(+), 45 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 3852292a..6925591c 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -1,11 +1,15 @@ package dev.dsf.bpe; import java.io.Serializable; +import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; +import org.hl7.fhir.r4.model.CodeType; import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.UrlType; //todo: remove process and processStep + CodeSystems, make message never contain e.getMessage() becaus security @@ -70,4 +74,26 @@ public static ProcessError toError(Extension extension) return new ProcessError(processCode, stepCode, action, potentialFixUrl, message); } + + public static List<Task.TaskOutputComponent> toTaskOutput(List<ProcessError> errors) + { + if (errors == null || errors.isEmpty()) + return List.of(); + return errors.stream().map(ProcessError::toTaskOutput).collect(Collectors.toList()); + } + + public static Task.TaskOutputComponent toTaskOutput(ProcessError error) + { + Task.TaskOutputComponent param = new Task.TaskOutputComponent(); + + param.getType().addCoding(new Coding(CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.ERROR.getValue(), null)); + param.addExtension(ProcessError.toExtension(error)); + Extension dataAbsentReason = new Extension() + .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") + .setValue(new CodeType("not-applicable")); + param.setValue(new StringType()); + param.getValue().addExtension(dataAbsentReason); + + return param; + } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 4a7f48b3..0b97cca8 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -22,7 +22,6 @@ import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.task.NetworkSpeedCalculator; -import dev.dsf.bpe.util.task.output.generator.ErrorOutputComponentGenerator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -61,8 +60,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Targets targets = variables.getTargets(); Map<Target, List<ProcessError>> errorsPerTarget = new HashMap<>(); - ErrorOutputComponentGenerator.create(ErrorListUtils.getErrorList(execution).getEntries()) - .forEach(task::addOutput); + ProcessError.toTaskOutput(ErrorListUtils.getErrorList(execution).getEntries()).forEach(task::addOutput); targets.getEntries().stream().sorted(Comparator.comparing(Target::getEndpointIdentifierValue)).forEach(target -> { diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java deleted file mode 100644 index 901d16c6..00000000 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/ErrorOutputComponentGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -package dev.dsf.bpe.util.task.output.generator; - -import java.util.List; -import java.util.stream.Collectors; - -import org.hl7.fhir.r4.model.CodeType; -import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.Extension; -import org.hl7.fhir.r4.model.StringType; -import org.hl7.fhir.r4.model.Task; - -import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ProcessError; - -public final class ErrorOutputComponentGenerator -{ - private ErrorOutputComponentGenerator() - { - } - - public static List<Task.TaskOutputComponent> create(List<ProcessError> errors) - { - if (errors == null || errors.isEmpty()) - return List.of(); - return errors.stream().map(ErrorOutputComponentGenerator::create).collect(Collectors.toList()); - } - - public static Task.TaskOutputComponent create(ProcessError error) - { - Task.TaskOutputComponent param = new Task.TaskOutputComponent(); - - param.getType().addCoding(new Coding(CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.ERROR.getValue(), null)); - param.addExtension(ProcessError.toExtension(error)); - Extension dataAbsentReason = new Extension() - .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") - .setValue(new CodeType("not-applicable")); - param.setValue(new StringType()); - param.getValue().addExtension(dataAbsentReason); - - return param; - } -} From c8bea9e448e124ba5bb51141ff0b222510739e63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 17:22:06 +0200 Subject: [PATCH 346/382] Moved methods only used in tests to the test in question and made methods private that are only used by other methods inside the class --- .../output/generator/PingStatusGenerator.java | 19 ++++------------ .../dsf/fhir/profiles/TaskProfileTest.java | 22 ++++++++++++++----- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 5533a6b9..e35d5695 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -94,7 +94,7 @@ public static Task updatePongStatusOutput(Task task, CodeSystem.DsfPingStatus.Co return task; } - public static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent outputComponent, + private static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent outputComponent, CodeSystem.DsfPingStatus.Code statusCode) { if (hasStatusCodeSet(outputComponent)) @@ -132,7 +132,7 @@ public static Task updatePongStatusOutput(Task task, Target target) return task; } - public static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputComponent, Target target) + private static TaskOutputComponent updateStatusOutput(TaskOutputComponent outputComponent, Target target) { if (hasTargetSet(outputComponent)) { @@ -169,7 +169,7 @@ public static Task updatePongStatusOutputDownloadSpeed(Task task, BigDecimal dow return task; } - public static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComponent outputComponent, + private static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, CodeSystem.DsfPingUnits.Code networkSpeedUnit) { if (hasDownloadSpeedSet(outputComponent)) @@ -208,7 +208,7 @@ public static Task updatePongStatusOutputUploadSpeed(Task task, BigDecimal uploa return task; } - public static TaskOutputComponent updateStatusOutputUploadSpeed(TaskOutputComponent outputComponent, + private static TaskOutputComponent updateStatusOutputUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, CodeSystem.DsfPingUnits.Code networkSpeedUnit) { if (hasDownloadSpeedSet(outputComponent)) @@ -252,12 +252,6 @@ private static boolean hasDownloadSpeedSet(TaskOutputComponent outputComponent) return downloadSpeedExtension != null; } - public static TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, - BigDecimal downloadSpeed, BigDecimal uploadSpeed, CodeSystem.DsfPingUnits.Code unit) - { - return createPingStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); - } - public static TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors) { @@ -273,11 +267,6 @@ public static TaskOutputComponent createPingStatusOutput(Target target, CodeSyst downloadSpeed, uploadSpeed, unit.name()); } - public static TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode) - { - return createPongStatusOutput(target, statusCode, null); - } - public static TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors) { diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 3be3007e..4347ede8 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -41,7 +41,6 @@ import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationGenerator; import dev.dsf.bpe.util.task.input.generator.ErrorInputComponentGenerator; -import dev.dsf.bpe.util.task.output.generator.ErrorOutputComponentGenerator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; @@ -203,7 +202,7 @@ public void testTaskStartPingProcessProfileValidWithErrorMessages() { Task task = createValidTaskStartPingProcess(); - ErrorOutputComponentGenerator.create(processErrors(4)).forEach(task::addOutput); + ProcessError.toTaskOutput(processErrors(4)).forEach(task::addOutput); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -331,8 +330,8 @@ public String getCorrelationKey() Task task = createValidTaskStartPingProcess(); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED, - BigDecimal.ZERO, BigDecimal.ZERO, CodeSystem.DsfPingUnits.Code.bps)); + task.addOutput(createPingStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED, BigDecimal.ZERO, + BigDecimal.ZERO, CodeSystem.DsfPingUnits.Code.bps)); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -443,7 +442,7 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(PingStatusGenerator.createPongStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED)); + task.addOutput(createPongStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED)); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -483,7 +482,7 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(PingStatusGenerator.createPongStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED)); + task.addOutput(createPongStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED)); task.addInput(DownloadResourceSizeGenerator.create(1000)); task.addInput(DownloadResourceReferenceGenerator.create("https://test.endpoint.org/fhir/Binary")); @@ -696,4 +695,15 @@ private String fillPlaceholders(String xml) dtf.format(LocalDate.ofInstant(Instant.now(), TimeZone.getDefault().toZoneId()))); return xml; } + + private Task.TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, + BigDecimal downloadSpeed, BigDecimal uploadSpeed, CodeSystem.DsfPingUnits.Code unit) + { + return PingStatusGenerator.createPingStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); + } + + private Task.TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode) + { + return PingStatusGenerator.createPongStatusOutput(target, statusCode, null); + } } From cb8e4f2a3b3360be9bfd6fef297c9b98e436c17d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 17:29:09 +0200 Subject: [PATCH 347/382] Deleted ErrorInputParser and moved its method to SavePong as it is the only place where it is used --- .../dev/dsf/bpe/service/ping/SavePong.java | 18 ++++++++++-- .../bpe/util/task/input/ErrorInputParser.java | 28 ------------------- 2 files changed, 16 insertions(+), 30 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index 6960ed39..bfa6c593 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -1,6 +1,7 @@ package dev.dsf.bpe.service.ping; import java.time.Duration; +import java.util.List; import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; @@ -11,10 +12,11 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; +import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.task.input.ErrorInputParser; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; @@ -54,10 +56,22 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), decimalType.getValue().longValue())); - ProcessErrors errorList = new ProcessErrors(ErrorInputParser.parseInputs(pong)); + ProcessErrors errorList = new ProcessErrors(parseInputs(pong)); ErrorListUtils.addAll(errorList, delegateExecution, correlationKey); logger.debug("Saved pong information."); } + + private List<ProcessError> parseInputs(Task task) + { + List<Task.ParameterComponent> inputs = task.getInput().stream().filter( + input -> CodeSystem.DsfPing.Code.ERROR.getValue().equals(input.getType().getCodingFirstRep().getCode())) + .toList(); + + return inputs.stream() + .map(input -> ProcessError + .toError(input.getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR))) + .toList(); + } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java b/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java deleted file mode 100644 index b1ec7abd..00000000 --- a/src/main/java/dev/dsf/bpe/util/task/input/ErrorInputParser.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.dsf.bpe.util.task.input; - -import java.util.List; - -import org.hl7.fhir.r4.model.Task; - -import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.ConstantsPing; -import dev.dsf.bpe.ProcessError; - -public final class ErrorInputParser -{ - private ErrorInputParser() - { - } - - public static List<ProcessError> parseInputs(Task task) - { - List<Task.ParameterComponent> inputs = task.getInput().stream().filter( - input -> CodeSystem.DsfPing.Code.ERROR.getValue().equals(input.getType().getCodingFirstRep().getCode())) - .toList(); - - return inputs.stream() - .map(input -> ProcessError - .toError(input.getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR))) - .toList(); - } -} From 0cbff7ead9652b1dd64eff33d21c4da009d67b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 17:32:17 +0200 Subject: [PATCH 348/382] Combined methods because only the one with the String parameter was used --- .../input/generator/DownloadResourceReferenceGenerator.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java index 83d8cbe1..82135bdd 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java @@ -16,11 +16,6 @@ public static Task.ParameterComponent create(String uri) { Reference reference = new Reference(uri); reference.setType("Binary"); - return create(reference); - } - - public static Task.ParameterComponent create(Reference reference) - { Task.ParameterComponent param = new Task.ParameterComponent(); param.setValue(reference).getType().addCoding(new Coding(CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_REFERENCE.getValue(), null)); From a632979fe35acadd21f80975462eb265001e0d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 17:42:11 +0200 Subject: [PATCH 349/382] Removed empty line and replaced return variable with return statement --- .../bpe/util/task/SendTaskErrorConverter.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index 26221b9f..379e89ff 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -19,7 +19,6 @@ public final class SendTaskErrorConverter { - private SendTaskErrorConverter() { } @@ -31,35 +30,32 @@ private SendTaskErrorConverter() public static ProcessError convert(Exception exception, String action) { - ProcessError processError; if (exception instanceof WebApplicationException e) { - processError = convertWebApplicationException().apply(e, action); + return convertWebApplicationException().apply(e, action); } else if (exception instanceof SSLHandshakeException e) { - processError = convertSSLHandshakeException().apply(e, action); + return convertSSLHandshakeException().apply(e, action); } else if (exception instanceof ConnectTimeoutException e) { - processError = convertConnectTimeoutException().apply(e, action); + return convertConnectTimeoutException().apply(e, action); } else if (exception instanceof HttpHostConnectException e) { - processError = convertHttpHostConnectException().apply(e, action); + return convertHttpHostConnectException().apply(e, action); } else if (exception instanceof ProcessingException e) { - processError = EXPECTED_CAUSES_WITH_CONVERTERS.keySet().stream() + return EXPECTED_CAUSES_WITH_CONVERTERS.keySet().stream() .map(causeClass -> getExpectedCauseInstanceFromStack(causeClass, e)).filter(Objects::nonNull) .findFirst().map(ex -> applyConverter(ex, action)).orElse(applyConverter(e, action)); } else { - processError = convertExceptionFallback().apply(exception, action); + return convertExceptionFallback().apply(exception, action); } - - return processError; } private static BiFunction<SSLHandshakeException, String, ProcessError> convertSSLHandshakeException() From 5b269d8cac2c4cf322c93da156c3fbc9f2beb5fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 17:55:30 +0200 Subject: [PATCH 350/382] Replaced map streaming with if-statements to improve readability --- .../bpe/util/task/SendTaskErrorConverter.java | 42 +++++++++++-------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index 379e89ff..839c50fa 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -23,11 +23,6 @@ private SendTaskErrorConverter() { } - private static final Map<Class<? extends Throwable>, BiFunction<? extends Throwable, String, ProcessError>> EXPECTED_CAUSES_WITH_CONVERTERS = Map - .of(SSLHandshakeException.class, convertSSLHandshakeException(), ConnectTimeoutException.class, - convertConnectTimeoutException(), UnknownHostException.class, convertUnknownHostException(), - HttpHostConnectException.class, convertConnectTimeoutException()); - public static ProcessError convert(Exception exception, String action) { if (exception instanceof WebApplicationException e) @@ -48,9 +43,31 @@ else if (exception instanceof HttpHostConnectException e) } else if (exception instanceof ProcessingException e) { - return EXPECTED_CAUSES_WITH_CONVERTERS.keySet().stream() - .map(causeClass -> getExpectedCauseInstanceFromStack(causeClass, e)).filter(Objects::nonNull) - .findFirst().map(ex -> applyConverter(ex, action)).orElse(applyConverter(e, action)); + SSLHandshakeException sslHandshakeException = getExpectedCauseInstanceFromStack(SSLHandshakeException.class, e); + if(sslHandshakeException != null) + { + return convertSSLHandshakeException().apply(sslHandshakeException, action); + } + + ConnectTimeoutException connectTimeoutException = getExpectedCauseInstanceFromStack(ConnectTimeoutException.class, e); + if(connectTimeoutException != null) + { + return convertConnectTimeoutException().apply(connectTimeoutException, action); + } + + UnknownHostException unknownHostException = getExpectedCauseInstanceFromStack(UnknownHostException.class, e); + if (unknownHostException != null) + { + return convertUnknownHostException().apply(unknownHostException, action); + } + + HttpHostConnectException httpHostConnectException = getExpectedCauseInstanceFromStack(HttpHostConnectException.class, e); + if (httpHostConnectException != null) + { + return convertHttpHostConnectException().apply(httpHostConnectException, action); + } + + return convertExceptionFallback().apply(e, action); } else { @@ -100,15 +117,6 @@ private static BiFunction<UnknownHostException, String, ProcessError> convertUnk e.getMessage()); } - private static <T extends Throwable> ProcessError applyConverter(T ex, String action) - { - @SuppressWarnings("unchecked") - BiFunction<T, String, ProcessError> converter = (BiFunction<T, String, ProcessError>) EXPECTED_CAUSES_WITH_CONVERTERS - .getOrDefault(ex.getClass(), convertExceptionFallback()); - return converter.apply(ex, action); - } - - private static <T extends Throwable> T getExpectedCauseInstanceFromStack(Class<T> expectedCause, Throwable e) { if (Objects.isNull(e)) From 6bfd6ebbcb49932d445a18fa5785d97ea5c41508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 17:59:26 +0200 Subject: [PATCH 351/382] Ran format and sort --- .../bpe/util/task/SendTaskErrorConverter.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index 839c50fa..868aabeb 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -43,25 +43,29 @@ else if (exception instanceof HttpHostConnectException e) } else if (exception instanceof ProcessingException e) { - SSLHandshakeException sslHandshakeException = getExpectedCauseInstanceFromStack(SSLHandshakeException.class, e); - if(sslHandshakeException != null) + SSLHandshakeException sslHandshakeException = getExpectedCauseInstanceFromStack(SSLHandshakeException.class, + e); + if (sslHandshakeException != null) { return convertSSLHandshakeException().apply(sslHandshakeException, action); } - ConnectTimeoutException connectTimeoutException = getExpectedCauseInstanceFromStack(ConnectTimeoutException.class, e); - if(connectTimeoutException != null) + ConnectTimeoutException connectTimeoutException = getExpectedCauseInstanceFromStack( + ConnectTimeoutException.class, e); + if (connectTimeoutException != null) { return convertConnectTimeoutException().apply(connectTimeoutException, action); } - UnknownHostException unknownHostException = getExpectedCauseInstanceFromStack(UnknownHostException.class, e); + UnknownHostException unknownHostException = getExpectedCauseInstanceFromStack(UnknownHostException.class, + e); if (unknownHostException != null) { return convertUnknownHostException().apply(unknownHostException, action); } - HttpHostConnectException httpHostConnectException = getExpectedCauseInstanceFromStack(HttpHostConnectException.class, e); + HttpHostConnectException httpHostConnectException = getExpectedCauseInstanceFromStack( + HttpHostConnectException.class, e); if (httpHostConnectException != null) { return convertHttpHostConnectException().apply(httpHostConnectException, action); From d28a52edb484bcb08c9bd88d03e6a5c2f5fc7ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 18:16:51 +0200 Subject: [PATCH 352/382] Removed NetworkSpeedCalculator because enums are already able to calculate the speed themselves --- src/main/java/dev/dsf/bpe/CodeSystem.java | 32 +++++++++++++++++++ .../dsf/bpe/service/ping/StoreResults.java | 5 ++- .../bpe/service/pong/StoreDownloadSpeed.java | 4 +-- .../bpe/service/pong/StoreUploadSpeed.java | 3 +- .../bpe/util/task/NetworkSpeedCalculator.java | 24 -------------- 5 files changed, 36 insertions(+), 32 deletions(-) delete mode 100644 src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index a7023a80..7838922d 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -221,6 +221,10 @@ public enum Code @Override public BigDecimal calculateSpeed(long bytes, Duration duration) { + if (bytes == 0) + return BigDecimal.ZERO; + if (duration.isZero()) + return BigDecimal.valueOf(Long.MAX_VALUE); BigDecimal bits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP); BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); @@ -232,6 +236,10 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) @Override public BigDecimal calculateSpeed(long bytes, Duration duration) { + if (bytes == 0) + return BigDecimal.ZERO; + if (duration.isZero()) + return BigDecimal.valueOf(Long.MAX_VALUE); BigDecimal kiloBits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP) .divide(BigDecimal.valueOf(1000), RoundingMode.HALF_UP); BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) @@ -244,6 +252,10 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) @Override public BigDecimal calculateSpeed(long bytes, Duration duration) { + if (bytes == 0) + return BigDecimal.ZERO; + if (duration.isZero()) + return BigDecimal.valueOf(Long.MAX_VALUE); BigDecimal kiloBits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP) .divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) @@ -256,6 +268,10 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) @Override public BigDecimal calculateSpeed(long bytes, Duration duration) { + if (bytes == 0) + return BigDecimal.ZERO; + if (duration.isZero()) + return BigDecimal.valueOf(Long.MAX_VALUE); BigDecimal kiloBits = BigDecimal.valueOf(bytes * 8L).setScale(2, RoundingMode.HALF_UP) .divide(BigDecimal.valueOf(1000000000), RoundingMode.HALF_UP); BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) @@ -268,6 +284,10 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) @Override public BigDecimal calculateSpeed(long bytes, Duration duration) { + if (bytes == 0) + return BigDecimal.ZERO; + if (duration.isZero()) + return BigDecimal.valueOf(Long.MAX_VALUE); BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP); BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); @@ -279,6 +299,10 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) @Override public BigDecimal calculateSpeed(long bytes, Duration duration) { + if (bytes == 0) + return BigDecimal.ZERO; + if (duration.isZero()) + return BigDecimal.valueOf(Long.MAX_VALUE); BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP) .divide(BigDecimal.valueOf(1000), RoundingMode.HALF_UP); BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) @@ -291,6 +315,10 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) @Override public BigDecimal calculateSpeed(long bytes, Duration duration) { + if (bytes == 0) + return BigDecimal.ZERO; + if (duration.isZero()) + return BigDecimal.valueOf(Long.MAX_VALUE); BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP) .divide(BigDecimal.valueOf(1000000), RoundingMode.HALF_UP); BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) @@ -303,6 +331,10 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) @Override public BigDecimal calculateSpeed(long bytes, Duration duration) { + if (bytes == 0) + return BigDecimal.ZERO; + if (duration.isZero()) + return BigDecimal.valueOf(Long.MAX_VALUE); BigDecimal kiloBits = BigDecimal.valueOf(bytes).setScale(2, RoundingMode.HALF_UP) .divide(BigDecimal.valueOf(1000000000), RoundingMode.HALF_UP); BigDecimal seconds = BigDecimal.valueOf(duration.toMillis()).setScale(3, RoundingMode.HALF_UP) diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 0b97cca8..af3a2b5b 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -21,7 +21,6 @@ import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorListUtils; -import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -79,7 +78,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw .getVariable(ExecutionVariables.DOWNLOADED_DURATION.correlatedValue(correlationKey)); BigDecimal downloadSpeed = downloadedBytes != null && downloadedDuration != null - ? NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDuration, networkSpeedUnit) + ? networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration) : null; Long uploadedBytes = variables @@ -88,7 +87,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw .getVariable(ExecutionVariables.UPLOADED_DURATION.correlatedValue(correlationKey)); BigDecimal uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null - ? NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDurationMillis, networkSpeedUnit) + ? networkSpeedUnit.calculateSpeed(uploadedBytes, uploadedDurationMillis) : null; task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errors.getEntries(), diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 0828e7a2..1d0e0dac 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -11,7 +11,6 @@ import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; -import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -38,8 +37,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Duration downloadedDuration = (Duration) variables .getVariable(ExecutionVariables.DOWNLOADED_DURATION.getValue()); - BigDecimal downloadSpeed = NetworkSpeedCalculator.calculate(downloadedBytes, downloadedDuration, - networkSpeedUnit); + BigDecimal downloadSpeed = networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration); PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.PENDING); PingStatusGenerator.updatePongStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index c53696f7..1b9ba43d 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -13,7 +13,6 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.util.task.NetworkSpeedCalculator; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; @@ -44,7 +43,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Duration uploadedDuration = uploadedDurationTaskInput .map(duration -> Duration.ofMillis(duration.getValue().longValue())).orElse(Duration.ZERO); - BigDecimal uploadSpeed = NetworkSpeedCalculator.calculate(uploadedBytes, uploadedDuration, networkSpeedUnit); + BigDecimal uploadSpeed = networkSpeedUnit.calculateSpeed(uploadedBytes, uploadedDuration); PingStatusGenerator.updatePongStatusOutputUploadSpeed(startTask, uploadSpeed, networkSpeedUnit); diff --git a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java b/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java deleted file mode 100644 index 80ec89da..00000000 --- a/src/main/java/dev/dsf/bpe/util/task/NetworkSpeedCalculator.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.dsf.bpe.util.task; - -import java.math.BigDecimal; -import java.math.RoundingMode; -import java.time.Duration; - -import dev.dsf.bpe.CodeSystem; - -public final class NetworkSpeedCalculator -{ - private NetworkSpeedCalculator() - { - } - - public static BigDecimal calculate(long bytes, Duration duration, CodeSystem.DsfPingUnits.Code unit) - { - if (bytes == 0) - return BigDecimal.ZERO; - if (duration.isZero()) - return BigDecimal.valueOf(Long.MAX_VALUE); - - return unit.calculateSpeed(bytes, duration); - } -} From 604e26258f2f0040c75b88835f23bf02a6c1e891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 20 Aug 2025 19:10:51 +0200 Subject: [PATCH 353/382] ExecutionVariables enum values are now the enum names --- .../java/dev/dsf/bpe/ExecutionVariables.java | 46 +++++++------------ .../dsf/bpe/message/CleanupPongMessage.java | 8 ++-- .../dev/dsf/bpe/message/SendPingMessage.java | 11 ++--- .../dev/dsf/bpe/message/SendPongMessage.java | 11 ++--- .../java/dev/dsf/bpe/service/Cleanup.java | 4 +- .../bpe/service/GenerateAndStoreResource.java | 9 ++-- .../bpe/service/SetDownloadResourceSize.java | 2 +- .../autostart/SetTargetAndConfigureTimer.java | 4 +- .../bpe/service/ping/CheckPingTaskStatus.java | 2 +- ...adResourceAndMeasureSpeedInSubProcess.java | 6 +-- .../dsf/bpe/service/ping/LogAndSaveError.java | 2 +- .../bpe/service/ping/LogAndSaveSendError.java | 6 +-- .../ping/LogAndSaveUploadErrorPing.java | 2 +- .../dev/dsf/bpe/service/ping/SavePong.java | 4 +- .../dsf/bpe/service/ping/StoreResults.java | 11 ++--- .../pong/DownloadResourceAndMeasureSpeed.java | 7 ++- .../pong/EstimateCleanupTimerDuration.java | 2 +- .../service/pong/LogAndSaveAndStoreError.java | 2 +- .../pong/LogAndSaveUploadErrorPong.java | 2 +- .../bpe/service/pong/SelectPongTarget.java | 3 +- .../service/pong/SetEndpointIdentifier.java | 2 +- .../bpe/service/pong/StoreDownloadSpeed.java | 5 +- .../bpe/util/BinaryResourceDownloader.java | 2 +- .../java/dev/dsf/bpe/util/ErrorListUtils.java | 12 ++--- 24 files changed, 73 insertions(+), 92 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ExecutionVariables.java b/src/main/java/dev/dsf/bpe/ExecutionVariables.java index f5445064..3714a6cc 100644 --- a/src/main/java/dev/dsf/bpe/ExecutionVariables.java +++ b/src/main/java/dev/dsf/bpe/ExecutionVariables.java @@ -2,37 +2,25 @@ public enum ExecutionVariables { - TIMER_INTERVAL("timerInterval"), - STOP_TIMER("stopTimer"), - DOWNLOAD_RESOURCE_SIZE_BYTES("downloadResourceSizeBytes"), - DOWNLOAD_RESOURCE("downloadResource"), - DOWNLOAD_RESOURCE_REFERENCE("downloadResourceReference"), - STATUS_CODE("statusCode"), - ERROR("error"), - ERROR_LIST("errors"), - DOWNLOADED_BYTES("downloadedBytes"), - DOWNLOADED_DURATION("downloadedDuration"), - PONG_TARGET_ENDPOINT_IDENTIFIER("targetEndpointIdentifier"), - UPLOADED_BYTES("uploadedBytes"), - UPLOADED_DURATION("uploadedDuration"), - RESOURCE_DOWNLOAD_ERROR("resourceDownloadError"), - RESOURCE_UPLOAD_ERROR("resourceUploadError"), - PING_TASK_ID("pingTaskId"); - - private final String value; - - ExecutionVariables(String value) - { - this.value = value; - } - - public String getValue() - { - return value; - } + timerInterval, + stopTimer, + downloadResourceSizeBytes, + downloadResource, + downloadResourceReference, + statusCode, + error, + errors, + downloadedBytes, + downloadedDuration, + targetEndpointIdentifier, + uploadedBytes, + uploadedDuration, + resourceDownloadError, + resourceUploadError, + pingTaskId; public String correlatedValue(String correlationKey) { - return getValue() + "_" + correlationKey; + return name() + "_" + correlationKey; } } diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 74ab4088..2db36ff1 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -35,9 +35,9 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE { Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - Long downloadedBytes = variables.getLong(ExecutionVariables.DOWNLOADED_BYTES.correlatedValue(correlationKey)); + Long downloadedBytes = variables.getLong(ExecutionVariables.downloadedBytes.correlatedValue(correlationKey)); Duration downloadedDuration = (Duration) variables - .getVariable(ExecutionVariables.DOWNLOADED_DURATION.correlatedValue(correlationKey)); + .getVariable(ExecutionVariables.downloadedDuration.correlatedValue(correlationKey)); Stream<Task.ParameterComponent> downloadedBytesParameter = downloadedBytes != null ? Stream.of(DownloadedBytesGenerator.create(downloadedBytes)) @@ -57,8 +57,8 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab ProcessError error = SendTaskErrorConverter.convert(exception, "Sending cleanup message to " + target.getEndpointUrl()); - execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), new ProcessErrorValueImpl(error)); - execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), CodeSystem.DsfPing.Code.ERROR.getValue()); + execution.setVariableLocal(ExecutionVariables.error.name(), new ProcessErrorValueImpl(error)); + execution.setVariableLocal(ExecutionVariables.statusCode.name(), CodeSystem.DsfPing.Code.ERROR.getValue()); logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); } diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index 811f1578..e8fd8ef8 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -38,9 +38,8 @@ public SendPingMessage(ProcessPluginApi api) @Override protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - String downloadResourceReference = variables - .getString(ExecutionVariables.DOWNLOAD_RESOURCE_REFERENCE.getValue()); - long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); + String downloadResourceReference = variables.getString(ExecutionVariables.downloadResourceReference.name()); + long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.downloadResourceSizeBytes.name()); Stream<ParameterComponent> downloadResourceReferenceStream = downloadResourceReference == null ? Stream.empty() : Stream.of(DownloadResourceReferenceGenerator.create(downloadResourceReference)); @@ -63,7 +62,7 @@ protected void sendTask(DelegateExecution execution, Variables variables, Target additionalInputParameters); if (taskId != null) { - execution.setVariableLocal(ExecutionVariables.PING_TASK_ID.getValue(), taskId.getIdPart()); + execution.setVariableLocal(ExecutionVariables.pingTaskId.name(), taskId.getIdPart()); } } @@ -82,8 +81,8 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab ProcessError error = SendTaskErrorConverter.convert(exception, "Sending ping message to " + target.getEndpointUrl()); - execution.setVariableLocal(ExecutionVariables.ERROR.getValue(), new ProcessErrorValueImpl(error)); - execution.setVariableLocal(ExecutionVariables.STATUS_CODE.getValue(), CodeSystem.DsfPing.Code.ERROR.getValue()); + execution.setVariableLocal(ExecutionVariables.error.name(), new ProcessErrorValueImpl(error)); + execution.setVariableLocal(ExecutionVariables.statusCode.name(), CodeSystem.DsfPing.Code.ERROR.getValue()); logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); } diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index 1d9bb6bd..9a0fd8af 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -52,14 +52,13 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE Variables variables) { ProcessErrors errorList = ErrorListUtils.getErrorList(execution); - long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); + long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.downloadResourceSizeBytes.name()); if (downloadResourceSizeBytes >= 0) { - Long downloadedBytes = variables.getLong(ExecutionVariables.DOWNLOADED_BYTES.getValue()); + Long downloadedBytes = variables.getLong(ExecutionVariables.downloadedBytes.name()); Duration downloadedDuration = (Duration) variables - .getVariable(ExecutionVariables.DOWNLOADED_DURATION.getValue()); - String downloadResourceReference = variables - .getString(ExecutionVariables.DOWNLOAD_RESOURCE_REFERENCE.getValue()); + .getVariable(ExecutionVariables.downloadedDuration.name()); + String downloadResourceReference = variables.getString(ExecutionVariables.downloadResourceReference.name()); Stream<Task.ParameterComponent> downloadedBytesParameter = downloadedBytes != null ? Stream.of(DownloadedBytesGenerator.create(downloadedBytes)) @@ -104,7 +103,7 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab ErrorListUtils.add(error, execution); PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.ERROR); - variables.setString(ExecutionVariables.STATUS_CODE.getValue(), CodeSystem.DsfPing.Code.ERROR.getValue()); + variables.setString(ExecutionVariables.statusCode.name(), CodeSystem.DsfPing.Code.ERROR.getValue()); variables.updateTask(startTask); logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 0ea47edb..fb7bcf73 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -39,8 +39,8 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) CodeSystem.DsfPingProcesses.Code process = getProcess((String) this.process.getValue(delegateExecution)); Objects.requireNonNull(process); - String downloadResourceId = new IdType( - variables.getString(ExecutionVariables.DOWNLOAD_RESOURCE_REFERENCE.getValue())).getIdPart(); + String downloadResourceId = new IdType(variables.getString(ExecutionVariables.downloadResourceReference.name())) + .getIdPart(); if (downloadResourceId != null) { try diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index bd7f42d1..ca7a9056 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -54,7 +54,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) { resourceContent = new RandomByteInputStream(downloadResourceSizeBytes); } - variables.setLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), downloadResourceSizeBytes); + variables.setLong(ExecutionVariables.downloadResourceSizeBytes.name(), downloadResourceSizeBytes); logger.debug("Generated resource."); logger.debug("Storing binary resource for download..."); @@ -64,7 +64,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) String reference = downloadResource.toVersionless().getValueAsString(); - variables.setString(ExecutionVariables.DOWNLOAD_RESOURCE_REFERENCE.getValue(), reference); + variables.setString(ExecutionVariables.downloadResourceReference.name(), reference); logger.debug("Stored binary resource for download"); } @@ -75,14 +75,13 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) CodeSystem.DsfPingProcessSteps.Code.GENERATE_AND_STORE_RESOURCE, "Storing Binary resource on local DSF FHIR server.", ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, "Local DSF FHIR server responded with status: " + status); - variables.setVariable(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue(), - new ProcessErrorValueImpl(error)); + variables.setVariable(ExecutionVariables.resourceUploadError.name(), new ProcessErrorValueImpl(error)); } } private long getDownloadResourceSize(Variables variables) { - return variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); + return variables.getLong(ExecutionVariables.downloadResourceSizeBytes.name()); } private IdType storeBinary(RandomByteInputStream downloadResourceContent) diff --git a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java index 8dcce2b3..892507a6 100644 --- a/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java +++ b/src/main/java/dev/dsf/bpe/service/SetDownloadResourceSize.java @@ -33,7 +33,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Setting download resource size..."); long downloadResourceSizeBytes = getDownloadResourceSizeBytes(variables); - variables.setLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), downloadResourceSizeBytes); + variables.setLong(ExecutionVariables.downloadResourceSizeBytes.name(), downloadResourceSizeBytes); logger.debug("Set download resource size to " + downloadResourceSizeBytes); } diff --git a/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java b/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java index 79c44c4f..0effa8df 100644 --- a/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java +++ b/src/main/java/dev/dsf/bpe/service/autostart/SetTargetAndConfigureTimer.java @@ -25,9 +25,9 @@ public SetTargetAndConfigureTimer(ProcessPluginApi api) protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { String timerInterval = getTimerInterval(variables); - logger.debug("Setting variable '{}' to {}", ExecutionVariables.TIMER_INTERVAL.getValue(), timerInterval); + logger.debug("Setting variable '{}' to {}", ExecutionVariables.timerInterval.name(), timerInterval); - variables.setString(ExecutionVariables.TIMER_INTERVAL.getValue(), timerInterval); + variables.setString(ExecutionVariables.timerInterval.name(), timerInterval); variables.setTarget( variables.createTarget(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().get(), api.getEndpointProvider().getLocalEndpointIdentifierValue().get(), diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index 9769e916..05b2bf03 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -37,7 +37,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); String correlationKey = target.getCorrelationKey(); - String taskId = (String) delegateExecution.getVariableLocal(ExecutionVariables.PING_TASK_ID.getValue()); + String taskId = (String) delegateExecution.getVariableLocal(ExecutionVariables.pingTaskId.name()); Objects.requireNonNull(taskId); FhirWebserviceClient fhirWebserviceClient = api.getFhirWebserviceClientProvider() diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 4c9cd177..8c880ad1 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -39,14 +39,14 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable if (downloadResult.getError() == null) { - variables.setLong(ExecutionVariables.DOWNLOADED_BYTES.correlatedValue(correlationKey), + variables.setLong(ExecutionVariables.downloadedBytes.correlatedValue(correlationKey), downloadResult.getDownloadedBytes()); - variables.setVariable(ExecutionVariables.DOWNLOADED_DURATION.correlatedValue(correlationKey), + variables.setVariable(ExecutionVariables.downloadedDuration.correlatedValue(correlationKey), new DurationValueImpl(downloadResult.getDownloadedDuration())); } else { - delegateExecution.setVariableLocal(ExecutionVariables.RESOURCE_DOWNLOAD_ERROR.getValue(), + delegateExecution.setVariableLocal(ExecutionVariables.resourceDownloadError.name(), downloadResult.getError()); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index 47e82bee..a9b9b00f 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -28,7 +28,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Target target = variables.getTarget(); ProcessError error = (ProcessError) delegateExecution - .getVariableLocal(ExecutionVariables.RESOURCE_DOWNLOAD_ERROR.getValue()); + .getVariableLocal(ExecutionVariables.resourceDownloadError.name()); ErrorListUtils.add(error, delegateExecution, target.getCorrelationKey()); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 9fbcecf5..9796175a 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -28,10 +28,10 @@ public LogAndSaveSendError(ProcessPluginApi api) protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { String correlationKey = variables.getTarget().getCorrelationKey(); - ProcessError error = (ProcessError) execution.getVariableLocal(ExecutionVariables.ERROR.getValue()); + ProcessError error = (ProcessError) execution.getVariableLocal(ExecutionVariables.error.name()); ErrorListUtils.add(error, execution, correlationKey); - variables.setLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), 0L); - variables.setVariable(ExecutionVariables.UPLOADED_DURATION.correlatedValue(correlationKey), + variables.setLong(ExecutionVariables.uploadedBytes.correlatedValue(correlationKey), 0L); + variables.setVariable(ExecutionVariables.uploadedDuration.correlatedValue(correlationKey), new DurationValueImpl(Duration.ZERO)); logger.debug("Saved error when trying to send ping message. Error message: {}", error.message()); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java index aa929ad2..fde5cdef 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java @@ -23,7 +23,7 @@ public LogAndSaveUploadErrorPing(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - ProcessError error = (ProcessError) variables.getVariable(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue()); + ProcessError error = (ProcessError) variables.getVariable(ExecutionVariables.resourceUploadError.name()); logger.info("Error while storing binary resource for download: {}", error.message()); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index bfa6c593..b3399516 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -47,13 +47,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue(), org.hl7.fhir.r4.model.Duration.class); optDownloadedDuration.ifPresent( - duration -> variables.setVariable(ExecutionVariables.UPLOADED_DURATION.correlatedValue(correlationKey), + duration -> variables.setVariable(ExecutionVariables.uploadedDuration.correlatedValue(correlationKey), new DurationValueImpl(Duration.ofMillis(duration.getValue().longValue())))); Optional<DecimalType> optDownloadedBytes = api.getTaskHelper().getFirstInputParameterValue(pong, CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue(), DecimalType.class); optDownloadedBytes.ifPresent(decimalType -> variables.setLong( - ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey), decimalType.getValue().longValue())); + ExecutionVariables.uploadedBytes.correlatedValue(correlationKey), decimalType.getValue().longValue())); ProcessErrors errorList = new ProcessErrors(parseInputs(pong)); diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index af3a2b5b..1f633f7e 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -68,23 +68,22 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw ProcessErrors errors = ErrorListUtils.getErrorList(execution, correlationKey); CodeSystem.DsfPingStatus.Code statusCode = errors.isEmpty() ? CodeSystem.DsfPingStatus.Code.COMPLETED : CodeSystem.DsfPingStatus.Code.ERROR; - long downloadResourceSizeBytes = variables - .getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); + long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.downloadResourceSizeBytes.name()); if (downloadResourceSizeBytes >= 0) // if fat-ping { Long downloadedBytes = variables - .getLong(ExecutionVariables.DOWNLOADED_BYTES.correlatedValue(correlationKey)); + .getLong(ExecutionVariables.downloadedBytes.correlatedValue(correlationKey)); Duration downloadedDuration = (Duration) variables - .getVariable(ExecutionVariables.DOWNLOADED_DURATION.correlatedValue(correlationKey)); + .getVariable(ExecutionVariables.downloadedDuration.correlatedValue(correlationKey)); BigDecimal downloadSpeed = downloadedBytes != null && downloadedDuration != null ? networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration) : null; Long uploadedBytes = variables - .getLong(ExecutionVariables.UPLOADED_BYTES.correlatedValue(correlationKey)); + .getLong(ExecutionVariables.uploadedBytes.correlatedValue(correlationKey)); Duration uploadedDurationMillis = (Duration) variables - .getVariable(ExecutionVariables.UPLOADED_DURATION.correlatedValue(correlationKey)); + .getVariable(ExecutionVariables.uploadedDuration.correlatedValue(correlationKey)); BigDecimal uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null ? networkSpeedUnit.calculateSpeed(uploadedBytes, uploadedDurationMillis) diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index e5bf6cb0..9cc10d8c 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -35,14 +35,13 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable if (downloadResult.getError() == null) { - variables.setLong(ExecutionVariables.DOWNLOADED_BYTES.getValue(), downloadResult.getDownloadedBytes()); - variables.setVariable(ExecutionVariables.DOWNLOADED_DURATION.getValue(), + variables.setLong(ExecutionVariables.downloadedBytes.name(), downloadResult.getDownloadedBytes()); + variables.setVariable(ExecutionVariables.downloadedDuration.name(), new DurationValueImpl(downloadResult.getDownloadedDuration())); } else { - delegateExecution.setVariable(ExecutionVariables.RESOURCE_DOWNLOAD_ERROR.getValue(), - downloadResult.getError()); + delegateExecution.setVariable(ExecutionVariables.resourceDownloadError.name(), downloadResult.getError()); } logger.debug("Completed resource download and measured speed."); } diff --git a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java index 0e829eef..1f5cb891 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java +++ b/src/main/java/dev/dsf/bpe/service/pong/EstimateCleanupTimerDuration.java @@ -28,7 +28,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable logger.debug("Estimating cleanup timer duration..."); final long minTimerDurationMillis = 20000; Duration downloadedDuration = Optional - .ofNullable((Duration) variables.getVariable(ExecutionVariables.DOWNLOADED_DURATION.getValue())) + .ofNullable((Duration) variables.getVariable(ExecutionVariables.downloadedDuration.name())) .orElse(Duration.ZERO); long timerDurationMillis = downloadedDuration.toMillis() > Long.MAX_VALUE / 10 - minTimerDurationMillis ? Long.MAX_VALUE diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 2838046b..04b6f2b6 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -31,7 +31,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task startTask = variables.getStartTask(); ProcessError error = (ProcessError) delegateExecution - .getVariableLocal(ExecutionVariables.RESOURCE_DOWNLOAD_ERROR.getValue()); + .getVariableLocal(ExecutionVariables.resourceDownloadError.name()); ErrorListUtils.add(error, delegateExecution); PingStatusGenerator.updatePongStatusOutput(startTask, diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java index bb6c2e4d..af9e4749 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java @@ -24,7 +24,7 @@ public LogAndSaveUploadErrorPong(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - ProcessError error = (ProcessError) variables.getVariable(ExecutionVariables.RESOURCE_UPLOAD_ERROR.getValue()); + ProcessError error = (ProcessError) variables.getVariable(ExecutionVariables.resourceUploadError.name()); ErrorListUtils.add(error, execution); diff --git a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java index b5ff9efe..71a87488 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SelectPongTarget.java @@ -32,8 +32,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw String correlationKey = api.getTaskHelper() .getFirstInputParameterStringValue(task, BpmnMessage.URL, BpmnMessage.Codes.CORRELATION_KEY).get(); String targetOrganizationIdentifierValue = task.getRequester().getIdentifier().getValue(); - String targetEndpointIdentifierValue = variables - .getString(ExecutionVariables.PONG_TARGET_ENDPOINT_IDENTIFIER.getValue()); + String targetEndpointIdentifierValue = variables.getString(ExecutionVariables.targetEndpointIdentifier.name()); String targetEndpointAddress = api.getEndpointProvider().getEndpointAddress(targetEndpointIdentifierValue) .orElseThrow(() -> diff --git a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java index e9b3225e..89b0ef46 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SetEndpointIdentifier.java @@ -30,7 +30,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task task = variables.getStartTask(); String endpointIdentifierValue = getEndpointIdentifierValue(task); - variables.setString(ExecutionVariables.PONG_TARGET_ENDPOINT_IDENTIFIER.getValue(), endpointIdentifierValue); + variables.setString(ExecutionVariables.targetEndpointIdentifier.name(), endpointIdentifierValue); logger.debug("Set endpoint identifier to " + endpointIdentifierValue); } diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 1d0e0dac..0bf539e0 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -33,9 +33,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Task startTask = variables.getStartTask(); logger.debug("Storing download speed..."); - long downloadedBytes = variables.getLong(ExecutionVariables.DOWNLOADED_BYTES.getValue()); - Duration downloadedDuration = (Duration) variables - .getVariable(ExecutionVariables.DOWNLOADED_DURATION.getValue()); + long downloadedBytes = variables.getLong(ExecutionVariables.downloadedBytes.name()); + Duration downloadedDuration = (Duration) variables.getVariable(ExecutionVariables.downloadedDuration.name()); BigDecimal downloadSpeed = networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration); diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index 0bf6067a..ab5b7998 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -35,7 +35,7 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t { DownloadResult downloadResult; - long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); + long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.downloadResourceSizeBytes.name()); Optional<Reference> optDownloadResourceReference = api.getTaskHelper().getFirstInputParameterValue(task, CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_REFERENCE.getValue(), diff --git a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java index 926de7d9..a88b5d8d 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java @@ -39,11 +39,11 @@ public static void add(ProcessError error, DelegateExecution execution, String c { if (correlationKey != null) { - add(error, ExecutionVariables.ERROR_LIST.correlatedValue(correlationKey), execution); + add(error, ExecutionVariables.errors.correlatedValue(correlationKey), execution); } else { - add(error, ExecutionVariables.ERROR_LIST.getValue(), execution); + add(error, ExecutionVariables.errors.name(), execution); } } @@ -56,11 +56,11 @@ public static ProcessErrors getErrorList(DelegateExecution execution, String cor { if (correlationKey != null) { - return getErrorList(ExecutionVariables.ERROR_LIST.correlatedValue(correlationKey), execution); + return getErrorList(ExecutionVariables.errors.correlatedValue(correlationKey), execution); } else { - return getErrorList(ExecutionVariables.ERROR_LIST.getValue(), execution); + return getErrorList(ExecutionVariables.errors.name(), execution); } } @@ -86,11 +86,11 @@ private static void saveErrorList(ProcessErrors errors, DelegateExecution execut { if (correlationKey != null) { - saveErrorList(errors, ExecutionVariables.ERROR_LIST.correlatedValue(correlationKey), execution); + saveErrorList(errors, ExecutionVariables.errors.correlatedValue(correlationKey), execution); } else { - saveErrorList(errors, ExecutionVariables.ERROR_LIST.getValue(), execution); + saveErrorList(errors, ExecutionVariables.errors.name(), execution); } } From c62bfa16c966aa394340a120538202b658ab690c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Sun, 24 Aug 2025 21:49:30 +0200 Subject: [PATCH 354/382] Replaced network speed extension with FHIR Quantity datatype --- src/main/java/dev/dsf/bpe/CodeSystem.java | 50 +++++++ .../dsf/bpe/PingProcessPluginDefinition.java | 22 ++- .../output/generator/PingStatusGenerator.java | 129 +++++++++--------- .../fhir/CodeSystem/dsf-ping-units.xml | 59 -------- .../dsf-extension-network-speed.xml | 95 ------------- .../dsf-extension-ping-status.xml | 94 +++++++------ ...-units.xml => dsf-network-speed-units.xml} | 25 +++- .../bpe/PingProcessPluginDefinitionTest.java | 4 +- .../dsf/fhir/profiles/TaskProfileTest.java | 14 +- 9 files changed, 206 insertions(+), 286 deletions(-) delete mode 100644 src/main/resources/fhir/CodeSystem/dsf-ping-units.xml delete mode 100644 src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml rename src/main/resources/fhir/ValueSet/{dsf-ping-units.xml => dsf-network-speed-units.xml} (54%) diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index 7838922d..e4566b95 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -230,6 +230,12 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); return bits.divide(seconds, 2, RoundingMode.HALF_UP); } + + @Override + public String toUcum() + { + return "bit/s"; + } }, kbps { @@ -246,6 +252,12 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); } + + @Override + public String toUcum() + { + return "Kbit/s"; + } }, Mbps { @@ -262,6 +274,12 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); } + + @Override + public String toUcum() + { + return "Mbit/s"; + } }, Gbps { @@ -278,6 +296,12 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); } + + @Override + public String toUcum() + { + return "Gbit/s"; + } }, Bps { @@ -293,6 +317,12 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); } + + @Override + public String toUcum() + { + return "By/s"; + } }, kBps { @@ -309,6 +339,12 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); } + + @Override + public String toUcum() + { + return "KBy/s"; + } }, MBps { @@ -325,6 +361,12 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); } + + @Override + public String toUcum() + { + return "MBy/s"; + } }, GBps { @@ -341,9 +383,17 @@ public BigDecimal calculateSpeed(long bytes, Duration duration) .divide(BigDecimal.valueOf(1000).setScale(3, RoundingMode.HALF_UP), RoundingMode.HALF_UP); return kiloBits.divide(seconds, 2, RoundingMode.HALF_UP); } + + @Override + public String toUcum() + { + return "GBy/s"; + } }; public abstract BigDecimal calculateSpeed(long bytes, Duration duration); + + public abstract String toUcum(); } } } diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index 38f71510..8b38267c 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -52,7 +52,6 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var cPing = "fhir/CodeSystem/dsf-ping.xml"; var cPingStatus = "fhir/CodeSystem/dsf-ping-status.xml"; - var cPingUnits = "fhir/CodeSystem/dsf-ping-units.xml"; var cPingProcesses = "fhir/CodeSystem/dsf-ping-processes.xml"; var cPingProcessSteps = "fhir/CodeSystem/dsf-ping-process-steps.xml"; @@ -63,7 +62,6 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var sStartPingAutostart = "fhir/StructureDefinition/dsf-task-start-ping-autostart.xml"; var sStopPingAutostart = "fhir/StructureDefinition/dsf-task-stop-ping-autostart.xml"; var sCleanupPong = "fhir/StructureDefinition/dsf-task-cleanup-pong.xml"; - var sNetworkSpeedExtension = "fhir/StructureDefinition/dsf-extension-network-speed.xml"; var sErrorExtension = "fhir/StructureDefinition/dsf-extension-error.xml"; var tStartPing = "fhir/Task/dsf-task-start-ping.xml"; @@ -71,21 +69,21 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var tStopPingAutoStart = "fhir/Task/dsf-task-stop-ping-autostart.xml"; var vPing = "fhir/ValueSet/dsf-ping.xml"; - var vPingUnits = "fhir/ValueSet/dsf-ping-units.xml"; + var vPingUnits = "fhir/ValueSet/dsf-network-speed-units.xml"; var vPingStatus = "fhir/ValueSet/dsf-ping-status.xml"; var vPongStatus = "fhir/ValueSet/dsf-pong-status.xml"; var vPingProcesses = "fhir/ValueSet/dsf-ping-processes.xml"; var vPingProcessSteps = "fhir/ValueSet/dsf-ping-process-steps.xml"; - return Map.of(ConstantsPing.PROCESS_NAME_FULL_PING, - Arrays.asList(aPing, cPing, cPingStatus, cPingUnits, cPingProcesses, cPingProcessSteps, sErrorExtension, - sPingStatus, sStartPing, sPong, sCleanupPong, sNetworkSpeedExtension, tStartPing, vPing, - vPingStatus, vPingUnits, vPingProcesses, vPingProcessSteps), - ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, Arrays.asList(aPingAutostart, cPing, - sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, tStopPingAutoStart, vPing), + return Map.of( + ConstantsPing.PROCESS_NAME_FULL_PING, Arrays.asList(aPing, cPing, cPingStatus, cPingProcesses, + cPingProcessSteps, sErrorExtension, sPingStatus, sStartPing, sPong, sCleanupPong, tStartPing, + vPing, vPingStatus, vPingUnits, vPingProcesses, vPingProcessSteps), + ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, + Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, + tStopPingAutoStart, vPing), ConstantsPing.PROCESS_NAME_FULL_PONG, - Arrays.asList(aPong, cPing, cPingStatus, cPingUnits, cPingProcesses, cPingProcessSteps, sErrorExtension, - sPingStatus, sPing, sNetworkSpeedExtension, vPing, vPongStatus, vPingUnits, vPingProcesses, - vPingProcessSteps)); + Arrays.asList(aPong, cPing, cPingStatus, cPingProcesses, cPingProcessSteps, sErrorExtension, + sPingStatus, sPing, vPing, vPongStatus, vPingUnits, vPingProcesses, vPingProcessSteps)); } } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index e35d5695..da8de4bd 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -8,8 +8,8 @@ import java.util.stream.Stream; import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Quantity; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.TaskOutputComponent; @@ -24,6 +24,8 @@ public final class PingStatusGenerator { + private static final String CODESYSTEM_UCUM = "http://unitsofmeasure.org"; + private PingStatusGenerator() { } @@ -174,11 +176,13 @@ private static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputCom { if (hasDownloadSpeedSet(outputComponent)) { - updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.name()); + updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.name(), CODESYSTEM_UCUM, + networkSpeedUnit.toUcum()); } else { - addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.name()); + addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.name(), CODESYSTEM_UCUM, + networkSpeedUnit.toUcum()); } return outputComponent; @@ -213,11 +217,13 @@ private static TaskOutputComponent updateStatusOutputUploadSpeed(TaskOutputCompo { if (hasDownloadSpeedSet(outputComponent)) { - updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.name()); + updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.name(), CODESYSTEM_UCUM, + networkSpeedUnit.toUcum()); } else { - addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.name()); + addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.name(), CODESYSTEM_UCUM, + networkSpeedUnit.toUcum()); } return outputComponent; @@ -256,7 +262,7 @@ public static TaskOutputComponent createPingStatusOutput(Target target, CodeSyst List<ProcessError> errors) { return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS.getValue(), statusCode.getValue(), errors, - null, null, null); + null, null, null, null, null); } public static TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, @@ -264,24 +270,25 @@ public static TaskOutputComponent createPingStatusOutput(Target target, CodeSyst CodeSystem.DsfPingUnits.Code unit) { return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS.getValue(), statusCode.getValue(), errors, - downloadSpeed, uploadSpeed, unit.name()); + downloadSpeed, uploadSpeed, unit.name(), CODESYSTEM_UCUM, unit.toUcum()); } public static TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors) { return createStatusOutput(target, CodeSystem.DsfPing.Code.PONG_STATUS.getValue(), statusCode.getValue(), errors, - null, null, null); + null, null, null, null, null); } private static TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, - List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit) + List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit, String unitSystem, + String unitCode) { TaskOutputComponent output = new TaskOutputComponent(); addStatus(output, outputParameter, statusCode); addTarget(output, target); addErrors(output, errors); - addNetworkSpeed(output, downloadSpeed, uploadSpeed, unit); + addNetworkSpeed(output, downloadSpeed, uploadSpeed, unit, unitSystem, unitCode); return output; } @@ -433,28 +440,28 @@ private static TaskOutputComponent updateErrors(TaskOutputComponent outputCompon } private static TaskOutputComponent addNetworkSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, - BigDecimal uploadSpeed, String unit) + BigDecimal uploadSpeed, String unit, String unitSystem, String unitCode) { - addDownloadSpeed(outputComponent, downloadSpeed, unit); - addUploadSpeed(outputComponent, uploadSpeed, unit); + addDownloadSpeed(outputComponent, downloadSpeed, unit, unitSystem, unitCode); + addUploadSpeed(outputComponent, uploadSpeed, unit, unitSystem, unitCode); return outputComponent; } private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, - String unit) + String unit, String unitSystem, String unitCode) { - if (downloadSpeed != null && unit != null) + if (downloadSpeed != null && unit != null && unitSystem != null && unitCode != null) { Extension extension = getOrCreatePingStatusExtension(outputComponent); Extension downloadSpeedExtension = extension.addExtension() .setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); - Extension networkSpeed = downloadSpeedExtension.addExtension() - .setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) - .setValue(new DecimalType(downloadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(CodeSystem.DsfPingUnits.URL, unit, null)); + Quantity quantity = new Quantity(); + quantity.setValue(downloadSpeed); + quantity.setUnit(unit); + quantity.setSystem(unitSystem); + quantity.setCode(unitCode); + downloadSpeedExtension.setValue(quantity); } sortStatusOutputExtensions(outputComponent); @@ -462,35 +469,30 @@ private static TaskOutputComponent addDownloadSpeed(TaskOutputComponent outputCo } private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outputComponent, - BigDecimal downloadSpeed, String unit) + BigDecimal downloadSpeed, String unit, String unitSystem, String unitCode) { - if (downloadSpeed != null && unit != null) + if (downloadSpeed != null && unit != null && unitSystem != null && unitCode != null) { Extension extension = getOrCreatePingStatusExtension(outputComponent); Extension downloadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); if (downloadSpeedExtension != null) { - Extension networkSpeedExtension = downloadSpeedExtension - .getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); - if (networkSpeedExtension != null) - { - networkSpeedExtension.setExtension(new ArrayList<>()); - List<Extension> extensions = networkSpeedExtension.getExtension(); - extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, - new DecimalType(downloadSpeed))); - extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, - new Coding(CodeSystem.DsfPingUnits.URL, unit, null))); - } + Quantity quantity = new Quantity(); + quantity.setValue(downloadSpeed); + quantity.setUnit(unit); + quantity.setSystem(unitSystem); + quantity.setCode(unitCode); + downloadSpeedExtension.setValue(quantity); } else { downloadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_DOWNLOAD_SPEED); - Extension networkSpeed = downloadSpeedExtension.addExtension() - .setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) - .setValue(new DecimalType(downloadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(CodeSystem.DsfPingUnits.URL, unit, null)); + Quantity quantity = new Quantity(); + quantity.setValue(downloadSpeed); + quantity.setUnit(unit); + quantity.setSystem(unitSystem); + quantity.setCode(unitCode); + downloadSpeedExtension.setValue(quantity); } } sortStatusOutputExtensions(outputComponent); @@ -499,18 +501,18 @@ private static TaskOutputComponent updateDownloadSpeed(TaskOutputComponent outpu } private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, - String unit) + String unit, String unitSystem, String unitCode) { - if (uploadSpeed != null && unit != null) + if (uploadSpeed != null && unit != null && unitSystem != null && unitCode != null) { Extension extension = getOrCreatePingStatusExtension(outputComponent); Extension uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); - Extension networkSpeed = uploadSpeedExtension.addExtension() - .setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) - .setValue(new DecimalType(uploadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(CodeSystem.DsfPingUnits.URL, unit, null)); + Quantity quantity = new Quantity(); + quantity.setValue(uploadSpeed); + quantity.setUnit(unit); + quantity.setSystem(unitSystem); + quantity.setCode(unitCode); + uploadSpeedExtension.setValue(quantity); } sortStatusOutputExtensions(outputComponent); @@ -518,35 +520,32 @@ private static TaskOutputComponent addUploadSpeed(TaskOutputComponent outputComp } private static TaskOutputComponent updateUploadSpeed(TaskOutputComponent outputComponent, BigDecimal uploadSpeed, - String unit) + String unit, String unitSystem, String unitCode) { - if (uploadSpeed != null && unit != null) + if (uploadSpeed != null && unit != null && unitSystem != null && unitCode != null) { Extension extension = getOrCreatePingStatusExtension(outputComponent); Extension uploadSpeedExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); if (uploadSpeedExtension != null) { - Extension networkSpeedExtension = uploadSpeedExtension - .getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); - if (networkSpeedExtension != null) + Quantity quantity = (Quantity) uploadSpeedExtension.getValue(); + if (quantity != null) { - networkSpeedExtension.setExtension(new ArrayList<>()); - List<Extension> extensions = networkSpeedExtension.getExtension(); - extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE, - new DecimalType(uploadSpeed))); - extensions.add(new Extension(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT, - new Coding(CodeSystem.DsfPingUnits.URL, unit, null))); + quantity.setValue(uploadSpeed); + quantity.setUnit(unit); + quantity.setSystem(unitSystem); + quantity.setCode(unitCode); } } else { uploadSpeedExtension = extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_UPLOAD_SPEED); - Extension networkSpeed = uploadSpeedExtension.addExtension() - .setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_VALUE) - .setValue(new DecimalType(uploadSpeed)); - networkSpeed.addExtension().setUrl(ConstantsPing.EXTENSION_URL_NETWORK_SPEED_UNIT) - .setValue(new Coding(CodeSystem.DsfPingUnits.URL, unit, null)); + Quantity quantity = new Quantity(); + quantity.setValue(uploadSpeed); + quantity.setUnit(unit); + quantity.setSystem(unitSystem); + quantity.setCode(unitCode); + uploadSpeedExtension.setValue(quantity); } } sortStatusOutputExtensions(outputComponent); diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml deleted file mode 100644 index d615641a..00000000 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-units.xml +++ /dev/null @@ -1,59 +0,0 @@ -<CodeSystem xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> - <code value="ALL" /> - </tag> - </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-units-v2" /> - <!-- version managed by bpe --> - <version value="#{version}" /> - <name value="DSF_Ping_Units" /> - <title value="DSF Ping Units" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <!-- date managed by bpe --> - <date value="#{date}" /> - <publisher value="DSF" /> - <description value="CodeSystem with ping/pong download speed units" /> - <caseSensitive value="true" /> - <hierarchyMeaning value="grouped-by" /> - <versionNeeded value="false" /> - <content value="complete" /> - <concept> - <code value="bps"/> - <display value="bps"/> - <definition value="Download speed unit in bits per second" /> - </concept> - <concept> - <code value="kbps"/> - <display value="kbps"/> - <definition value="Download speed unit in kilobits per second" /> - </concept> - <concept> - <code value="Mbps"/> - <display value="Mbps"/> - <definition value="Download speed unit in megabits per second" /> - </concept> - <concept> - <code value="Gbps"/> - <display value="Gbps"/> - <definition value="Download speed unit in gigabits per second" /> - </concept> - <concept> - <code value="Bps"/> - <display value="Bps"/> - <definition value="Download speed unit in bytes per second" /> - </concept> - <concept> - <code value="kBps"/> - <display value="kBps"/> - <definition value="Download speed unit in kilobytes per second" /> - </concept> - <concept> - <code value="MBps"/> - <display value="MBps"/> - <definition value="Download speed unit in megabytes per second" /> - </concept> -</CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml deleted file mode 100644 index c82ca295..00000000 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-network-speed.xml +++ /dev/null @@ -1,95 +0,0 @@ -<StructureDefinition xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag"/> - <code value="ALL"/> - </tag> - </meta> - <url value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed"/> - <!-- version managed by bpe --> - <version value="#{version}" /> - <name value="NetworkSpeed"/> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <!-- date managed by bpe --> - <date value="#{date}" /> - <fhirVersion value="4.0.1"/> - <kind value="complex-type"/> - <abstract value="false"/> - <context> - <type value="element"/> - <expression value="Extension.extension"/> - </context> - <type value="Extension"/> - <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> - <derivation value="constraint"/> - <differential> - <element id="Extension.extension"> - <path value="Extension.extension"/> - <slicing> - <discriminator> - <type value="value"/> - <path value="url"/> - </discriminator> - <rules value="open"/> - </slicing> - <min value="2"/> - <max value="2"/> - </element> - <element id="Extension.extension:network-speed"> - <path value="Extension.extension"/> - <sliceName value="network-speed"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:network-speed.url"> - <path value="Extension.extension.url"/> - <fixedUri value="network-speed"/> - </element> - <element id="Extension.extension:network-speed.value[x]"> - <path value="Extension.extension.value[x]"/> - <type> - <code value="decimal"/> - </type> - </element> - <element id="Extension.extension:unit"> - <path value="Extension.extension"/> - <sliceName value="unit"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:unit.url"> - <path value="Extension.extension.url"/> - <fixedUri value="unit"/> - </element> - <element id="Extension.extension:unit.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <type> - <code value="Coding"/> - </type> - </element> - <element id="Extension.extension:unit.value[x].system"> - <path value="Extension.extension.value[x].system"/> - <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-units-v2"/> - </element> - <element id="Extension.extension:unit.value[x].code"> - <path value="Extension.extension.value[x].code"/> - <min value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-units-v2"/> - </binding> - </element> - <element id="Extension.url"> - <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed"/> - </element> - <element id="Extension.value[x]"> - <path value="Extension.value[x]"/> - <max value="0"/> - </element> - </differential> -</StructureDefinition> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index aff75036..377cd1aa 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -111,61 +111,43 @@ <min value="0"/> <max value="1"/> </element> - <element id="Extension.extension:download-speed.extension"> - <path value="Extension.extension.extension" /> - <slicing> - <discriminator> - <type value="value" /> - <path value="url" /> - </discriminator> - <rules value="open" /> - </slicing> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:download-speed.extension:network-speed-extension"> - <path value="Extension.extension.extension" /> - <sliceName value="network-speed-extension" /> - <min value="1" /> - <type> - <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed|#{version}" /> - </type> - </element> <element id="Extension.extension:download-speed.url"> <path value="Extension.extension.url"/> <fixedUri value="download-speed"/> </element> <element id="Extension.extension:download-speed.value[x]"> <path value="Extension.extension.value[x]"/> - <max value="0"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="Quantity"/> + </type> </element> - <element id="Extension.extension:upload-speed"> - <path value="Extension.extension"/> - <sliceName value="upload-speed"/> - <min value="0"/> + <element id="Extension.extension:download-speed.value[x].value"> + <path value="Extension.extension.value[x].value"/> + <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:upload-speed.extension"> - <path value="Extension.extension.extension" /> - <slicing> - <discriminator> - <type value="value" /> - <path value="url" /> - </discriminator> - <rules value="open" /> - </slicing> + <element id="Extension.extension:download-speed.value[x].unit"> + <path value="Extension.extension.value[x].unit"/> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:upload-speed.extension:network-speed-extension"> - <path value="Extension.extension.extension" /> - <sliceName value="network-speed-extension" /> - <min value="1" /> - <type> - <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/extension-network-speed|#{version}" /> - </type> + <element id="Extension.extension:download-speed.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:download-speed.value[x].code"> + <path value="Extension.extension.value[x].code"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:upload-speed"> + <path value="Extension.extension"/> + <sliceName value="upload-speed"/> + <min value="0"/> + <max value="1"/> </element> <element id="Extension.extension:upload-speed.url"> <path value="Extension.extension.url"/> @@ -173,7 +155,31 @@ </element> <element id="Extension.extension:upload-speed.value[x]"> <path value="Extension.extension.value[x]"/> - <max value="0"/> + <min value="1"/> + <max value="1"/> + <type> + <code value="Quantity"/> + </type> + </element> + <element id="Extension.extension:upload-speed.value[x].value"> + <path value="Extension.extension.value[x].value"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:upload-speed.value[x].unit"> + <path value="Extension.extension.value[x].unit"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:upload-speed.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:upload-speed.value[x].code"> + <path value="Extension.extension.value[x].code"/> + <min value="1"/> + <max value="1"/> </element> <element id="Extension.extension:error"> <path value="Extension.extension"/> diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml b/src/main/resources/fhir/ValueSet/dsf-network-speed-units.xml similarity index 54% rename from src/main/resources/fhir/ValueSet/dsf-ping-units.xml rename to src/main/resources/fhir/ValueSet/dsf-network-speed-units.xml index fa619072..cbf115de 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping-units.xml +++ b/src/main/resources/fhir/ValueSet/dsf-network-speed-units.xml @@ -21,8 +21,29 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-units-v2" /> - <version value="#{version}" /> + <system value="http://unitsofmeasure.org" /> + <version value="3.0.1"/> + <concept> + <code value="bit/s"/> + </concept> + <concept> + <code value="Kbit/s"/> + </concept> + <concept> + <code value="Mbit/s"/> + </concept> + <concept> + <code value="GBit/s"/> + </concept> + <concept> + <code value="By/s"/> + </concept> + <concept> + <code value="KBy/s"/> + </concept> + <concept> + <code value="MBy/s"/> + </concept> </include> </compose> </ValueSet> \ No newline at end of file diff --git a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java index fc964b10..8148ddd9 100644 --- a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java +++ b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java @@ -20,7 +20,7 @@ public void testResourceLoading() throws Exception var ping = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING); assertNotNull(ping); - assertEquals(18, ping.stream().filter(this::exists).count()); + assertEquals(16, ping.stream().filter(this::exists).count()); var pingAutostart = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART); assertNotNull(pingAutostart); @@ -28,7 +28,7 @@ public void testResourceLoading() throws Exception var pong = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PONG); assertNotNull(pong); - assertEquals(15, pong.stream().filter(this::exists).count()); + assertEquals(13, pong.stream().filter(this::exists).count()); } private boolean exists(String file) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 4347ede8..489e6973 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -59,16 +59,16 @@ public class TaskProfileTest @ClassRule public static final ValidationSupportRule validationRule = new ValidationSupportRule(def.getResourceVersion(), def.getResourceReleaseDate(), - Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-error.xml", "dsf-extension-network-speed.xml", - "dsf-extension-ping-status.xml", "dsf-extension-ping-status-1_0.xml", "dsf-task-ping.xml", - "dsf-task-pong.xml", "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", - "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), + Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-error.xml", "dsf-extension-ping-status.xml", + "dsf-extension-ping-status-1_0.xml", "dsf-task-ping.xml", "dsf-task-pong.xml", + "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", + "dsf-task-cleanup-pong.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", - "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-ping-units.xml", - "dsf-ping-process-steps.xml", "dsf-ping-processes.xml"), + "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-ping-process-steps.xml", + "dsf-ping-processes.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-pong-status-1_0.xml", - "dsf-pong-status.xml", "dsf-ping-units.xml", "dsf-ping-process-steps.xml", + "dsf-pong-status.xml", "dsf-network-speed-units.xml", "dsf-ping-process-steps.xml", "dsf-ping-processes.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), From b779b097b359f097c5fbda04f24e99fea3062b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 27 Aug 2025 13:48:01 +0200 Subject: [PATCH 355/382] Made extension backwards compatible by reintroducing the error-message element making it so the new extension only adds to the previous version --- .../dsf-extension-ping-status.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 377cd1aa..3159fd78 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -105,6 +105,23 @@ <path value="Extension.extension.value[x].value"/> <min value="1"/> </element> + <element id="Extension.extension:error-message"> + <path value="Extension.extension"/> + <sliceName value="error-message"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Extension.extension:error-message.url"> + <path value="Extension.extension.url"/> + <fixedUri value="error-message"/> + </element> + <element id="Extension.extension:error-message.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <type> + <code value="string"/> + </type> + </element> <element id="Extension.extension:download-speed"> <path value="Extension.extension"/> <sliceName value="download-speed"/> From 38bc906df516d6af7e971f4e8302946b7f75735d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 29 Aug 2025 18:58:27 +0200 Subject: [PATCH 356/382] Replaced process, process step and action in errors with a unique coding for every type of error. Also removed exception messages from errors to prevent leaking any potentially critical information --- src/main/java/dev/dsf/bpe/CodeSystem.java | 438 ++++++++++++++---- .../java/dev/dsf/bpe/ExecutionVariables.java | 5 + .../dsf/bpe/PingProcessPluginDefinition.java | 17 +- src/main/java/dev/dsf/bpe/ProcessError.java | 48 +- .../bpe/mail/AggregateErrorMailService.java | 12 +- .../dsf/bpe/message/CleanupPongMessage.java | 6 +- .../dev/dsf/bpe/message/SendPingMessage.java | 6 +- .../dev/dsf/bpe/message/SendPongMessage.java | 12 +- .../java/dev/dsf/bpe/service/Cleanup.java | 41 +- .../bpe/service/GenerateAndStoreResource.java | 82 +++- .../bpe/service/ping/CheckPingTaskStatus.java | 57 ++- ...adResourceAndMeasureSpeedInSubProcess.java | 8 +- .../dsf/bpe/service/ping/LogAndSaveError.java | 3 +- .../bpe/service/ping/LogAndSaveSendError.java | 2 +- .../ping/LogAndSaveUploadErrorPing.java | 5 +- .../dev/dsf/bpe/service/ping/SavePong.java | 5 +- .../pong/DownloadResourceAndMeasureSpeed.java | 11 +- .../service/pong/LogAndSaveAndStoreError.java | 11 +- .../pong/LogAndSaveUploadErrorPong.java | 7 +- .../bpe/service/pong/SaveTimeoutError.java | 11 +- .../bpe/util/BinaryResourceDownloader.java | 115 +++-- .../java/dev/dsf/bpe/util/ErrorListUtils.java | 67 +++ .../bpe/util/task/SendTaskErrorConverter.java | 329 +++++++++++-- .../fhir/CodeSystem/dsf-ping-error.xml | 324 +++++++++++++ .../CodeSystem/dsf-ping-process-steps.xml | 139 ------ .../fhir/CodeSystem/dsf-ping-processes.xml | 34 -- .../dsf-extension-error.xml | 92 +--- .../fhir/ValueSet/dsf-ping-process-steps.xml | 27 -- .../fhir/ValueSet/dsf-ping-processes.xml | 27 -- .../bpe/PingProcessPluginDefinitionTest.java | 4 +- .../dsf/fhir/profiles/TaskProfileTest.java | 10 +- .../dev/dsf/library/ProcessErrorTest.java | 102 +--- 32 files changed, 1355 insertions(+), 702 deletions(-) create mode 100644 src/main/resources/fhir/CodeSystem/dsf-ping-error.xml delete mode 100644 src/main/resources/fhir/CodeSystem/dsf-ping-process-steps.xml delete mode 100644 src/main/resources/fhir/CodeSystem/dsf-ping-processes.xml delete mode 100644 src/main/resources/fhir/ValueSet/dsf-ping-process-steps.xml delete mode 100644 src/main/resources/fhir/ValueSet/dsf-ping-processes.xml diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index e4566b95..9d1b1678 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -3,6 +3,8 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.time.Duration; +import java.util.HashMap; +import java.util.Map; public final class CodeSystem { @@ -111,94 +113,6 @@ public String getValue() return value; } - public static Code ofValue(String value) - { - return new SingleStringValueEnumParser<>(Code.class).ofValue(value); - } - } - - } - - public static final class DsfPingProcesses - { - public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-processes-v2"; - - private DsfPingProcesses() - { - } - - public enum Code implements SingleStringValueEnum - { - PING("ping"), - PONG("pong"); - - private final String value; - - Code(String value) - { - this.value = value; - } - - public String getValue() - { - return value; - } - - public static Code ofValue(String value) - { - return new SingleStringValueEnumParser<>(Code.class).ofValue(value); - } - } - } - - public static final class DsfPingProcessSteps - { - public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2"; - - private DsfPingProcessSteps() - { - } - - public enum Code implements SingleStringValueEnum - { - SET_DOWNLOAD_RESOURCE_SIZE("set-download-resource-size"), - GENERATE_AND_STORE_RESOURCE("generate-and-store-resource"), - LOG_AND_SAVE_ERROR("log-and-save-error"), - SELECT_TARGETS("select-targets"), - PING("ping"), - LOG_AND_SAVE_SEND_ERROR("log-and-save-send-error"), - LOG_AND_SAVE_NO_RESPONSE("log-and-save-no-response"), - SAVE_PONG("save-pong"), - DOWNLOAD_RESOURCE_AND_MEASURE_SPEED("download-resource-and-measure-speed"), - CLEANUP_PONG("cleanup-pong"), - CLEANUP("cleanup"), - STORE_RESULTS("store-results"), - LOG_PING("log-ping"), - SET_ENDPOINT_IDENTIFIER("set-endpoint-identifier"), - SELECT_PONG_TARGET("select-pong-target"), - STORE_DOWNLOAD_SPEED("store-download-speed"), - LOG_AND_SAVE_AND_STORE_ERROR("log-and-save-and-store-error"), - ESTIMATE_CLEANUP_TIMER_DURATION("estimate-cleanup-timer-duration"), - PONG("pong"), - STORE_UPLOAD_SPEED("store-upload-speed"), - SAVE_TIMEOUT_ERROR("save-timeout-error"), - STORE_ERRORS("store-errors"), - CLEANUP_TIMER_CATCH_EVENT("cleanup-timer-catch-event"), - PONG_MESSAGE_TIMEOUT_TIMER_CATCH_EVENT("pong-timer-catch-event"), - CHECK_PING_TASK_STATUS("check-ping-task-status"); - - private final String value; - - Code(String value) - { - this.value = value; - } - - public String getValue() - { - return value; - } - public static Code ofValue(String value) { return new SingleStringValueEnumParser<>(Code.class).ofValue(value); @@ -206,6 +120,7 @@ public static Code ofValue(String value) } } + // TODO: rename to DsfNetworkSpeedUnits public static final class DsfPingUnits { public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-units-v2"; @@ -396,4 +311,351 @@ public String toUcum() public abstract String toUcum(); } } + + public final class DsfPingError + { + public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-error-v2"; + + private DsfPingError() + { + } + + public enum Concept + { + SEND_MESSAGE_HTTP_401( + "send-message-http-401", + "Sending a message to the remote instance resulted in HTTP status 401." + ), + SEND_MESSAGE_HTTP_403( + "send-message-http-403", + "Sending a message to the remote instance resulted in HTTP status 403." + ), + SEND_REFERENCE_MESSAGE_HTTP_403( + "send-reference-message-http-403", + "Sending a message including a reference to the remote instance resulted in HTTP status 403." + ), + SEND_MESSAGE_HTTP_500( + "send-message-http-500", + "Sending a message to the remote instance resulted in HTTP status 500." + ), + SEND_MESSAGE_HTTP_502( + "send-message-http-502", + "Sending a message to the remote instance resulted in HTTP status 502." + ), + SEND_MESSAGE_HTTP_UNEXPECTED( + "send-message-http-unexpected", + "Sending a message to the remote instance resulted in an unexpected HTTP status code." + ), + SEND_MESSAGE_SSL_HANDSHAKE( + "send-message-ssl-handshake", + "Sending a message to the remote instance was unsuccessful because of a failed SSL handshake." + ), + SEND_MESSAGE_CONNECT_TIMEOUT( + "send-message-connect-timeout", + "Sending a message to the remote instance was unsuccessful because of a connection timeout." + ), + SEND_MESSAGE_HTTP_HOST_CONNECT( + "send-message-http-host-connect", + "Sending a message to the remote instance was unsuccessful because the connection was refused." + ), + SEND_MESSAGE_UNKNOWN_HOST( + "send-message-unknown-host", + "Sending a message to the remote instance was unsuccessful because the target hostname could not be resolved" + ), + + RECEIVE_MESSAGE_HTTP_401( + "receive-message-http-401", + "Received a message and responded with HTTP status 401." + ), + RECEIVE_MESSAGE_HTTP_403( + "receive-message-http-403", + "Received a message and responded with HTTP status 403." + ), + RECEIVE_REFERENCE_MESSAGE_HTTP_403( + "receive-reference-message-http-403", + "Received a message including a reference and responded with HTTP status 403." + ), + RECEIVE_MESSAGE_HTTP_500( + "receive-message-http-500", + "Received a message and responded with HTTP status 500." + ), + RECEIVE_MESSAGE_HTTP_502( + "receive-message-http-502", + "Received a message and responded with HTTP status 502." + ), + RECEIVE_MESSAGE_HTTP_UNEXPECTED( + "receive-message-http-unexpected", + "Received a message and responded with an unexpected HTTP status code." + ), + RECEIVE_MESSAGE_SSL_HANDSHAKE( + "receive-message-ssl-handshake", + "Receiving a message was unsuccessful because of a failed SSL handshake." + ), + RECEIVE_MESSAGE_CONNECT_TIMEOUT( + "receive-message-connect-timeout", + "Receiving a message was unsuccessful because of a connection timeout." + ), + RECEIVE_MESSAGE_HTTP_HOST_CONNECT( + "receive-message-http-host-connect", + "Receiving a message was unsuccessful because the connection was refused." + ), + RECEIVE_MESSAGE_UNKNOWN_HOST( + "receive-message-unknown-host", + "Receiving a message was unsuccessful because the target hostname could not be resolved" + ), + + LOCAL_BINARY_DELETE_TIMEOUT( + "local-binary-delete-timeout", + "Local instance ran into a read/connect timeout trying to clean up the binary resource." + ), + LOCAL_BINARY_DELETE_HTTP_401( + "local-binary-delete-http-401", + "Local instance ran into a HTTP status 401 trying to clean up the binary resource." + ), + LOCAL_BINARY_DELETE_HTTP_403( + "local-binary-delete-http-403", + "Local instance ran into a HTTP status 403 trying to clean up the binary resource." + ), + LOCAL_BINARY_DELETE_HTTP_500( + "local-binary-delete-http-500", + "Local instance ran into a HTTP status 500 trying to clean up the binary resource." + ), + LOCAL_BINARY_DELETE_HTTP_502( + "local-binary-delete-http-502", + "Local instance ran into a HTTP status 502 trying to clean up the binary resource." + ), + LOCAL_BINARY_DELETE_HTTP_UNEXPECTED( + "local-binary-delete-http-unexpected", + "Local instance ran into an unexpected HTTP status code trying to clean up the binary resource." + ), + + REMOTE_BINARY_DELETE_TIMEOUT( + "remote-binary-delete-timeout", + "Remote instance ran into a read/connect timeout trying to clean up the binary resource." + ), + REMOTE_BINARY_DELETE_HTTP_401( + "remote-binary-delete-http-401", + "Remote instance ran into a HTTP status 401 trying to clean up the binary resource." + ), + REMOTE_BINARY_DELETE_HTTP_403( + "remote-binary-delete-http-403", + "Remote instance ran into a HTTP status 403 trying to clean up the binary resource." + ), + REMOTE_BINARY_DELETE_HTTP_500( + "remote-binary-delete-http-500", + "Remote instance ran into a HTTP status 500 trying to clean up the binary resource." + ), + REMOTE_BINARY_DELETE_HTTP_502( + "remote-binary-delete-http-502", + "Remote instance ran into a HTTP status 502 trying to clean up the binary resource." + ), + REMOTE_BINARY_DELETE_HTTP_UNEXPECTED( + "remote-binary-delete-http-unexpected", + "Remote instance ran into an unexpected HTTP status code trying to clean up the binary resource." + ), + + LOCAL_BINARY_POST_HTTP_401( + "local-binary-post-http-401", + "Local instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server." + ), + LOCAL_BINARY_POST_HTTP_403( + "local-binary-post-http-403", + "Local instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server." + ), + LOCAL_BINARY_POST_HTTP_500( + "local-binary-post-http-500", + "Local instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server." + ), + LOCAL_BINARY_POST_HTTP_502( + "local-binary-post-http-502", + "Local instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server." + ), + LOCAL_BINARY_POST_HTTP_UNEXPECTED( + "local-binary-post-http-unexpected", + "Local instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server." + ), + LOCAL_BINARY_POST_TIMEOUT( + "local-binary-post-timeout", + "Local instance ran into a timeout trying to post the binary resource to its own FHIR server." + ), + + REMOTE_BINARY_POST_HTTP_401( + "remote-binary-post-http-401", + "Remote instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server." + ), + REMOTE_BINARY_POST_HTTP_403( + "remote-binary-post-http-403", + "Remote instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server." + ), + REMOTE_BINARY_POST_HTTP_500( + "remote-binary-post-http-500", + "Remote instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server." + ), + REMOTE_BINARY_POST_HTTP_502( + "remote-binary-post-http-502", + "Remote instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server." + ), + REMOTE_BINARY_POST_HTTP_UNEXPECTED( + "remote-binary-post-http-unexpected", + "Remote instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server." + ), + REMOTE_BINARY_POST_TIMEOUT( + "remote-binary-post-timeout", + "Remote instance ran into a timeout trying to post the binary resource to its own FHIR server." + ), + + RESPONSE_MESSAGE_TIMEOUT_STATUS_REQUESTED( + "response-message-timeout-status-requested", + "Response message timed out. The status of the request on the target FHIR server is 'requested'" + ), + RESPONSE_MESSAGE_TIMEOUT_STATUS_IN_PROGRESS( + "response-message-timeout-status-in-progress", + "Response message timed out. The status of the request on the target FHIR server is 'in-progress'" + ), + RESPONSE_MESSAGE_TIMEOUT_STATUS_FAILED( + "response-message-timeout-status-failed", + "Response message timed out. The status of the request on the target FHIR server is 'failed'" + ), + RESPONSE_MESSAGE_TIMEOUT_STATUS_COMPLETED( + "response-message-timeout-status-completed", + "Response message timed out. The status of the request on the target FHIR server is 'completed'" + ), + RESPONSE_MESSAGE_TIMEOUT_STATUS_UNEXPECTED( + "response-message-timeout-status-unexpected", + "Response message timed out. The status of the request on the target FHIR server is neither of 'requested', 'in-progress', 'failed' or 'completed'." + ), + + RESPONSE_MESSAGE_TIMEOUT_HTTP_401( + "response-message-timeout-http-401", + "Response message timed out. Received HTTP status 401 trying to check request status on the target." + ), + RESPONSE_MESSAGE_TIMEOUT_HTTP_403( + "response-message-timeout-http-403", + "Response message timed out. Received HTTP status 403 trying to check request status on the target." + ), + RESPONSE_MESSAGE_TIMEOUT_HTTP_500( + "response-message-timeout-http-500", + "Response message timed out. Received HTTP status 500 trying to check request status on the target." + ), + RESPONSE_MESSAGE_TIMEOUT_HTTP_502( + "response-message-timeout-http-502", + "Response message timed out. Received HTTP status 502 trying to check request status on the target." + ), + RESPONSE_MESSAGE_TIMEOUT_HTTP_UNEXPECTED( + "response-message-timeout-http-unexpected", + "Response message timed out. Received an unexpected HTTP status code trying to check request status on the target." + ), + + CLEANUP_MESSAGE_TIMEOUT( + "cleanup-message-timeout", + "Timeout while waiting for cleanup message from ping party." + ), + + LOCAL_BINARY_DOWNLOAD_IO_ERROR( + "local-binary-download-io-error", + "Local party encountered an I/O error trying to download the binary resource from the target." + ), + LOCAL_BINARY_DOWNLOAD_HTTP_401( + "local-binary-download-http-401", + "Local party received HTTP status 401 trying to download the binary resource from the target." + ), + LOCAL_BINARY_DOWNLOAD_HTTP_403( + "local-binary-download-http-403", + "Local party received HTTP status 403 trying to download the binary resource from the target." + ), + LOCAL_BINARY_DOWNLOAD_HTTP_500( + "local-binary-download-http-500", + "Local party received HTTP status 500 trying to download the binary resource from the target." + ), + LOCAL_BINARY_DOWNLOAD_HTTP_502( + "local-binary-download-http-502", + "Local party received HTTP status 500 trying to download the binary resource from the target." + ), + LOCAL_BINARY_DOWNLOAD_HTTP_UNEXPECTED( + "local-binary-download-http-unexpected", + "Local party received an unexpected HTTP status trying to download the binary resource from the target." + ), + LOCAL_BINARY_DOWNLOAD_TIMEOUT( + "local-binary-download-timeout", + "Local party ran into a read/connect timeout trying to download the binary resource from the target." + ), + LOCAL_BINARY_DOWNLOAD_MISSING_REFERENCE( + "local-binary-download-missing-reference", + "Local instance was unable to download the binary resource from the target because the reference was missing." + ), + + REMOTE_BINARY_DOWNLOAD_IO_ERROR( + "remote-binary-download-io-error", + "Remote party encountered an I/O error trying to download the binary resource from this server." + ), + REMOTE_BINARY_DOWNLOAD_HTTP_401( + "remote-binary-download-http-401", + "Remote party received HTTP status 401 trying to download the binary resource from this server." + ), + REMOTE_BINARY_DOWNLOAD_HTTP_403( + "remote-binary-download-http-403", + "Remote party received HTTP status 403 trying to download the binary resource from this server." + ), + REMOTE_BINARY_DOWNLOAD_HTTP_500( + "remote-binary-download-http-500", + "Remote party received HTTP status 500 trying to download the binary resource from this server." + ), + REMOTE_BINARY_DOWNLOAD_HTTP_502( + "remote-binary-download-http-502", + "Remote party received HTTP status 500 trying to download the binary resource from this server." + ), + REMOTE_BINARY_DOWNLOAD_HTTP_UNEXPECTED( + "remote-binary-download-http-unexpected", + "Remote party received an unexpected HTTP status trying to download the binary resource from this server." + ), + REMOTE_BINARY_DOWNLOAD_TIMEOUT( + "remote-binary-download-timeout", + "Remote party ran into a read/connect timeout trying to download the binary resource from this server." + ), + REMOTE_BINARY_DOWNLOAD_MISSING_REFERENCE( + "remote-binary-download-missing-reference", + "Remote instance was unable to download the binary resource from this server because the reference was missing." + ), + + UNKNOWN( + "unknown", + "An unknown error was encountered. Consult logs for more details." + ),; + + private final String code; + private final String display; + + private static final Map<String, Concept> CODE_TO_ENUM = new HashMap<>(); + + static + { + for (Concept e : values()) + { + CODE_TO_ENUM.put(e.code, e); + } + } + + Concept(String code, String display) + { + this.code = code; + this.display = display; + } + + public String getCode() + { + return code; + } + + public String getDisplay() + { + return display; + } + + public static Concept fromCode(String code) + { + + return CODE_TO_ENUM.get(code); + } + } + } } diff --git a/src/main/java/dev/dsf/bpe/ExecutionVariables.java b/src/main/java/dev/dsf/bpe/ExecutionVariables.java index 3714a6cc..3344133c 100644 --- a/src/main/java/dev/dsf/bpe/ExecutionVariables.java +++ b/src/main/java/dev/dsf/bpe/ExecutionVariables.java @@ -9,14 +9,19 @@ public enum ExecutionVariables downloadResourceReference, statusCode, error, + errorLocal, + errorRemote, errors, + errorsRemote, downloadedBytes, downloadedDuration, targetEndpointIdentifier, uploadedBytes, uploadedDuration, resourceDownloadError, + resourceDownloadErrorRemote, resourceUploadError, + resourceUploadErrorRemote, pingTaskId; public String correlatedValue(String correlationKey) diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index 8b38267c..f5380e1f 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -52,8 +52,7 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var cPing = "fhir/CodeSystem/dsf-ping.xml"; var cPingStatus = "fhir/CodeSystem/dsf-ping-status.xml"; - var cPingProcesses = "fhir/CodeSystem/dsf-ping-processes.xml"; - var cPingProcessSteps = "fhir/CodeSystem/dsf-ping-process-steps.xml"; + var cPingError = "fhir/CodeSystem/dsf-ping-error.xml"; var sPingStatus = "fhir/StructureDefinition/dsf-extension-ping-status.xml"; var sPing = "fhir/StructureDefinition/dsf-task-ping.xml"; @@ -72,18 +71,14 @@ public Map<String, List<String>> getFhirResourcesByProcessId() var vPingUnits = "fhir/ValueSet/dsf-network-speed-units.xml"; var vPingStatus = "fhir/ValueSet/dsf-ping-status.xml"; var vPongStatus = "fhir/ValueSet/dsf-pong-status.xml"; - var vPingProcesses = "fhir/ValueSet/dsf-ping-processes.xml"; - var vPingProcessSteps = "fhir/ValueSet/dsf-ping-process-steps.xml"; - return Map.of( - ConstantsPing.PROCESS_NAME_FULL_PING, Arrays.asList(aPing, cPing, cPingStatus, cPingProcesses, - cPingProcessSteps, sErrorExtension, sPingStatus, sStartPing, sPong, sCleanupPong, tStartPing, - vPing, vPingStatus, vPingUnits, vPingProcesses, vPingProcessSteps), + return Map.of(ConstantsPing.PROCESS_NAME_FULL_PING, + Arrays.asList(aPing, cPing, cPingStatus, cPingError, sErrorExtension, sPingStatus, sStartPing, sPong, + sCleanupPong, tStartPing, vPing, vPingStatus, vPingUnits), ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART, Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, tStartPingAutoStart, tStopPingAutoStart, vPing), - ConstantsPing.PROCESS_NAME_FULL_PONG, - Arrays.asList(aPong, cPing, cPingStatus, cPingProcesses, cPingProcessSteps, sErrorExtension, - sPingStatus, sPing, vPing, vPongStatus, vPingUnits, vPingProcesses, vPingProcessSteps)); + ConstantsPing.PROCESS_NAME_FULL_PONG, Arrays.asList(aPong, cPing, cPingStatus, cPingError, + sErrorExtension, sPingStatus, sPing, vPing, vPongStatus, vPingUnits)); } } diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 6925591c..4a19c9fa 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -12,67 +12,43 @@ import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.UrlType; -//todo: remove process and processStep + CodeSystems, make message never contain e.getMessage() becaus security -// ping status codesystem should extend old ping status codesystem, map every possible error to a unique name in a new codesystem -// that repaces process + processStep, display values should contain the exact text that is now contained in action -// remove equals method -public record ProcessError(CodeSystem.DsfPingProcesses.Code process, CodeSystem.DsfPingProcessSteps.Code processStep, - String action, String potentialFixUrl, String message) implements Serializable +public record ProcessError(String process, CodeSystem.DsfPingError.Concept concept, String potentialFixUrl) + implements Serializable { public static Extension toExtension(ProcessError error) { Objects.requireNonNull(error); - Objects.requireNonNull(error.action()); + Objects.requireNonNull(error.concept()); Objects.requireNonNull(error.process()); - Objects.requireNonNull(error.message()); - Objects.requireNonNull(error.processStep()); Extension extension = new Extension(); extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, error.process().getValue(), null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, error.process().getValue(), null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(error.action())); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ERROR) + .setValue(new Coding().setSystem(CodeSystem.DsfPingError.URL).setCode(error.concept.getCode()) + .setDisplay(error.concept.getDisplay())); if (Objects.nonNull(error.potentialFixUrl)) { extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) .setValue(new UrlType(error.potentialFixUrl())); } - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(error.message())); return extension; } - public static ProcessError toError(Extension extension) + public static ProcessError toError(Extension extension, String process) { - Extension processExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_PROCESS); - Objects.requireNonNull(processExtension); - String process = ((Coding) processExtension.getValue()).getCode(); - - - Extension processStepExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP); - Objects.requireNonNull(processStepExtension); - String processStep = ((Coding) processStepExtension.getValue()).getCode(); - - Extension actionExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_ACTION); - Objects.requireNonNull(actionExtension); - String action = ((StringType) actionExtension.getValue()).getValue(); + Extension errorExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_ERROR); + Objects.requireNonNull(errorExtension); + CodeSystem.DsfPingError.Concept error = CodeSystem.DsfPingError.Concept + .fromCode(((Coding) errorExtension.getValue()).getCode()); Extension potentalFixUrlExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX); String potentialFixUrl = Objects.nonNull(potentalFixUrlExtension) ? ((UrlType) potentalFixUrlExtension.getValue()).getValue() : null; - Extension messageExtension = extension.getExtensionByUrl(ConstantsPing.EXTENSION_URL_MESSAGE); - Objects.requireNonNull(messageExtension); - String message = ((StringType) messageExtension.getValue()).getValue(); - - CodeSystem.DsfPingProcesses.Code processCode = CodeSystem.DsfPingProcesses.Code.ofValue(process); - CodeSystem.DsfPingProcessSteps.Code stepCode = CodeSystem.DsfPingProcessSteps.Code.ofValue(processStep); - - return new ProcessError(processCode, stepCode, action, potentialFixUrl, message); + return new ProcessError(process, error, potentialFixUrl); } public static List<Task.TaskOutputComponent> toTaskOutput(List<ProcessError> errors) diff --git a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java index b064a324..6d92f0b8 100644 --- a/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java +++ b/src/main/java/dev/dsf/bpe/mail/AggregateErrorMailService.java @@ -9,7 +9,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.variables.Target; @@ -72,7 +72,7 @@ protected String createMessage(Target target, ProcessError error) if (error != null && error.process() != null) { - if (CodeSystem.DsfPingProcesses.Code.PING.equals(error.process())) + if (ConstantsPing.PROCESS_NAME_PING.equals(error.process())) { b.append(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().orElse("?")); b.append('/'); @@ -101,13 +101,7 @@ protected String createMessage(Target target, ProcessError error) b.append(": "); } b.append("\n\t"); - b.append("Process: ").append(error.process()); - b.append("\n\t"); - b.append("Process step: ").append(error.processStep()); - b.append("\n\t"); - b.append("Action: ").append(error.action()); - b.append("\n\t"); - b.append("Message: ").append(error.message()); + b.append("Description: ").append(error.concept().getDisplay()); } else { diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 2db36ff1..2f359978 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.task.SendTaskErrorConverter; @@ -54,13 +55,12 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab String errorMessage) { Target target = variables.getTarget(); - ProcessError error = SendTaskErrorConverter.convert(exception, - "Sending cleanup message to " + target.getEndpointUrl()); + ProcessError error = SendTaskErrorConverter.convertLocal(exception, false, ConstantsPing.PROCESS_NAME_PING); execution.setVariableLocal(ExecutionVariables.error.name(), new ProcessErrorValueImpl(error)); execution.setVariableLocal(ExecutionVariables.statusCode.name(), CodeSystem.DsfPing.Code.ERROR.getValue()); - logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); + logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.concept().getDisplay()); } @Override diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index e8fd8ef8..ae77bcc6 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -13,6 +13,7 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.task.SendTaskErrorConverter; @@ -78,13 +79,12 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab String errorMessage) { Target target = variables.getTarget(); - ProcessError error = SendTaskErrorConverter.convert(exception, - "Sending ping message to " + target.getEndpointUrl()); + ProcessError error = SendTaskErrorConverter.convertLocal(exception, true, ConstantsPing.PROCESS_NAME_PING); execution.setVariableLocal(ExecutionVariables.error.name(), new ProcessErrorValueImpl(error)); execution.setVariableLocal(ExecutionVariables.statusCode.name(), CodeSystem.DsfPing.Code.ERROR.getValue()); - logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); + logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.concept().getDisplay()); } @Override diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index 9a0fd8af..7da39fc3 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.ProcessErrors; @@ -51,7 +52,7 @@ public void afterPropertiesSet() throws Exception protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution, Variables variables) { - ProcessErrors errorList = ErrorListUtils.getErrorList(execution); + ProcessErrors errorListRemote = ErrorListUtils.getErrorListRemote(execution); long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.downloadResourceSizeBytes.name()); if (downloadResourceSizeBytes >= 0) { @@ -72,12 +73,12 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE return Stream .of(downloadedBytesParameter, downloadedDurationParameter, downloadedResourceReferenceParameter, - ErrorInputComponentGenerator.create(errorList.getEntries()).stream()) + ErrorInputComponentGenerator.create(errorListRemote.getEntries()).stream()) .flatMap(stream -> stream); } else { - return ErrorInputComponentGenerator.create(errorList.getEntries()).stream(); + return ErrorInputComponentGenerator.create(errorListRemote.getEntries()).stream(); } } @@ -98,14 +99,13 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab Target target = variables.getTarget(); Task startTask = variables.getStartTask(); - ProcessError error = SendTaskErrorConverter.convert(exception, - "Sending pong message to " + target.getEndpointUrl()); + ProcessError error = SendTaskErrorConverter.convertLocal(exception, true, ConstantsPing.PROCESS_NAME_PONG); ErrorListUtils.add(error, execution); PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.ERROR); variables.setString(ExecutionVariables.statusCode.name(), CodeSystem.DsfPing.Code.ERROR.getValue()); variables.updateTask(startTask); - logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.message()); + logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.concept().getDisplay()); } } diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index fb7bcf73..1f1434be 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -1,7 +1,6 @@ package dev.dsf.bpe.service; import java.net.SocketTimeoutException; -import java.util.Objects; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.Expression; @@ -36,8 +35,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) { logger.debug("Cleaning up..."); - CodeSystem.DsfPingProcesses.Code process = getProcess((String) this.process.getValue(delegateExecution)); - Objects.requireNonNull(process); + String process = (String) this.process.getValue(delegateExecution); String downloadResourceId = new IdType(variables.getString(ExecutionVariables.downloadResourceReference.name())) .getIdPart(); @@ -55,10 +53,11 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) { if (e.getCause() instanceof SocketTimeoutException) { - ProcessError error = new ProcessError(process, CodeSystem.DsfPingProcessSteps.Code.CLEANUP, - ConstantsPing.CLEANUP_ERROR_ACTION, ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT, - e.getCause().getMessage()); + ProcessError error = new ProcessError(process, + CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); ErrorListUtils.add(error, delegateExecution); + logger.error(e.getCause().getMessage()); } else { @@ -67,9 +66,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) } catch (WebApplicationException e) { - ProcessError error = new ProcessError(process, CodeSystem.DsfPingProcessSteps.Code.CLEANUP, - ConstantsPing.CLEANUP_ERROR_ACTION, ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, - "Response from local DSF FHIR server: " + e.getResponse().getStatus()); + ProcessError error = toProcessError(e, process); ErrorListUtils.add(error, delegateExecution); } } @@ -80,15 +77,29 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) logger.debug("Cleanup complete."); } - public void setProcess(org.camunda.bpm.engine.delegate.Expression process) + private ProcessError toProcessError(WebApplicationException e, String process) { - this.process = process; + int status = e.getResponse().getStatus(); + String message = "Response from local DSF FHIR server: " + status; + logger.error(message, e); + + return switch (status) + { + case 401 -> new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + case 403 -> new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + case 500 -> new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + case 502 -> new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + default -> new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_HTTP_UNEXPECTED, + null); + }; } - private CodeSystem.DsfPingProcesses.Code getProcess(String process) + public void setProcess(Expression process) { - if (process == null || process.isEmpty()) - return null; - return CodeSystem.DsfPingProcesses.Code.ofValue(process); + this.process = process; } } diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index ca7a9056..06eda87a 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -1,6 +1,6 @@ package dev.dsf.bpe.service; -import java.util.Objects; +import java.net.SocketTimeoutException; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -18,6 +18,7 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; import dev.dsf.bpe.variables.process_error.ProcessErrorValueImpl; +import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.WebApplicationException; public class GenerateAndStoreResource extends AbstractServiceDelegate implements InitializingBean @@ -42,6 +43,7 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) { logger.debug("Generating resource..."); long downloadResourceSizeBytes = getDownloadResourceSize(variables); + String process = (String) this.process.getValue(delegateExecution); RandomByteInputStream resourceContent; if (downloadResourceSizeBytes > maxUploadSizeBytes) { @@ -70,12 +72,74 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) } catch (WebApplicationException e) { - String status = String.valueOf(e.getResponse().getStatus()); - ProcessError error = new ProcessError(getProcess((String) process.getValue(delegateExecution)), - CodeSystem.DsfPingProcessSteps.Code.GENERATE_AND_STORE_RESOURCE, - "Storing Binary resource on local DSF FHIR server.", ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, - "Local DSF FHIR server responded with status: " + status); + int status = e.getResponse().getStatus(); + ProcessError error; + ProcessError errorRemote; + + switch (status) + { + case 401: + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + errorRemote = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + break; + case 403: + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + errorRemote = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + break; + case 500: + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + errorRemote = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + break; + case 502: + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + errorRemote = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + break; + default: + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_HTTP_UNEXPECTED, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_HTTP_UNEXPECTED, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + break; + } + variables.setVariable(ExecutionVariables.resourceUploadError.name(), new ProcessErrorValueImpl(error)); + if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + variables.setVariable(ExecutionVariables.resourceUploadErrorRemote.name(), + new ProcessErrorValueImpl(errorRemote)); + } + } + catch (ProcessingException e) + { + if (e.getCause() instanceof SocketTimeoutException) + { + ProcessError error = new ProcessError(process, + CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + ProcessError errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + + variables.setVariable(ExecutionVariables.resourceUploadError.name(), new ProcessErrorValueImpl(error)); + if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + variables.setVariable(ExecutionVariables.resourceUploadErrorRemote.name(), + new ProcessErrorValueImpl(errorRemote)); + } + } + else + { + throw e; + } } } @@ -91,10 +155,8 @@ private IdType storeBinary(RandomByteInputStream downloadResourceContent) api.getOrganizationProvider().getLocalOrganization().get().getIdElement().getValue()); } - private CodeSystem.DsfPingProcesses.Code getProcess(String process) + public void setProcess(Expression process) { - if (process == null || process.isEmpty()) - return null; - return CodeSystem.DsfPingProcesses.Code.ofValue(process); + this.process = process; } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index 05b2bf03..a55b807b 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -42,35 +42,54 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Objects.requireNonNull(taskId); FhirWebserviceClient fhirWebserviceClient = api.getFhirWebserviceClientProvider() .getWebserviceClient(target.getEndpointUrl()); - ProcessError error; try { Task pingTask = fhirWebserviceClient.withRetry(3, 1000).read(Task.class, taskId); - error = switch (pingTask.getStatus()) + ProcessError error = switch (pingTask.getStatus()) { - case REQUESTED, INPROGRESS, FAILED, COMPLETED -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, - CodeSystem.DsfPingProcessSteps.Code.CHECK_PING_TASK_STATUS, "Awaiting pong message", null, - "Pong message timed out. Status of ping task resource with id " + taskId + " from " - + target.getEndpointUrl() + " is " + pingTask.getStatus()); - default -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, - CodeSystem.DsfPingProcessSteps.Code.CHECK_PING_TASK_STATUS, "Awaiting pong message", null, - "Pong message timed out. Status of ping task resource with id " + taskId + " from " - + target.getEndpointUrl() + " is " + pingTask.getStatus() - + ". Unexpected status. Should be either of " + Task.TaskStatus.REQUESTED + ", " - + Task.TaskStatus.INPROGRESS + ", " + Task.TaskStatus.COMPLETED + " or " - + Task.TaskStatus.FAILED); + case COMPLETED -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RESPONSE_MESSAGE_TIMEOUT_STATUS_COMPLETED, null); + case FAILED -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RESPONSE_MESSAGE_TIMEOUT_STATUS_FAILED, null); + case INPROGRESS -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RESPONSE_MESSAGE_TIMEOUT_STATUS_IN_PROGRESS, null); + case REQUESTED -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RESPONSE_MESSAGE_TIMEOUT_STATUS_REQUESTED, null); + default -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RESPONSE_MESSAGE_TIMEOUT_STATUS_UNEXPECTED, null); }; + ErrorListUtils.add(error, delegateExecution, correlationKey); } catch (WebApplicationException e) { - error = new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, - CodeSystem.DsfPingProcessSteps.Code.CHECK_PING_TASK_STATUS, - "Pong message timed out. Error when retrieving status of ping task resource with id " + taskId - + " from " + target.getEndpointUrl(), - ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, e.getMessage()); + ProcessError error = getProcessError(e); + ErrorListUtils.add(error, delegateExecution, correlationKey); } - ErrorListUtils.add(error, delegateExecution, correlationKey); + logger.debug("Saved '{}' to process execution for correlation key '{}'", CodeSystem.DsfPing.Code.ERROR.getValue(), correlationKey); } + + private static ProcessError getProcessError(WebApplicationException e) + { + int statusCode = e.getResponse().getStatus(); + return switch (statusCode) + { + case 401 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RESPONSE_MESSAGE_TIMEOUT_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + case 403 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RESPONSE_MESSAGE_TIMEOUT_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + case 500 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RESPONSE_MESSAGE_TIMEOUT_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + case 502 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RESPONSE_MESSAGE_TIMEOUT_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + default -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RESPONSE_MESSAGE_TIMEOUT_HTTP_UNEXPECTED, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + }; + } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java index 8c880ad1..f1c00f1b 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java +++ b/src/main/java/dev/dsf/bpe/service/ping/DownloadResourceAndMeasureSpeedInSubProcess.java @@ -6,7 +6,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -35,9 +35,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader( - CodeSystem.DsfPingProcesses.Code.PING).download(variables, api, task); + ConstantsPing.PROCESS_NAME_PING).download(variables, api, task); - if (downloadResult.getError() == null) + if (downloadResult.getErrorTuple() == null) { variables.setLong(ExecutionVariables.downloadedBytes.correlatedValue(correlationKey), downloadResult.getDownloadedBytes()); @@ -47,7 +47,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable else { delegateExecution.setVariableLocal(ExecutionVariables.resourceDownloadError.name(), - downloadResult.getError()); + downloadResult.getErrorTuple().errorLocal()); } logger.debug("Completed resource download and measured speed."); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java index a9b9b00f..2db502fc 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveError.java @@ -32,6 +32,7 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable ErrorListUtils.add(error, delegateExecution, target.getCorrelationKey()); - logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), error.message()); + logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), + error.concept().getDisplay()); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 9796175a..b6e52f31 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -33,6 +33,6 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw variables.setLong(ExecutionVariables.uploadedBytes.correlatedValue(correlationKey), 0L); variables.setVariable(ExecutionVariables.uploadedDuration.correlatedValue(correlationKey), new DurationValueImpl(Duration.ZERO)); - logger.debug("Saved error when trying to send ping message. Error message: {}", error.message()); + logger.debug("Saved error when trying to send ping message. Error message: {}", error.concept().getDisplay()); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java index fde5cdef..be2b2d4c 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveUploadErrorPing.java @@ -7,6 +7,7 @@ import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; @@ -25,6 +26,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw { ProcessError error = (ProcessError) variables.getVariable(ExecutionVariables.resourceUploadError.name()); - logger.info("Error while storing binary resource for download: {}", error.message()); + ErrorListUtils.add(error, execution); + + logger.info("Error while storing binary resource for download: {}", error.concept().getDisplay()); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index b3399516..db90d544 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -70,8 +70,9 @@ private List<ProcessError> parseInputs(Task task) .toList(); return inputs.stream() - .map(input -> ProcessError - .toError(input.getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR))) + .map(input -> ProcessError.toError( + input.getExtensionByUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR), + ConstantsPing.PROCESS_NAME_PONG)) .toList(); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java index 9cc10d8c..bf7b04ff 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/DownloadResourceAndMeasureSpeed.java @@ -6,7 +6,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.util.BinaryResourceDownloader; import dev.dsf.bpe.v1.ProcessPluginApi; @@ -31,9 +31,9 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task task = variables.getStartTask(); BinaryResourceDownloader.DownloadResult downloadResult = new BinaryResourceDownloader( - CodeSystem.DsfPingProcesses.Code.PONG).download(variables, api, task); + ConstantsPing.PROCESS_NAME_PONG).download(variables, api, task); - if (downloadResult.getError() == null) + if (downloadResult.getErrorTuple() == null) { variables.setLong(ExecutionVariables.downloadedBytes.name(), downloadResult.getDownloadedBytes()); variables.setVariable(ExecutionVariables.downloadedDuration.name(), @@ -41,7 +41,10 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable } else { - delegateExecution.setVariable(ExecutionVariables.resourceDownloadError.name(), downloadResult.getError()); + delegateExecution.setVariable(ExecutionVariables.resourceDownloadError.name(), + downloadResult.getErrorTuple().errorLocal()); + delegateExecution.setVariable(ExecutionVariables.resourceDownloadErrorRemote.name(), + downloadResult.getErrorTuple().errorRemote()); } logger.debug("Completed resource download and measured speed."); } diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java index 04b6f2b6..49455dce 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveAndStoreError.java @@ -31,13 +31,18 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Task startTask = variables.getStartTask(); ProcessError error = (ProcessError) delegateExecution - .getVariableLocal(ExecutionVariables.resourceDownloadError.name()); - + .getVariable(ExecutionVariables.resourceDownloadError.name()); ErrorListUtils.add(error, delegateExecution); + + ProcessError errorRemote = (ProcessError) delegateExecution + .getVariable(ExecutionVariables.resourceDownloadErrorRemote.name()); + ErrorListUtils.addRemote(errorRemote, delegateExecution); + PingStatusGenerator.updatePongStatusOutput(startTask, ErrorListUtils.getErrorList(delegateExecution).getEntries()); variables.updateTask(startTask); - logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), error.message()); + logger.info("Error while trying to download resource from {}: {}", target.getEndpointUrl(), + error.concept().getDisplay()); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java index af9e4749..4a69f96c 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java +++ b/src/main/java/dev/dsf/bpe/service/pong/LogAndSaveUploadErrorPong.java @@ -25,9 +25,12 @@ public LogAndSaveUploadErrorPong(ProcessPluginApi api) protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { ProcessError error = (ProcessError) variables.getVariable(ExecutionVariables.resourceUploadError.name()); - ErrorListUtils.add(error, execution); - logger.info("Error while storing binary resource for download: {}", error.message()); + ProcessError errorRemote = (ProcessError) variables + .getVariable(ExecutionVariables.resourceUploadErrorRemote.name()); + ErrorListUtils.addRemote(errorRemote, execution); + + logger.info("Error while storing binary resource for download: {}", error.concept().getDisplay()); } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java index 96d0aab9..79a772dd 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java +++ b/src/main/java/dev/dsf/bpe/service/pong/SaveTimeoutError.java @@ -6,11 +6,11 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; public class SaveTimeoutError extends AbstractServiceDelegate @@ -25,16 +25,13 @@ public SaveTimeoutError(ProcessPluginApi api) @Override protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError { - Target target = variables.getTarget(); logger.debug("Storing timeout error..."); - ProcessError error = new ProcessError(CodeSystem.DsfPingProcesses.Code.PONG, - CodeSystem.DsfPingProcessSteps.Code.CLEANUP_TIMER_CATCH_EVENT, - "Waiting for cleanup message from " + target.getOrganizationIdentifierValue(), null, - "Timeout while waiting for cleanup message"); + ProcessError error = new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.CLEANUP_MESSAGE_TIMEOUT, null); ErrorListUtils.add(error, execution); - logger.debug("Stored timeout error: {}", error.message()); + logger.debug("Stored timeout error: {}", error.concept().getDisplay()); } } diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index ab5b7998..b76eca9e 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -24,9 +24,9 @@ public class BinaryResourceDownloader { private static final Logger logger = LoggerFactory.getLogger(BinaryResourceDownloader.class); - private final CodeSystem.DsfPingProcesses.Code process; + private final String process; - public BinaryResourceDownloader(CodeSystem.DsfPingProcesses.Code process) + public BinaryResourceDownloader(String process) { this.process = process; } @@ -44,10 +44,11 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t if (optDownloadResourceReference.isEmpty()) { ProcessError error = new ProcessError(process, - CodeSystem.DsfPingProcessSteps.Code.DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, - "Extracting binary resource reference from task " + task.getIdElement().getValue(), null, - "No reference provided in task"); - downloadResult = new DownloadResult(error); + CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_MISSING_REFERENCE, null); + ProcessError errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_MISSING_REFERENCE, null); + logDownloadError("Missing binary reference"); + downloadResult = new DownloadResult(error, errorRemote); return downloadResult; } @@ -55,7 +56,6 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t IdType downloadResourceReferenceIdType = new IdType(downloadResourceReference.getReference()); String downloadResourceReferenceId = downloadResourceReferenceIdType.getIdPart(); String webserviceUrl = downloadResourceReferenceIdType.getBaseUrl(); - String action = "Downloading binary resource from " + webserviceUrl; try { InputStream binaryResourceInputStream = api.getFhirWebserviceClientProvider() @@ -79,20 +79,59 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t binaryResourceInputStream.close(); String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); ProcessError error = new ProcessError(process, - CodeSystem.DsfPingProcessSteps.Code.DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, null, - errorMessage); - logger.error("Encountered an error while downloading resource: {}", errorMessage); - downloadResult = new DownloadResult(error); + CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_IO_ERROR, null); + ProcessError errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_IO_ERROR, null); + logDownloadError(errorMessage); + downloadResult = new DownloadResult(error, errorRemote); } } catch (WebApplicationException e) { String errorMessage = (e.getResponse().getStatusInfo().getStatusCode() + " " + e.getMessage()).trim(); - ProcessError error = new ProcessError(process, - CodeSystem.DsfPingProcessSteps.Code.DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, - ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, errorMessage); - logger.error("Encountered an error while downloading resource: {}", errorMessage); - downloadResult = new DownloadResult(error); + int statusCode = e.getResponse().getStatus(); + ProcessError error; + ProcessError errorRemote; + + switch (statusCode) + { + case 401: + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + break; + case 403: + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + break; + case 500: + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + break; + case 502: + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + break; + default: + error = new ProcessError(process, + CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_HTTP_UNEXPECTED, null); + errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_HTTP_UNEXPECTED, null); + break; + } + logDownloadError(errorMessage); + downloadResult = new DownloadResult(error, errorRemote); } catch (ProcessingException e) { @@ -100,10 +139,13 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t { String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); ProcessError error = new ProcessError(process, - CodeSystem.DsfPingProcessSteps.Code.DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, - ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT, errorMessage); - logger.error("Encountered an error while downloading resource: {}", errorMessage); - downloadResult = new DownloadResult(error); + CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + ProcessError errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + logDownloadError(errorMessage); + downloadResult = new DownloadResult(error, errorRemote); } else { @@ -114,32 +156,40 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t { String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); ProcessError error = new ProcessError(process, - CodeSystem.DsfPingProcessSteps.Code.DOWNLOAD_RESOURCE_AND_MEASURE_SPEED, action, null, - errorMessage); - logger.error("Encountered an error while downloading resource: {}", errorMessage); - downloadResult = new DownloadResult(error); + CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_IO_ERROR, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + ProcessError errorRemote = new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_IO_ERROR, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + logDownloadError(errorMessage); + downloadResult = new DownloadResult(error, errorRemote); } return downloadResult; } + private void logDownloadError(String errorMessage) + { + logger.error("Encountered an error while downloading resource: {}", errorMessage); + } + public static class DownloadResult { private final long downloadedBytes; private final Duration downloadedDuration; - private final ProcessError error; + private final ErrorTuple errorTuple; public DownloadResult(long downloadedBytes, Duration downloadedDuration) { this.downloadedBytes = downloadedBytes; this.downloadedDuration = downloadedDuration; - error = null; + errorTuple = null; } - public DownloadResult(ProcessError error) + public DownloadResult(ProcessError error, ProcessError errorRemote) { downloadedBytes = 0; downloadedDuration = Duration.ZERO; - this.error = error; + this.errorTuple = new ErrorTuple(error, errorRemote); } public long getDownloadedBytes() @@ -152,9 +202,14 @@ public Duration getDownloadedDuration() return downloadedDuration; } - public ProcessError getError() + public ErrorTuple getErrorTuple() { - return error; + return errorTuple; } + + public record ErrorTuple(ProcessError errorLocal, ProcessError errorRemote) + { + } + } } diff --git a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java index a88b5d8d..0df63dc7 100644 --- a/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java +++ b/src/main/java/dev/dsf/bpe/util/ErrorListUtils.java @@ -30,6 +30,27 @@ public static void addAll(ProcessErrors errors, DelegateExecution execution, Str } } + public static void addAllRemote(ProcessErrors errors, DelegateExecution execution) + { + ProcessErrors errorList = getErrorListRemote(execution); + if (errors != null) + { + errorList.addAll(errors); + saveErrorListRemote(errorList, execution, null); + } + } + + public static void addAllRemote(ProcessErrors errors, DelegateExecution execution, String correlationKey) + { + ProcessErrors errorList = correlationKey != null ? getErrorListRemote(execution, correlationKey) + : getErrorListRemote(execution); + if (errors != null) + { + errorList.addAll(errors); + saveErrorListRemote(errorList, execution, correlationKey); + } + } + public static void add(ProcessError error, DelegateExecution execution) { add(error, execution, null); @@ -47,6 +68,23 @@ public static void add(ProcessError error, DelegateExecution execution, String c } } + public static void addRemote(ProcessError error, DelegateExecution execution) + { + addRemote(error, execution, null); + } + + public static void addRemote(ProcessError error, DelegateExecution execution, String correlationKey) + { + if (correlationKey != null) + { + add(error, ExecutionVariables.errorsRemote.correlatedValue(correlationKey), execution); + } + else + { + add(error, ExecutionVariables.errorsRemote.name(), execution); + } + } + public static ProcessErrors getErrorList(DelegateExecution execution) { return getErrorList(execution, null); @@ -64,6 +102,23 @@ public static ProcessErrors getErrorList(DelegateExecution execution, String cor } } + public static ProcessErrors getErrorListRemote(DelegateExecution execution) + { + return getErrorListRemote(execution, null); + } + + public static ProcessErrors getErrorListRemote(DelegateExecution execution, String correlationKey) + { + if (correlationKey != null) + { + return getErrorList(ExecutionVariables.errorsRemote.correlatedValue(correlationKey), execution); + } + else + { + return getErrorList(ExecutionVariables.errorsRemote.name(), execution); + } + } + public static ProcessErrors getErrorList(String variableName, DelegateExecution execution) { ProcessErrors errors = (ProcessErrors) execution.getVariable(variableName); @@ -94,6 +149,18 @@ private static void saveErrorList(ProcessErrors errors, DelegateExecution execut } } + private static void saveErrorListRemote(ProcessErrors errors, DelegateExecution execution, String correlationKey) + { + if (correlationKey != null) + { + saveErrorList(errors, ExecutionVariables.errorsRemote.correlatedValue(correlationKey), execution); + } + else + { + saveErrorList(errors, ExecutionVariables.errorsRemote.name(), execution); + } + } + private static void saveErrorList(ProcessErrors errors, String variableName, DelegateExecution execution) { execution.setVariable(variableName, new ProcessErrorsValueImpl(errors)); diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index 868aabeb..6d248e4e 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -1,45 +1,63 @@ package dev.dsf.bpe.util.task; import java.net.UnknownHostException; -import java.util.Map; import java.util.Objects; -import java.util.function.BiFunction; import javax.net.ssl.SSLHandshakeException; import org.apache.http.conn.ConnectTimeoutException; import org.apache.http.conn.HttpHostConnectException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ProcessError; import jakarta.ws.rs.ProcessingException; import jakarta.ws.rs.WebApplicationException; -import jakarta.ws.rs.core.Response; public final class SendTaskErrorConverter { + private static final Logger logger = LoggerFactory.getLogger(SendTaskErrorConverter.class); + private SendTaskErrorConverter() { } - public static ProcessError convert(Exception exception, String action) + private enum ErrorType + { + LOCAL, + REMOTE + } + + public static ProcessError convertLocal(Exception exception, boolean messageWithReference, String process) + { + return convert(exception, ErrorType.LOCAL, messageWithReference, process); + } + + public static ProcessError convertRemote(Exception exception, boolean messageWithReference, String process) + { + return convert(exception, ErrorType.REMOTE, messageWithReference, process); + } + + private static ProcessError convert(Exception exception, ErrorType errorType, boolean messageWithReference, + String process) { if (exception instanceof WebApplicationException e) { - return convertWebApplicationException().apply(e, action); + return convertWebApplicationException(e, errorType, messageWithReference, process); } - else if (exception instanceof SSLHandshakeException e) + else if (exception instanceof SSLHandshakeException) { - return convertSSLHandshakeException().apply(e, action); + return convertSSLHandshakeException(errorType, process); } - else if (exception instanceof ConnectTimeoutException e) + else if (exception instanceof ConnectTimeoutException) { - return convertConnectTimeoutException().apply(e, action); + return convertConnectTimeoutException(errorType, process); } - else if (exception instanceof HttpHostConnectException e) + else if (exception instanceof HttpHostConnectException) { - return convertHttpHostConnectException().apply(e, action); + return convertHttpHostConnectException(errorType, process); } else if (exception instanceof ProcessingException e) { @@ -47,78 +65,307 @@ else if (exception instanceof ProcessingException e) e); if (sslHandshakeException != null) { - return convertSSLHandshakeException().apply(sslHandshakeException, action); + return convertSSLHandshakeException(errorType, process); } ConnectTimeoutException connectTimeoutException = getExpectedCauseInstanceFromStack( ConnectTimeoutException.class, e); if (connectTimeoutException != null) { - return convertConnectTimeoutException().apply(connectTimeoutException, action); + return convertConnectTimeoutException(errorType, process); } UnknownHostException unknownHostException = getExpectedCauseInstanceFromStack(UnknownHostException.class, e); if (unknownHostException != null) { - return convertUnknownHostException().apply(unknownHostException, action); + return convertUnknownHostException(errorType, process); } HttpHostConnectException httpHostConnectException = getExpectedCauseInstanceFromStack( HttpHostConnectException.class, e); if (httpHostConnectException != null) { - return convertHttpHostConnectException().apply(httpHostConnectException, action); + return convertHttpHostConnectException(errorType, process); } - return convertExceptionFallback().apply(e, action); + return convertExceptionFallback(exception, errorType, process); } else { - return convertExceptionFallback().apply(exception, action); + return convertExceptionFallback(exception, errorType, process); } } - private static BiFunction<SSLHandshakeException, String, ProcessError> convertSSLHandshakeException() + private static ProcessError convertSSLHandshakeException(ErrorType errorType, String process) { - return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, - CodeSystem.DsfPingProcessSteps.Code.PING, action, ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL, - e.getMessage()); + if (ConstantsPing.PROCESS_NAME_PING.equals(process)) + { + return switch (errorType) + { + case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_SSL_HANDSHAKE, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL); + case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_SSL_HANDSHAKE, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL); + }; + } + else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + return switch (errorType) + { + case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_SSL_HANDSHAKE, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL); + case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_SSL_HANDSHAKE, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL); + }; + } + else + { + throw new IllegalArgumentException("Unknown process: " + process); + } } - private static BiFunction<Exception, String, ProcessError> convertExceptionFallback() + private static ProcessError convertExceptionFallback(Exception e, ErrorType errorType, String process) { - return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, - CodeSystem.DsfPingProcessSteps.Code.PING, action, null, e.getMessage()); + logger.warn("No fitting converter found for exception {}: {}", e.getClass().getName(), e.getMessage()); + if (ConstantsPing.PROCESS_NAME_PING.equals(process)) + { + return switch (errorType) + { + case LOCAL, REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.UNKNOWN, null); + }; + } + else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + return switch (errorType) + { + case LOCAL, REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.UNKNOWN, null); + }; + } + else + { + throw new IllegalArgumentException("Unknown process: " + process); + } } - private static BiFunction<ConnectTimeoutException, String, ProcessError> convertConnectTimeoutException() + private static ProcessError convertConnectTimeoutException(ErrorType errorType, String process) { - return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, - CodeSystem.DsfPingProcessSteps.Code.PING, action, ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT, - e.getMessage()); + if (ConstantsPing.PROCESS_NAME_PING.equals(process)) + { + return switch (errorType) + { + case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_CONNECT_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_CONNECT_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + }; + } + else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + return switch (errorType) + { + case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_CONNECT_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_CONNECT_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + }; + } + else + { + throw new IllegalArgumentException("Unknown process: " + process); + } } - private static BiFunction<WebApplicationException, String, ProcessError> convertWebApplicationException() + private static ProcessError convertWebApplicationException(WebApplicationException e, ErrorType errorType, + boolean messageWithReference, String process) { - return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, - CodeSystem.DsfPingProcessSteps.Code.PING, action, ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP, - "Response from remote DSF FHIR server: " + e.getResponse().getStatus() + " " - + Response.Status.fromStatusCode(e.getResponse().getStatus()).toString()); + int statusCode = e.getResponse().getStatus(); + if (ConstantsPing.PROCESS_NAME_PING.equals(process)) + { + return switch (errorType) + { + case LOCAL -> switch (statusCode) + { + case 401 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 403 -> + { + if (messageWithReference) + { + yield new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_REFERENCE_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + else + { + yield new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + } + case 500 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 502 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + default -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + }; + case REMOTE -> switch (statusCode) + { + case 401 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 403 -> + { + if (messageWithReference) + { + yield new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_REFERENCE_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + else + { + yield new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + } + case 500 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 502 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + default -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_UNEXPECTED, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + }; + }; + } + else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + return switch (errorType) + { + case LOCAL -> switch (statusCode) + { + case 401 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 403 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 500 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 502 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + default -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + }; + case REMOTE -> switch (statusCode) + { + case 401 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 403 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 500 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 502 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + default -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_UNEXPECTED, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + }; + }; + } + else + { + throw new IllegalArgumentException("Unknown process: " + process); + } } - private static BiFunction<HttpHostConnectException, String, ProcessError> convertHttpHostConnectException() + private static ProcessError convertHttpHostConnectException(ErrorType errorType, String process) { - return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, - CodeSystem.DsfPingProcessSteps.Code.PING, action, ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED, - e.getMessage()); + if (ConstantsPing.PROCESS_NAME_PING.equals(process)) + { + return switch (errorType) + { + case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + }; + } + else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + return switch (errorType) + { + case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + }; + } + else + { + throw new IllegalArgumentException("Unknown process: " + process); + } } - private static BiFunction<UnknownHostException, String, ProcessError> convertUnknownHostException() + private static ProcessError convertUnknownHostException(ErrorType errorType, String process) { - return (e, action) -> new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, - CodeSystem.DsfPingProcessSteps.Code.PING, action, ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST, - e.getMessage()); + if (ConstantsPing.PROCESS_NAME_PING.equals(process)) + { + return switch (errorType) + { + case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_UNKNOWN_HOST, + ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST); + case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_UNKNOWN_HOST, + ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST); + }; + } + else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + return switch (errorType) + { + case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_UNKNOWN_HOST, + ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST); + case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_UNKNOWN_HOST, + ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST); + }; + } + else + { + throw new IllegalArgumentException("Unknown process: " + process); + } } private static <T extends Throwable> T getExpectedCauseInstanceFromStack(Class<T> expectedCause, Throwable e) diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml new file mode 100644 index 00000000..e7f9b0eb --- /dev/null +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml @@ -0,0 +1,324 @@ +<CodeSystem xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://dsf.dev/fhir/CodeSystem/ping-error-v2" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="DSF_Ping_Error" /> + <title value="DSF Ping Error" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="DSF" /> + <description value="CodeSystem error codes that might occur during execution." /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> + <concept> + <code value="send-message-http-401"/> + <display value="Sending a message to the remote instance resulted in HTTP status 401."/> + </concept> + <concept> + <code value="send-message-http-403"/> + <display value="Sending a message to the remote instance resulted in HTTP status 403."/> + </concept> + <concept> + <code value="send-reference-message-http-403"/> + <display value="Sending a message including a reference to the remote instance resulted in HTTP status 403."/> + </concept> + <concept> + <code value="send-message-http-500"/> + <display value="Sending a message to the remote instance resulted in HTTP status 500."/> + </concept> + <concept> + <code value="send-message-http-502"/> + <display value="Sending a message to the remote instance resulted in HTTP status 502."/> + </concept> + <concept> + <code value="send-message-http-unexpected"/> + <display value="Sending a message to the remote instance resulted in an unexpected HTTP status code."/> + </concept> + <concept> + <code value="send-message-ssl-handshake"/> + <display value="Sending a message to the remote instance was unsuccessful because of a failed SSL handshake."/> + </concept> + <concept> + <code value="send-message-connect-timeout"/> + <display value="Sending a message to the remote instance was unsuccessful because of a connection timeout."/> + </concept> + <concept> + <code value="send-message-http-host-connect"/> + <display value="Sending a message to the remote instance was unsuccessful because the connection was refused."/> + </concept> + <concept> + <code value="send-message-unknown-host"/> + <display value="Sending a message to the remote instance was unsuccessful because the target hostname could not be resolved."/> + </concept> + + + <concept> + <code value="receive-message-http-401"/> + <display value="Received a message and responded with HTTP status 401."/> + </concept> + <concept> + <code value="receive-message-http-403"/> + <display value="Received a message and responded with HTTP status 403."/> + </concept> + <concept> + <code value="receive-reference-message-http-403"/> + <display value="Received a message including a reference and responded with HTTP status 403."/> + </concept> + <concept> + <code value="receive-message-http-500"/> + <display value="Received a message and responded with HTTP status 500."/> + </concept> + <concept> + <code value="receive-message-http-502"/> + <display value="Received a message and responded with HTTP status 502."/> + </concept> + <concept> + <code value="receive-message-http-unexpected"/> + <display value="Received a message and responded with an unexpected HTTP status code."/> + </concept> + <concept> + <code value="receive-message-ssl-handshake"/> + <display value="Receiving a message was unsuccessful because of a failed SSL handshake."/> + </concept> + <concept> + <code value="receive-message-connect-timeout"/> + <display value="Receiving a message was unsuccessful because of a connection timeout."/> + </concept> + <concept> + <code value="receive-message-http-host-connect"/> + <display value="Receiving a message was unsuccessful because the connection was refused."/> + </concept> + <concept> + <code value="receive-message-unknown-host"/> + <display value="Receiving a message was unsuccessful because the target hostname could not be resolved."/> + </concept> + + <concept> + <code value="local-binary-delete-timeout"/> + <display value="Local instance ran into a read/connect timeout trying to clean up the binary resource."/> + </concept> + <concept> + <code value="local-binary-delete-http-401"/> + <display value="Local instance ran into a HTTP status 401 trying to clean up the binary resource."/> + </concept> + <concept> + <code value="local-binary-delete-http-403"/> + <display value="Local instance ran into a HTTP status 403 trying to clean up the binary resource."/> + </concept> + <concept> + <code value="local-binary-delete-http-500"/> + <display value="Local instance ran into a HTTP status 500 trying to clean up the binary resource."/> + </concept> + <concept> + <code value="local-binary-delete-http-502"/> + <display value="Local instance ran into a HTTP status 502 trying to clean up the binary resource."/> + </concept> + <concept> + <code value="local-binary-delete-http-unexpected"/> + <display value="Local instance ran into an unexpected HTTP status code trying to clean up the binary resource."/> + </concept> + + <concept> + <code value="remote-binary-delete-timeout"/> + <display value="Remote instance ran into a read/connect timeout trying to clean up the binary resource."/> + </concept> + <concept> + <code value="remote-binary-delete-http-401"/> + <display value="Remote instance ran into a HTTP status 401 trying to clean up the binary resource."/> + </concept> + <concept> + <code value="remote-binary-delete-http-403"/> + <display value="Remote instance ran into a HTTP status 403 trying to clean up the binary resource."/> + </concept> + <concept> + <code value="remote-binary-delete-http-500"/> + <display value="Remote instance ran into a HTTP status 500 trying to clean up the binary resource."/> + </concept> + <concept> + <code value="remote-binary-delete-http-502"/> + <display value="Remote instance ran into a HTTP status 502 trying to clean up the binary resource."/> + </concept> + <concept> + <code value="remote-binary-delete-http-unexpected"/> + <display value="Remote instance ran into an unexpected HTTP status code trying to clean up the binary resource."/> + </concept> + + <concept> + <code value="local-binary-post-http-401"/> + <display value="Local instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server."/> + </concept> + <concept> + <code value="local-binary-post-http-403"/> + <display value="Local instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server."/> + </concept> + <concept> + <code value="local-binary-post-http-500"/> + <display value="Local instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server."/> + </concept> + <concept> + <code value="local-binary-post-http-502"/> + <display value="Local instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server."/> + </concept> + <concept> + <code value="local-binary-post-http-unexpected"/> + <display value="Local instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server."/> + </concept> + <concept> + <code value="local-binary-post-timeout"/> + <display value="Local instance ran into a timeout trying to post the binary resource to its own FHIR server."/> + </concept> + + <concept> + <code value="remote-binary-post-http-401"/> + <display value="Remote instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server."/> + </concept> + <concept> + <code value="remote-binary-post-http-403"/> + <display value="Remote instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server."/> + </concept> + <concept> + <code value="remote-binary-post-http-500"/> + <display value="Remote instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server."/> + </concept> + <concept> + <code value="remote-binary-post-http-502"/> + <display value="Remote instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server."/> + </concept> + <concept> + <code value="remote-binary-post-http-unexpected"/> + <display value="Remote instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server."/> + </concept> + <concept> + <code value="remote-binary-post-timeout"/> + <display value="Remote instance ran into a timeout trying to post the binary resource to its own FHIR server."/> + </concept> + + <concept> + <code value="response-message-timeout-status-requested"/> + <display value="Response message timed out. The status of the request on the target FHIR server is 'requested'"/> + </concept> + <concept> + <code value="response-message-timeout-status-in-progress"/> + <display value="Response message timed out. The status of the request on the target FHIR server is 'in-progress'"/> + </concept> + <concept> + <code value="response-message-timeout-status-failed"/> + <display value="Response message timed out. The status of the request on the target FHIR server is 'failed'"/> + </concept> + <concept> + <code value="response-message-timeout-status-completed"/> + <display value="Response message timed out. The status of the request on the target FHIR server is 'completed'"/> + </concept> + <concept> + <code value="response-message-timeout-status-unexpected"/> + <display value="Response message timed out. The status of the request on the target FHIR server is neither of 'requested', 'in-progress', 'failed' or 'completed'."/> + </concept> + + <concept> + <code value="response-message-timeout-http-401"/> + <display value="Response message timed out. Received HTTP status 401 trying to check request status on the target."/> + </concept> + <concept> + <code value="response-message-timeout-http-403"/> + <display value="Response message timed out. Received HTTP status 403 trying to check request status on the target."/> + </concept> + <concept> + <code value="response-message-timeout-http-500"/> + <display value="Response message timed out. Received HTTP status 500 trying to check request status on the target."/> + </concept> + <concept> + <code value="response-message-timeout-http-502"/> + <display value="Response message timed out. Received HTTP status 502 trying to check request status on the target."/> + </concept> + <concept> + <code value="response-message-timeout-http-unexpected"/> + <display value="Response message timed out. Received an unexpected HTTP status code trying to check request status on the target."/> + </concept> + + <concept> + <code value="cleanup-message-timeout"/> + <display value="Timeout while waiting for cleanup message from remote instance."/> + </concept> + + <concept> + <code value="local-binary-download-io-error"/> + <display value="Local instance encountered an I/O error trying to download the binary resource from the target."/> + </concept> + <concept> + <code value="local-binary-download-http-401"/> + <display value="Local instance received HTTP status 401 trying to download the binary resource from the target."/> + </concept> + <concept> + <code value="local-binary-download-http-403"/> + <display value="Local instance received HTTP status 403 trying to download the binary resource from the target."/> + </concept> + <concept> + <code value="local-binary-download-http-500"/> + <display value="Local instance received HTTP status 500 trying to download the binary resource from the target."/> + </concept> + <concept> + <code value="local-binary-download-http-502"/> + <display value="Local instance received HTTP status 500 trying to download the binary resource from the target."/> + </concept> + <concept> + <code value="local-binary-download-http-unexpected"/> + <display value="Local instance received an unexpected HTTP status trying to download the binary resource from the target."/> + </concept> + <concept> + <code value="local-binary-download-timeout"/> + <display value="Local instance ran into a read/connect timeout trying to download the binary resource from the target."/> + </concept> + <concept> + <code value="local-binary-download-missing-reference"/> + <display value="Local instance was unable to download the binary resource from the target because the reference was missing."/> + </concept> + + <concept> + <code value="remote-binary-download-io-error"/> + <display value="Remote instance encountered an I/O error trying to download the binary resource from this server."/> + </concept> + <concept> + <code value="remote-binary-download-http-401"/> + <display value="Remote instance received HTTP status 401 trying to download the binary resource from this server."/> + </concept> + <concept> + <code value="remote-binary-download-http-403"/> + <display value="Remote instance received HTTP status 403 trying to download the binary resource from this server."/> + </concept> + <concept> + <code value="remote-binary-download-http-500"/> + <display value="Remote instance received HTTP status 500 trying to download the binary resource from this server."/> + </concept> + <concept> + <code value="remote-binary-download-http-502"/> + <display value="Remote instance received HTTP status 500 trying to download the binary resource from this server."/> + </concept> + <concept> + <code value="remote-binary-download-http-unexpected"/> + <display value="Remote instance received an unexpected HTTP status trying to download the binary resource from this server."/> + </concept> + <concept> + <code value="remote-binary-download-timeout"/> + <display value="Remote instance ran into a read/connect timeout trying to download the binary resource from this server."/> + </concept> + <concept> + <code value="remote-binary-download-missing-reference"/> + <display value="Remote instance was unable to download the binary resource from this server because the reference was missing."/> + </concept> + + <concept> + <code value="unknown"/> + <display value="An unknown error was encountered. Consult logs for more details."/> + </concept> +</CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-process-steps.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-process-steps.xml deleted file mode 100644 index 8be176de..00000000 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-process-steps.xml +++ /dev/null @@ -1,139 +0,0 @@ -<CodeSystem xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> - <code value="ALL" /> - </tag> - </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2" /> - <!-- version managed by bpe --> - <version value="#{version}" /> - <name value="DSF_Ping_Process_Steps" /> - <title value="DSF Ping Process Steps" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <!-- date managed by bpe --> - <date value="#{date}" /> - <publisher value="DSF" /> - <description value="CodeSystem with ping/pong process steps" /> - <caseSensitive value="true" /> - <hierarchyMeaning value="grouped-by" /> - <versionNeeded value="false" /> - <content value="complete" /> - <concept> - <code value="set-download-resource-size"/> - <display value="Set Download Resource Size"/> - <definition value="Sets the size of the resource to be downloaded" /> - </concept> - <concept> - <code value="generate-and-store-resource"/> - <display value="Generate And Store Resource"/> - <definition value="Generates the resource for download and posts it to the local DSF FHIR server" /> - </concept> - <concept> - <code value="log-and-save-error"/> - <display value="Log And Save Error"/> - <definition value="Logs an error and saves it as an execution variable" /> - </concept> - <concept> - <code value="select-targets"/> - <display value="Select Targets"/> - <definition value="Selects targets to be pinged" /> - </concept> - <concept> - <code value="ping"/> - <display value="Ping"/> - <definition value="Sends a ping message" /> - </concept> - <concept> - <code value="log-and-save-send-error"/> - <display value="Log And Save Send Error"/> - <definition value="Logs a send error and saves it as an execution variable" /> - </concept> - <concept> - <code value="log-and-save-no-response"/> - <display value="Log And Save No Response"/> - <definition value="Logs and saves that a pong message is missing" /> - </concept> - <concept> - <code value="save-pong"/> - <display value="Save Pong"/> - <definition value="Saves the input parameters of the pong message as execution variables" /> - </concept> - <concept> - <code value="download-resource-and-measure-speed"/> - <display value="Download Resource And Measure Speed"/> - <definition value="Downloads the resource referenced by the input parameter of the previously received message and measures the network speed" /> - </concept> - <concept> - <code value="cleanup-pong"/> - <display value="Cleanup Pong"/> - <definition value="Sends a cleanup message to the pong process" /> - </concept> - <concept> - <code value="cleanup"/> - <display value="cleanup"/> - <definition value="Cleans up the process e.g. by deleting the binary resource that was created to test connections and measure network speed" /> - </concept> - <concept> - <code value="store-results"/> - <display value="Store Results"/> - <definition value="Stores results of the process as output parameters of the start task" /> - </concept> - <concept> - <code value="log-ping"/> - <display value="Log Ping"/> - <definition value="Logs that a ping message was received" /> - </concept> - <concept> - <code value="set-endpoint-identifier"/> - <display value="Set Endpoint Identifier"/> - <definition value="Sets the endpoint identifier from the ping message" /> - </concept> - <concept> - <code value="select-pong-target"/> - <display value="Select Pong Target"/> - <definition value="Selects the target to reply to with a pong message" /> - </concept> - <concept> - <code value="store-download-speed"/> - <display value="Store Download Speed"/> - <definition value="Stores the measured download speed" /> - </concept> - <concept> - <code value="log-and-save-and-store-error"/> - <display value="Log And Save And Store Error"/> - <definition value="Logs and error and saves it as an execution variable and stores it as an output parameter in the start task" /> - </concept> - <concept> - <code value="estimate-cleanup-timer-duration"/> - <display value="Estimate Cleanup Timer Duration"/> - <definition value="Estimates the duration of the cleanup timer" /> - </concept> - <concept> - <code value="pong"/> - <display value="Pong"/> - <definition value="Sends a pong message to the target" /> - </concept> - <concept> - <code value="store-upload-speed"/> - <display value="Store Upload Speed"/> - <definition value="Stores the measured upload speed" /> - </concept> - <concept> - <code value="save-timeout-error"/> - <display value="Save Timeout Error"/> - <definition value="Saves the timeout error while waiting for cleanup message in an execution variable" /> - </concept> - <concept> - <code value="store-errors"/> - <display value="Store Errors"/> - <definition value="Stores all error that are present as execution variables as output parameters of the start task" /> - </concept> - <concept> - <code value="cleanup-timer-catch-event"/> - <display value="Cleanup Timer Catch Event"/> - <definition value="Timeout event while waiting for cleanup message"/> - </concept> -</CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-processes.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-processes.xml deleted file mode 100644 index 28822fc1..00000000 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-processes.xml +++ /dev/null @@ -1,34 +0,0 @@ -<CodeSystem xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> - <code value="ALL" /> - </tag> - </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-processes-v2" /> - <!-- version managed by bpe --> - <version value="#{version}" /> - <name value="DSF_Ping_Processes" /> - <title value="DSF Ping Processes" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <!-- date managed by bpe --> - <date value="#{date}" /> - <publisher value="DSF" /> - <description value="CodeSystem with processes in the ping-pong plugin" /> - <caseSensitive value="true" /> - <hierarchyMeaning value="grouped-by" /> - <versionNeeded value="false" /> - <content value="complete" /> - <concept> - <code value="ping"/> - <display value="Ping"/> - <definition value="Ping process" /> - </concept> - <concept> - <code value="pong"/> - <display value="Pong"/> - <definition value="Pong process" /> - </concept> -</CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml index be51c7f7..6476c0fa 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-error.xml @@ -42,53 +42,20 @@ </discriminator> <rules value="open"/> </slicing> - <min value="4"/> - <max value="5"/> - </element> - <element id="Extension.extension:process"> - <path value="Extension.extension"/> - <sliceName value="process"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:process.url"> - <path value="Extension.extension.url"/> - <fixedUri value="process"/> - </element> - <element id="Extension.extension:process.value[x]"> - <path value="Extension.extension.value[x]"/> <min value="1"/> - <max value="1"/> - <type> - <code value="Coding"/> - </type> + <max value="2"/> </element> - <element id="Extension.extension:process.value[x].system"> - <path value="Extension.extension.value[x].system"/> - <min value="1"/> - <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-processes-v2"/> - </element> - <element id="Extension.extension:process.value[x].code"> - <path value="Extension.extension.value[x].code"/> - <min value="1"/> - <max value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-processes-v2|#{version}"/> - </binding> - </element> - <element id="Extension.extension:process-step"> + <element id="Extension.extension:error"> <path value="Extension.extension"/> - <sliceName value="process-step"/> + <sliceName value="error"/> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:process-step.url"> + <element id="Extension.extension:error.url"> <path value="Extension.extension.url"/> - <fixedUri value="process-step"/> + <fixedUri value="error"/> </element> - <element id="Extension.extension:process-step.value[x]"> + <element id="Extension.extension:error.value[x]"> <path value="Extension.extension.value[x]"/> <min value="1"/> <max value="1"/> @@ -96,38 +63,13 @@ <code value="Coding"/> </type> </element> - <element id="Extension.extension:process-step.value[x].system"> + <element id="Extension.extension:error.value[x].system"> <path value="Extension.extension.value[x].system"/> <min value="1"/> - <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2"/> </element> - <element id="Extension.extension:process-step.value[x].code"> + <element id="Extension.extension:error.value[x].code"> <path value="Extension.extension.value[x].code"/> <min value="1"/> - <max value="1"/> - <binding> - <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-process-steps-v2|#{version}"/> - </binding> - </element> - <element id="Extension.extension:action"> - <path value="Extension.extension"/> - <sliceName value="action"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:action.url"> - <path value="Extension.extension.url"/> - <fixedUri value="action"/> - </element> - <element id="Extension.extension:action.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="string"/> - </type> </element> <element id="Extension.extension:potential-fix"> <path value="Extension.extension"/> @@ -147,24 +89,6 @@ <code value="url"/> </type> </element> - <element id="Extension.extension:message"> - <path value="Extension.extension"/> - <sliceName value="message"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:message.url"> - <path value="Extension.extension.url"/> - <fixedUri value="message"/> - </element> - <element id="Extension.extension:message.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <max value="1"/> - <type> - <code value="string"/> - </type> - </element> <element id="Extension.url"> <path value="Extension.url"/> <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-error"/> diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-process-steps.xml b/src/main/resources/fhir/ValueSet/dsf-ping-process-steps.xml deleted file mode 100644 index bfc215a9..00000000 --- a/src/main/resources/fhir/ValueSet/dsf-ping-process-steps.xml +++ /dev/null @@ -1,27 +0,0 @@ -<ValueSet xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> - <code value="ALL" /> - </tag> - </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping-process-steps-v2" /> - <!-- version managed by bpe --> - <version value="#{version}" /> - <name value="DSF_Ping_Process_Steps" /> - <title value="DSF Ping Process Steps" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <!-- date managed by bpe --> - <date value="#{date}" /> - <publisher value="DSF" /> - <description value="ValueSet with ping/pong process steps" /> - <immutable value="true" /> - <compose> - <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-process-steps-v2" /> - <version value="#{version}" /> - </include> - </compose> -</ValueSet> \ No newline at end of file diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-processes.xml b/src/main/resources/fhir/ValueSet/dsf-ping-processes.xml deleted file mode 100644 index afc3919c..00000000 --- a/src/main/resources/fhir/ValueSet/dsf-ping-processes.xml +++ /dev/null @@ -1,27 +0,0 @@ -<ValueSet xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag" /> - <code value="ALL" /> - </tag> - </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping-processes-v2" /> - <!-- version managed by bpe --> - <version value="#{version}" /> - <name value="DSF_Ping_Processes" /> - <title value="DSF Ping Processes" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <!-- date managed by bpe --> - <date value="#{date}" /> - <publisher value="DSF" /> - <description value="ValueSet with processes in the ping-pong plugin" /> - <immutable value="true" /> - <compose> - <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-processes-v2" /> - <version value="#{version}" /> - </include> - </compose> -</ValueSet> \ No newline at end of file diff --git a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java index 8148ddd9..55e289ab 100644 --- a/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java +++ b/src/test/java/dev/dsf/bpe/PingProcessPluginDefinitionTest.java @@ -20,7 +20,7 @@ public void testResourceLoading() throws Exception var ping = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING); assertNotNull(ping); - assertEquals(16, ping.stream().filter(this::exists).count()); + assertEquals(13, ping.stream().filter(this::exists).count()); var pingAutostart = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART); assertNotNull(pingAutostart); @@ -28,7 +28,7 @@ public void testResourceLoading() throws Exception var pong = resourcesByProcessId.get(ConstantsPing.PROCESS_NAME_FULL_PONG); assertNotNull(pong); - assertEquals(13, pong.stream().filter(this::exists).count()); + assertEquals(10, pong.stream().filter(this::exists).count()); } private boolean exists(String file) diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 489e6973..43ebf6e2 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -64,12 +64,10 @@ public class TaskProfileTest "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", - "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-ping-process-steps.xml", - "dsf-ping-processes.xml"), + "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml", "dsf-pong-status-1_0.xml", - "dsf-pong-status.xml", "dsf-network-speed-units.xml", "dsf-ping-process-steps.xml", - "dsf-ping-processes.xml")); + "dsf-pong-status.xml", "dsf-network-speed-units.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); @@ -216,8 +214,8 @@ private List<ProcessError> processErrors(int amount) List<ProcessError> errors = new ArrayList<>(); for (int i = 0; i < amount; i++) { - errors.add(new ProcessError(CodeSystem.DsfPingProcesses.Code.PING, CodeSystem.DsfPingProcessSteps.Code.PING, - UUID.randomUUID().toString(), null, UUID.randomUUID().toString())); + CodeSystem.DsfPingError.Concept[] concepts = CodeSystem.DsfPingError.Concept.values(); + errors.add(new ProcessError(ConstantsPing.PROCESS_NAME_PING, concepts[i % concepts.length], null)); } return errors; } diff --git a/src/test/java/dev/dsf/library/ProcessErrorTest.java b/src/test/java/dev/dsf/library/ProcessErrorTest.java index 6d30574b..6b870867 100644 --- a/src/test/java/dev/dsf/library/ProcessErrorTest.java +++ b/src/test/java/dev/dsf/library/ProcessErrorTest.java @@ -16,45 +16,27 @@ public class ProcessErrorTest { private static final String testString = "foo"; - private static final CodeSystem.DsfPingProcesses.Code testProcess = CodeSystem.DsfPingProcesses.Code.PING; - private static final CodeSystem.DsfPingProcessSteps.Code testStep = CodeSystem.DsfPingProcessSteps.Code.CHECK_PING_TASK_STATUS; + private static final String testProcess = ConstantsPing.PROCESS_NAME_PING; + private static final CodeSystem.DsfPingError.Concept testConcept = CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_401; @Test public void ExtensionToErrorTest() { - ProcessError expected = new ProcessError(testProcess, testStep, testString, testString, testString); - assertEquals(expected, ProcessError.toError(getExtensionFull())); + ProcessError expected = new ProcessError(testProcess, testConcept, testString); + assertEquals(expected, ProcessError.toError(getExtensionFull(), testProcess)); } @Test public void ExtensionWithoutFixUrlToErrorTest() { - ProcessError expected = new ProcessError(testProcess, testStep, testString, null, testString); - assertEquals(expected, ProcessError.toError(getExtensionMissingFixUrl())); + ProcessError expected = new ProcessError(testProcess, testConcept, null); + assertEquals(expected, ProcessError.toError(getExtensionMissingFixUrl(), testProcess)); } @Test - public void ExtensionWithoutProcessToErrorTest() + public void ExtensionWithoutErrorToErrorTest() { - assertThrows(NullPointerException.class, () -> ProcessError.toError(getExtensionMissingProcess())); - } - - @Test - public void ExtensionWithoutProcessStepToErrorTest() - { - assertThrows(NullPointerException.class, () -> ProcessError.toError(getExtensionMissingProcessStep())); - } - - @Test - public void ExtensionWithoutActionToErrorTest() - { - assertThrows(NullPointerException.class, () -> ProcessError.toError(getExtensionMissingAction())); - } - - @Test - public void ExtensionWithoutMessageToErrorTest() - { - assertThrows(NullPointerException.class, () -> ProcessError.toError(getExtensionMissingMessage())); + assertThrows(NullPointerException.class, () -> ProcessError.toError(getExtensionMissingError(), testProcess)); } @@ -63,13 +45,10 @@ private Extension getExtensionFull() Extension extension = new Extension(); extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, testProcess.getValue(), null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, testStep.getValue(), null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ERROR) + .setValue(new Coding().setSystem(CodeSystem.DsfPingError.URL).setCode(testConcept.getCode()) + .setDisplay(testConcept.getDisplay())); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); return extension; } @@ -79,69 +58,18 @@ private Extension getExtensionMissingFixUrl() Extension extension = new Extension(); extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, testProcess.getValue(), null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, testStep.getValue(), null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); - - return extension; - } - - private Extension getExtensionMissingProcess() - { - Extension extension = new Extension(); - extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); - - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, testString, null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); - - return extension; - } - - private Extension getExtensionMissingProcessStep() - { - Extension extension = new Extension(); - extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); - - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, testString, null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); - - return extension; - } - - private Extension getExtensionMissingAction() - { - Extension extension = new Extension(); - extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); - - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, testString, null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, testString, null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_MESSAGE).setValue(new StringType(testString)); + extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ERROR) + .setValue(new Coding().setSystem(CodeSystem.DsfPingError.URL).setCode(testConcept.getCode()) + .setDisplay(testConcept.getDisplay())); return extension; } - private Extension getExtensionMissingMessage() + private Extension getExtensionMissingError() { Extension extension = new Extension(); extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS) - .setValue(new Coding(CodeSystem.DsfPingProcesses.URL, testString, null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_PROCESS_STEP) - .setValue(new Coding(CodeSystem.DsfPingProcessSteps.URL, testString, null)); - extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ACTION).setValue(new StringType(testString)); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX).setValue(new UrlType(testString)); return extension; From 330cce90bb07cbcac202d76bde14bdb8b4df5be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 8 Sep 2025 17:18:21 +0200 Subject: [PATCH 357/382] Added resource version to all Codings: - Added resource version to PingProcessPluginDefinition - CodeSystems now include a method that returns a Coding based on a provided Code which always includes the resource version from the PingProcessPluginDefinition - Refactored uses of new Coding initialization to use the methods provided by the respective CodeSystem instead --- src/main/java/dev/dsf/bpe/CodeSystem.java | 36 ++++++++++++++++++- .../dsf/bpe/PingProcessPluginDefinition.java | 10 +++++- src/main/java/dev/dsf/bpe/ProcessError.java | 5 ++- .../DownloadResourceReferenceGenerator.java | 4 +-- .../DownloadResourceSizeGenerator.java | 3 +- .../ErrorInputComponentGenerator.java | 2 +- .../output/generator/PingStatusGenerator.java | 28 ++++++++------- 7 files changed, 65 insertions(+), 23 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index 9d1b1678..c3e48e19 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -6,6 +6,8 @@ import java.util.HashMap; import java.util.Map; +import org.hl7.fhir.r4.model.Coding; + public final class CodeSystem { private CodeSystem() @@ -46,7 +48,6 @@ public T ofValue(String value) } } - public static final class DsfPing { public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-v2"; @@ -55,6 +56,14 @@ private DsfPing() { } + public static Coding fromCode(Code code) + { + return new Coding() + .setSystem(URL) + .setCode(code.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); + } + public enum Code implements SingleStringValueEnum { PING_STATUS("ping-status"), @@ -95,6 +104,14 @@ private DsfPingStatus() { } + public static Coding fromCode(Code code) + { + return new Coding() + .setSystem(URL) + .setCode(code.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); + } + public enum Code implements SingleStringValueEnum { COMPLETED("completed"), @@ -129,6 +146,14 @@ private DsfPingUnits() { } + public static Coding fromCode(Code code) + { + return new Coding() + .setSystem(URL) + .setCode(code.toUcum()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); + } + public enum Code { bps @@ -320,6 +345,15 @@ private DsfPingError() { } + public static Coding fromConcept(Concept concept) + { + return new Coding() + .setSystem(URL) + .setCode(concept.getCode()) + .setDisplay(concept.getDisplay()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); + } + public enum Concept { SEND_MESSAGE_HTTP_401( diff --git a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java index f5380e1f..e2f1d5c4 100644 --- a/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java +++ b/src/main/java/dev/dsf/bpe/PingProcessPluginDefinition.java @@ -10,7 +10,9 @@ public class PingProcessPluginDefinition implements ProcessPluginDefinition { - public static final String VERSION = "2.0.0.0"; + public static final String RESOURCE_VERSION = "2.0"; + public static final String NON_RESOURCE_VERSION = "0.0"; + public static final String VERSION = RESOURCE_VERSION + "." + NON_RESOURCE_VERSION; public static final LocalDate RELEASE_DATE = LocalDate.of(2023, 9, 12); @Override @@ -25,6 +27,12 @@ public String getVersion() return VERSION; } + @Override + public String getResourceVersion() + { + return RESOURCE_VERSION; + } + @Override public LocalDate getReleaseDate() { diff --git a/src/main/java/dev/dsf/bpe/ProcessError.java b/src/main/java/dev/dsf/bpe/ProcessError.java index 4a19c9fa..17a5a8c7 100644 --- a/src/main/java/dev/dsf/bpe/ProcessError.java +++ b/src/main/java/dev/dsf/bpe/ProcessError.java @@ -25,8 +25,7 @@ public static Extension toExtension(ProcessError error) extension.setUrl(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_ERROR); extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_ERROR) - .setValue(new Coding().setSystem(CodeSystem.DsfPingError.URL).setCode(error.concept.getCode()) - .setDisplay(error.concept.getDisplay())); + .setValue(CodeSystem.DsfPingError.fromConcept(error.concept())); if (Objects.nonNull(error.potentialFixUrl)) { extension.addExtension().setUrl(ConstantsPing.EXTENSION_URL_POTENTIAL_FIX) @@ -62,7 +61,7 @@ public static Task.TaskOutputComponent toTaskOutput(ProcessError error) { Task.TaskOutputComponent param = new Task.TaskOutputComponent(); - param.getType().addCoding(new Coding(CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.ERROR.getValue(), null)); + param.getType().addCoding(CodeSystem.DsfPing.fromCode(CodeSystem.DsfPing.Code.ERROR)); param.addExtension(ProcessError.toExtension(error)); Extension dataAbsentReason = new Extension() .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java index 82135bdd..626645b5 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java @@ -5,6 +5,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.PingProcessPluginDefinition; public final class DownloadResourceReferenceGenerator { @@ -17,8 +18,7 @@ public static Task.ParameterComponent create(String uri) Reference reference = new Reference(uri); reference.setType("Binary"); Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(reference).getType().addCoding(new Coding(CodeSystem.DsfPing.URL, - CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_REFERENCE.getValue(), null)); + param.setValue(reference).getType().addCoding(CodeSystem.DsfPing.fromCode(CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_REFERENCE)); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java index 48c91381..6337dfa2 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java @@ -15,8 +15,7 @@ private DownloadResourceSizeGenerator() public static Task.ParameterComponent create(long sizeBytes) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(new DecimalType(sizeBytes)).getType().addCoding(new Coding(CodeSystem.DsfPing.URL, - CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue(), null)); + param.setValue(new DecimalType(sizeBytes)).getType().addCoding(CodeSystem.DsfPing.fromCode(CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES)); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java index 5ee726cc..a17c10e6 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java @@ -29,7 +29,7 @@ public static Task.ParameterComponent create(ProcessError error) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.getType().addCoding(new Coding(CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.ERROR.getValue(), null)); + param.getType().addCoding(CodeSystem.DsfPing.fromCode(CodeSystem.DsfPing.Code.ERROR)); param.addExtension(ProcessError.toExtension(error)); Extension dataAbsentReason = new Extension() .setUrl("http://hl7.org/fhir/StructureDefinition/data-absent-reason") diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index da8de4bd..94ab49c3 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -17,6 +17,7 @@ import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.PingProcessPluginDefinition; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier; import dev.dsf.bpe.v1.constants.NamingSystems.OrganizationIdentifier; @@ -101,11 +102,11 @@ private static TaskOutputComponent updatePongStatusOutput(TaskOutputComponent ou { if (hasStatusCodeSet(outputComponent)) { - updateStatus(outputComponent, CodeSystem.DsfPing.Code.PONG_STATUS.getValue(), statusCode.getValue()); + updateStatus(outputComponent, CodeSystem.DsfPing.Code.PONG_STATUS.getValue(), statusCode); } else { - addStatus(outputComponent, CodeSystem.DsfPing.Code.PONG_STATUS.getValue(), statusCode.getValue()); + addStatus(outputComponent, CodeSystem.DsfPing.Code.PONG_STATUS, statusCode); } return outputComponent; @@ -261,7 +262,7 @@ private static boolean hasDownloadSpeedSet(TaskOutputComponent outputComponent) public static TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors) { - return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS.getValue(), statusCode.getValue(), errors, + return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS, statusCode, errors, null, null, null, null, null); } @@ -269,18 +270,18 @@ public static TaskOutputComponent createPingStatusOutput(Target target, CodeSyst List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, CodeSystem.DsfPingUnits.Code unit) { - return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS.getValue(), statusCode.getValue(), errors, + return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS, statusCode, errors, downloadSpeed, uploadSpeed, unit.name(), CODESYSTEM_UCUM, unit.toUcum()); } public static TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors) { - return createStatusOutput(target, CodeSystem.DsfPing.Code.PONG_STATUS.getValue(), statusCode.getValue(), errors, + return createStatusOutput(target, CodeSystem.DsfPing.Code.PONG_STATUS, statusCode, errors, null, null, null, null, null); } - private static TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, + private static TaskOutputComponent createStatusOutput(Target target, CodeSystem.DsfPing.Code outputParameter, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit, String unitSystem, String unitCode) { @@ -293,13 +294,13 @@ private static TaskOutputComponent createStatusOutput(Target target, String outp return output; } - private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent, String outputParameter, - String statusCode) + private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent, CodeSystem.DsfPing.Code outputParameter, + CodeSystem.DsfPingStatus.Code statusCode) { if (outputParameter != null && statusCode != null) { - outputComponent.setValue(new Coding().setSystem(CodeSystem.DsfPingStatus.URL).setCode(statusCode)); - outputComponent.getType().addCoding().setSystem(CodeSystem.DsfPing.URL).setCode(outputParameter); + outputComponent.setValue(CodeSystem.DsfPingStatus.fromCode(statusCode)); + outputComponent.getType().addCoding(CodeSystem.DsfPing.fromCode(outputParameter)); sortStatusOutputExtensions(outputComponent); } @@ -307,16 +308,17 @@ private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent } private static TaskOutputComponent updateStatus(TaskOutputComponent outputComponent, String outputParameter, - String statusCode) + CodeSystem.DsfPingStatus.Code statusCode) { Type valueType = outputComponent.getValue(); if (valueType instanceof Coding coding) { - coding.setSystem(CodeSystem.DsfPingStatus.URL).setCode(statusCode); + coding.setSystem(CodeSystem.DsfPingStatus.URL).setCode(statusCode.getValue()).setVersion( + PingProcessPluginDefinition.RESOURCE_VERSION); } else { - outputComponent.setValue(new Coding().setSystem(CodeSystem.DsfPingStatus.URL).setCode(statusCode)); + outputComponent.setValue(CodeSystem.DsfPingStatus.fromCode(statusCode)); } List<Coding> outputTypeCodings = outputComponent.getType().getCoding(); From 643648b59eee4d6fb89c9144caf5fb56a983867a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 9 Sep 2025 09:32:02 +0200 Subject: [PATCH 358/382] Removed method that will never get used as there is no scenario where errors need to be communicated remotely after failing to send the pong message in the pong process --- .../java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index 6d248e4e..3793faa0 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -35,11 +35,6 @@ public static ProcessError convertLocal(Exception exception, boolean messageWith return convert(exception, ErrorType.LOCAL, messageWithReference, process); } - public static ProcessError convertRemote(Exception exception, boolean messageWithReference, String process) - { - return convert(exception, ErrorType.REMOTE, messageWithReference, process); - } - private static ProcessError convert(Exception exception, ErrorType errorType, boolean messageWithReference, String process) { From 28d4b056d4b3dd9ef6ea5129e60385afb3a51c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 9 Sep 2025 09:32:51 +0200 Subject: [PATCH 359/382] Format --- .../DownloadResourceReferenceGenerator.java | 3 ++- .../DownloadResourceSizeGenerator.java | 3 ++- .../output/generator/PingStatusGenerator.java | 26 +++++++++---------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java index 626645b5..33a41277 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java @@ -18,7 +18,8 @@ public static Task.ParameterComponent create(String uri) Reference reference = new Reference(uri); reference.setType("Binary"); Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(reference).getType().addCoding(CodeSystem.DsfPing.fromCode(CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_REFERENCE)); + param.setValue(reference).getType() + .addCoding(CodeSystem.DsfPing.fromCode(CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_REFERENCE)); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java index 6337dfa2..f899b42f 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java @@ -15,7 +15,8 @@ private DownloadResourceSizeGenerator() public static Task.ParameterComponent create(long sizeBytes) { Task.ParameterComponent param = new Task.ParameterComponent(); - param.setValue(new DecimalType(sizeBytes)).getType().addCoding(CodeSystem.DsfPing.fromCode(CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES)); + param.setValue(new DecimalType(sizeBytes)).getType() + .addCoding(CodeSystem.DsfPing.fromCode(CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES)); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 94ab49c3..db929738 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -262,28 +262,28 @@ private static boolean hasDownloadSpeedSet(TaskOutputComponent outputComponent) public static TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors) { - return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS, statusCode, errors, - null, null, null, null, null); + return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS, statusCode, errors, null, null, null, + null, null); } public static TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, CodeSystem.DsfPingUnits.Code unit) { - return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS, statusCode, errors, - downloadSpeed, uploadSpeed, unit.name(), CODESYSTEM_UCUM, unit.toUcum()); + return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS, statusCode, errors, downloadSpeed, + uploadSpeed, unit.name(), CODESYSTEM_UCUM, unit.toUcum()); } public static TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors) { - return createStatusOutput(target, CodeSystem.DsfPing.Code.PONG_STATUS, statusCode, errors, - null, null, null, null, null); + return createStatusOutput(target, CodeSystem.DsfPing.Code.PONG_STATUS, statusCode, errors, null, null, null, + null, null); } - private static TaskOutputComponent createStatusOutput(Target target, CodeSystem.DsfPing.Code outputParameter, CodeSystem.DsfPingStatus.Code statusCode, - List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, String unit, String unitSystem, - String unitCode) + private static TaskOutputComponent createStatusOutput(Target target, CodeSystem.DsfPing.Code outputParameter, + CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors, BigDecimal downloadSpeed, + BigDecimal uploadSpeed, String unit, String unitSystem, String unitCode) { TaskOutputComponent output = new TaskOutputComponent(); addStatus(output, outputParameter, statusCode); @@ -294,8 +294,8 @@ private static TaskOutputComponent createStatusOutput(Target target, CodeSystem. return output; } - private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent, CodeSystem.DsfPing.Code outputParameter, - CodeSystem.DsfPingStatus.Code statusCode) + private static TaskOutputComponent addStatus(TaskOutputComponent outputComponent, + CodeSystem.DsfPing.Code outputParameter, CodeSystem.DsfPingStatus.Code statusCode) { if (outputParameter != null && statusCode != null) { @@ -313,8 +313,8 @@ private static TaskOutputComponent updateStatus(TaskOutputComponent outputCompon Type valueType = outputComponent.getValue(); if (valueType instanceof Coding coding) { - coding.setSystem(CodeSystem.DsfPingStatus.URL).setCode(statusCode.getValue()).setVersion( - PingProcessPluginDefinition.RESOURCE_VERSION); + coding.setSystem(CodeSystem.DsfPingStatus.URL).setCode(statusCode.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); } else { From 3773e4f07457f6ae3c6e8edd2aa40d4e49a34ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 9 Sep 2025 18:00:16 +0200 Subject: [PATCH 360/382] - No longer displays network speeds of 0 units - The CodeSystem dsf-ping-status now contains the codes from version 1.0 of the plugin again, meaning the old semantics of the ping and pong status fields have been restored. HTTP status codes 401 and 403 have been mapped to code "not-allowed." All other types or errors are mapped to "not-reachable" as its description was the most fitting target for a catch-all rule for failed requests. Exact error codes with potential fix URLs are still listed in the extension --- src/main/java/dev/dsf/bpe/CodeSystem.java | 25 +- .../dsf/bpe/message/CleanupPongMessage.java | 8 +- .../dev/dsf/bpe/message/SendPingMessage.java | 13 +- .../dev/dsf/bpe/message/SendPongMessage.java | 14 +- .../bpe/service/ping/CheckPingTaskStatus.java | 6 + .../bpe/service/ping/LogAndSaveSendError.java | 12 +- .../dev/dsf/bpe/service/ping/SavePong.java | 3 + .../dsf/bpe/service/ping/StoreResults.java | 4 +- .../bpe/service/pong/StoreDownloadSpeed.java | 1 - .../dev/dsf/bpe/service/pong/StoreErrors.java | 12 +- .../dev/dsf/bpe/spring/config/PingConfig.java | 6 + .../bpe/util/task/SendTaskErrorConverter.java | 336 +++++++++++------- .../codesystem/dsfpingstatus/CodeValue.java | 9 + .../dsfpingstatus/CodeValueImpl.java | 21 ++ .../dsfpingstatus/CodeValueSerializer.java | 18 + .../dsfpingstatus/CodeValueTypeImpl.java | 31 ++ src/main/resources/bpe/ping.bpmn | 2 +- src/main/resources/bpe/pong.bpmn | 2 +- .../fhir/CodeSystem/dsf-ping-status.xml | 28 +- .../fhir/ValueSet/dsf-ping-status.xml | 12 + .../fhir/ValueSet/dsf-pong-status.xml | 9 + .../dsf/fhir/profiles/TaskProfileTest.java | 8 +- 22 files changed, 393 insertions(+), 187 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValue.java create mode 100644 src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueImpl.java create mode 100644 src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueSerializer.java create mode 100644 src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueTypeImpl.java diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index c3e48e19..f8472dad 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -58,9 +58,7 @@ private DsfPing() public static Coding fromCode(Code code) { - return new Coding() - .setSystem(URL) - .setCode(code.getValue()) + return new Coding().setSystem(URL).setCode(code.getValue()) .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); } @@ -106,17 +104,17 @@ private DsfPingStatus() public static Coding fromCode(Code code) { - return new Coding() - .setSystem(URL) - .setCode(code.getValue()) + return new Coding().setSystem(URL).setCode(code.getValue()) .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); } public enum Code implements SingleStringValueEnum { - COMPLETED("completed"), - PENDING("pending"), - ERROR("error"); + NOT_ALLOWED("not-allowed"), + NOT_REACHABLE("not-reachable"), + PONG_MISSING("pong-missing"), + PONG_RECEIVED("pong-received"), + PONG_SENT("pong-send"); private final String value; @@ -148,9 +146,7 @@ private DsfPingUnits() public static Coding fromCode(Code code) { - return new Coding() - .setSystem(URL) - .setCode(code.toUcum()) + return new Coding().setSystem(URL).setCode(code.toUcum()) .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); } @@ -347,10 +343,7 @@ private DsfPingError() public static Coding fromConcept(Concept concept) { - return new Coding() - .setSystem(URL) - .setCode(concept.getCode()) - .setDisplay(concept.getDisplay()) + return new Coding().setSystem(URL).setCode(concept.getCode()).setDisplay(concept.getDisplay()) .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); } diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 2f359978..536d642d 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -55,12 +55,14 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab String errorMessage) { Target target = variables.getTarget(); - ProcessError error = SendTaskErrorConverter.convertLocal(exception, false, ConstantsPing.PROCESS_NAME_PING); + SendTaskErrorConverter.ProcessErrorWithStatusCode errorAndStatus = SendTaskErrorConverter + .convertLocal(exception, false, ConstantsPing.PROCESS_NAME_PING); - execution.setVariableLocal(ExecutionVariables.error.name(), new ProcessErrorValueImpl(error)); + execution.setVariableLocal(ExecutionVariables.error.name(), new ProcessErrorValueImpl(errorAndStatus.error())); execution.setVariableLocal(ExecutionVariables.statusCode.name(), CodeSystem.DsfPing.Code.ERROR.getValue()); - logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.concept().getDisplay()); + logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), + errorAndStatus.error().concept().getDisplay()); } @Override diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index ae77bcc6..02f70479 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -15,7 +15,6 @@ import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; -import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; @@ -23,6 +22,7 @@ import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.codesystem.dsfpingstatus.CodeValueImpl; import dev.dsf.bpe.variables.process_error.ProcessErrorValueImpl; import dev.dsf.fhir.client.FhirWebserviceClient; @@ -79,12 +79,15 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab String errorMessage) { Target target = variables.getTarget(); - ProcessError error = SendTaskErrorConverter.convertLocal(exception, true, ConstantsPing.PROCESS_NAME_PING); + SendTaskErrorConverter.ProcessErrorWithStatusCode errorAndStatus = SendTaskErrorConverter + .convertLocal(exception, true, ConstantsPing.PROCESS_NAME_PING); - execution.setVariableLocal(ExecutionVariables.error.name(), new ProcessErrorValueImpl(error)); - execution.setVariableLocal(ExecutionVariables.statusCode.name(), CodeSystem.DsfPing.Code.ERROR.getValue()); + execution.setVariableLocal(ExecutionVariables.error.name(), new ProcessErrorValueImpl(errorAndStatus.error())); + execution.setVariableLocal(ExecutionVariables.statusCode.name(), + new CodeValueImpl(errorAndStatus.statusCode())); - logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.concept().getDisplay()); + logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), + errorAndStatus.error().concept().getDisplay()); } @Override diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index 7da39fc3..a77b0f1c 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -26,6 +26,7 @@ import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.codesystem.dsfpingstatus.CodeValueImpl; public class SendPongMessage extends AbstractTaskMessageSend { @@ -87,6 +88,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw { Target target = variables.getTarget(); Task mainTask = variables.getStartTask(); + variables.setVariable(ExecutionVariables.statusCode.name(), + new CodeValueImpl(CodeSystem.DsfPingStatus.Code.PONG_SENT)); PingStatusGenerator.updatePongStatusOutput(mainTask, target); variables.updateTask(mainTask); super.doExecute(execution, variables); @@ -99,13 +102,14 @@ protected void handleSendTaskError(DelegateExecution execution, Variables variab Target target = variables.getTarget(); Task startTask = variables.getStartTask(); - ProcessError error = SendTaskErrorConverter.convertLocal(exception, true, ConstantsPing.PROCESS_NAME_PONG); + SendTaskErrorConverter.ProcessErrorWithStatusCode errorAndStatus = SendTaskErrorConverter + .convertLocal(exception, true, ConstantsPing.PROCESS_NAME_PONG); - ErrorListUtils.add(error, execution); - PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.ERROR); - variables.setString(ExecutionVariables.statusCode.name(), CodeSystem.DsfPing.Code.ERROR.getValue()); + ErrorListUtils.add(errorAndStatus.error(), execution); + variables.setVariable(ExecutionVariables.statusCode.name(), new CodeValueImpl(errorAndStatus.statusCode())); variables.updateTask(startTask); - logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), error.concept().getDisplay()); + logger.info("Request to {} resulted in error: {}", target.getEndpointUrl(), + errorAndStatus.error().concept().getDisplay()); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java index a55b807b..5504ed02 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java +++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java @@ -17,6 +17,7 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.codesystem.dsfpingstatus.CodeValueImpl; import dev.dsf.fhir.client.FhirWebserviceClient; import jakarta.ws.rs.WebApplicationException; @@ -65,6 +66,11 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable ProcessError error = getProcessError(e); ErrorListUtils.add(error, delegateExecution, correlationKey); } + finally + { + variables.setVariable(ExecutionVariables.statusCode.correlatedValue(correlationKey), + new CodeValueImpl(CodeSystem.DsfPingStatus.Code.PONG_MISSING)); + } logger.debug("Saved '{}' to process execution for correlation key '{}'", CodeSystem.DsfPing.Code.ERROR.getValue(), correlationKey); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index b6e52f31..5e0bd097 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -1,19 +1,21 @@ package dev.dsf.bpe.service.ping; import java.time.Duration; +import java.util.Objects; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.v1.ProcessPluginApi; import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Variables; -import dev.dsf.bpe.variables.duration.DurationValueImpl; +import dev.dsf.bpe.variables.codesystem.dsfpingstatus.CodeValueImpl; public class LogAndSaveSendError extends AbstractServiceDelegate { @@ -29,10 +31,12 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw { String correlationKey = variables.getTarget().getCorrelationKey(); ProcessError error = (ProcessError) execution.getVariableLocal(ExecutionVariables.error.name()); + CodeSystem.DsfPingStatus.Code status = (CodeSystem.DsfPingStatus.Code) execution + .getVariableLocal(ExecutionVariables.statusCode.name()); + Objects.requireNonNull(status, "status"); + ErrorListUtils.add(error, execution, correlationKey); - variables.setLong(ExecutionVariables.uploadedBytes.correlatedValue(correlationKey), 0L); - variables.setVariable(ExecutionVariables.uploadedDuration.correlatedValue(correlationKey), - new DurationValueImpl(Duration.ZERO)); + variables.setVariable(ExecutionVariables.statusCode.correlatedValue(correlationKey), new CodeValueImpl(status)); logger.debug("Saved error when trying to send ping message. Error message: {}", error.concept().getDisplay()); } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java index db90d544..9e940c75 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SavePong.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SavePong.java @@ -21,6 +21,7 @@ import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; import dev.dsf.bpe.v1.variables.Target; import dev.dsf.bpe.v1.variables.Variables; +import dev.dsf.bpe.variables.codesystem.dsfpingstatus.CodeValueImpl; import dev.dsf.bpe.variables.duration.DurationValueImpl; public class SavePong extends AbstractServiceDelegate @@ -59,6 +60,8 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable ProcessErrors errorList = new ProcessErrors(parseInputs(pong)); ErrorListUtils.addAll(errorList, delegateExecution, correlationKey); + variables.setVariable(ExecutionVariables.statusCode.correlatedValue(correlationKey), + new CodeValueImpl(CodeSystem.DsfPingStatus.Code.PONG_RECEIVED)); logger.debug("Saved pong information."); } diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 1f633f7e..d37f0097 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -66,8 +66,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw String correlationKey = target.getCorrelationKey(); ProcessErrors errors = ErrorListUtils.getErrorList(execution, correlationKey); - CodeSystem.DsfPingStatus.Code statusCode = errors.isEmpty() ? CodeSystem.DsfPingStatus.Code.COMPLETED - : CodeSystem.DsfPingStatus.Code.ERROR; + CodeSystem.DsfPingStatus.Code statusCode = (CodeSystem.DsfPingStatus.Code) variables + .getVariable(ExecutionVariables.statusCode.correlatedValue(correlationKey)); long downloadResourceSizeBytes = variables.getLong(ExecutionVariables.downloadResourceSizeBytes.name()); if (downloadResourceSizeBytes >= 0) // if fat-ping { diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 0bf539e0..c4e0b177 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -38,7 +38,6 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw BigDecimal downloadSpeed = networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration); - PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.PENDING); PingStatusGenerator.updatePongStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); variables.updateTask(startTask); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java index c7da456a..d1e75772 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreErrors.java @@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ExecutionVariables; import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.util.ErrorListUtils; import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; @@ -32,14 +33,9 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw ProcessErrors errors = ErrorListUtils.getErrorList(execution); PingStatusGenerator.updatePongStatusOutput(startTask, errors.getEntries()); - if (!errors.isEmpty()) - { - PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.ERROR); - } - else - { - PingStatusGenerator.updatePongStatusOutput(startTask, CodeSystem.DsfPingStatus.Code.COMPLETED); - } + CodeSystem.DsfPingStatus.Code status = (CodeSystem.DsfPingStatus.Code) variables + .getVariable(ExecutionVariables.statusCode.name()); + PingStatusGenerator.updatePongStatusOutput(startTask, status); variables.updateTask(startTask); logger.debug("Stored errors in task: " + startTask.getIdElement().getValue()); diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 9df90528..e5344921 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -313,6 +313,12 @@ public LogAndSaveUploadErrorPong logAndSaveUploadErrorPong() return new LogAndSaveUploadErrorPong(api); } + @Bean + public dev.dsf.bpe.variables.codesystem.dsfpingstatus.CodeValueSerializer pingStatusCodeSerializer() + { + return new dev.dsf.bpe.variables.codesystem.dsfpingstatus.CodeValueSerializer(); + } + @Bean public DurationValueSerializer durationValueSerializer( @Qualifier(OBJECT_MAPPER_WITH_TIME_MODULE) ObjectMapper objectMapper) diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index 3793faa0..cd588813 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -30,13 +30,18 @@ private enum ErrorType REMOTE } - public static ProcessError convertLocal(Exception exception, boolean messageWithReference, String process) + public record ProcessErrorWithStatusCode(ProcessError error, CodeSystem.DsfPingStatus.Code statusCode) { - return convert(exception, ErrorType.LOCAL, messageWithReference, process); } - private static ProcessError convert(Exception exception, ErrorType errorType, boolean messageWithReference, + public static ProcessErrorWithStatusCode convertLocal(Exception exception, boolean messageWithReference, String process) + { + return convert(exception, ErrorType.LOCAL, messageWithReference, process); + } + + private static ProcessErrorWithStatusCode convert(Exception exception, ErrorType errorType, + boolean messageWithReference, String process) { if (exception instanceof WebApplicationException e) { @@ -92,30 +97,38 @@ else if (exception instanceof ProcessingException e) } } - private static ProcessError convertSSLHandshakeException(ErrorType errorType, String process) + private static ProcessErrorWithStatusCode convertSSLHandshakeException(ErrorType errorType, String process) { if (ConstantsPing.PROCESS_NAME_PING.equals(process)) { return switch (errorType) { - case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_SSL_HANDSHAKE, - ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL); - case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_SSL_HANDSHAKE, - ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL); + case LOCAL -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_SSL_HANDSHAKE, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case REMOTE -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_SSL_HANDSHAKE, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) { return switch (errorType) { - case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_SSL_HANDSHAKE, - ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL); - case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_SSL_HANDSHAKE, - ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL); + case LOCAL -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_SSL_HANDSHAKE, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case REMOTE -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_SSL_HANDSHAKE, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_SSL), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else @@ -124,23 +137,23 @@ else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) } } - private static ProcessError convertExceptionFallback(Exception e, ErrorType errorType, String process) + private static ProcessErrorWithStatusCode convertExceptionFallback(Exception e, ErrorType errorType, String process) { logger.warn("No fitting converter found for exception {}: {}", e.getClass().getName(), e.getMessage()); if (ConstantsPing.PROCESS_NAME_PING.equals(process)) { return switch (errorType) { - case LOCAL, REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.UNKNOWN, null); + case LOCAL, REMOTE -> new ProcessErrorWithStatusCode(new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.UNKNOWN, null), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) { return switch (errorType) { - case LOCAL, REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.UNKNOWN, null); + case LOCAL, REMOTE -> new ProcessErrorWithStatusCode(new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.UNKNOWN, null), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else @@ -149,30 +162,38 @@ else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) } } - private static ProcessError convertConnectTimeoutException(ErrorType errorType, String process) + private static ProcessErrorWithStatusCode convertConnectTimeoutException(ErrorType errorType, String process) { if (ConstantsPing.PROCESS_NAME_PING.equals(process)) { return switch (errorType) { - case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_CONNECT_TIMEOUT, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_CONNECT_TIMEOUT, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case LOCAL -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_CONNECT_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case REMOTE -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_CONNECT_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) { return switch (errorType) { - case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_CONNECT_TIMEOUT, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_CONNECT_TIMEOUT, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case LOCAL -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_CONNECT_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case REMOTE -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_CONNECT_TIMEOUT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else @@ -181,8 +202,8 @@ else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) } } - private static ProcessError convertWebApplicationException(WebApplicationException e, ErrorType errorType, - boolean messageWithReference, String process) + private static ProcessErrorWithStatusCode convertWebApplicationException(WebApplicationException e, + ErrorType errorType, boolean messageWithReference, String process) { int statusCode = e.getResponse().getStatus(); if (ConstantsPing.PROCESS_NAME_PING.equals(process)) @@ -191,63 +212,87 @@ private static ProcessError convertWebApplicationException(WebApplicationExcepti { case LOCAL -> switch (statusCode) { - case 401 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_401, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 401 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); case 403 -> { if (messageWithReference) { - yield new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_REFERENCE_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + yield new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_REFERENCE_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); } else { - yield new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + yield new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); } } - case 500 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_500, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - case 502 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_502, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - default -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 500 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case 502 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + default -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; case REMOTE -> switch (statusCode) { - case 401 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_401, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 401 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); case 403 -> { if (messageWithReference) { - yield new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_REFERENCE_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + yield new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_REFERENCE_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); } else { - yield new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + yield new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); } } - case 500 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_500, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - case 502 -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_502, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - default -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_UNEXPECTED, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 500 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case 502 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + default -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_UNEXPECTED, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; }; } @@ -257,39 +302,58 @@ else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) { case LOCAL -> switch (statusCode) { - case 401 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_401, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - case 403 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - case 500 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_500, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - case 502 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_502, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - default -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 401 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); + case 403 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); + case 500 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case 502 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + default -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; case REMOTE -> switch (statusCode) { - case 401 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_401, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - case 403 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - case 500 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_500, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - case 502 -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_502, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); - default -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_UNEXPECTED, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case 401 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_401, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); + case 403 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_403, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); + case 500 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_500, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case 502 -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_502, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + default -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_UNEXPECTED, null), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; }; } @@ -299,30 +363,38 @@ else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) } } - private static ProcessError convertHttpHostConnectException(ErrorType errorType, String process) + private static ProcessErrorWithStatusCode convertHttpHostConnectException(ErrorType errorType, String process) { if (ConstantsPing.PROCESS_NAME_PING.equals(process)) { return switch (errorType) { - case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_HOST_CONNECT, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); - case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_HOST_CONNECT, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + case LOCAL -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case REMOTE -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) { return switch (errorType) { - case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_HOST_CONNECT, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); - case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_HOST_CONNECT, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + case LOCAL -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case REMOTE -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else @@ -331,30 +403,38 @@ else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) } } - private static ProcessError convertUnknownHostException(ErrorType errorType, String process) + private static ProcessErrorWithStatusCode convertUnknownHostException(ErrorType errorType, String process) { if (ConstantsPing.PROCESS_NAME_PING.equals(process)) { return switch (errorType) { - case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_UNKNOWN_HOST, - ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST); - case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_UNKNOWN_HOST, - ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST); + case LOCAL -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_UNKNOWN_HOST, + ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case REMOTE -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_UNKNOWN_HOST, + ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) { return switch (errorType) { - case LOCAL -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_UNKNOWN_HOST, - ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST); - case REMOTE -> new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_UNKNOWN_HOST, - ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST); + case LOCAL -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_UNKNOWN_HOST, + ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case REMOTE -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_UNKNOWN_HOST, + ConstantsPing.POTENTIAL_FIX_URL_UNKNOWN_HOST), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else diff --git a/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValue.java b/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValue.java new file mode 100644 index 00000000..7614746e --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValue.java @@ -0,0 +1,9 @@ +package dev.dsf.bpe.variables.codesystem.dsfpingstatus; + +import org.camunda.bpm.engine.variable.value.PrimitiveValue; + +import dev.dsf.bpe.CodeSystem; + +public interface CodeValue extends PrimitiveValue<CodeSystem.DsfPingStatus.Code> +{ +} diff --git a/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueImpl.java b/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueImpl.java new file mode 100644 index 00000000..5a0af299 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueImpl.java @@ -0,0 +1,21 @@ +package dev.dsf.bpe.variables.codesystem.dsfpingstatus; + +import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; + +import dev.dsf.bpe.CodeSystem; + +public class CodeValueImpl extends PrimitiveTypeValueImpl<CodeSystem.DsfPingStatus.Code> implements CodeValue +{ + private static final PrimitiveValueType DURATION_VALUE_TYPE = new CodeValueTypeImpl(); + + public CodeValueImpl(CodeSystem.DsfPingStatus.Code value) + { + super(value, DURATION_VALUE_TYPE); + } + + public CodeValueImpl(CodeSystem.DsfPingStatus.Code value, PrimitiveValueType type) + { + super(value, type); + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueSerializer.java b/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueSerializer.java new file mode 100644 index 00000000..462f66f1 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueSerializer.java @@ -0,0 +1,18 @@ +package dev.dsf.bpe.variables.codesystem.dsfpingstatus; + +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.variables.GenericPrimitiveTypeSerializer; + +public class CodeValueSerializer extends GenericPrimitiveTypeSerializer<CodeSystem.DsfPingStatus.Code, CodeValueImpl> +{ + private static final PrimitiveValueType DURATION_VALUE_TYPE = new CodeValueTypeImpl(); + + public CodeValueSerializer() + { + super(DURATION_VALUE_TYPE, new ObjectMapper(), CodeValueImpl.class, CodeSystem.DsfPingStatus.Code.class); + } +} diff --git a/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueTypeImpl.java b/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueTypeImpl.java new file mode 100644 index 00000000..95ee1f2c --- /dev/null +++ b/src/main/java/dev/dsf/bpe/variables/codesystem/dsfpingstatus/CodeValueTypeImpl.java @@ -0,0 +1,31 @@ +package dev.dsf.bpe.variables.codesystem.dsfpingstatus; + +import java.util.Map; + +import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; + +import dev.dsf.bpe.CodeSystem; + +public class CodeValueTypeImpl extends PrimitiveValueTypeImpl +{ + private static final Class<CodeSystem.DsfPingStatus.Code> CODE_CLASS = CodeSystem.DsfPingStatus.Code.class; + + public CodeValueTypeImpl() + { + super(CODE_CLASS); + } + + @Override + public CodeValueImpl createValue(Object o, Map<String, Object> map) + { + if (o instanceof CodeSystem.DsfPingStatus.Code code) + { + return new CodeValueImpl(code); + } + else + { + throw new IllegalArgumentException("Cannot create value of type " + CODE_CLASS.getSimpleName() + + " from type " + o.getClass().getSimpleName()); + } + } +} diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 4a06be29..171d213e 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -121,7 +121,7 @@ <bpmn:sequenceFlow id="Flow_136htek" sourceRef="LogNoResponse" targetRef="Gateway_09z7b0z" /> <bpmn:sequenceFlow id="Flow_08vgmf6" sourceRef="Activity_0ri6fnv" targetRef="Gateway_0z5gz96" /> <bpmn:sequenceFlow id="Flow_101sqed" name="not-allowed or not-reachable" sourceRef="Gateway_0z5gz96" targetRef="Activity_0p5edt9"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'error'}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && (statusCode.getValue() == 'not-allowed' || statusCode.getValue() == 'not-reachable')}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1ho1hys" sourceRef="Gateway_09z7b0z" targetRef="SubProcessEndEvent" /> <bpmn:sequenceFlow id="Flow_13u1nzy" sourceRef="Gateway_0p0be0a" targetRef="Gateway_02orad4"> diff --git a/src/main/resources/bpe/pong.bpmn b/src/main/resources/bpe/pong.bpmn index ae1ee5fb..6116cda6 100644 --- a/src/main/resources/bpe/pong.bpmn +++ b/src/main/resources/bpe/pong.bpmn @@ -99,7 +99,7 @@ <bpmn:sequenceFlow id="Flow_1o3n9u6" sourceRef="Gateway_1ggdr8l" targetRef="Activity_005ywv2" /> <bpmn:sequenceFlow id="Flow_0fzmjzb" sourceRef="Activity_005ywv2" targetRef="Gateway_0eiy9fm" /> <bpmn:sequenceFlow id="Flow_0h8flp6" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0otptjn"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && statusCode == 'error'}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('statusCode') && (statusCode.getValue() == 'not-reachable' || statusCode.getValue() == 'not-allowed')}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1bzjspe" sourceRef="Gateway_0eiy9fm" targetRef="Gateway_1l5dkpz" /> <bpmn:sequenceFlow id="Flow_00t1ck1" sourceRef="Gateway_0eiy9fm" targetRef="Activity_0otptjn"> diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml index 2fe8cdc1..9393919b 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml @@ -22,18 +22,28 @@ <versionNeeded value="false" /> <content value="complete" /> <concept> - <code value="completed" /> - <display value="Completed" /> - <definition value="Ping-pong was completed successfully" /> + <code value="not-allowed" /> + <display value="Not allowed" /> + <definition value="Not allowed to start pong-process at target organization" /> </concept> <concept> - <code value="error" /> - <display value="Error" /> - <definition value="An error occurred during ping-pong process" /> + <code value="not-reachable" /> + <display value="Not reachable" /> + <definition value="Ping could not be sent to target organization" /> </concept> <concept> - <code value="pending"/> - <display value="Pending"/> - <definition value="Execution completion is still pending"/> + <code value="pong-missing" /> + <display value="Pong missing" /> + <definition value="No pong received from target organization" /> + </concept> + <concept> + <code value="pong-received" /> + <display value="Pong received" /> + <definition value="Pong received from target organization" /> + </concept> + <concept> + <code value="pong-send" /> + <display value="Pong sent" /> + <definition value="Pong successfully sent to target organization" /> </concept> </CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-status.xml b/src/main/resources/fhir/ValueSet/dsf-ping-status.xml index b315e52f..0325be6f 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping-status.xml +++ b/src/main/resources/fhir/ValueSet/dsf-ping-status.xml @@ -23,6 +23,18 @@ <include> <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> <version value="#{version}" /> + <concept> + <code value="not-allowed" /> + </concept> + <concept> + <code value="not-reachable" /> + </concept> + <concept> + <code value="pong-missing" /> + </concept> + <concept> + <code value="pong-received" /> + </concept> </include> </compose> </ValueSet> \ No newline at end of file diff --git a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml index e6187730..d3c90078 100644 --- a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml +++ b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml @@ -22,6 +22,15 @@ <include> <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> <version value="#{version}" /> + <concept> + <code value="not-allowed" /> + </concept> + <concept> + <code value="not-reachable" /> + </concept> + <concept> + <code value="pong-send" /> + </concept> </include> </compose> </ValueSet> \ No newline at end of file diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 43ebf6e2..88dd82dc 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -284,7 +284,7 @@ public String getCorrelationKey() Task task = createValidTaskStartPingProcess(); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); - task.addOutput(PingStatusGenerator.createPingStatusOutput(target, CodeSystem.DsfPingStatus.Code.ERROR, + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, CodeSystem.DsfPingStatus.Code.PONG_MISSING, processErrors(5))); ValidationResult result = resourceValidator.validate(task); @@ -328,7 +328,7 @@ public String getCorrelationKey() Task task = createValidTaskStartPingProcess(); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType() .addCoding(BpmnMessage.businessKey()); - task.addOutput(createPingStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED, BigDecimal.ZERO, + task.addOutput(createPingStatusOutput(target, CodeSystem.DsfPingStatus.Code.PONG_RECEIVED, BigDecimal.ZERO, BigDecimal.ZERO, CodeSystem.DsfPingUnits.Code.bps)); ValidationResult result = resourceValidator.validate(task); @@ -440,7 +440,7 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(createPongStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED)); + task.addOutput(createPongStatusOutput(target, CodeSystem.DsfPingStatus.Code.PONG_SENT)); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -480,7 +480,7 @@ public String getCorrelationKey() } }; Task task = createValidTaskPing(); - task.addOutput(createPongStatusOutput(target, CodeSystem.DsfPingStatus.Code.COMPLETED)); + task.addOutput(createPongStatusOutput(target, CodeSystem.DsfPingStatus.Code.PONG_SENT)); task.addInput(DownloadResourceSizeGenerator.create(1000)); task.addInput(DownloadResourceReferenceGenerator.create("https://test.endpoint.org/fhir/Binary")); From ea1096fb5ef89c5315ae222b043ac58e9f60f6ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 10 Sep 2025 09:45:46 +0200 Subject: [PATCH 361/382] Fixed codes not being the same in both files and removed dots at the end of display values --- src/main/java/dev/dsf/bpe/CodeSystem.java | 130 ++++++++--------- .../fhir/CodeSystem/dsf-ping-error.xml | 134 +++++++++--------- 2 files changed, 132 insertions(+), 132 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index f8472dad..a25f6ae0 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -351,39 +351,39 @@ public enum Concept { SEND_MESSAGE_HTTP_401( "send-message-http-401", - "Sending a message to the remote instance resulted in HTTP status 401." + "Sending a message to the remote instance resulted in HTTP status 401" ), SEND_MESSAGE_HTTP_403( "send-message-http-403", - "Sending a message to the remote instance resulted in HTTP status 403." + "Sending a message to the remote instance resulted in HTTP status 403" ), SEND_REFERENCE_MESSAGE_HTTP_403( "send-reference-message-http-403", - "Sending a message including a reference to the remote instance resulted in HTTP status 403." + "Sending a message including a reference to the remote instance resulted in HTTP status 403" ), SEND_MESSAGE_HTTP_500( "send-message-http-500", - "Sending a message to the remote instance resulted in HTTP status 500." + "Sending a message to the remote instance resulted in HTTP status 500" ), SEND_MESSAGE_HTTP_502( "send-message-http-502", - "Sending a message to the remote instance resulted in HTTP status 502." + "Sending a message to the remote instance resulted in HTTP status 502" ), SEND_MESSAGE_HTTP_UNEXPECTED( "send-message-http-unexpected", - "Sending a message to the remote instance resulted in an unexpected HTTP status code." + "Sending a message to the remote instance resulted in an unexpected HTTP status code" ), SEND_MESSAGE_SSL_HANDSHAKE( "send-message-ssl-handshake", - "Sending a message to the remote instance was unsuccessful because of a failed SSL handshake." + "Sending a message to the remote instance was unsuccessful because of a failed SSL handshake" ), SEND_MESSAGE_CONNECT_TIMEOUT( "send-message-connect-timeout", - "Sending a message to the remote instance was unsuccessful because of a connection timeout." + "Sending a message to the remote instance was unsuccessful because of a connection timeout" ), SEND_MESSAGE_HTTP_HOST_CONNECT( "send-message-http-host-connect", - "Sending a message to the remote instance was unsuccessful because the connection was refused." + "Sending a message to the remote instance was unsuccessful because the connection was refused" ), SEND_MESSAGE_UNKNOWN_HOST( "send-message-unknown-host", @@ -392,39 +392,39 @@ public enum Concept RECEIVE_MESSAGE_HTTP_401( "receive-message-http-401", - "Received a message and responded with HTTP status 401." + "Received a message and responded with HTTP status 401" ), RECEIVE_MESSAGE_HTTP_403( "receive-message-http-403", - "Received a message and responded with HTTP status 403." + "Received a message and responded with HTTP status 403" ), RECEIVE_REFERENCE_MESSAGE_HTTP_403( "receive-reference-message-http-403", - "Received a message including a reference and responded with HTTP status 403." + "Received a message including a reference and responded with HTTP status 403" ), RECEIVE_MESSAGE_HTTP_500( "receive-message-http-500", - "Received a message and responded with HTTP status 500." + "Received a message and responded with HTTP status 500" ), RECEIVE_MESSAGE_HTTP_502( "receive-message-http-502", - "Received a message and responded with HTTP status 502." + "Received a message and responded with HTTP status 502" ), RECEIVE_MESSAGE_HTTP_UNEXPECTED( "receive-message-http-unexpected", - "Received a message and responded with an unexpected HTTP status code." + "Received a message and responded with an unexpected HTTP status code" ), RECEIVE_MESSAGE_SSL_HANDSHAKE( "receive-message-ssl-handshake", - "Receiving a message was unsuccessful because of a failed SSL handshake." + "Receiving a message was unsuccessful because of a failed SSL handshake" ), RECEIVE_MESSAGE_CONNECT_TIMEOUT( "receive-message-connect-timeout", - "Receiving a message was unsuccessful because of a connection timeout." + "Receiving a message was unsuccessful because of a connection timeout" ), RECEIVE_MESSAGE_HTTP_HOST_CONNECT( "receive-message-http-host-connect", - "Receiving a message was unsuccessful because the connection was refused." + "Receiving a message was unsuccessful because the connection was refused" ), RECEIVE_MESSAGE_UNKNOWN_HOST( "receive-message-unknown-host", @@ -433,102 +433,102 @@ public enum Concept LOCAL_BINARY_DELETE_TIMEOUT( "local-binary-delete-timeout", - "Local instance ran into a read/connect timeout trying to clean up the binary resource." + "Local instance ran into a read/connect timeout trying to clean up the binary resource" ), LOCAL_BINARY_DELETE_HTTP_401( "local-binary-delete-http-401", - "Local instance ran into a HTTP status 401 trying to clean up the binary resource." + "Local instance ran into a HTTP status 401 trying to clean up the binary resource" ), LOCAL_BINARY_DELETE_HTTP_403( "local-binary-delete-http-403", - "Local instance ran into a HTTP status 403 trying to clean up the binary resource." + "Local instance ran into a HTTP status 403 trying to clean up the binary resource" ), LOCAL_BINARY_DELETE_HTTP_500( "local-binary-delete-http-500", - "Local instance ran into a HTTP status 500 trying to clean up the binary resource." + "Local instance ran into a HTTP status 500 trying to clean up the binary resource" ), LOCAL_BINARY_DELETE_HTTP_502( "local-binary-delete-http-502", - "Local instance ran into a HTTP status 502 trying to clean up the binary resource." + "Local instance ran into a HTTP status 502 trying to clean up the binary resource" ), LOCAL_BINARY_DELETE_HTTP_UNEXPECTED( "local-binary-delete-http-unexpected", - "Local instance ran into an unexpected HTTP status code trying to clean up the binary resource." + "Local instance ran into an unexpected HTTP status code trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_TIMEOUT( "remote-binary-delete-timeout", - "Remote instance ran into a read/connect timeout trying to clean up the binary resource." + "Remote instance ran into a read/connect timeout trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_HTTP_401( "remote-binary-delete-http-401", - "Remote instance ran into a HTTP status 401 trying to clean up the binary resource." + "Remote instance ran into a HTTP status 401 trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_HTTP_403( "remote-binary-delete-http-403", - "Remote instance ran into a HTTP status 403 trying to clean up the binary resource." + "Remote instance ran into a HTTP status 403 trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_HTTP_500( "remote-binary-delete-http-500", - "Remote instance ran into a HTTP status 500 trying to clean up the binary resource." + "Remote instance ran into a HTTP status 500 trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_HTTP_502( "remote-binary-delete-http-502", - "Remote instance ran into a HTTP status 502 trying to clean up the binary resource." + "Remote instance ran into a HTTP status 502 trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_HTTP_UNEXPECTED( "remote-binary-delete-http-unexpected", - "Remote instance ran into an unexpected HTTP status code trying to clean up the binary resource." + "Remote instance ran into an unexpected HTTP status code trying to clean up the binary resource" ), LOCAL_BINARY_POST_HTTP_401( "local-binary-post-http-401", - "Local instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server." + "Local instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server" ), LOCAL_BINARY_POST_HTTP_403( "local-binary-post-http-403", - "Local instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server." + "Local instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server" ), LOCAL_BINARY_POST_HTTP_500( "local-binary-post-http-500", - "Local instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server." + "Local instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server" ), LOCAL_BINARY_POST_HTTP_502( "local-binary-post-http-502", - "Local instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server." + "Local instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server" ), LOCAL_BINARY_POST_HTTP_UNEXPECTED( "local-binary-post-http-unexpected", - "Local instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server." + "Local instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server" ), LOCAL_BINARY_POST_TIMEOUT( "local-binary-post-timeout", - "Local instance ran into a timeout trying to post the binary resource to its own FHIR server." + "Local instance ran into a timeout trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_HTTP_401( "remote-binary-post-http-401", - "Remote instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server." + "Remote instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_HTTP_403( "remote-binary-post-http-403", - "Remote instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server." + "Remote instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_HTTP_500( "remote-binary-post-http-500", - "Remote instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server." + "Remote instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_HTTP_502( "remote-binary-post-http-502", - "Remote instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server." + "Remote instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_HTTP_UNEXPECTED( "remote-binary-post-http-unexpected", - "Remote instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server." + "Remote instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_TIMEOUT( "remote-binary-post-timeout", - "Remote instance ran into a timeout trying to post the binary resource to its own FHIR server." + "Remote instance ran into a timeout trying to post the binary resource to its own FHIR server" ), RESPONSE_MESSAGE_TIMEOUT_STATUS_REQUESTED( @@ -549,99 +549,99 @@ public enum Concept ), RESPONSE_MESSAGE_TIMEOUT_STATUS_UNEXPECTED( "response-message-timeout-status-unexpected", - "Response message timed out. The status of the request on the target FHIR server is neither of 'requested', 'in-progress', 'failed' or 'completed'." + "Response message timed out. The status of the request on the target FHIR server is neither of 'requested', 'in-progress', 'failed' or 'completed'" ), RESPONSE_MESSAGE_TIMEOUT_HTTP_401( "response-message-timeout-http-401", - "Response message timed out. Received HTTP status 401 trying to check request status on the target." + "Response message timed out. Received HTTP status 401 trying to check request status on the target" ), RESPONSE_MESSAGE_TIMEOUT_HTTP_403( "response-message-timeout-http-403", - "Response message timed out. Received HTTP status 403 trying to check request status on the target." + "Response message timed out. Received HTTP status 403 trying to check request status on the target" ), RESPONSE_MESSAGE_TIMEOUT_HTTP_500( "response-message-timeout-http-500", - "Response message timed out. Received HTTP status 500 trying to check request status on the target." + "Response message timed out. Received HTTP status 500 trying to check request status on the target" ), RESPONSE_MESSAGE_TIMEOUT_HTTP_502( "response-message-timeout-http-502", - "Response message timed out. Received HTTP status 502 trying to check request status on the target." + "Response message timed out. Received HTTP status 502 trying to check request status on the target" ), RESPONSE_MESSAGE_TIMEOUT_HTTP_UNEXPECTED( "response-message-timeout-http-unexpected", - "Response message timed out. Received an unexpected HTTP status code trying to check request status on the target." + "Response message timed out. Received an unexpected HTTP status code trying to check request status on the target" ), CLEANUP_MESSAGE_TIMEOUT( "cleanup-message-timeout", - "Timeout while waiting for cleanup message from ping party." + "Timeout while waiting for cleanup message from remote instance" ), LOCAL_BINARY_DOWNLOAD_IO_ERROR( "local-binary-download-io-error", - "Local party encountered an I/O error trying to download the binary resource from the target." + "Local instance encountered an I/O error trying to download the binary resource from the target" ), LOCAL_BINARY_DOWNLOAD_HTTP_401( "local-binary-download-http-401", - "Local party received HTTP status 401 trying to download the binary resource from the target." + "Local instance received HTTP status 401 trying to download the binary resource from the target" ), LOCAL_BINARY_DOWNLOAD_HTTP_403( "local-binary-download-http-403", - "Local party received HTTP status 403 trying to download the binary resource from the target." + "Local instance received HTTP status 403 trying to download the binary resource from the target" ), LOCAL_BINARY_DOWNLOAD_HTTP_500( "local-binary-download-http-500", - "Local party received HTTP status 500 trying to download the binary resource from the target." + "Local instance received HTTP status 500 trying to download the binary resource from the target" ), LOCAL_BINARY_DOWNLOAD_HTTP_502( "local-binary-download-http-502", - "Local party received HTTP status 500 trying to download the binary resource from the target." + "Local instance received HTTP status 500 trying to download the binary resource from the target" ), LOCAL_BINARY_DOWNLOAD_HTTP_UNEXPECTED( "local-binary-download-http-unexpected", - "Local party received an unexpected HTTP status trying to download the binary resource from the target." + "Local instance received an unexpected HTTP status trying to download the binary resource from the target" ), LOCAL_BINARY_DOWNLOAD_TIMEOUT( "local-binary-download-timeout", - "Local party ran into a read/connect timeout trying to download the binary resource from the target." + "Local instance ran into a read/connect timeout trying to download the binary resource from the target" ), LOCAL_BINARY_DOWNLOAD_MISSING_REFERENCE( "local-binary-download-missing-reference", - "Local instance was unable to download the binary resource from the target because the reference was missing." + "Local instance was unable to download the binary resource from the target because the reference was missing" ), REMOTE_BINARY_DOWNLOAD_IO_ERROR( "remote-binary-download-io-error", - "Remote party encountered an I/O error trying to download the binary resource from this server." + "Remote instance encountered an I/O error trying to download the binary resource from this server" ), REMOTE_BINARY_DOWNLOAD_HTTP_401( "remote-binary-download-http-401", - "Remote party received HTTP status 401 trying to download the binary resource from this server." + "Remote instance received HTTP status 401 trying to download the binary resource from this server" ), REMOTE_BINARY_DOWNLOAD_HTTP_403( "remote-binary-download-http-403", - "Remote party received HTTP status 403 trying to download the binary resource from this server." + "Remote instance received HTTP status 403 trying to download the binary resource from this server" ), REMOTE_BINARY_DOWNLOAD_HTTP_500( "remote-binary-download-http-500", - "Remote party received HTTP status 500 trying to download the binary resource from this server." + "Remote instance received HTTP status 500 trying to download the binary resource from this server" ), REMOTE_BINARY_DOWNLOAD_HTTP_502( "remote-binary-download-http-502", - "Remote party received HTTP status 500 trying to download the binary resource from this server." + "Remote instance received HTTP status 502 trying to download the binary resource from this server" ), REMOTE_BINARY_DOWNLOAD_HTTP_UNEXPECTED( "remote-binary-download-http-unexpected", - "Remote party received an unexpected HTTP status trying to download the binary resource from this server." + "Remote instance received an unexpected HTTP status trying to download the binary resource from this server" ), REMOTE_BINARY_DOWNLOAD_TIMEOUT( "remote-binary-download-timeout", - "Remote party ran into a read/connect timeout trying to download the binary resource from this server." + "Remote instance ran into a read/connect timeout trying to download the binary resource from this server" ), REMOTE_BINARY_DOWNLOAD_MISSING_REFERENCE( "remote-binary-download-missing-reference", - "Remote instance was unable to download the binary resource from this server because the reference was missing." + "Remote instance was unable to download the binary resource from this server because the reference was missing" ), UNKNOWN( diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml index e7f9b0eb..f1679f01 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml @@ -23,185 +23,185 @@ <content value="complete" /> <concept> <code value="send-message-http-401"/> - <display value="Sending a message to the remote instance resulted in HTTP status 401."/> + <display value="Sending a message to the remote instance resulted in HTTP status 401"/> </concept> <concept> <code value="send-message-http-403"/> - <display value="Sending a message to the remote instance resulted in HTTP status 403."/> + <display value="Sending a message to the remote instance resulted in HTTP status 403"/> </concept> <concept> <code value="send-reference-message-http-403"/> - <display value="Sending a message including a reference to the remote instance resulted in HTTP status 403."/> + <display value="Sending a message including a reference to the remote instance resulted in HTTP status 403"/> </concept> <concept> <code value="send-message-http-500"/> - <display value="Sending a message to the remote instance resulted in HTTP status 500."/> + <display value="Sending a message to the remote instance resulted in HTTP status 500"/> </concept> <concept> <code value="send-message-http-502"/> - <display value="Sending a message to the remote instance resulted in HTTP status 502."/> + <display value="Sending a message to the remote instance resulted in HTTP status 502"/> </concept> <concept> <code value="send-message-http-unexpected"/> - <display value="Sending a message to the remote instance resulted in an unexpected HTTP status code."/> + <display value="Sending a message to the remote instance resulted in an unexpected HTTP status code"/> </concept> <concept> <code value="send-message-ssl-handshake"/> - <display value="Sending a message to the remote instance was unsuccessful because of a failed SSL handshake."/> + <display value="Sending a message to the remote instance was unsuccessful because of a failed SSL handshake"/> </concept> <concept> <code value="send-message-connect-timeout"/> - <display value="Sending a message to the remote instance was unsuccessful because of a connection timeout."/> + <display value="Sending a message to the remote instance was unsuccessful because of a connection timeout"/> </concept> <concept> <code value="send-message-http-host-connect"/> - <display value="Sending a message to the remote instance was unsuccessful because the connection was refused."/> + <display value="Sending a message to the remote instance was unsuccessful because the connection was refused"/> </concept> <concept> <code value="send-message-unknown-host"/> - <display value="Sending a message to the remote instance was unsuccessful because the target hostname could not be resolved."/> + <display value="Sending a message to the remote instance was unsuccessful because the target hostname could not be resolved"/> </concept> <concept> <code value="receive-message-http-401"/> - <display value="Received a message and responded with HTTP status 401."/> + <display value="Received a message and responded with HTTP status 401"/> </concept> <concept> <code value="receive-message-http-403"/> - <display value="Received a message and responded with HTTP status 403."/> + <display value="Received a message and responded with HTTP status 403"/> </concept> <concept> <code value="receive-reference-message-http-403"/> - <display value="Received a message including a reference and responded with HTTP status 403."/> + <display value="Received a message including a reference and responded with HTTP status 403"/> </concept> <concept> <code value="receive-message-http-500"/> - <display value="Received a message and responded with HTTP status 500."/> + <display value="Received a message and responded with HTTP status 500"/> </concept> <concept> <code value="receive-message-http-502"/> - <display value="Received a message and responded with HTTP status 502."/> + <display value="Received a message and responded with HTTP status 502"/> </concept> <concept> <code value="receive-message-http-unexpected"/> - <display value="Received a message and responded with an unexpected HTTP status code."/> + <display value="Received a message and responded with an unexpected HTTP status code"/> </concept> <concept> <code value="receive-message-ssl-handshake"/> - <display value="Receiving a message was unsuccessful because of a failed SSL handshake."/> + <display value="Receiving a message was unsuccessful because of a failed SSL handshake"/> </concept> <concept> <code value="receive-message-connect-timeout"/> - <display value="Receiving a message was unsuccessful because of a connection timeout."/> + <display value="Receiving a message was unsuccessful because of a connection timeout"/> </concept> <concept> <code value="receive-message-http-host-connect"/> - <display value="Receiving a message was unsuccessful because the connection was refused."/> + <display value="Receiving a message was unsuccessful because the connection was refused"/> </concept> <concept> <code value="receive-message-unknown-host"/> - <display value="Receiving a message was unsuccessful because the target hostname could not be resolved."/> + <display value="Receiving a message was unsuccessful because the target hostname could not be resolved"/> </concept> <concept> <code value="local-binary-delete-timeout"/> - <display value="Local instance ran into a read/connect timeout trying to clean up the binary resource."/> + <display value="Local instance ran into a read/connect timeout trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-delete-http-401"/> - <display value="Local instance ran into a HTTP status 401 trying to clean up the binary resource."/> + <display value="Local instance ran into a HTTP status 401 trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-delete-http-403"/> - <display value="Local instance ran into a HTTP status 403 trying to clean up the binary resource."/> + <display value="Local instance ran into a HTTP status 403 trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-delete-http-500"/> - <display value="Local instance ran into a HTTP status 500 trying to clean up the binary resource."/> + <display value="Local instance ran into a HTTP status 500 trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-delete-http-502"/> - <display value="Local instance ran into a HTTP status 502 trying to clean up the binary resource."/> + <display value="Local instance ran into a HTTP status 502 trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-delete-http-unexpected"/> - <display value="Local instance ran into an unexpected HTTP status code trying to clean up the binary resource."/> + <display value="Local instance ran into an unexpected HTTP status code trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-timeout"/> - <display value="Remote instance ran into a read/connect timeout trying to clean up the binary resource."/> + <display value="Remote instance ran into a read/connect timeout trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-http-401"/> - <display value="Remote instance ran into a HTTP status 401 trying to clean up the binary resource."/> + <display value="Remote instance ran into a HTTP status 401 trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-http-403"/> - <display value="Remote instance ran into a HTTP status 403 trying to clean up the binary resource."/> + <display value="Remote instance ran into a HTTP status 403 trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-http-500"/> - <display value="Remote instance ran into a HTTP status 500 trying to clean up the binary resource."/> + <display value="Remote instance ran into a HTTP status 500 trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-http-502"/> - <display value="Remote instance ran into a HTTP status 502 trying to clean up the binary resource."/> + <display value="Remote instance ran into a HTTP status 502 trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-http-unexpected"/> - <display value="Remote instance ran into an unexpected HTTP status code trying to clean up the binary resource."/> + <display value="Remote instance ran into an unexpected HTTP status code trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-post-http-401"/> - <display value="Local instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server."/> + <display value="Local instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="local-binary-post-http-403"/> - <display value="Local instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server."/> + <display value="Local instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="local-binary-post-http-500"/> - <display value="Local instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server."/> + <display value="Local instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="local-binary-post-http-502"/> - <display value="Local instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server."/> + <display value="Local instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="local-binary-post-http-unexpected"/> - <display value="Local instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server."/> + <display value="Local instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="local-binary-post-timeout"/> - <display value="Local instance ran into a timeout trying to post the binary resource to its own FHIR server."/> + <display value="Local instance ran into a timeout trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-http-401"/> - <display value="Remote instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server."/> + <display value="Remote instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-http-403"/> - <display value="Remote instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server."/> + <display value="Remote instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-http-500"/> - <display value="Remote instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server."/> + <display value="Remote instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-http-502"/> - <display value="Remote instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server."/> + <display value="Remote instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-http-unexpected"/> - <display value="Remote instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server."/> + <display value="Remote instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-timeout"/> - <display value="Remote instance ran into a timeout trying to post the binary resource to its own FHIR server."/> + <display value="Remote instance ran into a timeout trying to post the binary resource to its own FHIR server"/> </concept> <concept> @@ -222,99 +222,99 @@ </concept> <concept> <code value="response-message-timeout-status-unexpected"/> - <display value="Response message timed out. The status of the request on the target FHIR server is neither of 'requested', 'in-progress', 'failed' or 'completed'."/> + <display value="Response message timed out. The status of the request on the target FHIR server is neither of 'requested', 'in-progress', 'failed' or 'completed'"/> </concept> <concept> <code value="response-message-timeout-http-401"/> - <display value="Response message timed out. Received HTTP status 401 trying to check request status on the target."/> + <display value="Response message timed out. Received HTTP status 401 trying to check request status on the target"/> </concept> <concept> <code value="response-message-timeout-http-403"/> - <display value="Response message timed out. Received HTTP status 403 trying to check request status on the target."/> + <display value="Response message timed out. Received HTTP status 403 trying to check request status on the target"/> </concept> <concept> <code value="response-message-timeout-http-500"/> - <display value="Response message timed out. Received HTTP status 500 trying to check request status on the target."/> + <display value="Response message timed out. Received HTTP status 500 trying to check request status on the target"/> </concept> <concept> <code value="response-message-timeout-http-502"/> - <display value="Response message timed out. Received HTTP status 502 trying to check request status on the target."/> + <display value="Response message timed out. Received HTTP status 502 trying to check request status on the target"/> </concept> <concept> <code value="response-message-timeout-http-unexpected"/> - <display value="Response message timed out. Received an unexpected HTTP status code trying to check request status on the target."/> + <display value="Response message timed out. Received an unexpected HTTP status code trying to check request status on the target"/> </concept> <concept> <code value="cleanup-message-timeout"/> - <display value="Timeout while waiting for cleanup message from remote instance."/> + <display value="Timeout while waiting for cleanup message from remote instance"/> </concept> <concept> <code value="local-binary-download-io-error"/> - <display value="Local instance encountered an I/O error trying to download the binary resource from the target."/> + <display value="Local instance encountered an I/O error trying to download the binary resource from the target"/> </concept> <concept> <code value="local-binary-download-http-401"/> - <display value="Local instance received HTTP status 401 trying to download the binary resource from the target."/> + <display value="Local instance received HTTP status 401 trying to download the binary resource from the target"/> </concept> <concept> <code value="local-binary-download-http-403"/> - <display value="Local instance received HTTP status 403 trying to download the binary resource from the target."/> + <display value="Local instance received HTTP status 403 trying to download the binary resource from the target"/> </concept> <concept> <code value="local-binary-download-http-500"/> - <display value="Local instance received HTTP status 500 trying to download the binary resource from the target."/> + <display value="Local instance received HTTP status 500 trying to download the binary resource from the target"/> </concept> <concept> <code value="local-binary-download-http-502"/> - <display value="Local instance received HTTP status 500 trying to download the binary resource from the target."/> + <display value="Local instance received HTTP status 500 trying to download the binary resource from the target"/> </concept> <concept> <code value="local-binary-download-http-unexpected"/> - <display value="Local instance received an unexpected HTTP status trying to download the binary resource from the target."/> + <display value="Local instance received an unexpected HTTP status trying to download the binary resource from the target"/> </concept> <concept> <code value="local-binary-download-timeout"/> - <display value="Local instance ran into a read/connect timeout trying to download the binary resource from the target."/> + <display value="Local instance ran into a read/connect timeout trying to download the binary resource from the target"/> </concept> <concept> <code value="local-binary-download-missing-reference"/> - <display value="Local instance was unable to download the binary resource from the target because the reference was missing."/> + <display value="Local instance was unable to download the binary resource from the target because the reference was missing"/> </concept> <concept> <code value="remote-binary-download-io-error"/> - <display value="Remote instance encountered an I/O error trying to download the binary resource from this server."/> + <display value="Remote instance encountered an I/O error trying to download the binary resource from this server"/> </concept> <concept> <code value="remote-binary-download-http-401"/> - <display value="Remote instance received HTTP status 401 trying to download the binary resource from this server."/> + <display value="Remote instance received HTTP status 401 trying to download the binary resource from this server"/> </concept> <concept> <code value="remote-binary-download-http-403"/> - <display value="Remote instance received HTTP status 403 trying to download the binary resource from this server."/> + <display value="Remote instance received HTTP status 403 trying to download the binary resource from this server"/> </concept> <concept> <code value="remote-binary-download-http-500"/> - <display value="Remote instance received HTTP status 500 trying to download the binary resource from this server."/> + <display value="Remote instance received HTTP status 500 trying to download the binary resource from this server"/> </concept> <concept> <code value="remote-binary-download-http-502"/> - <display value="Remote instance received HTTP status 500 trying to download the binary resource from this server."/> + <display value="Remote instance received HTTP status 502 trying to download the binary resource from this server"/> </concept> <concept> <code value="remote-binary-download-http-unexpected"/> - <display value="Remote instance received an unexpected HTTP status trying to download the binary resource from this server."/> + <display value="Remote instance received an unexpected HTTP status trying to download the binary resource from this server"/> </concept> <concept> <code value="remote-binary-download-timeout"/> - <display value="Remote instance ran into a read/connect timeout trying to download the binary resource from this server."/> + <display value="Remote instance ran into a read/connect timeout trying to download the binary resource from this server"/> </concept> <concept> <code value="remote-binary-download-missing-reference"/> - <display value="Remote instance was unable to download the binary resource from this server because the reference was missing."/> + <display value="Remote instance was unable to download the binary resource from this server because the reference was missing"/> </concept> <concept> From 38ec69b664ddbb84213ad9daa7146983a7a1ac97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 10 Sep 2025 10:05:28 +0200 Subject: [PATCH 362/382] More formal speech --- src/main/java/dev/dsf/bpe/CodeSystem.java | 52 +++++++++---------- .../fhir/CodeSystem/dsf-ping-error.xml | 52 +++++++++---------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index a25f6ae0..69ce69a6 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -433,102 +433,102 @@ public enum Concept LOCAL_BINARY_DELETE_TIMEOUT( "local-binary-delete-timeout", - "Local instance ran into a read/connect timeout trying to clean up the binary resource" + "Local instance encountered a read/connect timeout trying to clean up the binary resource" ), LOCAL_BINARY_DELETE_HTTP_401( "local-binary-delete-http-401", - "Local instance ran into a HTTP status 401 trying to clean up the binary resource" + "Local instance encountered a HTTP status 401 trying to clean up the binary resource" ), LOCAL_BINARY_DELETE_HTTP_403( "local-binary-delete-http-403", - "Local instance ran into a HTTP status 403 trying to clean up the binary resource" + "Local instance encountered a HTTP status 403 trying to clean up the binary resource" ), LOCAL_BINARY_DELETE_HTTP_500( "local-binary-delete-http-500", - "Local instance ran into a HTTP status 500 trying to clean up the binary resource" + "Local instance encountered a HTTP status 500 trying to clean up the binary resource" ), LOCAL_BINARY_DELETE_HTTP_502( "local-binary-delete-http-502", - "Local instance ran into a HTTP status 502 trying to clean up the binary resource" + "Local instance encountered a HTTP status 502 trying to clean up the binary resource" ), LOCAL_BINARY_DELETE_HTTP_UNEXPECTED( "local-binary-delete-http-unexpected", - "Local instance ran into an unexpected HTTP status code trying to clean up the binary resource" + "Local instance encountered an unexpected HTTP status code trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_TIMEOUT( "remote-binary-delete-timeout", - "Remote instance ran into a read/connect timeout trying to clean up the binary resource" + "Remote instance encountered a read/connect timeout trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_HTTP_401( "remote-binary-delete-http-401", - "Remote instance ran into a HTTP status 401 trying to clean up the binary resource" + "Remote instance encountered a HTTP status 401 trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_HTTP_403( "remote-binary-delete-http-403", - "Remote instance ran into a HTTP status 403 trying to clean up the binary resource" + "Remote instance encountered a HTTP status 403 trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_HTTP_500( "remote-binary-delete-http-500", - "Remote instance ran into a HTTP status 500 trying to clean up the binary resource" + "Remote instance encountered a HTTP status 500 trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_HTTP_502( "remote-binary-delete-http-502", - "Remote instance ran into a HTTP status 502 trying to clean up the binary resource" + "Remote instance encountered a HTTP status 502 trying to clean up the binary resource" ), REMOTE_BINARY_DELETE_HTTP_UNEXPECTED( "remote-binary-delete-http-unexpected", - "Remote instance ran into an unexpected HTTP status code trying to clean up the binary resource" + "Remote instance encountered an unexpected HTTP status code trying to clean up the binary resource" ), LOCAL_BINARY_POST_HTTP_401( "local-binary-post-http-401", - "Local instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server" + "Local instance encountered a HTTP status 401 trying to post the binary resource to its own FHIR server" ), LOCAL_BINARY_POST_HTTP_403( "local-binary-post-http-403", - "Local instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server" + "Local instance encountered a HTTP status 403 trying to post the binary resource to its own FHIR server" ), LOCAL_BINARY_POST_HTTP_500( "local-binary-post-http-500", - "Local instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server" + "Local instance encountered a HTTP status 500 trying to post the binary resource to its own FHIR server" ), LOCAL_BINARY_POST_HTTP_502( "local-binary-post-http-502", - "Local instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server" + "Local instance encountered a HTTP status 502 trying to post the binary resource to its own FHIR server" ), LOCAL_BINARY_POST_HTTP_UNEXPECTED( "local-binary-post-http-unexpected", - "Local instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server" + "Local instance encountered an unexpected HTTP status code trying to post the binary resource to its own FHIR server" ), LOCAL_BINARY_POST_TIMEOUT( "local-binary-post-timeout", - "Local instance ran into a timeout trying to post the binary resource to its own FHIR server" + "Local instance encountered a timeout trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_HTTP_401( "remote-binary-post-http-401", - "Remote instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server" + "Remote instance encountered a HTTP status 401 trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_HTTP_403( "remote-binary-post-http-403", - "Remote instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server" + "Remote instance encountered a HTTP status 403 trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_HTTP_500( "remote-binary-post-http-500", - "Remote instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server" + "Remote instance encountered a HTTP status 500 trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_HTTP_502( "remote-binary-post-http-502", - "Remote instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server" + "Remote instance encountered a HTTP status 502 trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_HTTP_UNEXPECTED( "remote-binary-post-http-unexpected", - "Remote instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server" + "Remote instance encountered an unexpected HTTP status code trying to post the binary resource to its own FHIR server" ), REMOTE_BINARY_POST_TIMEOUT( "remote-binary-post-timeout", - "Remote instance ran into a timeout trying to post the binary resource to its own FHIR server" + "Remote instance encountered a timeout trying to post the binary resource to its own FHIR server" ), RESPONSE_MESSAGE_TIMEOUT_STATUS_REQUESTED( @@ -604,7 +604,7 @@ public enum Concept ), LOCAL_BINARY_DOWNLOAD_TIMEOUT( "local-binary-download-timeout", - "Local instance ran into a read/connect timeout trying to download the binary resource from the target" + "Local instance encountered a read/connect timeout trying to download the binary resource from the target" ), LOCAL_BINARY_DOWNLOAD_MISSING_REFERENCE( "local-binary-download-missing-reference", @@ -637,7 +637,7 @@ public enum Concept ), REMOTE_BINARY_DOWNLOAD_TIMEOUT( "remote-binary-download-timeout", - "Remote instance ran into a read/connect timeout trying to download the binary resource from this server" + "Remote instance encountered a read/connect timeout trying to download the binary resource from this server" ), REMOTE_BINARY_DOWNLOAD_MISSING_REFERENCE( "remote-binary-download-missing-reference", diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml index f1679f01..dcaa6e23 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml @@ -106,102 +106,102 @@ <concept> <code value="local-binary-delete-timeout"/> - <display value="Local instance ran into a read/connect timeout trying to clean up the binary resource"/> + <display value="Local instance encountered a read/connect timeout trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-delete-http-401"/> - <display value="Local instance ran into a HTTP status 401 trying to clean up the binary resource"/> + <display value="Local instance encountered a HTTP status 401 trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-delete-http-403"/> - <display value="Local instance ran into a HTTP status 403 trying to clean up the binary resource"/> + <display value="Local instance encountered a HTTP status 403 trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-delete-http-500"/> - <display value="Local instance ran into a HTTP status 500 trying to clean up the binary resource"/> + <display value="Local instance encountered a HTTP status 500 trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-delete-http-502"/> - <display value="Local instance ran into a HTTP status 502 trying to clean up the binary resource"/> + <display value="Local instance encountered a HTTP status 502 trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-delete-http-unexpected"/> - <display value="Local instance ran into an unexpected HTTP status code trying to clean up the binary resource"/> + <display value="Local instance encountered an unexpected HTTP status code trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-timeout"/> - <display value="Remote instance ran into a read/connect timeout trying to clean up the binary resource"/> + <display value="Remote instance encountered a read/connect timeout trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-http-401"/> - <display value="Remote instance ran into a HTTP status 401 trying to clean up the binary resource"/> + <display value="Remote instance encountered a HTTP status 401 trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-http-403"/> - <display value="Remote instance ran into a HTTP status 403 trying to clean up the binary resource"/> + <display value="Remote instance encountered a HTTP status 403 trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-http-500"/> - <display value="Remote instance ran into a HTTP status 500 trying to clean up the binary resource"/> + <display value="Remote instance encountered a HTTP status 500 trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-http-502"/> - <display value="Remote instance ran into a HTTP status 502 trying to clean up the binary resource"/> + <display value="Remote instance encountered a HTTP status 502 trying to clean up the binary resource"/> </concept> <concept> <code value="remote-binary-delete-http-unexpected"/> - <display value="Remote instance ran into an unexpected HTTP status code trying to clean up the binary resource"/> + <display value="Remote instance encountered an unexpected HTTP status code trying to clean up the binary resource"/> </concept> <concept> <code value="local-binary-post-http-401"/> - <display value="Local instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server"/> + <display value="Local instance encountered a HTTP status 401 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="local-binary-post-http-403"/> - <display value="Local instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server"/> + <display value="Local instance encountered a HTTP status 403 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="local-binary-post-http-500"/> - <display value="Local instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server"/> + <display value="Local instance encountered a HTTP status 500 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="local-binary-post-http-502"/> - <display value="Local instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server"/> + <display value="Local instance encountered a HTTP status 502 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="local-binary-post-http-unexpected"/> - <display value="Local instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server"/> + <display value="Local instance encountered an unexpected HTTP status code trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="local-binary-post-timeout"/> - <display value="Local instance ran into a timeout trying to post the binary resource to its own FHIR server"/> + <display value="Local instance encountered a timeout trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-http-401"/> - <display value="Remote instance ran into a HTTP status 401 trying to post the binary resource to its own FHIR server"/> + <display value="Remote instance encountered a HTTP status 401 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-http-403"/> - <display value="Remote instance ran into a HTTP status 403 trying to post the binary resource to its own FHIR server"/> + <display value="Remote instance encountered a HTTP status 403 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-http-500"/> - <display value="Remote instance ran into a HTTP status 500 trying to post the binary resource to its own FHIR server"/> + <display value="Remote instance encountered a HTTP status 500 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-http-502"/> - <display value="Remote instance ran into a HTTP status 502 trying to post the binary resource to its own FHIR server"/> + <display value="Remote instance encountered a HTTP status 502 trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-http-unexpected"/> - <display value="Remote instance ran into an unexpected HTTP status code trying to post the binary resource to its own FHIR server"/> + <display value="Remote instance encountered an unexpected HTTP status code trying to post the binary resource to its own FHIR server"/> </concept> <concept> <code value="remote-binary-post-timeout"/> - <display value="Remote instance ran into a timeout trying to post the binary resource to its own FHIR server"/> + <display value="Remote instance encountered a timeout trying to post the binary resource to its own FHIR server"/> </concept> <concept> @@ -277,7 +277,7 @@ </concept> <concept> <code value="local-binary-download-timeout"/> - <display value="Local instance ran into a read/connect timeout trying to download the binary resource from the target"/> + <display value="Local instance encountered a read/connect timeout trying to download the binary resource from the target"/> </concept> <concept> <code value="local-binary-download-missing-reference"/> @@ -310,7 +310,7 @@ </concept> <concept> <code value="remote-binary-download-timeout"/> - <display value="Remote instance ran into a read/connect timeout trying to download the binary resource from this server"/> + <display value="Remote instance encountered a read/connect timeout trying to download the binary resource from this server"/> </concept> <concept> <code value="remote-binary-download-missing-reference"/> From 3069158e26c2e8529b55d26529ab6481e97b5853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 10 Sep 2025 10:24:43 +0200 Subject: [PATCH 363/382] Fixed WebApplicationException using connection timeout fix URL instead of HTTP fix URL --- .../bpe/util/task/SendTaskErrorConverter.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index cd588813..ebd9866b 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -215,7 +215,7 @@ private static ProcessErrorWithStatusCode convertWebApplicationException(WebAppl case 401 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_401, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); case 403 -> { @@ -224,7 +224,7 @@ private static ProcessErrorWithStatusCode convertWebApplicationException(WebAppl yield new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.SEND_REFERENCE_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); } else @@ -232,24 +232,24 @@ yield new ProcessErrorWithStatusCode( yield new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); } } case 500 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_500, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); case 502 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_502, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); default -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + null), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; case REMOTE -> switch (statusCode) @@ -257,7 +257,7 @@ yield new ProcessErrorWithStatusCode( case 401 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_401, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); case 403 -> { @@ -266,7 +266,7 @@ yield new ProcessErrorWithStatusCode( yield new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.RECEIVE_REFERENCE_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); } else @@ -274,24 +274,24 @@ yield new ProcessErrorWithStatusCode( yield new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); } } case 500 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_500, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); case 502 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_502, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); default -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_UNEXPECTED, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + null), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; }; @@ -305,27 +305,27 @@ else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) case 401 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_401, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); case 403 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); case 500 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_500, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); case 502 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_502, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); default -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + null), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; case REMOTE -> switch (statusCode) @@ -333,22 +333,22 @@ else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) case 401 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_401, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); case 403 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_403, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_ALLOWED); case 500 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_500, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); case 502 -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_502, - ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT), + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); default -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, From 7896e613cc4cf6a2d918e8ed208fd000c8f45b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Wed, 10 Sep 2025 18:06:45 +0200 Subject: [PATCH 364/382] - Specified timeout errors to be either read or connect timeouts - Added handling for possible HttpHostConnectException and ConnectTimeoutExceptions when making requests concerning non-Task resources - Specified unknown errors to either originate from the local or remote instance --- src/main/java/dev/dsf/bpe/CodeSystem.java | 100 +++++++++++---- .../java/dev/dsf/bpe/service/Cleanup.java | 59 ++++++++- .../bpe/service/GenerateAndStoreResource.java | 116 ++++++++++++++++-- .../bpe/util/BinaryResourceDownloader.java | 104 ++++++++++++++-- .../bpe/util/task/SendTaskErrorConverter.java | 27 ++-- .../fhir/CodeSystem/dsf-ping-error.xml | 80 +++++++++--- 6 files changed, 417 insertions(+), 69 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index 69ce69a6..2010bcfa 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -431,9 +431,17 @@ public enum Concept "Receiving a message was unsuccessful because the target hostname could not be resolved" ), - LOCAL_BINARY_DELETE_TIMEOUT( - "local-binary-delete-timeout", - "Local instance encountered a read/connect timeout trying to clean up the binary resource" + LOCAL_BINARY_DELETE_TIMEOUT_CONNECT( + "local-binary-delete-timeout-connect", + "Local instance encountered a connect timeout trying to clean up the binary resource" + ), + LOCAL_BINARY_DELETE_TIMEOUT_READ( + "local-binary-delete-timeout-read", + "Local instance encountered a read timeout trying to clean up the binary resource" + ), + LOCAL_BINARY_DELETE_HTTP_HOST_CONNECT( + "local-binary-delete-http-host-connect", + "Local instance was unable to clean up the binary resource from the local DSF FHIR server because the connection was refused" ), LOCAL_BINARY_DELETE_HTTP_401( "local-binary-delete-http-401", @@ -456,9 +464,17 @@ public enum Concept "Local instance encountered an unexpected HTTP status code trying to clean up the binary resource" ), - REMOTE_BINARY_DELETE_TIMEOUT( - "remote-binary-delete-timeout", - "Remote instance encountered a read/connect timeout trying to clean up the binary resource" + REMOTE_BINARY_DELETE_TIMEOUT_CONNECT( + "remote-binary-delete-timeout-connect", + "Remote instance encountered a connect timeout trying to clean up the binary resource" + ), + REMOTE_BINARY_DELETE_TIMEOUT_READ( + "remote-binary-delete-timeout-read", + "Remote instance encountered a read timeout trying to clean up the binary resource" + ), + REMOTE_BINARY_DELETE_HTTP_HOST_CONNECT( + "remote-binary-delete-http-host-connect", + "Remote instance was unable to clean up the binary resource from its DSF FHIR server because the connection was refused" ), REMOTE_BINARY_DELETE_HTTP_401( "remote-binary-delete-http-401", @@ -501,9 +517,17 @@ public enum Concept "local-binary-post-http-unexpected", "Local instance encountered an unexpected HTTP status code trying to post the binary resource to its own FHIR server" ), - LOCAL_BINARY_POST_TIMEOUT( - "local-binary-post-timeout", - "Local instance encountered a timeout trying to post the binary resource to its own FHIR server" + LOCAL_BINARY_POST_TIMEOUT_CONNECT( + "local-binary-post-timeout-connect", + "Local instance encountered a connect timeout trying to post the binary resource to its own FHIR server" + ), + LOCAL_BINARY_POST_TIMEOUT_READ( + "local-binary-post-timeout-read", + "Local instance encountered a read timeout trying to post the binary resource to its own FHIR server" + ), + LOCAL_BINARY_POST_HTTP_HOST_CONNECT( + "local-binary-post-http-host-connect", + "Local instance was unable to post the binary resource to its own DSF FHIR server because the connection was refused" ), REMOTE_BINARY_POST_HTTP_401( @@ -526,9 +550,17 @@ public enum Concept "remote-binary-post-http-unexpected", "Remote instance encountered an unexpected HTTP status code trying to post the binary resource to its own FHIR server" ), - REMOTE_BINARY_POST_TIMEOUT( - "remote-binary-post-timeout", - "Remote instance encountered a timeout trying to post the binary resource to its own FHIR server" + REMOTE_BINARY_POST_TIMEOUT_CONNECT( + "remote-binary-post-timeout-connect", + "Remote instance encountered a connect timeout trying to post the binary resource to its own FHIR server" + ), + REMOTE_BINARY_POST_TIMEOUT_READ( + "remote-binary-post-timeout-read", + "Remote instance encountered a read timeout trying to post the binary resource to its own FHIR server" + ), + REMOTE_BINARY_POST_HTTP_HOST_CONNECT( + "remote-binary-post-http-host-connect", + "Remote instance was unable to post the binary resource to its own DSF FHIR server because the connection was refused" ), RESPONSE_MESSAGE_TIMEOUT_STATUS_REQUESTED( @@ -602,9 +634,17 @@ public enum Concept "local-binary-download-http-unexpected", "Local instance received an unexpected HTTP status trying to download the binary resource from the target" ), - LOCAL_BINARY_DOWNLOAD_TIMEOUT( - "local-binary-download-timeout", - "Local instance encountered a read/connect timeout trying to download the binary resource from the target" + LOCAL_BINARY_DOWNLOAD_TIMEOUT_CONNECT( + "local-binary-download-timeout-connect", + "Local instance encountered a connect timeout trying to download the binary resource from the target" + ), + LOCAL_BINARY_DOWNLOAD_TIMEOUT_READ( + "local-binary-download-timeout-read", + "Local instance encountered a read timeout trying to download the binary resource from the target" + ), + LOCAL_BINARY_DOWNLOAD_HTTP_HOST_CONNECT( + "local-binary-download-http-host-connect", + "Local instance was unable to download the binary resource from the remote DSF FHIR server because the connection was refused" ), LOCAL_BINARY_DOWNLOAD_MISSING_REFERENCE( "local-binary-download-missing-reference", @@ -635,19 +675,31 @@ public enum Concept "remote-binary-download-http-unexpected", "Remote instance received an unexpected HTTP status trying to download the binary resource from this server" ), - REMOTE_BINARY_DOWNLOAD_TIMEOUT( - "remote-binary-download-timeout", - "Remote instance encountered a read/connect timeout trying to download the binary resource from this server" + REMOTE_BINARY_DOWNLOAD_TIMEOUT_CONNECT( + "remote-binary-download-timeout-connect", + "Remote instance encountered a connect timeout trying to download the binary resource from this server" + ), + REMOTE_BINARY_DOWNLOAD_TIMEOUT_READ( + "remote-binary-download-timeout-read", + "Remote instance encountered a read timeout trying to download the binary resource from this server" + ), + REMOTE_BINARY_DOWNLOAD_HTTP_HOST_CONNECT( + "remote-binary-download-timeout-read", + "Remote instance encountered a read timeout trying to download the binary resource from this server" ), REMOTE_BINARY_DOWNLOAD_MISSING_REFERENCE( - "remote-binary-download-missing-reference", - "Remote instance was unable to download the binary resource from this server because the reference was missing" + "remote-binary-download-http-host-connect", + "Remote instance was unable to download the binary resource from the local DSF FHIR server because the connection was refused" ), - UNKNOWN( - "unknown", - "An unknown error was encountered. Consult logs for more details." - ),; + LOCAL_UNKNOWN( + "local-unknown", + "An unknown error was encountered by the local instance" + ), + REMOTE_UNKNOWN( + "remote-unknown", + "An unknown error was encountered by the remote instance" + ); private final String code; private final String display; diff --git a/src/main/java/dev/dsf/bpe/service/Cleanup.java b/src/main/java/dev/dsf/bpe/service/Cleanup.java index 1f1434be..b9c64990 100644 --- a/src/main/java/dev/dsf/bpe/service/Cleanup.java +++ b/src/main/java/dev/dsf/bpe/service/Cleanup.java @@ -1,7 +1,10 @@ package dev.dsf.bpe.service; import java.net.SocketTimeoutException; +import java.util.Locale; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.conn.HttpHostConnectException; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.Expression; import org.hl7.fhir.r4.model.Binary; @@ -51,17 +54,29 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) } catch (ProcessingException e) { - if (e.getCause() instanceof SocketTimeoutException) + if (e.getCause() instanceof SocketTimeoutException timeoutException) { - ProcessError error = new ProcessError(process, - CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_TIMEOUT, - ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + ProcessError error = toProcessError(timeoutException, process); + ErrorListUtils.add(error, delegateExecution); + logger.error(e.getCause().getMessage()); + } + else if (e.getCause() instanceof ConnectTimeoutException) + { + ProcessError error = toProcessErrorConnectTimeout(process); + ErrorListUtils.add(error, delegateExecution); + logger.error(e.getCause().getMessage()); + } + else if (e.getCause() instanceof HttpHostConnectException) + { + ProcessError error = toProcessErrorLocalHttpHostConnect(process); ErrorListUtils.add(error, delegateExecution); logger.error(e.getCause().getMessage()); } else { - throw new RuntimeException(e); + ProcessError error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_UNKNOWN, null); + ErrorListUtils.add(error, delegateExecution); + logger.error("Unexpected error: {}", e.getCause().getMessage()); } } catch (WebApplicationException e) @@ -77,6 +92,40 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) logger.debug("Cleanup complete."); } + private ProcessError toProcessError(SocketTimeoutException timeoutException, String process) + { + ProcessError error; + String message = timeoutException.getMessage().toLowerCase(Locale.ROOT); + if (message.contains("connect")) + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + else if (message.contains("read")) + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_TIMEOUT_READ, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + } + else + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_UNKNOWN, null); + logger.error("Unexpected error: {}", timeoutException.getMessage()); + } + return error; + } + + private ProcessError toProcessErrorLocalHttpHostConnect(String process) + { + return new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + } + + private ProcessError toProcessErrorConnectTimeout(String process) + { + return new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DELETE_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + private ProcessError toProcessError(WebApplicationException e, String process) { int status = e.getResponse().getStatus(); diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 06eda87a..913c7c22 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -1,7 +1,10 @@ package dev.dsf.bpe.service; import java.net.SocketTimeoutException; +import java.util.Locale; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.conn.HttpHostConnectException; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.engine.delegate.Expression; @@ -120,14 +123,34 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) } catch (ProcessingException e) { - if (e.getCause() instanceof SocketTimeoutException) + if (e.getCause() instanceof SocketTimeoutException socketTimeoutException) { - ProcessError error = new ProcessError(process, - CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_TIMEOUT, - ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); - ProcessError errorRemote = new ProcessError(process, - CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_TIMEOUT, - ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + ProcessError error = toProcessErrorLocal(socketTimeoutException, process); + ProcessError errorRemote = toProcessErrorRemote(socketTimeoutException, process); + + variables.setVariable(ExecutionVariables.resourceUploadError.name(), new ProcessErrorValueImpl(error)); + if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + variables.setVariable(ExecutionVariables.resourceUploadErrorRemote.name(), + new ProcessErrorValueImpl(errorRemote)); + } + } + else if (e.getCause() instanceof ConnectTimeoutException) + { + ProcessError error = toProcessErrorLocalConnectTimeout(process); + ProcessError errorRemote = toProcessErrorRemoteConnectTimeout(process); + + variables.setVariable(ExecutionVariables.resourceUploadError.name(), new ProcessErrorValueImpl(error)); + if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + variables.setVariable(ExecutionVariables.resourceUploadErrorRemote.name(), + new ProcessErrorValueImpl(errorRemote)); + } + } + else if (e.getCause() instanceof HttpHostConnectException) + { + ProcessError error = toProcessErrorLocalHttpHostConnect(process); + ProcessError errorRemote = toProcessErrorRemoteHttpHostConnect(process); variables.setVariable(ExecutionVariables.resourceUploadError.name(), new ProcessErrorValueImpl(error)); if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) @@ -138,11 +161,88 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) } else { - throw e; + ProcessError error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_UNKNOWN, null); + ProcessError errorRemote = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_UNKNOWN, + null); + variables.setVariable(ExecutionVariables.resourceUploadError.name(), new ProcessErrorValueImpl(error)); + if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) + { + variables.setVariable(ExecutionVariables.resourceUploadErrorRemote.name(), + new ProcessErrorValueImpl(errorRemote)); + } + logger.error("Unexpected error: {}", e.getMessage()); } } } + private ProcessError toProcessErrorLocal(SocketTimeoutException timeoutException, String process) + { + ProcessError error; + String message = timeoutException.getMessage().toLowerCase(Locale.ROOT); + if (message.contains("connect")) + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + else if (message.contains("read")) + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_TIMEOUT_READ, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + } + else + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_UNKNOWN, null); + logger.error("Unexpected error: {}", message); + } + return error; + } + + private ProcessError toProcessErrorRemote(SocketTimeoutException timeoutException, String process) + { + ProcessError error; + String message = timeoutException.getMessage().toLowerCase(Locale.ROOT); + if (message.contains("connect")) + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + else if (message.contains("read")) + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_TIMEOUT_READ, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + } + else + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_UNKNOWN, null); + logger.error("Unexpected error: {}", message); + } + return error; + } + + private ProcessError toProcessErrorLocalHttpHostConnect(String process) + { + return new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + } + + private ProcessError toProcessErrorRemoteHttpHostConnect(String process) + { + return new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + } + + private ProcessError toProcessErrorLocalConnectTimeout(String process) + { + return new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + + private ProcessError toProcessErrorRemoteConnectTimeout(String process) + { + return new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + private long getDownloadResourceSize(Variables variables) { return variables.getLong(ExecutionVariables.downloadResourceSizeBytes.name()); diff --git a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java index b76eca9e..e6b275f8 100644 --- a/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java +++ b/src/main/java/dev/dsf/bpe/util/BinaryResourceDownloader.java @@ -4,8 +4,11 @@ import java.io.InputStream; import java.net.SocketTimeoutException; import java.time.Duration; +import java.util.Locale; import java.util.Optional; +import org.apache.http.conn.ConnectTimeoutException; +import org.apache.http.conn.HttpHostConnectException; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; @@ -135,21 +138,38 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t } catch (ProcessingException e) { - if (e.getCause() instanceof SocketTimeoutException) + if (e.getCause() instanceof SocketTimeoutException socketTimeoutException) { String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); - ProcessError error = new ProcessError(process, - CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_TIMEOUT, - ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); - ProcessError errorRemote = new ProcessError(process, - CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_TIMEOUT, - ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + ProcessError error = toProcessErrorLocal(socketTimeoutException, process); + ProcessError errorRemote = toProcessErrorRemote(socketTimeoutException, process); + logDownloadError(errorMessage); + downloadResult = new DownloadResult(error, errorRemote); + } + else if (e.getCause() instanceof ConnectTimeoutException) + { + String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); + ProcessError error = toProcessErrorLocalConnectTimeout(process); + ProcessError errorRemote = toProcessErrorRemoteConnectTimeout(process); + logDownloadError(errorMessage); + downloadResult = new DownloadResult(error, errorRemote); + } + else if (e.getCause() instanceof HttpHostConnectException) + { + String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); + ProcessError error = toProcessErrorLocalHttpHostConnect(process); + ProcessError errorRemote = toProcessErrorRemoteHttpHostConnect(process); logDownloadError(errorMessage); downloadResult = new DownloadResult(error, errorRemote); } else { - throw e; + String errorMessage = e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName(); + ProcessError error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_UNKNOWN, null); + ProcessError errorRemote = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_UNKNOWN, + null); + logger.error("Unexpected error: {}", errorMessage); + downloadResult = new DownloadResult(error, errorRemote); } } catch (IOException e) @@ -167,6 +187,74 @@ public DownloadResult download(Variables variables, ProcessPluginApi api, Task t return downloadResult; } + private ProcessError toProcessErrorLocal(SocketTimeoutException timeoutException, String process) + { + ProcessError error; + String message = timeoutException.getMessage().toLowerCase(Locale.ROOT); + if (message.contains("connect")) + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + else if (message.contains("read")) + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_TIMEOUT_READ, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + } + else + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_UNKNOWN, null); + logger.error("Unexpected error: {}", timeoutException.getMessage()); + } + return error; + } + + private ProcessError toProcessErrorRemote(SocketTimeoutException timeoutException, String process) + { + ProcessError error; + String message = timeoutException.getMessage().toLowerCase(Locale.ROOT); + if (message.contains("connect")) + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + else if (message.contains("read")) + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_TIMEOUT_READ, + ConstantsPing.POTENTIAL_FIX_URL_READ_TIMEOUT); + } + else + { + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_UNKNOWN, null); + logger.error("Unexpected error: {}", timeoutException.getMessage()); + } + return error; + } + + private ProcessError toProcessErrorLocalHttpHostConnect(String process) + { + return new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + } + + private ProcessError toProcessErrorRemoteHttpHostConnect(String process) + { + return new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_HTTP_HOST_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_REFUSED); + } + + private ProcessError toProcessErrorLocalConnectTimeout(String process) + { + return new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + + private ProcessError toProcessErrorRemoteConnectTimeout(String process) + { + return new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + } + private void logDownloadError(String errorMessage) { logger.error("Encountered an error while downloading resource: {}", errorMessage); diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index ebd9866b..91d59c9f 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -144,16 +144,26 @@ private static ProcessErrorWithStatusCode convertExceptionFallback(Exception e, { return switch (errorType) { - case LOCAL, REMOTE -> new ProcessErrorWithStatusCode(new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.UNKNOWN, null), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case LOCAL -> new ProcessErrorWithStatusCode(new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.LOCAL_UNKNOWN, null), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case REMOTE -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PING, + CodeSystem.DsfPingError.Concept.REMOTE_UNKNOWN, null), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) { return switch (errorType) { - case LOCAL, REMOTE -> new ProcessErrorWithStatusCode(new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.UNKNOWN, null), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case LOCAL -> new ProcessErrorWithStatusCode(new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.LOCAL_UNKNOWN, null), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + case REMOTE -> new ProcessErrorWithStatusCode( + new ProcessError(ConstantsPing.PROCESS_NAME_PONG, + CodeSystem.DsfPingError.Concept.REMOTE_UNKNOWN, null), + CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; } else @@ -248,8 +258,7 @@ yield new ProcessErrorWithStatusCode( CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); default -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, - null), + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, null), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; case REMOTE -> switch (statusCode) @@ -290,8 +299,7 @@ yield new ProcessErrorWithStatusCode( CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); default -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PING, - CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_UNEXPECTED, - null), + CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_UNEXPECTED, null), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; }; @@ -324,8 +332,7 @@ else if (ConstantsPing.PROCESS_NAME_PONG.equals(process)) CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); default -> new ProcessErrorWithStatusCode( new ProcessError(ConstantsPing.PROCESS_NAME_PONG, - CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, - null), + CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_UNEXPECTED, null), CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); }; case REMOTE -> switch (statusCode) diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml index dcaa6e23..e5358845 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml @@ -105,8 +105,16 @@ </concept> <concept> - <code value="local-binary-delete-timeout"/> - <display value="Local instance encountered a read/connect timeout trying to clean up the binary resource"/> + <code value="local-binary-delete-timeout-connect"/> + <display value="Local instance encountered a connect timeout trying to clean up the binary resource"/> + </concept> + <concept> + <code value="local-binary-delete-timeout-read"/> + <display value="Local instance encountered a read timeout trying to clean up the binary resource"/> + </concept> + <concept> + <code value="local-binary-delete-http-host-connect"/> + <display value="Local instance was unable to clean up the binary resource from the local DSF FHIR server because the connection was refused"/> </concept> <concept> <code value="local-binary-delete-http-401"/> @@ -130,8 +138,16 @@ </concept> <concept> - <code value="remote-binary-delete-timeout"/> - <display value="Remote instance encountered a read/connect timeout trying to clean up the binary resource"/> + <code value="remote-binary-delete-timeout-connect"/> + <display value="Remote instance encountered a connect timeout trying to clean up the binary resource"/> + </concept> + <concept> + <code value="remote-binary-delete-timeout-read"/> + <display value="Remote instance encountered a read timeout trying to clean up the binary resource"/> + </concept> + <concept> + <code value="remote-binary-delete-http-host-connect"/> + <display value="Remote instance was unable to clean up the binary resource from its DSF FHIR server because the connection was refused"/> </concept> <concept> <code value="remote-binary-delete-http-401"/> @@ -175,8 +191,16 @@ <display value="Local instance encountered an unexpected HTTP status code trying to post the binary resource to its own FHIR server"/> </concept> <concept> - <code value="local-binary-post-timeout"/> - <display value="Local instance encountered a timeout trying to post the binary resource to its own FHIR server"/> + <code value="local-binary-post-timeout-connect"/> + <display value="Local instance encountered a connect timeout trying to post the binary resource to its own FHIR server"/> + </concept> + <concept> + <code value="local-binary-post-timeout-read"/> + <display value="Local instance encountered a read timeout trying to post the binary resource to its own FHIR server"/> + </concept> + <concept> + <code value="local-binary-post-http-host-connect"/> + <display value="Local instance was unable to post the binary resource to its own FHIR server because the connection was refused"/> </concept> <concept> @@ -200,8 +224,16 @@ <display value="Remote instance encountered an unexpected HTTP status code trying to post the binary resource to its own FHIR server"/> </concept> <concept> - <code value="remote-binary-post-timeout"/> - <display value="Remote instance encountered a timeout trying to post the binary resource to its own FHIR server"/> + <code value="remote-binary-post-timeout-connect"/> + <display value="Remote instance encountered a connect timeout trying to post the binary resource to its own FHIR server"/> + </concept> + <concept> + <code value="remote-binary-post-timeout-read"/> + <display value="Remote instance encountered a read timeout trying to post the binary resource to its own FHIR server"/> + </concept> + <concept> + <code value="remote-binary-post-http-host-connect"/> + <display value="Remote instance was unable to post the binary resource to its own DSF FHIR server because the connection was refused"/> </concept> <concept> @@ -276,8 +308,16 @@ <display value="Local instance received an unexpected HTTP status trying to download the binary resource from the target"/> </concept> <concept> - <code value="local-binary-download-timeout"/> - <display value="Local instance encountered a read/connect timeout trying to download the binary resource from the target"/> + <code value="local-binary-download-timeout-connect"/> + <display value="Local instance encountered a connect timeout trying to download the binary resource from the target"/> + </concept> + <concept> + <code value="local-binary-download-timeout-read"/> + <display value="Local instance encountered a read timeout trying to download the binary resource from the target"/> + </concept> + <concept> + <code value="local-binary-download-http-host-connect"/> + <display value="Local instance was unable to download the binary resource from the remote DSF FHIR server because the connection was refused"/> </concept> <concept> <code value="local-binary-download-missing-reference"/> @@ -309,8 +349,16 @@ <display value="Remote instance received an unexpected HTTP status trying to download the binary resource from this server"/> </concept> <concept> - <code value="remote-binary-download-timeout"/> - <display value="Remote instance encountered a read/connect timeout trying to download the binary resource from this server"/> + <code value="remote-binary-download-timeout-connect"/> + <display value="Remote instance encountered a connect timeout trying to download the binary resource from this server"/> + </concept> + <concept> + <code value="remote-binary-download-timeout-read"/> + <display value="Remote instance encountered a read timeout trying to download the binary resource from this server"/> + </concept> + <concept> + <code value="remote-binary-download-http-host-connect"/> + <display value="Remote instance was unable to download the binary resource from the local DSF FHIR server because the connection was refused"/> </concept> <concept> <code value="remote-binary-download-missing-reference"/> @@ -318,7 +366,11 @@ </concept> <concept> - <code value="unknown"/> - <display value="An unknown error was encountered. Consult logs for more details."/> + <code value="local-unknown"/> + <display value="An unknown error was encountered by the local instance"/> + </concept> + <concept> + <code value="remote-unknown"/> + <display value="An unknown error was encountered by the remote instance"/> </concept> </CodeSystem> \ No newline at end of file From cf37bf0a620e88e150e1e53a46b14356bf3f7433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 11 Sep 2025 16:57:35 +0200 Subject: [PATCH 365/382] - Added PingPongProcessPluginDeploymentStateListener to change CodeSystems and Ping-Status-Extension of old PingPong versions to match the new version. This required making those resources backwards compatible, meaning the new version of the resources has its elements declared as optional in such a way that it is possible to construct both a valid resource for older plugin versions and new plugin versions - Removed "-v2" suffixes from all resources as this is no longer required to work around versioning issues. Removed the v1 extension in test resources, because it will now break tests, since PingPongProcessPluginDeploymentStateListener is not fixing resources in test cases - Amended versions to Codings that were overseen in 330cce90bb07cbcac202d76bde14bdb8b4df5be3 - Enforced usage of versions for ping pong plugin Codings in StructureDefinitions for Task resources. Going forward, this prevents the issue where Task resources are unable to be posted because codes are searched for in the wrong CodeSystem version --- src/main/java/dev/dsf/bpe/CodeSystem.java | 8 +- src/main/java/dev/dsf/bpe/ConstantsPing.java | 2 +- ...gProcessPluginDeploymentStateListener.java | 170 ++++++++++++++++++ .../dev/dsf/bpe/message/SendPingMessage.java | 8 +- .../dev/dsf/bpe/spring/config/PingConfig.java | 8 + .../DownloadResourceSizeGenerator.java | 1 + .../generator/DownloadedBytesGenerator.java | 4 +- .../DownloadedDurationGenerator.java | 4 +- .../ErrorInputComponentGenerator.java | 1 + .../fhir/CodeSystem/dsf-ping-error.xml | 2 +- .../fhir/CodeSystem/dsf-ping-status.xml | 2 +- .../resources/fhir/CodeSystem/dsf-ping.xml | 2 +- .../dsf-extension-ping-status.xml | 4 +- .../dsf-task-cleanup-pong.xml | 20 ++- .../StructureDefinition/dsf-task-ping.xml | 56 ++++-- .../StructureDefinition/dsf-task-pong.xml | 40 ++++- .../dsf-task-start-ping-autostart.xml | 30 +++- .../dsf-task-start-ping.xml | 46 +++-- .../Task/dsf-task-start-ping-autostart.xml | 9 +- .../fhir/Task/dsf-task-start-ping.xml | 6 +- .../fhir/ValueSet/dsf-network-speed-units.xml | 2 +- .../fhir/ValueSet/dsf-ping-status.xml | 8 +- src/main/resources/fhir/ValueSet/dsf-ping.xml | 4 +- .../fhir/ValueSet/dsf-pong-status.xml | 7 +- .../dsf/fhir/profiles/TaskProfileTest.java | 22 ++- .../fhir/CodeSystem/dsf-ping-1_0.xml | 2 +- .../fhir/CodeSystem/dsf-ping-status-1_0.xml | 2 +- .../dsf-extension-ping-status-1_0.xml | 134 -------------- .../resources/fhir/ValueSet/dsf-ping-1_0.xml | 4 +- .../fhir/ValueSet/dsf-ping-status-1_0.xml | 4 +- .../fhir/ValueSet/dsf-pong-status-1_0.xml | 4 +- 31 files changed, 398 insertions(+), 218 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/listener/PingPongProcessPluginDeploymentStateListener.java delete mode 100644 src/test/resources/fhir/StructureDefinition/dsf-extension-ping-status-1_0.xml diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index 2010bcfa..4dea79c5 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -50,7 +50,7 @@ public T ofValue(String value) public static final class DsfPing { - public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-v2"; + public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping"; private DsfPing() { @@ -96,7 +96,7 @@ public static Code ofValue(String value) public static final class DsfPingStatus { - public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-status-v2"; + public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-status"; private DsfPingStatus() { @@ -138,7 +138,7 @@ public static Code ofValue(String value) // TODO: rename to DsfNetworkSpeedUnits public static final class DsfPingUnits { - public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-units-v2"; + public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-units"; private DsfPingUnits() { @@ -335,7 +335,7 @@ public String toUcum() public final class DsfPingError { - public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-error-v2"; + public static final String URL = "http://dsf.dev/fhir/CodeSystem/ping-error"; private DsfPingError() { diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 18f3e8e2..ad7300be 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -43,7 +43,7 @@ private ConstantsPing() public static final String PROFILE_DSF_TASK_CLEANUP_PONG_PROCESS_URI = PROCESS_DSF_URI_BASE + PROCESS_NAME_PONG; public static final String PROFILE_DSF_TASK_CLEANUP_PONG_MESSAGE_NAME = "cleanupPong"; - public static final String STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"; + public static final String STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status"; public static final String STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; public static final String STRUCTURE_DEFINITION_URL_EXTENSION_ERROR = "http://dsf.dev/fhir/StructureDefinition/extension-error"; diff --git a/src/main/java/dev/dsf/bpe/listener/PingPongProcessPluginDeploymentStateListener.java b/src/main/java/dev/dsf/bpe/listener/PingPongProcessPluginDeploymentStateListener.java new file mode 100644 index 00000000..5bf59b0b --- /dev/null +++ b/src/main/java/dev/dsf/bpe/listener/PingPongProcessPluginDeploymentStateListener.java @@ -0,0 +1,170 @@ +package dev.dsf.bpe.listener; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.function.BiConsumer; +import java.util.stream.Collectors; + +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.CodeSystem; +import org.hl7.fhir.r4.model.MetadataResource; +import org.hl7.fhir.r4.model.Resource; +import org.hl7.fhir.r4.model.StructureDefinition; +import org.springframework.beans.factory.InitializingBean; + +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.PingProcessPluginDefinition; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.ProcessPluginDeploymentStateListener; + +public class PingPongProcessPluginDeploymentStateListener + implements ProcessPluginDeploymentStateListener, InitializingBean +{ + private final ProcessPluginApi api; + + public PingPongProcessPluginDeploymentStateListener(ProcessPluginApi api) + { + this.api = api; + } + + @Override + public void afterPropertiesSet() + { + Objects.requireNonNull(api, "api"); + } + + @Override + public void onProcessesDeployed(List<String> activeProcesses) + { + updateOlderResourcesIfCurrentIsNewestResource(dev.dsf.bpe.CodeSystem.DsfPing.URL, CodeSystem.class, + adaptCodeSystems()); + + updateOlderResourcesIfCurrentIsNewestResource(dev.dsf.bpe.CodeSystem.DsfPingStatus.URL, CodeSystem.class, + adaptCodeSystems()); + + updateOlderResourcesIfCurrentIsNewestResource(dev.dsf.bpe.CodeSystem.DsfPingUnits.URL, CodeSystem.class, + adaptCodeSystems()); + + updateOlderResourcesIfCurrentIsNewestResource(dev.dsf.bpe.CodeSystem.DsfPingError.URL, CodeSystem.class, + adaptCodeSystems()); + + updateOlderResourcesIfCurrentIsNewestResource(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS, + StructureDefinition.class, adaptExtensionStructureDefinitions()); + } + + private <T extends MetadataResource> void updateOlderResourcesIfCurrentIsNewestResource(String url, Class<T> type, + BiConsumer<T, List<T>> converter) + { + Bundle searchResult = search(type, url); + List<T> resources = extractAndSortResources(searchResult, type, url); + + if (currentIsNewestResource(resources)) + { + T currentResource = resources.get(resources.size() - 1); + List<T> oldResources = resources.subList(0, resources.size() - 1); + converter.accept(currentResource, oldResources); + } + } + + private Bundle search(Class<? extends Resource> type, String url) + { + return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().search(type, + Map.of("url", List.of(url))); + } + + private <T extends MetadataResource> List<T> extractAndSortResources(Bundle bundle, Class<T> type, String url) + { + return bundle.getEntry().stream().filter(Bundle.BundleEntryComponent::hasResource) + .map(Bundle.BundleEntryComponent::getResource).filter(type::isInstance).map(type::cast) + .filter(m -> url.equals(m.getUrl())).sorted((r1, r2) -> + { + MinorMajorVersion version1 = getMajorMinorVersion(r1.getVersion().substring(0, 3)); + MinorMajorVersion version2 = getMajorMinorVersion(r2.getVersion().substring(0, 3)); + + if (version1.major > version2.major) + { + return 1; + } + else if (version1.major < version2.major) + { + return -1; + } + else + { + return Integer.compare(version1.minor, version2.minor); + } + }).toList(); + } + + private boolean currentIsNewestResource(List<? extends MetadataResource> resources) + { + return !resources.isEmpty() && PingProcessPluginDefinition.RESOURCE_VERSION + .equals(resources.get(resources.size() - 1).getVersion()); + } + + private MinorMajorVersion getMajorMinorVersion(String version) + { + if (version.matches("\\d\\.\\d")) + { + String[] minorMajor = version.split("\\."); + return new MinorMajorVersion(Integer.parseInt(minorMajor[0]), Integer.parseInt(minorMajor[1])); + } + + throw new RuntimeException("Fhir resource version " + version + " does not match regex \\d\\.\\d"); + } + + private BiConsumer<CodeSystem, List<CodeSystem>> adaptCodeSystems() + { + return (currentResource, olderResources) -> + { + List<CodeSystem> codeSystemsWithNonMatchingConceptCodes = filterCodeSystemsWithNonMatchingConceptCodesAndAdaptToCurrentCodeSystemConceptCodes( + currentResource, olderResources); + updateResources(codeSystemsWithNonMatchingConceptCodes); + }; + } + + private List<CodeSystem> filterCodeSystemsWithNonMatchingConceptCodesAndAdaptToCurrentCodeSystemConceptCodes( + CodeSystem currentCodeSystem, List<CodeSystem> olderCodeSystems) + { + Set<String> currentConceptCodes = getConceptCodes(currentCodeSystem); + return olderCodeSystems.stream().filter(c -> !currentConceptCodes.equals(getConceptCodes(c))) + .map(c -> c.setConcept(currentCodeSystem.getConcept())).toList(); + } + + private Set<String> getConceptCodes(CodeSystem codeSystem) + { + return codeSystem.getConcept().stream().map(CodeSystem.ConceptDefinitionComponent::getCode) + .collect(Collectors.toSet()); + } + + private BiConsumer<StructureDefinition, List<StructureDefinition>> adaptExtensionStructureDefinitions() + { + return (currentResource, olderResources) -> + { + overrideDifferentialForOlderExtensionStructureDefinitions(olderResources, + currentResource.getDifferential()); + updateResources(olderResources); + }; + } + + private void overrideDifferentialForOlderExtensionStructureDefinitions( + List<StructureDefinition> olderStructureDefinitions, + StructureDefinition.StructureDefinitionDifferentialComponent newDifferential) + { + olderStructureDefinitions.forEach(olderStructureDefinition -> + { + olderStructureDefinition.setDifferential(newDifferential); + }); + } + + private void updateResources(List<? extends MetadataResource> resources) + { + resources.forEach(m -> api.getFhirWebserviceClientProvider().getLocalWebserviceClient().update(m)); + } + + private record MinorMajorVersion(int major, int minor) + { + } +} diff --git a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java index 02f70479..df30bce4 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPingMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPingMessage.java @@ -15,6 +15,7 @@ import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; +import dev.dsf.bpe.PingProcessPluginDefinition; import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadResourceReferenceGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadResourceSizeGenerator; @@ -46,9 +47,12 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut : Stream.of(DownloadResourceReferenceGenerator.create(downloadResourceReference)); Stream<ParameterComponent> downloadResourceSizeBytesStream = Stream .of(DownloadResourceSizeGenerator.create(downloadResourceSizeBytes)); - Stream<ParameterComponent> endpointIdentifierStream = Stream.of(api.getTaskHelper().createInput( + ParameterComponent endpointIdentifierComponent = api.getTaskHelper().createInput( new Reference().setIdentifier(getLocalEndpointIdentifier()).setType(ResourceType.Endpoint.name()), - CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.ENDPOINT_IDENTIFIER.getValue())); + CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.ENDPOINT_IDENTIFIER.getValue()); + endpointIdentifierComponent.getType().getCodingFirstRep() + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); + Stream<ParameterComponent> endpointIdentifierStream = Stream.of(endpointIdentifierComponent); return Stream.concat(endpointIdentifierStream, Stream.concat(downloadResourceReferenceStream, downloadResourceSizeBytesStream)); diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index e5344921..6bc11b42 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.listener.PingPongProcessPluginDeploymentStateListener; import dev.dsf.bpe.listener.SetCorrelationKeyListener; import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.message.CleanupPongMessage; @@ -104,6 +105,13 @@ public void setMaxUploadSizeBytes(long maxUploadSizeBytes) this.maxUploadSizeBytes = maxUploadSizeBytes; } + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public PingPongProcessPluginDeploymentStateListener pingPongProcessPluginDeploymentStateListener() + { + return new PingPongProcessPluginDeploymentStateListener(api); + } + @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SetTargetAndConfigureTimer setTargetAndConfigureTimer() diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java index f899b42f..f2432404 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java @@ -5,6 +5,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.PingProcessPluginDefinition; public final class DownloadResourceSizeGenerator { diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java index 690b5399..e8f22422 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedBytesGenerator.java @@ -4,6 +4,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.PingProcessPluginDefinition; public final class DownloadedBytesGenerator { @@ -15,7 +16,8 @@ public static Task.ParameterComponent create(long bytes) { Task.ParameterComponent param = new Task.ParameterComponent(); param.setValue(new DecimalType(bytes)).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) - .setCode(CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue()); + .setCode(CodeSystem.DsfPing.Code.DOWNLOADED_BYTES.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationGenerator.java index 72fee158..b24288f5 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadedDurationGenerator.java @@ -5,6 +5,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.PingProcessPluginDefinition; public final class DownloadedDurationGenerator { @@ -20,7 +21,8 @@ public static Task.ParameterComponent create(Duration duration) Task.ParameterComponent param = new Task.ParameterComponent(); param.setValue(new org.hl7.fhir.r4.model.Duration().setValue(duration.toMillis()).setSystem(CODESYSTEM_UCUM) .setCode(CODESYSTEM_UCUM_CODE_MILLISECONDS)).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) - .setCode(CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue()); + .setCode(CodeSystem.DsfPing.Code.DOWNLOADED_DURATION_MILLIS.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); return param; } } diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java index a17c10e6..ae53302d 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java @@ -10,6 +10,7 @@ import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.PingProcessPluginDefinition; import dev.dsf.bpe.ProcessError; public final class ErrorInputComponentGenerator diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml index e5358845..1cb0f4ac 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-error-v2" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping-error" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping_Error" /> diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml index 9393919b..8dfaf7e5 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-status.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping-status" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping_Status" /> diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping.xml b/src/main/resources/fhir/CodeSystem/dsf-ping.xml index 8306e246..d8c044a9 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping" /> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 3159fd78..54723fd5 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -5,7 +5,7 @@ <code value="ALL"/> </tag> </meta> - <url value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"/> + <url value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> <!-- version managed by bpe --> <version value="#{version}" /> <name value="PingResponse"/> @@ -234,7 +234,7 @@ </element> <element id="Extension.url"> <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2"/> + <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> </element> <element id="Extension.value[x]"> <path value="Extension.value[x]"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml index 6d951732..21d165e0 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-cleanup-pong.xml @@ -72,7 +72,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> </binding> </element> <element id="Task.input:downloaded-bytes.type.coding"> @@ -84,7 +84,13 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:downloaded-bytes.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:downloaded-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -112,7 +118,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> </binding> </element> <element id="Task.input:downloaded-duration.type.coding"> @@ -124,7 +130,13 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:downloaded-duration.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:downloaded-duration.type.coding.code"> <path value="Task.input.type.coding.code"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml index db1804a8..03719e8e 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-ping.xml @@ -70,7 +70,7 @@ <path value="Task.input.type" /> <binding> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> </binding> </element> <element id="Task.input:endpoint-identifier.type.coding"> @@ -81,7 +81,13 @@ <element id="Task.input:endpoint-identifier.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:endpoint-identifier.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:endpoint-identifier.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -129,7 +135,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> </binding> </element> <element id="Task.input:download-resource-size-bytes.type.coding"> @@ -141,7 +147,13 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -167,7 +179,7 @@ <path value="Task.input.type"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> </binding> </element> <element id="Task.input:download-resource-reference.type.coding"> @@ -179,7 +191,13 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:download-resource-reference.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:download-resource-reference.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -242,7 +260,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> </binding> </element> <element id="Task.output:process-error.type.coding"> @@ -254,7 +272,13 @@ <path value="Task.output.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.output:process-error.type.coding.version"> + <path value="Task.output.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.output:process-error.type.coding.code"> <path value="Task.output.type.coding.code"/> @@ -288,14 +312,14 @@ <min value="1" /> <type> <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2|#{version}" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status|#{version}" /> </type> </element> <element id="Task.output:pong-status.type"> <path value="Task.output.type"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> </binding> </element> <element id="Task.output:pong-status.type.coding"> @@ -306,7 +330,13 @@ <element id="Task.output:pong-status.type.coding.system"> <path value="Task.output.type.coding.system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.output:pong-status.type.coding.version"> + <path value="Task.output.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.output:pong-status.type.coding.code"> <path value="Task.output.type.coding.code"/> @@ -322,14 +352,14 @@ <element id="Task.output:pong-status.value[x].system"> <path value="Task.output.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status"/> </element> <element id="Task.output:pong-status.value[x].code"> <path value="Task.output.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/pong-status-v2|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/pong-status|#{version}"/> </binding> </element> </differential> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml index fbe1d2c2..e1ef4e93 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-pong.xml @@ -69,7 +69,7 @@ <path value="Task.input.type"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> </binding> </element> <element id="Task.input:download-resource-reference.type.coding"> @@ -81,7 +81,13 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:download-resource-reference.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:download-resource-reference.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -123,7 +129,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> </binding> </element> <element id="Task.input:downloaded-bytes.type.coding"> @@ -135,7 +141,13 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:downloaded-bytes.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:downloaded-bytes.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -163,7 +175,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping"/> </binding> </element> <element id="Task.input:downloaded-duration.type.coding"> @@ -175,7 +187,13 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:downloaded-duration.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:downloaded-duration.type.coding.code"> <path value="Task.input.type.coding.code"/> @@ -224,7 +242,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> </binding> </element> <element id="Task.input:process-error.type.coding"> @@ -236,7 +254,13 @@ <path value="Task.input.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.input:process-error.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:process-error.type.coding.code"> <path value="Task.input.type.coding.code"/> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml index 969e6229..49e249f7 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml @@ -68,7 +68,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> </binding> </element> <element id="Task.input:target-endpoints.type.coding"> @@ -79,7 +79,13 @@ <element id="Task.input:target-endpoints.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:target-endpoints.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:target-endpoints.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -108,7 +114,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> </binding> </element> <element id="Task.input:timer-interval.type.coding"> @@ -119,7 +125,13 @@ <element id="Task.input:timer-interval.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:timer-interval.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:timer-interval.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -154,13 +166,19 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> </binding> </element> <element id="Task.input:download-resource-size-bytes.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code" /> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index bd941da4..fce3e8b3 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -68,7 +68,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> </binding> </element> <element id="Task.input:target-endpoints.type.coding"> @@ -79,7 +79,13 @@ <element id="Task.input:target-endpoints.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:target-endpoints.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:target-endpoints.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -108,13 +114,19 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> </binding> </element> <element id="Task.input:download-resource-size-bytes.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:download-resource-size-bytes.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.input:download-resource-size-bytes.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -154,7 +166,7 @@ <max value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> </binding> </element> <element id="Task.output:process-error.type.coding"> @@ -166,7 +178,13 @@ <path value="Task.output.type.coding.system"/> <min value="1"/> <max value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.output:process-error.type.coding.version"> + <path value="Task.output.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.output:process-error.type.coding.code"> <path value="Task.output.type.coding.code"/> @@ -200,14 +218,14 @@ <min value="1" /> <type> <code value="Extension" /> - <profile value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status-v2|#{version}" /> + <profile value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status|#{version}" /> </type> </element> <element id="Task.output:ping-status.type"> <path value="Task.output.type"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-v2|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}"/> </binding> </element> <element id="Task.output:ping-status.type.coding"> @@ -218,7 +236,13 @@ <element id="Task.output:ping-status.type.coding.system"> <path value="Task.output.type.coding.system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping"/> + </element> + <element id="Task.output:ping-status.type.coding.version"> + <path value="Task.output.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> </element> <element id="Task.output:ping-status.type.coding.code"> <path value="Task.output.type.coding.code"/> @@ -234,14 +258,14 @@ <element id="Task.output:ping-status.value[x].system"> <path value="Task.output.value[x].system"/> <min value="1"/> - <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status-v2"/> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping-status"/> </element> <element id="Task.output:ping-status.value[x].code"> <path value="Task.output.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> - <valueSet value="http://dsf.dev/fhir/ValueSet/ping-status-v2|#{version}"/> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping-status|#{version}"/> </binding> </element> </differential> diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml index 86636765..92773665 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml @@ -38,7 +38,8 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <version value="#{version}"/> <code value="target-endpoints"/> </coding> </type> @@ -47,7 +48,8 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <version value="#{version}"/> <code value="timer-interval"/> </coding> </type> @@ -56,7 +58,8 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <version value="#{version}"/> <code value="download-resource-size-bytes"/> </coding> </type> diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping.xml b/src/main/resources/fhir/Task/dsf-task-start-ping.xml index 1ab93850..79340db5 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping.xml @@ -38,7 +38,8 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <version value="#{version}"/> <code value="download-resource-size-bytes" /> </coding> </type> @@ -47,7 +48,8 @@ <input> <type> <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping-v2"/> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <version value="#{version}"/> <code value="target-endpoints"/> </coding> </type> diff --git a/src/main/resources/fhir/ValueSet/dsf-network-speed-units.xml b/src/main/resources/fhir/ValueSet/dsf-network-speed-units.xml index cbf115de..dc170e51 100644 --- a/src/main/resources/fhir/ValueSet/dsf-network-speed-units.xml +++ b/src/main/resources/fhir/ValueSet/dsf-network-speed-units.xml @@ -6,7 +6,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping-units-v2" /> + <url value="http://dsf.dev/fhir/ValueSet/ping-units" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping_Units" /> diff --git a/src/main/resources/fhir/ValueSet/dsf-ping-status.xml b/src/main/resources/fhir/ValueSet/dsf-ping-status.xml index 0325be6f..0729a89a 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping-status.xml +++ b/src/main/resources/fhir/ValueSet/dsf-ping-status.xml @@ -6,7 +6,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping-status-v2" /> + <url value="http://dsf.dev/fhir/ValueSet/ping-status" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping_Status" /> @@ -21,19 +21,23 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-status" /> <version value="#{version}" /> <concept> <code value="not-allowed" /> + <display value="Not allowed" /> </concept> <concept> <code value="not-reachable" /> + <display value="Not reachable" /> </concept> <concept> <code value="pong-missing" /> + <display value="Pong missing" /> </concept> <concept> <code value="pong-received" /> + <display value="Pong received" /> </concept> </include> </compose> diff --git a/src/main/resources/fhir/ValueSet/dsf-ping.xml b/src/main/resources/fhir/ValueSet/dsf-ping.xml index 4984f57a..0fef6dbf 100644 --- a/src/main/resources/fhir/ValueSet/dsf-ping.xml +++ b/src/main/resources/fhir/ValueSet/dsf-ping.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping-v2" /> + <url value="http://dsf.dev/fhir/ValueSet/ping" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Ping" /> @@ -20,7 +20,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping" /> <version value="#{version}" /> </include> </compose> diff --git a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml index d3c90078..09860584 100644 --- a/src/main/resources/fhir/ValueSet/dsf-pong-status.xml +++ b/src/main/resources/fhir/ValueSet/dsf-pong-status.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/pong-status-v2" /> + <url value="http://dsf.dev/fhir/ValueSet/pong-status" /> <!-- version managed by bpe --> <version value="#{version}" /> <name value="DSF_Pong_Status" /> @@ -20,16 +20,19 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-status" /> <version value="#{version}" /> <concept> <code value="not-allowed" /> + <display value="Not allowed" /> </concept> <concept> <code value="not-reachable" /> + <display value="Not reachable" /> </concept> <concept> <code value="pong-send" /> + <display value="Pong send" /> </concept> </include> </compose> diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 88dd82dc..d6f78196 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -60,8 +60,8 @@ public class TaskProfileTest public static final ValidationSupportRule validationRule = new ValidationSupportRule(def.getResourceVersion(), def.getResourceReleaseDate(), Arrays.asList("dsf-task-base-1.0.0.xml", "dsf-extension-error.xml", "dsf-extension-ping-status.xml", - "dsf-extension-ping-status-1_0.xml", "dsf-task-ping.xml", "dsf-task-pong.xml", - "dsf-task-start-ping.xml", "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", + "dsf-task-ping.xml", "dsf-task-pong.xml", "dsf-task-start-ping.xml", + "dsf-task-start-ping-autostart.xml", "dsf-task-stop-ping-autostart.xml", "dsf-task-cleanup-pong.xml"), Arrays.asList("dsf-read-access-tag-1.0.0.xml", "dsf-bpmn-message-1.0.0.xml", "dsf-ping-1_0.xml", "dsf-ping.xml", "dsf-ping-status-1_0.xml", "dsf-ping-status.xml"), @@ -92,7 +92,8 @@ public void testTaskStartAutostartProcessProfileValidWithTargetEndpoints() .setValue(new StringType( "Endpoint?identifier=http://dsf.dev/sid/endpoint-identifier|endpoint.target.org")) .getType().addCoding().setSystem(CodeSystem.DsfPing.URL) - .setCode(CodeSystem.DsfPing.Code.TARGET_ENDPOINTS.getValue()); + .setCode(CodeSystem.DsfPing.Code.TARGET_ENDPOINTS.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -106,7 +107,8 @@ public void testTaskStartAutostartProcessProfileValidTimerInterval() { Task task = createValidTaskStartAutostartProcess(); task.addInput().setValue(new StringType("PT24H")).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) - .setCode(CodeSystem.DsfPing.Code.TIMER_INTERVAL.getValue()); + .setCode(CodeSystem.DsfPing.Code.TIMER_INTERVAL.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -120,7 +122,8 @@ public void testTaskStartAutostartProcessProfileNotValidTimerInterval() { Task task = createValidTaskStartAutostartProcess(); task.addInput().setValue(new StringType("invalid_duration")).getType().addCoding() - .setSystem(CodeSystem.DsfPing.URL).setCode(CodeSystem.DsfPing.Code.TIMER_INTERVAL.getValue()); + .setSystem(CodeSystem.DsfPing.URL).setCode(CodeSystem.DsfPing.Code.TIMER_INTERVAL.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -228,7 +231,8 @@ public void testTaskStartPingProcessProfileValidWithTargetEndpoints() .setValue(new StringType( "Endpoint?identifier=http://dsf.dev/sid/endpoint-identifier|endpoint.target.org")) .getType().addCoding().setSystem(CodeSystem.DsfPing.URL) - .setCode(CodeSystem.DsfPing.Code.TARGET_ENDPOINTS.getValue()); + .setCode(CodeSystem.DsfPing.Code.TARGET_ENDPOINTS.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -393,7 +397,8 @@ private Task createValidTaskStartPingProcess() task.addInput().setValue(new StringType(ConstantsPing.PROFILE_DSF_TASK_START_PING_MESSAGE_NAME)).getType() .addCoding(BpmnMessage.messageName()); task.addInput().setValue(new DecimalType(1)).getType().addCoding().setSystem(CodeSystem.DsfPing.URL) - .setCode(CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()); + .setCode(CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); return task; } @@ -515,7 +520,8 @@ private Task createValidTaskPing() .setValue(new Reference().setType(ResourceType.Endpoint.name()) .setIdentifier(EndpointIdentifier.withValue("endpoint.target.org"))) .getType().addCoding().setSystem(CodeSystem.DsfPing.URL) - .setCode(CodeSystem.DsfPing.Code.ENDPOINT_IDENTIFIER.getValue()); + .setCode(CodeSystem.DsfPing.Code.ENDPOINT_IDENTIFIER.getValue()) + .setVersion(PingProcessPluginDefinition.RESOURCE_VERSION); return task; } diff --git a/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml b/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml index 630c9073..c2586c9f 100644 --- a/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml +++ b/src/test/resources/fhir/CodeSystem/dsf-ping-1_0.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping" /> <!-- version managed by bpe --> <version value="1.0" /> <name value="DSF_Ping" /> diff --git a/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml b/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml index 62ebe1cb..6a1bd2c4 100644 --- a/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml +++ b/src/test/resources/fhir/CodeSystem/dsf-ping-status-1_0.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> + <url value="http://dsf.dev/fhir/CodeSystem/ping-status" /> <!-- version managed by bpe --> <version value="1.0" /> <name value="DSF_Ping_Status" /> diff --git a/src/test/resources/fhir/StructureDefinition/dsf-extension-ping-status-1_0.xml b/src/test/resources/fhir/StructureDefinition/dsf-extension-ping-status-1_0.xml deleted file mode 100644 index 3917b793..00000000 --- a/src/test/resources/fhir/StructureDefinition/dsf-extension-ping-status-1_0.xml +++ /dev/null @@ -1,134 +0,0 @@ -<StructureDefinition xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://dsf.dev/fhir/CodeSystem/read-access-tag"/> - <code value="ALL"/> - </tag> - </meta> - <url value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> - <!-- version managed by bpe --> - <version value="1.0" /> - <name value="PingResponse"/> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <!-- date managed by bpe --> - <date value="#{date}" /> - <fhirVersion value="4.0.1"/> - <kind value="complex-type"/> - <abstract value="false"/> - <context> - <type value="element"/> - <expression value="Task.output"/> - </context> - <type value="Extension"/> - <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> - <derivation value="constraint"/> - <differential> - <element id="Extension.extension"> - <path value="Extension.extension"/> - <slicing> - <discriminator> - <type value="value"/> - <path value="url"/> - </discriminator> - <rules value="open"/> - </slicing> - <min value="3"/> - </element> - <element id="Extension.extension:correlation-key"> - <path value="Extension.extension"/> - <sliceName value="correlation-key"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:correlation-key.url"> - <path value="Extension.extension.url"/> - <fixedUri value="correlation-key"/> - </element> - <element id="Extension.extension:correlation-key.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <type> - <code value="string"/> - </type> - </element> - <element id="Extension.extension:organization-identifier"> - <path value="Extension.extension"/> - <sliceName value="organization-identifier"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:organization-identifier.url"> - <path value="Extension.extension.url"/> - <fixedUri value="organization-identifier"/> - </element> - <element id="Extension.extension:organization-identifier.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <type> - <code value="Identifier"/> - </type> - </element> - <element id="Extension.extension:organization-identifier.value[x].system"> - <path value="Extension.extension.value[x].system"/> - <min value="1"/> - <fixedUri value="http://dsf.dev/sid/organization-identifier"/> - </element> - <element id="Extension.extension:organization-identifier.value[x].value"> - <path value="Extension.extension.value[x].value"/> - <min value="1"/> - </element> - <element id="Extension.extension:endpoint-identifier"> - <path value="Extension.extension"/> - <sliceName value="endpoint-identifier"/> - <min value="1"/> - <max value="1"/> - </element> - <element id="Extension.extension:endpoint-identifier.url"> - <path value="Extension.extension.url"/> - <fixedUri value="endpoint-identifier"/> - </element> - <element id="Extension.extension:endpoint-identifier.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <type> - <code value="Identifier"/> - </type> - </element> - <element id="Extension.extension:endpoint-identifier.value[x].system"> - <path value="Extension.extension.value[x].system"/> - <min value="1"/> - <fixedUri value="http://dsf.dev/sid/endpoint-identifier"/> - </element> - <element id="Extension.extension:endpoint-identifier.value[x].value"> - <path value="Extension.extension.value[x].value"/> - <min value="1"/> - </element> - <element id="Extension.extension:error-message"> - <path value="Extension.extension"/> - <sliceName value="error-message"/> - <min value="0"/> - <max value="1"/> - </element> - <element id="Extension.extension:error-message.url"> - <path value="Extension.extension.url"/> - <fixedUri value="error-message"/> - </element> - <element id="Extension.extension:error-message.value[x]"> - <path value="Extension.extension.value[x]"/> - <min value="1"/> - <type> - <code value="string"/> - </type> - </element> - <element id="Extension.url"> - <path value="Extension.url"/> - <fixedUri value="http://dsf.dev/fhir/StructureDefinition/extension-ping-status"/> - </element> - <element id="Extension.value[x]"> - <path value="Extension.value[x]"/> - <max value="0"/> - </element> - </differential> -</StructureDefinition> \ No newline at end of file diff --git a/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml b/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml index 4784f28a..e52dfd87 100644 --- a/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml +++ b/src/test/resources/fhir/ValueSet/dsf-ping-1_0.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping-v2" /> + <url value="http://dsf.dev/fhir/ValueSet/ping" /> <!-- version managed by bpe --> <version value="1.0" /> <name value="DSF_Ping" /> @@ -20,7 +20,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-v2" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping" /> <version value="1.0" /> </include> </compose> diff --git a/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml b/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml index cae323ec..afc26d27 100644 --- a/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml +++ b/src/test/resources/fhir/ValueSet/dsf-ping-status-1_0.xml @@ -6,7 +6,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/ping-status-v2" /> + <url value="http://dsf.dev/fhir/ValueSet/ping-status" /> <!-- version managed by bpe --> <version value="1.0" /> <name value="DSF_Ping_Status" /> @@ -21,7 +21,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-status" /> <version value="1.0" /> <concept> <code value="not-allowed" /> diff --git a/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml b/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml index 38a2020a..d0661cea 100644 --- a/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml +++ b/src/test/resources/fhir/ValueSet/dsf-pong-status-1_0.xml @@ -5,7 +5,7 @@ <code value="ALL" /> </tag> </meta> - <url value="http://dsf.dev/fhir/ValueSet/pong-status-v2" /> + <url value="http://dsf.dev/fhir/ValueSet/pong-status" /> <!-- version managed by bpe --> <version value="1.0" /> <name value="DSF_Pong_Status" /> @@ -20,7 +20,7 @@ <immutable value="true" /> <compose> <include> - <system value="http://dsf.dev/fhir/CodeSystem/ping-status-v2" /> + <system value="http://dsf.dev/fhir/CodeSystem/ping-status" /> <version value="1.0" /> <concept> <code value="not-allowed" /> From 671f26c1f8c11a5172a8c32d3d800ed242dacb0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 11 Sep 2025 18:27:08 +0200 Subject: [PATCH 366/382] Fixed errors being appended to ping-status-extension instead of ping-status-extension.errors --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 1 + .../output/generator/PingStatusGenerator.java | 50 +++++++++++++++---- .../dsf-extension-ping-status.xml | 15 +++--- 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index ad7300be..3416fd88 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -55,6 +55,7 @@ private ConstantsPing() public static final String EXTENSION_URL_NETWORK_SPEED_UNIT = "unit"; public static final String EXTENSION_URL_NETWORK_SPEED_VALUE = "network-speed"; public static final String EXTENSION_URL_ERROR = "error"; + public static final String EXTENSION_URL_ERRORS = "errors"; public static final String EXTENSION_URL_PROCESS = "process"; public static final String EXTENSION_URL_PROCESS_STEP = "process-step"; public static final String EXTENSION_URL_ACTION = "action"; diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index db929738..6c9225de 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -409,9 +409,10 @@ private static TaskOutputComponent addErrors(TaskOutputComponent outputComponent if (errors != null) { Extension extension = getOrCreatePingStatusExtension(outputComponent); + Extension errorsExtension = getOrCreateErrorsExtension(extension); for (ProcessError error : errors) { - extension.addExtension(ProcessError.toExtension(error)); + errorsExtension.addExtension(ProcessError.toExtension(error)); } } sortStatusOutputExtensions(outputComponent); @@ -421,20 +422,13 @@ private static TaskOutputComponent addErrors(TaskOutputComponent outputComponent private static TaskOutputComponent updateErrors(TaskOutputComponent outputComponent, List<ProcessError> errors) { Extension extension = getOrCreatePingStatusExtension(outputComponent); - List<Extension> nonErrorExtensions = extension.getExtension().stream() - .filter(extension1 -> !ConstantsPing.EXTENSION_URL_ERROR.equals(extension1.getUrl())) - .collect(Collectors.toCollection(ArrayList::new)); + Extension errorsExtension = getOrCreateErrorsExtension(extension); if (errors != null) { List<Extension> newErrorExtensions = errors.stream().map(ProcessError::toExtension) .collect(Collectors.toCollection(ArrayList::new)); - nonErrorExtensions.addAll(newErrorExtensions); - extension.setExtension(newErrorExtensions); - } - else - { - extension.setExtension(nonErrorExtensions); + errorsExtension.setExtension(newErrorExtensions); } sortStatusOutputExtensions(outputComponent); @@ -593,6 +587,42 @@ private static Optional<Extension> getPingStatusExtension(TaskOutputComponent ou } } + private static Extension getOrCreateErrorsExtension(Extension extension) + { + Optional<Extension> optionalExtension = getErrorsExtension(extension); + if (optionalExtension.isPresent()) + { + return optionalExtension.get(); + } + else + { + Extension errorsExtension = extension.addExtension(); + errorsExtension.setUrl(ConstantsPing.EXTENSION_URL_ERRORS); + return errorsExtension; + } + } + + private static Optional<Extension> getErrorsExtension(Extension extension) + { + List<Extension> errorsExtensions = extension.getExtension().stream() + .filter(ex -> ConstantsPing.EXTENSION_URL_ERRORS.equals(extension.getUrl())).toList(); + if (errorsExtensions.isEmpty()) + { + return Optional.empty(); + } + else + { + if (errorsExtensions.size() == 1) + { + return Optional.of(errorsExtensions.get(0)); + } + else + { + throw new RuntimeException("Only one errors extension is allowed but found " + errorsExtensions.size()); + } + } + } + private static List<Task.TaskOutputComponent> getOutputsByExtensionUrlAndCodes(Task task, String... codes) { return task.getOutput().stream() diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index 54723fd5..a1d2f050 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -198,12 +198,12 @@ <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:error"> + <element id="Extension.extension:errors"> <path value="Extension.extension"/> <sliceName value="error"/> <min value="0"/> </element> - <element id="Extension.extension:error.extension"> + <element id="Extension.extension:errors.extension"> <path value="Extension.extension.extension" /> <slicing> <discriminator> @@ -212,23 +212,20 @@ </discriminator> <rules value="open" /> </slicing> - <min value="1"/> - <max value="1"/> </element> - <element id="Extension.extension:error.extension:error-extension"> + <element id="Extension.extension:errors.extension:error-extension"> <path value="Extension.extension.extension" /> <sliceName value="error-extension" /> - <min value="1" /> <type> <code value="Extension" /> <profile value="http://dsf.dev/fhir/StructureDefinition/extension-error|#{version}" /> </type> </element> - <element id="Extension.extension:error.url"> + <element id="Extension.extension:errors.url"> <path value="Extension.extension.url"/> - <fixedUri value="error"/> + <fixedUri value="errors"/> </element> - <element id="Extension.extension:error.value[x]"> + <element id="Extension.extension:errors.value[x]"> <path value="Extension.extension.value[x]"/> <max value="0"/> </element> From 45907d5cf49b56a5f14e4b93df1b40244a23c92e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 15 Sep 2025 10:44:59 +0200 Subject: [PATCH 367/382] Added error handling for HTTP 413 Request Entity too large and removed unused imports --- src/main/java/dev/dsf/bpe/CodeSystem.java | 8 ++++++++ src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java | 1 - src/main/java/dev/dsf/bpe/message/SendPongMessage.java | 1 - .../dev/dsf/bpe/service/GenerateAndStoreResource.java | 6 ++++++ .../dev/dsf/bpe/service/ping/LogAndSaveSendError.java | 1 - .../generator/DownloadResourceReferenceGenerator.java | 2 -- .../input/generator/DownloadResourceSizeGenerator.java | 2 -- .../input/generator/ErrorInputComponentGenerator.java | 2 -- src/main/resources/fhir/CodeSystem/dsf-ping-error.xml | 8 ++++++++ 9 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index 4dea79c5..80651261 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -505,6 +505,10 @@ public enum Concept "local-binary-post-http-403", "Local instance encountered a HTTP status 403 trying to post the binary resource to its own FHIR server" ), + LOCAL_BINARY_POST_HTTP_413( + "local-binary-post-http-413", + "Local instance encountered a HTTP status 413 trying to post the binary resource to its own FHIR server" + ), LOCAL_BINARY_POST_HTTP_500( "local-binary-post-http-500", "Local instance encountered a HTTP status 500 trying to post the binary resource to its own FHIR server" @@ -538,6 +542,10 @@ public enum Concept "remote-binary-post-http-403", "Remote instance encountered a HTTP status 403 trying to post the binary resource to its own FHIR server" ), + REMOTE_BINARY_POST_HTTP_413( + "remote-binary-post-http-413", + "Remote instance encountered a HTTP status 413 trying to post the binary resource to its own FHIR server" + ), REMOTE_BINARY_POST_HTTP_500( "remote-binary-post-http-500", "Remote instance encountered a HTTP status 500 trying to post the binary resource to its own FHIR server" diff --git a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java index 536d642d..eb148c12 100644 --- a/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/CleanupPongMessage.java @@ -11,7 +11,6 @@ import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; -import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.util.task.SendTaskErrorConverter; import dev.dsf.bpe.util.task.input.generator.DownloadedBytesGenerator; import dev.dsf.bpe.util.task.input.generator.DownloadedDurationGenerator; diff --git a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java index a77b0f1c..c5c34497 100644 --- a/src/main/java/dev/dsf/bpe/message/SendPongMessage.java +++ b/src/main/java/dev/dsf/bpe/message/SendPongMessage.java @@ -12,7 +12,6 @@ import dev.dsf.bpe.CodeSystem; import dev.dsf.bpe.ConstantsPing; import dev.dsf.bpe.ExecutionVariables; -import dev.dsf.bpe.ProcessError; import dev.dsf.bpe.ProcessErrors; import dev.dsf.bpe.mail.AggregateErrorMailService; import dev.dsf.bpe.util.ErrorListUtils; diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 913c7c22..2e1504b8 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -93,6 +93,12 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) errorRemote = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_HTTP_403, ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); break; + case 413: + error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_HTTP_413, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + errorRemote = new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_BINARY_POST_HTTP_413, + ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); + break; case 500: error = new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_HTTP_500, ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP); diff --git a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java index 5e0bd097..753c1d1c 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java +++ b/src/main/java/dev/dsf/bpe/service/ping/LogAndSaveSendError.java @@ -1,6 +1,5 @@ package dev.dsf.bpe.service.ping; -import java.time.Duration; import java.util.Objects; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java index 33a41277..a8e2a09f 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceReferenceGenerator.java @@ -1,11 +1,9 @@ package dev.dsf.bpe.util.task.input.generator; -import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.PingProcessPluginDefinition; public final class DownloadResourceReferenceGenerator { diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java index f2432404..53429582 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/DownloadResourceSizeGenerator.java @@ -1,11 +1,9 @@ package dev.dsf.bpe.util.task.input.generator; -import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.DecimalType; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.PingProcessPluginDefinition; public final class DownloadResourceSizeGenerator { diff --git a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java index ae53302d..eb821935 100644 --- a/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/input/generator/ErrorInputComponentGenerator.java @@ -4,13 +4,11 @@ import java.util.stream.Collectors; import org.hl7.fhir.r4.model.CodeType; -import org.hl7.fhir.r4.model.Coding; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; import dev.dsf.bpe.CodeSystem; -import dev.dsf.bpe.PingProcessPluginDefinition; import dev.dsf.bpe.ProcessError; public final class ErrorInputComponentGenerator diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml index 1cb0f4ac..8c630fb3 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml @@ -178,6 +178,10 @@ <code value="local-binary-post-http-403"/> <display value="Local instance encountered a HTTP status 403 trying to post the binary resource to its own FHIR server"/> </concept> + <concept> + <code value="local-binary-post-http-413"/> + <display value="Local instance encountered a HTTP status 413 trying to post the binary resource to its own FHIR server"/> + </concept> <concept> <code value="local-binary-post-http-500"/> <display value="Local instance encountered a HTTP status 500 trying to post the binary resource to its own FHIR server"/> @@ -211,6 +215,10 @@ <code value="remote-binary-post-http-403"/> <display value="Remote instance encountered a HTTP status 403 trying to post the binary resource to its own FHIR server"/> </concept> + <concept> + <code value="remote-binary-post-http-413"/> + <display value="Remote instance encountered a HTTP status 413 trying to post the binary resource to its own FHIR server"/> + </concept> <concept> <code value="remote-binary-post-http-500"/> <display value="Remote instance encountered a HTTP status 500 trying to post the binary resource to its own FHIR server"/> From 27ff7759c2a6763e0e30f0f2ce0262d59237f37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 15 Sep 2025 11:52:16 +0200 Subject: [PATCH 368/382] Fixed duplicate errors-extensions in pong status output --- .../output/generator/PingStatusGenerator.java | 14 ++--- .../dsf/bpe/util/PingStatusGeneratorTest.java | 60 +++++++++++++++++++ .../dsf/fhir/profiles/TaskProfileTest.java | 4 +- 3 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 src/test/java/dev/dsf/bpe/util/PingStatusGeneratorTest.java diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 6c9225de..9e2a6aaf 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -60,7 +60,7 @@ public static TaskOutputComponent updateStatusOutput(TaskOutputComponent output, { Extension pingStatusExtension = getOrCreatePingStatusExtension(output); List<Extension> errorExtensions = pingStatusExtension.getExtension().stream() - .filter(extension -> ConstantsPing.EXTENSION_URL_ERROR.equals(extension.getUrl())).toList(); + .filter(extension -> ConstantsPing.EXTENSION_URL_ERRORS.equals(extension.getUrl())).toList(); if (errorExtensions.isEmpty()) { addErrors(output, errors); @@ -605,7 +605,7 @@ private static Extension getOrCreateErrorsExtension(Extension extension) private static Optional<Extension> getErrorsExtension(Extension extension) { List<Extension> errorsExtensions = extension.getExtension().stream() - .filter(ex -> ConstantsPing.EXTENSION_URL_ERRORS.equals(extension.getUrl())).toList(); + .filter(ex -> ConstantsPing.EXTENSION_URL_ERRORS.equals(ex.getUrl())).toList(); if (errorsExtensions.isEmpty()) { return Optional.empty(); @@ -688,12 +688,12 @@ private static void sortStatusOutputExtensions(TaskOutputComponent outputCompone sortedExtensions.add(uploadSpeedExtension.get()); } - List<Extension> errorExtensions = extensions.stream() - .filter(extension -> ConstantsPing.EXTENSION_URL_ERROR.equals(extension.getUrl())).toList(); - if (!errorExtensions.isEmpty()) + Optional<Extension> errorsExtension = extensions.stream() + .filter(extension -> ConstantsPing.EXTENSION_URL_ERRORS.equals(extension.getUrl())).findFirst(); + if (errorsExtension.isPresent()) { - extensions.removeAll(errorExtensions); - sortedExtensions.addAll(errorExtensions); + extensions.remove(errorsExtension.get()); + sortedExtensions.add(errorsExtension.get()); } sortedExtensions.addAll(extensions); diff --git a/src/test/java/dev/dsf/bpe/util/PingStatusGeneratorTest.java b/src/test/java/dev/dsf/bpe/util/PingStatusGeneratorTest.java new file mode 100644 index 00000000..04d32224 --- /dev/null +++ b/src/test/java/dev/dsf/bpe/util/PingStatusGeneratorTest.java @@ -0,0 +1,60 @@ +package dev.dsf.bpe.util; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +import org.hl7.fhir.r4.model.Element; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Task; +import org.junit.Test; + +import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ConstantsPing; +import dev.dsf.bpe.ProcessError; +import dev.dsf.bpe.util.task.output.generator.PingStatusGenerator; +import dev.dsf.fhir.profiles.TaskProfileTest; + +public class PingStatusGeneratorTest +{ + @Test + public void updatingPongErrorsResultsInOneErrorsExtensionTest() + { + String process = "pong"; + + List<ProcessError> errors = processErrors(process); + + Task pongTask = TaskProfileTest.createValidTaskStartPingProcess(); + + PingStatusGenerator.updatePongStatusOutput(pongTask, errors); + + errors.add(new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_BINARY_POST_HTTP_UNEXPECTED, null)); + + PingStatusGenerator.updatePongStatusOutput(pongTask, errors); + + List<Extension> errorsExtensions = pongTask.getOutput().stream().map(Element::getExtension) + .map(extensions -> extensions.stream() + .filter(extension -> ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS + .equals(extension.getUrl())) + .findFirst().orElse(null)) + .filter(Objects::nonNull) + .map(extension -> extension.getExtension().stream() + .filter(extension1 -> ConstantsPing.EXTENSION_URL_ERRORS.equals(extension1.getUrl())).toList()) + .reduce(new ArrayList<>(), (list1, list2) -> + { + list1.addAll(list2); + return list1; + }); + + assertEquals(1, errorsExtensions.size()); + } + + private List<ProcessError> processErrors(String process) + { + List<ProcessError> errors = new ArrayList<>(); + errors.add(new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_UNKNOWN, null)); + return errors; + } +} diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index d6f78196..4db24afc 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -381,7 +381,7 @@ public void testTaskStartPingProcessProfileNotValid3() || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } - private Task createValidTaskStartPingProcess() + public static Task createValidTaskStartPingProcess() { Task task = new Task(); task.getMeta().addProfile(ConstantsPing.PROFILE_DSF_TASK_START_PING); @@ -497,7 +497,7 @@ public String getCorrelationKey() || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } - private Task createValidTaskPing() + public static Task createValidTaskPing() { Task task = new Task(); task.getMeta().addProfile(ConstantsPing.PROFILE_DSF_TASK_PING); From 3ac2c654c9e60622c1851e6ef3e8c23df51a0ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Mon, 15 Sep 2025 16:51:51 +0200 Subject: [PATCH 369/382] Fixed errors-extension being created without any error entries which resulted in logs being polluted with warnings because there is an extension on a resource with neither a value nor other extensions present --- .../dsf/bpe/util/task/output/generator/PingStatusGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 9e2a6aaf..2c2e0ce6 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -406,7 +406,7 @@ private static TaskOutputComponent updateTarget(TaskOutputComponent outputCompon private static TaskOutputComponent addErrors(TaskOutputComponent outputComponent, List<ProcessError> errors) { - if (errors != null) + if (errors != null && !errors.isEmpty()) { Extension extension = getOrCreatePingStatusExtension(outputComponent); Extension errorsExtension = getOrCreateErrorsExtension(extension); From ae5cc426b2f9a8734138d1b080932d71f849a1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 16 Sep 2025 09:50:01 +0200 Subject: [PATCH 370/382] Reformulated response message timeout because the underlying issue is not that a timer event triggered in the BPMN but that an expected message is missing --- src/main/java/dev/dsf/bpe/CodeSystem.java | 10 +++++----- src/main/resources/fhir/CodeSystem/dsf-ping-error.xml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index 80651261..d70285ca 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -573,23 +573,23 @@ public enum Concept RESPONSE_MESSAGE_TIMEOUT_STATUS_REQUESTED( "response-message-timeout-status-requested", - "Response message timed out. The status of the request on the target FHIR server is 'requested'" + "Response missing, sent Task status is 'requested'" ), RESPONSE_MESSAGE_TIMEOUT_STATUS_IN_PROGRESS( "response-message-timeout-status-in-progress", - "Response message timed out. The status of the request on the target FHIR server is 'in-progress'" + "Response missing, sent Task status is 'in-progress'" ), RESPONSE_MESSAGE_TIMEOUT_STATUS_FAILED( "response-message-timeout-status-failed", - "Response message timed out. The status of the request on the target FHIR server is 'failed'" + "Response missing, sent Task status is 'failed'" ), RESPONSE_MESSAGE_TIMEOUT_STATUS_COMPLETED( "response-message-timeout-status-completed", - "Response message timed out. The status of the request on the target FHIR server is 'completed'" + "Response missing, sent Task status is 'completed'" ), RESPONSE_MESSAGE_TIMEOUT_STATUS_UNEXPECTED( "response-message-timeout-status-unexpected", - "Response message timed out. The status of the request on the target FHIR server is neither of 'requested', 'in-progress', 'failed' or 'completed'" + "Response missing, sent Task status is neither of 'requested', 'in-progress', 'failed' or 'completed'" ), RESPONSE_MESSAGE_TIMEOUT_HTTP_401( diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml index 8c630fb3..5724256a 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping-error.xml @@ -246,23 +246,23 @@ <concept> <code value="response-message-timeout-status-requested"/> - <display value="Response message timed out. The status of the request on the target FHIR server is 'requested'"/> + <display value="Response missing, sent Task status is 'requested'"/> </concept> <concept> <code value="response-message-timeout-status-in-progress"/> - <display value="Response message timed out. The status of the request on the target FHIR server is 'in-progress'"/> + <display value="Response missing, sent Task status is 'in-progress'"/> </concept> <concept> <code value="response-message-timeout-status-failed"/> - <display value="Response message timed out. The status of the request on the target FHIR server is 'failed'"/> + <display value="Response missing, sent Task status is 'failed'"/> </concept> <concept> <code value="response-message-timeout-status-completed"/> - <display value="Response message timed out. The status of the request on the target FHIR server is 'completed'"/> + <display value="Response missing, sent Task status is 'completed'"/> </concept> <concept> <code value="response-message-timeout-status-unexpected"/> - <display value="Response message timed out. The status of the request on the target FHIR server is neither of 'requested', 'in-progress', 'failed' or 'completed'"/> + <display value="Response missing, sent Task status is neither of 'requested', 'in-progress', 'failed' or 'completed'"/> </concept> <concept> From 06c52ed94740b200c409a8c1d5c2fce611b6edf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 16 Sep 2025 09:58:51 +0200 Subject: [PATCH 371/382] Renamed download-speed to download-speed-from-remote and upload-speed to upload-speed-to-remote to reduce ambiguity as the values could previously be interpreted as the network speed to and from the local FHIR server --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 4 +-- .../dsf-extension-ping-status.xml | 36 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index 3416fd88..e32071fe 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -50,8 +50,8 @@ private ConstantsPing() public static final String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; public static final String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; public static final String EXTENSION_URL_ENDPOINT_IDENTIFIER = "endpoint-identifier"; - public static final String EXTENSION_URL_DOWNLOAD_SPEED = "download-speed"; - public static final String EXTENSION_URL_UPLOAD_SPEED = "upload-speed"; + public static final String EXTENSION_URL_DOWNLOAD_SPEED = "download-speed-from-remote"; + public static final String EXTENSION_URL_UPLOAD_SPEED = "upload-speed-to-remote"; public static final String EXTENSION_URL_NETWORK_SPEED_UNIT = "unit"; public static final String EXTENSION_URL_NETWORK_SPEED_VALUE = "network-speed"; public static final String EXTENSION_URL_ERROR = "error"; diff --git a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml index a1d2f050..5d42cc76 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-extension-ping-status.xml @@ -122,17 +122,17 @@ <code value="string"/> </type> </element> - <element id="Extension.extension:download-speed"> + <element id="Extension.extension:download-speed-from-remote"> <path value="Extension.extension"/> - <sliceName value="download-speed"/> + <sliceName value="download-speed-from-remote"/> <min value="0"/> <max value="1"/> </element> - <element id="Extension.extension:download-speed.url"> + <element id="Extension.extension:download-speed-from-remote.url"> <path value="Extension.extension.url"/> - <fixedUri value="download-speed"/> + <fixedUri value="download-speed-from-remote"/> </element> - <element id="Extension.extension:download-speed.value[x]"> + <element id="Extension.extension:download-speed-from-remote.value[x]"> <path value="Extension.extension.value[x]"/> <min value="1"/> <max value="1"/> @@ -140,37 +140,37 @@ <code value="Quantity"/> </type> </element> - <element id="Extension.extension:download-speed.value[x].value"> + <element id="Extension.extension:download-speed-from-remote.value[x].value"> <path value="Extension.extension.value[x].value"/> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:download-speed.value[x].unit"> + <element id="Extension.extension:download-speed-from-remote.value[x].unit"> <path value="Extension.extension.value[x].unit"/> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:download-speed.value[x].system"> + <element id="Extension.extension:download-speed-from-remote.value[x].system"> <path value="Extension.extension.value[x].system"/> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:download-speed.value[x].code"> + <element id="Extension.extension:download-speed-from-remote.value[x].code"> <path value="Extension.extension.value[x].code"/> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:upload-speed"> + <element id="Extension.extension:upload-speed-to-remote"> <path value="Extension.extension"/> - <sliceName value="upload-speed"/> + <sliceName value="upload-speed-to-remote"/> <min value="0"/> <max value="1"/> </element> - <element id="Extension.extension:upload-speed.url"> + <element id="Extension.extension:upload-speed-to-remote.url"> <path value="Extension.extension.url"/> - <fixedUri value="upload-speed"/> + <fixedUri value="upload-speed-to-remote"/> </element> - <element id="Extension.extension:upload-speed.value[x]"> + <element id="Extension.extension:upload-speed-to-remote.value[x]"> <path value="Extension.extension.value[x]"/> <min value="1"/> <max value="1"/> @@ -178,22 +178,22 @@ <code value="Quantity"/> </type> </element> - <element id="Extension.extension:upload-speed.value[x].value"> + <element id="Extension.extension:upload-speed-to-remote.value[x].value"> <path value="Extension.extension.value[x].value"/> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:upload-speed.value[x].unit"> + <element id="Extension.extension:upload-speed-to-remote.value[x].unit"> <path value="Extension.extension.value[x].unit"/> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:upload-speed.value[x].system"> + <element id="Extension.extension:upload-speed-to-remote.value[x].system"> <path value="Extension.extension.value[x].system"/> <min value="1"/> <max value="1"/> </element> - <element id="Extension.extension:upload-speed.value[x].code"> + <element id="Extension.extension:upload-speed-to-remote.value[x].code"> <path value="Extension.extension.value[x].code"/> <min value="1"/> <max value="1"/> From a03491e700ef5b5e6b727fb1d5118d9bfd34a283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 16 Sep 2025 17:27:00 +0200 Subject: [PATCH 372/382] Network speeds now get fitted to the next higher SI prefix should the value in a given prefix exceed 1000. This is now the default configuration for network speeds which can still be overridden. --- src/main/java/dev/dsf/bpe/CodeSystem.java | 17 +++++++++ .../dsf/bpe/service/ping/StoreResults.java | 37 +++++++++++++++---- .../bpe/service/pong/StoreDownloadSpeed.java | 16 +++++++- .../bpe/service/pong/StoreUploadSpeed.java | 16 +++++++- .../dev/dsf/bpe/spring/config/PingConfig.java | 2 +- 5 files changed, 76 insertions(+), 12 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index d70285ca..31595561 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -5,6 +5,7 @@ import java.time.Duration; import java.util.HashMap; import java.util.Map; +import java.util.stream.Stream; import org.hl7.fhir.r4.model.Coding; @@ -330,6 +331,22 @@ public String toUcum() public abstract BigDecimal calculateSpeed(long bytes, Duration duration); public abstract String toUcum(); + + public static SpeedAndUnit calculateSpeedWithFittingUnit(Long downloadedBytes, Duration downloadedDuration) + { + return Stream + .of(CodeSystem.DsfPingUnits.Code.bps, CodeSystem.DsfPingUnits.Code.kbps, + CodeSystem.DsfPingUnits.Code.Mbps, CodeSystem.DsfPingUnits.Code.Gbps) + .map(unit -> new SpeedAndUnit(unit.calculateSpeed(downloadedBytes, downloadedDuration), unit)) + .filter(speedAndUnit -> speedAndUnit.speed.compareTo(BigDecimal.valueOf(1000L)) < 0).findFirst() + .orElse(new SpeedAndUnit( + CodeSystem.DsfPingUnits.Code.Gbps.calculateSpeed(downloadedBytes, downloadedDuration), + Code.Gbps)); + } + + public record SpeedAndUnit(BigDecimal speed, Code unit) + { + } } } diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index d37f0097..436c0ad3 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -32,7 +33,7 @@ public class StoreResults extends AbstractServiceDelegate implements Initializin { private static final Logger logger = LoggerFactory.getLogger(StoreResults.class); private final AggregateErrorMailService errorMailService; - private final CodeSystem.DsfPingUnits.Code networkSpeedUnit; + private CodeSystem.DsfPingUnits.Code networkSpeedUnit; public StoreResults(ProcessPluginApi api, AggregateErrorMailService errorMailService, CodeSystem.DsfPingUnits.Code networkSpeedUnit) @@ -76,18 +77,40 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Duration downloadedDuration = (Duration) variables .getVariable(ExecutionVariables.downloadedDuration.correlatedValue(correlationKey)); - BigDecimal downloadSpeed = downloadedBytes != null && downloadedDuration != null - ? networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration) - : null; + BigDecimal downloadSpeed; + if (Objects.isNull(networkSpeedUnit)) + { + CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code + .calculateSpeedWithFittingUnit(downloadedBytes, downloadedDuration); + downloadSpeed = speedAndUnit.speed(); + networkSpeedUnit = speedAndUnit.unit(); + } + else + { + downloadSpeed = downloadedBytes != null && downloadedDuration != null + ? networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration) + : null; + } Long uploadedBytes = variables .getLong(ExecutionVariables.uploadedBytes.correlatedValue(correlationKey)); Duration uploadedDurationMillis = (Duration) variables .getVariable(ExecutionVariables.uploadedDuration.correlatedValue(correlationKey)); - BigDecimal uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null - ? networkSpeedUnit.calculateSpeed(uploadedBytes, uploadedDurationMillis) - : null; + BigDecimal uploadSpeed; + if (Objects.isNull(networkSpeedUnit)) + { + CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code + .calculateSpeedWithFittingUnit(uploadedBytes, uploadedDurationMillis); + uploadSpeed = speedAndUnit.speed(); + networkSpeedUnit = speedAndUnit.unit(); + } + else + { + uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null + ? networkSpeedUnit.calculateSpeed(uploadedBytes, uploadedDurationMillis) + : null; + } task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errors.getEntries(), downloadSpeed, uploadSpeed, networkSpeedUnit)); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index c4e0b177..50dcca6e 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -2,6 +2,7 @@ import java.math.BigDecimal; import java.time.Duration; +import java.util.Objects; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -19,7 +20,7 @@ public class StoreDownloadSpeed extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(StoreDownloadSpeed.class); - private final CodeSystem.DsfPingUnits.Code networkSpeedUnit; + private CodeSystem.DsfPingUnits.Code networkSpeedUnit; public StoreDownloadSpeed(ProcessPluginApi api, CodeSystem.DsfPingUnits.Code networkSpeedUnit) { @@ -36,7 +37,18 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw long downloadedBytes = variables.getLong(ExecutionVariables.downloadedBytes.name()); Duration downloadedDuration = (Duration) variables.getVariable(ExecutionVariables.downloadedDuration.name()); - BigDecimal downloadSpeed = networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration); + BigDecimal downloadSpeed; + if (Objects.isNull(networkSpeedUnit)) + { + CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code + .calculateSpeedWithFittingUnit(downloadedBytes, downloadedDuration); + downloadSpeed = speedAndUnit.speed(); + networkSpeedUnit = speedAndUnit.unit(); + } + else + { + downloadSpeed = networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration); + } PingStatusGenerator.updatePongStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index 1b9ba43d..84c637d0 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -2,6 +2,7 @@ import java.math.BigDecimal; import java.time.Duration; +import java.util.Objects; import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; @@ -21,7 +22,7 @@ public class StoreUploadSpeed extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(StoreUploadSpeed.class); - private final CodeSystem.DsfPingUnits.Code networkSpeedUnit; + private CodeSystem.DsfPingUnits.Code networkSpeedUnit; public StoreUploadSpeed(ProcessPluginApi api, CodeSystem.DsfPingUnits.Code networkSpeedUnit) { @@ -43,7 +44,18 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable Duration uploadedDuration = uploadedDurationTaskInput .map(duration -> Duration.ofMillis(duration.getValue().longValue())).orElse(Duration.ZERO); - BigDecimal uploadSpeed = networkSpeedUnit.calculateSpeed(uploadedBytes, uploadedDuration); + BigDecimal uploadSpeed; + if (Objects.isNull(networkSpeedUnit)) + { + CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code + .calculateSpeedWithFittingUnit(uploadedBytes, uploadedDuration); + uploadSpeed = speedAndUnit.speed(); + networkSpeedUnit = speedAndUnit.unit(); + } + else + { + uploadSpeed = networkSpeedUnit.calculateSpeed(uploadedBytes, uploadedDuration); + } PingStatusGenerator.updatePongStatusOutputUploadSpeed(startTask, uploadSpeed, networkSpeedUnit); diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 6bc11b42..c4a650ab 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -72,7 +72,7 @@ public class PingConfig @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values are: \"bps\", \"kbps\", \"Mbps\", \"Gbps\", \"Bps\", \"kBps\", \"MBps\", \"GBps\". Default is \"mbps\".", processNames = { "dsfdev_ping", "dsfdev_pong" }) - @Value("${dev.dsf.bpe.ping.networkSpeedUnit:Mbps}") + @Value("${dev.dsf.bpe.ping.networkSpeedUnit:#{null}}") private CodeSystem.DsfPingUnits.Code networkSpeedUnit; public CodeSystem.DsfPingUnits.Code getNetworkSpeedUnit() From 5f83b76589865a9675fbbadd539cad6e1353c500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Tue, 16 Sep 2025 18:03:14 +0200 Subject: [PATCH 373/382] Added more null checks because they produced NullPointerExceptions when trying to download a resource and the resulting error prevented any bytes from being downloaded --- .../dsf/bpe/service/ping/StoreResults.java | 51 +++++++++---------- .../bpe/service/pong/StoreDownloadSpeed.java | 23 +++++---- .../bpe/service/pong/StoreUploadSpeed.java | 25 +++++---- .../output/generator/PingStatusGenerator.java | 19 +++---- 4 files changed, 60 insertions(+), 58 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index 436c0ad3..f631a77e 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -77,40 +77,15 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Duration downloadedDuration = (Duration) variables .getVariable(ExecutionVariables.downloadedDuration.correlatedValue(correlationKey)); - BigDecimal downloadSpeed; - if (Objects.isNull(networkSpeedUnit)) - { - CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code - .calculateSpeedWithFittingUnit(downloadedBytes, downloadedDuration); - downloadSpeed = speedAndUnit.speed(); - networkSpeedUnit = speedAndUnit.unit(); - } - else - { - downloadSpeed = downloadedBytes != null && downloadedDuration != null - ? networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration) - : null; - } + BigDecimal downloadSpeed = calculateNetworkSpeed(downloadedBytes, downloadedDuration); Long uploadedBytes = variables .getLong(ExecutionVariables.uploadedBytes.correlatedValue(correlationKey)); Duration uploadedDurationMillis = (Duration) variables .getVariable(ExecutionVariables.uploadedDuration.correlatedValue(correlationKey)); - BigDecimal uploadSpeed; - if (Objects.isNull(networkSpeedUnit)) - { - CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code - .calculateSpeedWithFittingUnit(uploadedBytes, uploadedDurationMillis); - uploadSpeed = speedAndUnit.speed(); - networkSpeedUnit = speedAndUnit.unit(); - } - else - { - uploadSpeed = uploadedBytes != null && uploadedDurationMillis != null - ? networkSpeedUnit.calculateSpeed(uploadedBytes, uploadedDurationMillis) - : null; - } + BigDecimal uploadSpeed = calculateNetworkSpeed(uploadedBytes, uploadedDurationMillis); + task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errors.getEntries(), downloadSpeed, uploadSpeed, networkSpeedUnit)); @@ -128,4 +103,24 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw logger.debug("Successfully stored results for task {}", variables.getStartTask().getIdElement().getValue()); } + + private BigDecimal calculateNetworkSpeed(Long downloadedBytes, Duration downloadedDuration) + { + BigDecimal downloadSpeed = null; + if (downloadedBytes != null && downloadedDuration != null) + { + if (Objects.isNull(networkSpeedUnit)) + { + CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code + .calculateSpeedWithFittingUnit(downloadedBytes, downloadedDuration); + downloadSpeed = speedAndUnit.speed(); + networkSpeedUnit = speedAndUnit.unit(); + } + else + { + downloadSpeed = networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration); + } + } + return downloadSpeed; + } } diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java index 50dcca6e..95dab46c 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreDownloadSpeed.java @@ -37,17 +37,20 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw long downloadedBytes = variables.getLong(ExecutionVariables.downloadedBytes.name()); Duration downloadedDuration = (Duration) variables.getVariable(ExecutionVariables.downloadedDuration.name()); - BigDecimal downloadSpeed; - if (Objects.isNull(networkSpeedUnit)) + BigDecimal downloadSpeed = null; + if (downloadedDuration != null) { - CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code - .calculateSpeedWithFittingUnit(downloadedBytes, downloadedDuration); - downloadSpeed = speedAndUnit.speed(); - networkSpeedUnit = speedAndUnit.unit(); - } - else - { - downloadSpeed = networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration); + if (Objects.isNull(networkSpeedUnit)) + { + CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code + .calculateSpeedWithFittingUnit(downloadedBytes, downloadedDuration); + downloadSpeed = speedAndUnit.speed(); + networkSpeedUnit = speedAndUnit.unit(); + } + else + { + downloadSpeed = networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration); + } } PingStatusGenerator.updatePongStatusOutputDownloadSpeed(startTask, downloadSpeed, networkSpeedUnit); diff --git a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java index 84c637d0..73455be3 100644 --- a/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java +++ b/src/main/java/dev/dsf/bpe/service/pong/StoreUploadSpeed.java @@ -42,19 +42,22 @@ protected void doExecute(DelegateExecution delegateExecution, Variables variable long uploadedBytes = uploadedBytesTaskInput.map(PrimitiveType::getValue).orElse(BigDecimal.valueOf(0)) .longValue(); Duration uploadedDuration = uploadedDurationTaskInput - .map(duration -> Duration.ofMillis(duration.getValue().longValue())).orElse(Duration.ZERO); + .map(duration -> Duration.ofMillis(duration.getValue().longValue())).orElse(null); - BigDecimal uploadSpeed; - if (Objects.isNull(networkSpeedUnit)) + BigDecimal uploadSpeed = null; + if (uploadedDuration != null) { - CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code - .calculateSpeedWithFittingUnit(uploadedBytes, uploadedDuration); - uploadSpeed = speedAndUnit.speed(); - networkSpeedUnit = speedAndUnit.unit(); - } - else - { - uploadSpeed = networkSpeedUnit.calculateSpeed(uploadedBytes, uploadedDuration); + if (Objects.isNull(networkSpeedUnit)) + { + CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code + .calculateSpeedWithFittingUnit(uploadedBytes, uploadedDuration); + uploadSpeed = speedAndUnit.speed(); + networkSpeedUnit = speedAndUnit.unit(); + } + else + { + uploadSpeed = networkSpeedUnit.calculateSpeed(uploadedBytes, uploadedDuration); + } } PingStatusGenerator.updatePongStatusOutputUploadSpeed(startTask, uploadSpeed, networkSpeedUnit); diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index 2c2e0ce6..a34252c4 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -177,13 +177,14 @@ private static TaskOutputComponent updateStatusOutputDownloadSpeed(TaskOutputCom { if (hasDownloadSpeedSet(outputComponent)) { - updateDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.name(), CODESYSTEM_UCUM, - networkSpeedUnit.toUcum()); + updateDownloadSpeed(outputComponent, downloadSpeed, + networkSpeedUnit != null ? networkSpeedUnit.name() : null, CODESYSTEM_UCUM, + networkSpeedUnit != null ? networkSpeedUnit.toUcum() : null); } else { - addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit.name(), CODESYSTEM_UCUM, - networkSpeedUnit.toUcum()); + addDownloadSpeed(outputComponent, downloadSpeed, networkSpeedUnit != null ? networkSpeedUnit.name() : null, + CODESYSTEM_UCUM, networkSpeedUnit != null ? networkSpeedUnit.toUcum() : null); } return outputComponent; @@ -218,13 +219,13 @@ private static TaskOutputComponent updateStatusOutputUploadSpeed(TaskOutputCompo { if (hasDownloadSpeedSet(outputComponent)) { - updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.name(), CODESYSTEM_UCUM, - networkSpeedUnit.toUcum()); + updateUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit != null ? networkSpeedUnit.name() : null, + CODESYSTEM_UCUM, networkSpeedUnit != null ? networkSpeedUnit.toUcum() : null); } else { - addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit.name(), CODESYSTEM_UCUM, - networkSpeedUnit.toUcum()); + addUploadSpeed(outputComponent, uploadSpeed, networkSpeedUnit != null ? networkSpeedUnit.name() : null, + CODESYSTEM_UCUM, networkSpeedUnit != null ? networkSpeedUnit.toUcum() : null); } return outputComponent; @@ -271,7 +272,7 @@ public static TaskOutputComponent createPingStatusOutput(Target target, CodeSyst CodeSystem.DsfPingUnits.Code unit) { return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS, statusCode, errors, downloadSpeed, - uploadSpeed, unit.name(), CODESYSTEM_UCUM, unit.toUcum()); + uploadSpeed, unit != null ? unit.name() : null, CODESYSTEM_UCUM, unit != null ? unit.toUcum() : null); } public static TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, From a643d9b50f589249fe344fe65381c1a0324242bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 18 Sep 2025 13:21:56 +0200 Subject: [PATCH 374/382] Fixed downloadResourceSize not getting set after being reduced to maxUploadSizeBytes --- .../dev/dsf/bpe/service/GenerateAndStoreResource.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java index 2e1504b8..406cafb3 100644 --- a/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java +++ b/src/main/java/dev/dsf/bpe/service/GenerateAndStoreResource.java @@ -53,13 +53,14 @@ public void doExecute(DelegateExecution delegateExecution, Variables variables) logger.info( "Requested resource size of {} bytes exceeds configured maximum upload size of {} bytes. Trimmed to maximum upload size.", downloadResourceSizeBytes, maxUploadSizeBytes); + setDownloadResourceSizeBytes(variables, maxUploadSizeBytes); resourceContent = new RandomByteInputStream(maxUploadSizeBytes); } else { + setDownloadResourceSizeBytes(variables, downloadResourceSizeBytes); resourceContent = new RandomByteInputStream(downloadResourceSizeBytes); } - variables.setLong(ExecutionVariables.downloadResourceSizeBytes.name(), downloadResourceSizeBytes); logger.debug("Generated resource."); logger.debug("Storing binary resource for download..."); @@ -254,6 +255,11 @@ private long getDownloadResourceSize(Variables variables) return variables.getLong(ExecutionVariables.downloadResourceSizeBytes.name()); } + private void setDownloadResourceSizeBytes(Variables variables, long resourceSizeBytes) + { + variables.setLong(ExecutionVariables.downloadResourceSizeBytes.name(), resourceSizeBytes); + } + private IdType storeBinary(RandomByteInputStream downloadResourceContent) { return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().createBinary( From ad623baaf1e13c4ebfaf18f26f0c7b1223ebab64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Thu, 18 Sep 2025 14:11:55 +0200 Subject: [PATCH 375/382] Set default maxDownloadSizeBytes and maxUploadSizeBytes to 400MB because that is about the largest amount of data that can be stored in a Binary resource in DSF 1.x. --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index c4a650ab..bb2937fa 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -62,12 +62,12 @@ public class PingConfig private boolean sendPongProcessFailedMail; @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.", processNames = "dsfdev_ping, dsfdev_pong") - @Value("${dev.dsf.bpe.ping.maxDownloadSizeBytes:10000000}") + @Value("${dev.dsf.bpe.ping.maxDownloadSizeBytes:400000000}") private long maxDownloadSizeBytes; @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.", processNames = { "dsfdev_ping", "dsfdev_pong" }) - @Value("${dev.dsf.bpe.ping.maxUploadSizeBytes:10000000}") + @Value("${dev.dsf.bpe.ping.maxUploadSizeBytes:400000000}") private long maxUploadSizeBytes; @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values are: \"bps\", \"kbps\", \"Mbps\", \"Gbps\", \"Bps\", \"kBps\", \"MBps\", \"GBps\". Default is \"mbps\".", processNames = { From 8d25c079df7c4321db560daf973017117a61946b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 19 Sep 2025 11:19:57 +0200 Subject: [PATCH 376/382] Removed unused constants --- src/main/java/dev/dsf/bpe/ConstantsPing.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java index e32071fe..28b54b98 100644 --- a/src/main/java/dev/dsf/bpe/ConstantsPing.java +++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java @@ -44,7 +44,6 @@ private ConstantsPing() public static final String PROFILE_DSF_TASK_CLEANUP_PONG_MESSAGE_NAME = "cleanupPong"; public static final String STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS = "http://dsf.dev/fhir/StructureDefinition/extension-ping-status"; - public static final String STRUCTURE_DEFINITION_URL_EXTENSION_NETWORK_SPEED = "http://dsf.dev/fhir/StructureDefinition/extension-network-speed"; public static final String STRUCTURE_DEFINITION_URL_EXTENSION_ERROR = "http://dsf.dev/fhir/StructureDefinition/extension-error"; public static final String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; @@ -52,15 +51,9 @@ private ConstantsPing() public static final String EXTENSION_URL_ENDPOINT_IDENTIFIER = "endpoint-identifier"; public static final String EXTENSION_URL_DOWNLOAD_SPEED = "download-speed-from-remote"; public static final String EXTENSION_URL_UPLOAD_SPEED = "upload-speed-to-remote"; - public static final String EXTENSION_URL_NETWORK_SPEED_UNIT = "unit"; - public static final String EXTENSION_URL_NETWORK_SPEED_VALUE = "network-speed"; public static final String EXTENSION_URL_ERROR = "error"; public static final String EXTENSION_URL_ERRORS = "errors"; - public static final String EXTENSION_URL_PROCESS = "process"; - public static final String EXTENSION_URL_PROCESS_STEP = "process-step"; - public static final String EXTENSION_URL_ACTION = "action"; public static final String EXTENSION_URL_POTENTIAL_FIX = "potential-fix"; - public static final String EXTENSION_URL_MESSAGE = "message"; public static final long DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT = 10000000L; @@ -75,6 +68,4 @@ private ConstantsPing() public static final String POTENTIAL_FIX_URL_CONNECTION_TIMEOUT = POTENTIAL_FIX_URL_BASE + "/connection-timeout"; public static final String POTENTIAL_FIX_URL_CONNECTION_REFUSED = POTENTIAL_FIX_URL_BASE + "/connection-refused"; public static final String POTENTIAL_FIX_URL_UNKNOWN_HOST = POTENTIAL_FIX_URL_BASE + "/unknown-host"; - - public static final String CLEANUP_ERROR_ACTION = "Deleting generated Binary resource from local DSF FHIR server."; } From b41cbcac748305f36a170a1e7c864ae7a5d82629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 19 Sep 2025 12:04:10 +0200 Subject: [PATCH 377/382] Added error handling for SocketTimeoutException. A read timeout may occur if the DEV_DSF_BPE_FHIR_CLIENT_REMOTE_TIMEOUT_READ is too short --- .../bpe/util/task/SendTaskErrorConverter.java | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java index 91d59c9f..76b43560 100644 --- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java +++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java @@ -1,6 +1,8 @@ package dev.dsf.bpe.util.task; +import java.net.SocketTimeoutException; import java.net.UnknownHostException; +import java.util.Locale; import java.util.Objects; import javax.net.ssl.SSLHandshakeException; @@ -59,6 +61,10 @@ else if (exception instanceof HttpHostConnectException) { return convertHttpHostConnectException(errorType, process); } + else if (exception instanceof SocketTimeoutException socketTimeoutException) + { + return convertSocketTimeoutException(errorType, process, socketTimeoutException); + } else if (exception instanceof ProcessingException e) { SSLHandshakeException sslHandshakeException = getExpectedCauseInstanceFromStack(SSLHandshakeException.class, @@ -89,6 +95,13 @@ else if (exception instanceof ProcessingException e) return convertHttpHostConnectException(errorType, process); } + SocketTimeoutException socketTimeoutException = getExpectedCauseInstanceFromStack( + SocketTimeoutException.class, e); + if (socketTimeoutException != null) + { + return convertSocketTimeoutException(errorType, process, socketTimeoutException); + } + return convertExceptionFallback(exception, errorType, process); } else @@ -97,6 +110,52 @@ else if (exception instanceof ProcessingException e) } } + private static ProcessErrorWithStatusCode convertSocketTimeoutException(ErrorType errorType, String process, + SocketTimeoutException socketTimeoutException) + { + ProcessError error; + String message = socketTimeoutException.getMessage().toLowerCase(Locale.ROOT); + if (message.contains("connect")) + { + error = switch (errorType) + { + case LOCAL -> new ProcessError(process, + CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case REMOTE -> new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_TIMEOUT_CONNECT, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + }; + return new ProcessErrorWithStatusCode(error, CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + } + else if (message.contains("read")) + { + error = switch (errorType) + { + case LOCAL -> new ProcessError(process, + CodeSystem.DsfPingError.Concept.LOCAL_BINARY_DOWNLOAD_TIMEOUT_READ, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case REMOTE -> new ProcessError(process, + CodeSystem.DsfPingError.Concept.REMOTE_BINARY_DOWNLOAD_TIMEOUT_READ, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + }; + return new ProcessErrorWithStatusCode(error, CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + } + else + { + error = switch (errorType) + { + case LOCAL -> new ProcessError(process, CodeSystem.DsfPingError.Concept.LOCAL_UNKNOWN, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + case REMOTE -> new ProcessError(process, CodeSystem.DsfPingError.Concept.REMOTE_UNKNOWN, + ConstantsPing.POTENTIAL_FIX_URL_CONNECTION_TIMEOUT); + }; + logger.error("Unexpected error: {}", socketTimeoutException.getMessage()); + return new ProcessErrorWithStatusCode(error, CodeSystem.DsfPingStatus.Code.NOT_REACHABLE); + } + + } + private static ProcessErrorWithStatusCode convertSSLHandshakeException(ErrorType errorType, String process) { if (ConstantsPing.PROCESS_NAME_PING.equals(process)) From 69aa5194e3035b942d52c90ccbc90d99cbb5a1a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 19 Sep 2025 12:07:38 +0200 Subject: [PATCH 378/382] Added an input parameter to the start task that allows setting the duration the process waits for pong messages to allow adjusting for different network throughputs and hardware environments --- src/main/java/dev/dsf/bpe/CodeSystem.java | 3 +- .../java/dev/dsf/bpe/ExecutionVariables.java | 1 + .../service/ping/SetPongTimeoutDuration.java | 64 ++++ .../dev/dsf/bpe/spring/config/PingConfig.java | 8 + src/main/resources/bpe/ping.bpmn | 327 +++++++++--------- .../resources/fhir/CodeSystem/dsf-ping.xml | 5 + .../dsf-task-start-ping-autostart.xml | 54 ++- .../dsf-task-start-ping.xml | 54 ++- .../Task/dsf-task-start-ping-autostart.xml | 10 + .../fhir/Task/dsf-task-start-ping.xml | 122 ++++--- 10 files changed, 432 insertions(+), 216 deletions(-) create mode 100644 src/main/java/dev/dsf/bpe/service/ping/SetPongTimeoutDuration.java diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java index 31595561..b06d884e 100644 --- a/src/main/java/dev/dsf/bpe/CodeSystem.java +++ b/src/main/java/dev/dsf/bpe/CodeSystem.java @@ -74,7 +74,8 @@ public enum Code implements SingleStringValueEnum DOWNLOADED_DURATION_MILLIS("downloaded-duration"), DOWNLOADED_BYTES("downloaded-bytes"), DOWNLOAD_RESOURCE_REFERENCE("download-resource-reference"), - ERROR("error"); + ERROR("error"), + PONG_TIMEOUT_DURATION_ISO_8601("pong-timeout-duration"); private final String value; diff --git a/src/main/java/dev/dsf/bpe/ExecutionVariables.java b/src/main/java/dev/dsf/bpe/ExecutionVariables.java index 3344133c..245e15dc 100644 --- a/src/main/java/dev/dsf/bpe/ExecutionVariables.java +++ b/src/main/java/dev/dsf/bpe/ExecutionVariables.java @@ -22,6 +22,7 @@ public enum ExecutionVariables resourceDownloadErrorRemote, resourceUploadError, resourceUploadErrorRemote, + pongTimerDuration, pingTaskId; public String correlatedValue(String correlationKey) diff --git a/src/main/java/dev/dsf/bpe/service/ping/SetPongTimeoutDuration.java b/src/main/java/dev/dsf/bpe/service/ping/SetPongTimeoutDuration.java new file mode 100644 index 00000000..4cd07144 --- /dev/null +++ b/src/main/java/dev/dsf/bpe/service/ping/SetPongTimeoutDuration.java @@ -0,0 +1,64 @@ +package dev.dsf.bpe.service.ping; + +import java.time.Duration; +import java.time.format.DateTimeParseException; +import java.util.Optional; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import dev.dsf.bpe.CodeSystem; +import dev.dsf.bpe.ExecutionVariables; +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Variables; + +public class SetPongTimeoutDuration extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(SetPongTimeoutDuration.class); + + public SetPongTimeoutDuration(ProcessPluginApi api) + { + super(api); + } + + @Override + protected void doExecute(DelegateExecution execution, Variables variables) throws Exception + { + logger.debug("Setting pong timer duration..."); + Task startTask = variables.getStartTask(); + Optional<String> optPongTimeoutDuration = api.getTaskHelper().getFirstInputParameterStringValue(startTask, + CodeSystem.DsfPing.URL, CodeSystem.DsfPing.Code.PONG_TIMEOUT_DURATION_ISO_8601.getValue()); + if (optPongTimeoutDuration.isPresent()) + { + String pongTimeoutDuration = optPongTimeoutDuration.get(); + if (isDurationValid(pongTimeoutDuration)) + { + variables.setString(ExecutionVariables.pongTimerDuration.name(), pongTimeoutDuration); + logger.debug("Pong timer duration set to {}", pongTimeoutDuration); + } + else + { + throw new RuntimeException("Pong timeout duration is invalid"); + } + } else + { + logger.debug("No pong timeout duration specified"); + } + } + + private boolean isDurationValid(String duration) + { + try + { + Duration.parse(duration); + return true; + } + catch (DateTimeParseException e) + { + return false; + } + } +} diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index bb2937fa..289a7121 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -29,6 +29,7 @@ import dev.dsf.bpe.service.ping.LogAndSaveUploadErrorPing; import dev.dsf.bpe.service.ping.SavePong; import dev.dsf.bpe.service.ping.SelectPingTargets; +import dev.dsf.bpe.service.ping.SetPongTimeoutDuration; import dev.dsf.bpe.service.ping.StoreResults; import dev.dsf.bpe.service.pong.DownloadResourceAndMeasureSpeed; import dev.dsf.bpe.service.pong.EstimateCleanupTimerDuration; @@ -139,6 +140,13 @@ public AggregateErrorMailService aggregateErrorMailServicePong() } + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public SetPongTimeoutDuration setPongTimeoutDuration() + { + return new SetPongTimeoutDuration(api); + } + @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public SelectPingTargets selectPingTargets() diff --git a/src/main/resources/bpe/ping.bpmn b/src/main/resources/bpe/ping.bpmn index 171d213e..3d46927d 100644 --- a/src/main/resources/bpe/ping.bpmn +++ b/src/main/resources/bpe/ping.bpmn @@ -15,11 +15,11 @@ <bpmn:startEvent id="SubProcessStartEvent"> <bpmn:outgoing>Flow_10epxa2</bpmn:outgoing> </bpmn:startEvent> - <bpmn:intermediateCatchEvent id="PongTimer" name="PT200S"> + <bpmn:intermediateCatchEvent id="PongTimer"> <bpmn:incoming>Flow_0y9usku</bpmn:incoming> <bpmn:outgoing>Flow_1fjeq2h</bpmn:outgoing> <bpmn:timerEventDefinition id="TimerEventDefinition_1mgy0vi"> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT200S</bpmn:timeDuration> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">${execution.hasVariable("pongTimerDuration") ? pongTimerDuration : "PT30S"}</bpmn:timeDuration> </bpmn:timerEventDefinition> </bpmn:intermediateCatchEvent> <bpmn:intermediateCatchEvent id="PongCatchEvent" name="Pong" camunda:asyncAfter="true"> @@ -152,22 +152,6 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('resourceDownloadError')}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_18wxsor" sourceRef="Gateway_0de83s3" targetRef="Activity_0vw65a2" /> - <bpmn:textAnnotation id="TextAnnotation_0uc8utt"> - <bpmn:text>Information in message: -- dowloadResourceSize: long -- downloadResourceReference: Reference</bpmn:text> - </bpmn:textAnnotation> - <bpmn:textAnnotation id="TextAnnotation_0smygq5"> - <bpmn:text>Information in message: -- downloadDurationMillis: long -- downloadedBytes: long</bpmn:text> - </bpmn:textAnnotation> - <bpmn:textAnnotation id="TextAnnotation_08ic0l2"> - <bpmn:text>downloads up to maxDownloadSizeBytes</bpmn:text> - </bpmn:textAnnotation> - <bpmn:association id="Association_1c7vgba" sourceRef="Activity_0ri6fnv" targetRef="TextAnnotation_0uc8utt" /> - <bpmn:association id="Association_14iteoh" sourceRef="Activity_0vw65a2" targetRef="TextAnnotation_0smygq5" /> - <bpmn:association id="Association_0l3n1oc" sourceRef="TextAnnotation_08ic0l2" targetRef="Activity_0h9o9u7" /> </bpmn:subProcess> <bpmn:serviceTask id="Activity_0nwtf8o" name="Generate And Store Resource" camunda:class="dev.dsf.bpe.service.GenerateAndStoreResource"> <bpmn:extensionElements> @@ -210,7 +194,7 @@ <bpmn:outgoing>Flow_0iuuyo1</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:startEvent id="StartPingMessageStartEvent" name="startPing"> - <bpmn:outgoing>Flow_0e35w2m</bpmn:outgoing> + <bpmn:outgoing>Flow_1hor4v7</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_1t2j917" messageRef="Message_1pklz6t" /> </bpmn:startEvent> <bpmn:sequenceFlow id="Flow_0j92st0" sourceRef="SelectPingTargets" targetRef="SubProcess" /> @@ -224,10 +208,9 @@ <bpmn:sequenceFlow id="Flow_1c15ef2" sourceRef="Gateway_0bifi5h" targetRef="SelectPingTargets" /> <bpmn:sequenceFlow id="Flow_0fxlsv3" sourceRef="Activity_1wdftvk" targetRef="Gateway_0xw5i5v" /> <bpmn:serviceTask id="Activity_1wdftvk" name="Set Download Resource Size" camunda:class="dev.dsf.bpe.service.SetDownloadResourceSize"> - <bpmn:incoming>Flow_0e35w2m</bpmn:incoming> + <bpmn:incoming>Flow_0xy3953</bpmn:incoming> <bpmn:outgoing>Flow_0fxlsv3</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0e35w2m" sourceRef="StartPingMessageStartEvent" targetRef="Activity_1wdftvk" /> <bpmn:sequenceFlow id="Flow_0ejw9k5" sourceRef="Activity_1ddl5dm" targetRef="Gateway_0bifi5h" /> <bpmn:serviceTask id="Activity_1ddl5dm" name="Log And Save Error" camunda:class="dev.dsf.bpe.service.ping.LogAndSaveUploadErrorPing"> <bpmn:incoming>Flow_0z3dgxw</bpmn:incoming> @@ -243,6 +226,12 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.hasVariable('resourceUploadError')}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1qyomuj" sourceRef="Gateway_1nb10cc" targetRef="Gateway_0bifi5h" /> + <bpmn:sequenceFlow id="Flow_1hor4v7" sourceRef="StartPingMessageStartEvent" targetRef="Activity_0ox0y7r" /> + <bpmn:sequenceFlow id="Flow_0xy3953" sourceRef="Activity_0ox0y7r" targetRef="Activity_1wdftvk" /> + <bpmn:serviceTask id="Activity_0ox0y7r" name="Set Pong Timeout Duration" camunda:class="dev.dsf.bpe.service.ping.SetPongTimeoutDuration"> + <bpmn:incoming>Flow_1hor4v7</bpmn:incoming> + <bpmn:outgoing>Flow_0xy3953</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:textAnnotation id="TextAnnotation_1ig0151"> <bpmn:text>Includes download speeds and errors of all pongs</bpmn:text> </bpmn:textAnnotation> @@ -267,320 +256,344 @@ Save = save as execution variable Store = store on DSF FHIR server either as separate resource or output parameter</bpmn:text> </bpmn:textAnnotation> + <bpmn:textAnnotation id="TextAnnotation_0uc8utt"> + <bpmn:text>Information in message: +- dowloadResourceSize: long +- downloadResourceReference: Reference</bpmn:text> + </bpmn:textAnnotation> + <bpmn:association id="Association_1c7vgba" sourceRef="Activity_0ri6fnv" targetRef="TextAnnotation_0uc8utt" /> + <bpmn:textAnnotation id="TextAnnotation_0smygq5"> + <bpmn:text>Information in message: +- downloadDurationMillis: long +- downloadedBytes: long</bpmn:text> + </bpmn:textAnnotation> + <bpmn:association id="Association_14iteoh" sourceRef="Activity_0vw65a2" targetRef="TextAnnotation_0smygq5" /> + <bpmn:textAnnotation id="TextAnnotation_08ic0l2"> + <bpmn:text>downloads up to maxDownloadSizeBytes</bpmn:text> + </bpmn:textAnnotation> + <bpmn:association id="Association_0l3n1oc" sourceRef="TextAnnotation_08ic0l2" targetRef="Activity_0h9o9u7" /> </bpmn:process> <bpmn:error id="Error_0tkfq65" name="resourceUploadError" errorCode="resourceUploadError" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="dsfdev_ping"> + <bpmndi:BPMNShape id="BPMNShape_0ydgq5s" bpmnElement="StartPingMessageStartEvent"> + <dc:Bounds x="152" y="342" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="151" y="385" width="44" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1blajk7_di" bpmnElement="Activity_0ox0y7r"> + <dc:Bounds x="270" y="320" width="100" height="80" /> + <bpmndi:BPMNLabel /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1wz1w4r" bpmnElement="SubProcess" isExpanded="true"> - <dc:Bounds x="1040" y="180" width="1820" height="560" /> + <dc:Bounds x="1230" y="180" width="1820" height="560" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0qz7nye" bpmnElement="SubProcessStartEvent"> - <dc:Bounds x="1062" y="342" width="36" height="36" /> + <dc:Bounds x="1252" y="342" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_13ugi24" bpmnElement="PongTimer"> - <dc:Bounds x="1512" y="432" width="36" height="36" /> + <dc:Bounds x="1702" y="432" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="1510" y="475" width="40" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1xv73wh" bpmnElement="PongCatchEvent"> - <dc:Bounds x="1712" y="342" width="36" height="36" /> + <dc:Bounds x="1902" y="342" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1717" y="318" width="26" height="14" /> + <dc:Bounds x="1907" y="318" width="26" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_01k7kv3" bpmnElement="EventBasedGateway"> - <dc:Bounds x="1415" y="335" width="50" height="50" /> + <dc:Bounds x="1605" y="335" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0icju6y" bpmnElement="LogNoResponse"> - <dc:Bounds x="1600" y="410" width="100" height="80" /> + <dc:Bounds x="1790" y="410" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1ipvtcp" bpmnElement="Gateway_0z5gz96" isMarkerVisible="true"> - <dc:Bounds x="1315" y="335" width="50" height="50" /> + <dc:Bounds x="1505" y="335" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0zk1xt7" bpmnElement="Gateway_09z7b0z" isMarkerVisible="true"> - <dc:Bounds x="1755" y="425" width="50" height="50" /> + <dc:Bounds x="1945" y="425" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19as0g5" bpmnElement="SubProcessEndEvent"> - <dc:Bounds x="1862" y="432" width="36" height="36" /> + <dc:Bounds x="2052" y="432" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_004x7xw" bpmnElement="Activity_0ri6fnv"> - <dc:Bounds x="1170" y="320" width="100" height="80" /> + <dc:Bounds x="1360" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0gumkp5" bpmnElement="Gateway_0p0be0a" isMarkerVisible="true"> - <dc:Bounds x="1965" y="335" width="50" height="50" /> + <dc:Bounds x="2155" y="335" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_14o9c36" bpmnElement="Activity_0h9o9u7"> - <dc:Bounds x="2070" y="480" width="100" height="80" /> + <dc:Bounds x="2260" y="480" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1uxa2sw" bpmnElement="Activity_0vw65a2"> - <dc:Bounds x="2510" y="480" width="100" height="80" /> + <dc:Bounds x="2700" y="480" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0djpma6" bpmnElement="Activity_0akr23c"> - <dc:Bounds x="2280" y="600" width="100" height="80" /> + <dc:Bounds x="2470" y="600" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0n6ry0u" bpmnElement="Gateway_02orad4" isMarkerVisible="true"> - <dc:Bounds x="2685" y="335" width="50" height="50" /> + <dc:Bounds x="2875" y="335" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1pe00wg" bpmnElement="Event_1foycg9"> - <dc:Bounds x="2772" y="342" width="36" height="36" /> + <dc:Bounds x="2962" y="342" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_187dy31_di" bpmnElement="Activity_081me01"> - <dc:Bounds x="1820" y="320" width="100" height="80" /> + <dc:Bounds x="2010" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0p0eucz_di" bpmnElement="Activity_0p5edt9"> - <dc:Bounds x="1520" y="520" width="100" height="80" /> + <dc:Bounds x="1710" y="520" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0de83s3_di" bpmnElement="Gateway_0de83s3" isMarkerVisible="true"> - <dc:Bounds x="2195" y="495" width="50" height="50" /> + <dc:Bounds x="2385" y="495" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_12nm98a" bpmnElement="TextAnnotation_0uc8utt"> - <dc:Bounds x="1270" y="220" width="250" height="70" /> + <dc:Bounds x="1460" y="220" width="250" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1h13c04" bpmnElement="TextAnnotation_0smygq5"> - <dc:Bounds x="2580" y="612" width="240" height="55" /> + <dc:Bounds x="2770" y="612" width="240" height="55" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_084zno2" bpmnElement="TextAnnotation_08ic0l2"> - <dc:Bounds x="1980" y="622" width="170" height="37" /> + <dc:Bounds x="2170" y="622" width="170" height="37" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_1hlvqjb" bpmnElement="Flow_10epxa2"> - <di:waypoint x="1098" y="360" /> - <di:waypoint x="1170" y="360" /> + <di:waypoint x="1288" y="360" /> + <di:waypoint x="1360" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0gkyk6o" bpmnElement="Flow_0y9usku"> - <di:waypoint x="1440" y="385" /> - <di:waypoint x="1440" y="450" /> - <di:waypoint x="1512" y="450" /> + <di:waypoint x="1630" y="385" /> + <di:waypoint x="1630" y="450" /> + <di:waypoint x="1702" y="450" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0gf051n" bpmnElement="Flow_1fjeq2h"> - <di:waypoint x="1548" y="450" /> - <di:waypoint x="1600" y="450" /> + <di:waypoint x="1738" y="450" /> + <di:waypoint x="1790" y="450" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_132kwps" bpmnElement="Flow_1lghrxh"> - <di:waypoint x="1465" y="360" /> - <di:waypoint x="1712" y="360" /> + <di:waypoint x="1655" y="360" /> + <di:waypoint x="1902" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1lwj0ih" bpmnElement="Flow_1j54c2s"> - <di:waypoint x="1365" y="360" /> - <di:waypoint x="1415" y="360" /> + <di:waypoint x="1555" y="360" /> + <di:waypoint x="1605" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1k895i8" bpmnElement="Flow_136htek"> - <di:waypoint x="1700" y="450" /> - <di:waypoint x="1755" y="450" /> + <di:waypoint x="1890" y="450" /> + <di:waypoint x="1945" y="450" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0z1aurb" bpmnElement="Flow_08vgmf6"> - <di:waypoint x="1270" y="360" /> - <di:waypoint x="1315" y="360" /> + <di:waypoint x="1460" y="360" /> + <di:waypoint x="1505" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0ffsn0i" bpmnElement="Flow_101sqed"> - <di:waypoint x="1340" y="385" /> - <di:waypoint x="1340" y="560" /> - <di:waypoint x="1520" y="560" /> + <di:waypoint x="1530" y="385" /> + <di:waypoint x="1530" y="560" /> + <di:waypoint x="1710" y="560" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1265" y="524" width="70" height="27" /> + <dc:Bounds x="1455" y="524" width="70" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1ce9w6g" bpmnElement="Flow_1ho1hys"> - <di:waypoint x="1805" y="450" /> - <di:waypoint x="1862" y="450" /> + <di:waypoint x="1995" y="450" /> + <di:waypoint x="2052" y="450" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1iq5cwe" bpmnElement="Flow_13u1nzy"> - <di:waypoint x="2015" y="360" /> - <di:waypoint x="2685" y="360" /> + <di:waypoint x="2205" y="360" /> + <di:waypoint x="2875" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1skpxus" bpmnElement="Flow_1yt9547"> - <di:waypoint x="1990" y="385" /> - <di:waypoint x="1990" y="520" /> - <di:waypoint x="2070" y="520" /> + <di:waypoint x="2180" y="385" /> + <di:waypoint x="2180" y="520" /> + <di:waypoint x="2260" y="520" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1lmv30e" bpmnElement="Flow_0jcfur3"> - <di:waypoint x="2380" y="640" /> - <di:waypoint x="2410" y="640" /> - <di:waypoint x="2410" y="520" /> - <di:waypoint x="2510" y="520" /> + <di:waypoint x="2570" y="640" /> + <di:waypoint x="2600" y="640" /> + <di:waypoint x="2600" y="520" /> + <di:waypoint x="2700" y="520" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0klalf8_di" bpmnElement="Flow_0klalf8"> - <di:waypoint x="2610" y="520" /> - <di:waypoint x="2710" y="520" /> - <di:waypoint x="2710" y="385" /> + <di:waypoint x="2800" y="520" /> + <di:waypoint x="2900" y="520" /> + <di:waypoint x="2900" y="385" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ewmc79_di" bpmnElement="Flow_1ewmc79"> - <di:waypoint x="1748" y="360" /> - <di:waypoint x="1820" y="360" /> + <di:waypoint x="1938" y="360" /> + <di:waypoint x="2010" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jwekqw_di" bpmnElement="Flow_1jwekqw"> - <di:waypoint x="1920" y="360" /> - <di:waypoint x="1965" y="360" /> + <di:waypoint x="2110" y="360" /> + <di:waypoint x="2155" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0v8dcpi" bpmnElement="Flow_03nx6rk"> - <di:waypoint x="2735" y="360" /> - <di:waypoint x="2772" y="360" /> + <di:waypoint x="2925" y="360" /> + <di:waypoint x="2962" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0upu487_di" bpmnElement="Flow_0upu487"> - <di:waypoint x="1620" y="560" /> - <di:waypoint x="1780" y="560" /> - <di:waypoint x="1780" y="475" /> + <di:waypoint x="1810" y="560" /> + <di:waypoint x="1970" y="560" /> + <di:waypoint x="1970" y="475" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ncztgo_di" bpmnElement="Flow_1ncztgo"> - <di:waypoint x="2170" y="520" /> - <di:waypoint x="2195" y="520" /> + <di:waypoint x="2360" y="520" /> + <di:waypoint x="2385" y="520" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0qif01p_di" bpmnElement="Flow_0qif01p"> - <di:waypoint x="2220" y="545" /> - <di:waypoint x="2220" y="640" /> - <di:waypoint x="2280" y="640" /> + <di:waypoint x="2410" y="545" /> + <di:waypoint x="2410" y="640" /> + <di:waypoint x="2470" y="640" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_18wxsor_di" bpmnElement="Flow_18wxsor"> - <di:waypoint x="2245" y="520" /> - <di:waypoint x="2510" y="520" /> + <di:waypoint x="2435" y="520" /> + <di:waypoint x="2700" y="520" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0xtcxff" bpmnElement="Association_1c7vgba"> - <di:waypoint x="1252" y="320" /> - <di:waypoint x="1276" y="290" /> + <di:waypoint x="1442" y="320" /> + <di:waypoint x="1466" y="290" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1xojob2" bpmnElement="Association_14iteoh"> - <di:waypoint x="2602" y="559" /> - <di:waypoint x="2660" y="612" /> + <di:waypoint x="2792" y="559" /> + <di:waypoint x="2850" y="612" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_07aga42" bpmnElement="Association_0l3n1oc"> - <di:waypoint x="2074" y="622" /> - <di:waypoint x="2102" y="560" /> + <di:waypoint x="2264" y="622" /> + <di:waypoint x="2292" y="560" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BPMNShape_0fhb8wi" bpmnElement="Activity_0nwtf8o"> - <dc:Bounds x="530" y="460" width="100" height="80" /> + <dc:Bounds x="720" y="460" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0zyba7l" bpmnElement="Activity_0802w0b"> - <dc:Bounds x="2920" y="330" width="100" height="80" /> + <dc:Bounds x="3110" y="330" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19d4kn6" bpmnElement="SaveResults"> - <dc:Bounds x="3050" y="330" width="100" height="80" /> + <dc:Bounds x="3240" y="330" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0gw8z00" bpmnElement="EndEvent"> - <dc:Bounds x="3172" y="352" width="36" height="36" /> + <dc:Bounds x="3362" y="352" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0ob9la3" bpmnElement="Gateway_0bifi5h" isMarkerVisible="true"> - <dc:Bounds x="815" y="335" width="50" height="50" /> + <dc:Bounds x="1005" y="335" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0wi2en6" bpmnElement="SelectPingTargets"> - <dc:Bounds x="900" y="320" width="100" height="80" /> + <dc:Bounds x="1090" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_1v2z49g" bpmnElement="Gateway_0xw5i5v" isMarkerVisible="true"> - <dc:Bounds x="435" y="335" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BPMNShape_0ydgq5s" bpmnElement="StartPingMessageStartEvent"> - <dc:Bounds x="152" y="342" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="151" y="385" width="44" height="14" /> - </bpmndi:BPMNLabel> + <dc:Bounds x="625" y="335" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0wlxsbv_di" bpmnElement="Activity_1wdftvk"> - <dc:Bounds x="260" y="320" width="100" height="80" /> + <dc:Bounds x="450" y="320" width="100" height="80" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0v585g9_di" bpmnElement="Activity_1ddl5dm"> - <dc:Bounds x="790" y="580" width="100" height="80" /> + <dc:Bounds x="980" y="580" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0a51zrr" bpmnElement="Gateway_1nb10cc" isMarkerVisible="true"> - <dc:Bounds x="665" y="475" width="50" height="50" /> + <dc:Bounds x="855" y="475" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0diib78" bpmnElement="TextAnnotation_1ig0151"> - <dc:Bounds x="2990" y="239" width="160" height="49" /> + <dc:Bounds x="3180" y="239" width="160" height="49" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0o5toqz" bpmnElement="TextAnnotation_1j1ytqy"> - <dc:Bounds x="430" y="580" width="170" height="40" /> + <dc:Bounds x="620" y="580" width="170" height="40" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0ne04k7" bpmnElement="TextAnnotation_0dhecha"> - <dc:Bounds x="400" y="220" width="420" height="70" /> + <dc:Bounds x="590" y="220" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_0t4el3i" bpmnElement="TextAnnotation_1plclrb"> - <dc:Bounds x="2920" y="490" width="200" height="41" /> + <dc:Bounds x="3110" y="490" width="200" height="41" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BPMNShape_19d2657" bpmnElement="TextAnnotation_02e4h2c" bioc:stroke="#831311" bioc:fill="#ffcdd2" color:background-color="#ffcdd2" color:border-color="#831311"> - <dc:Bounds x="230" y="80" width="420" height="70" /> + <dc:Bounds x="420" y="80" width="420" height="70" /> <bpmndi:BPMNLabel /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="BPMNEdge_09zmq8d" bpmnElement="Flow_0j92st0"> - <di:waypoint x="1000" y="360" /> - <di:waypoint x="1040" y="360" /> + <di:waypoint x="1190" y="360" /> + <di:waypoint x="1230" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_036wiw0" bpmnElement="Flow_1bfs68o"> - <di:waypoint x="2860" y="370" /> - <di:waypoint x="2920" y="370" /> + <di:waypoint x="3050" y="370" /> + <di:waypoint x="3110" y="370" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0u9gpv1" bpmnElement="Flow_152nb9r"> - <di:waypoint x="460" y="385" /> - <di:waypoint x="460" y="500" /> - <di:waypoint x="530" y="500" /> + <di:waypoint x="650" y="385" /> + <di:waypoint x="650" y="500" /> + <di:waypoint x="720" y="500" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1fbz0br" bpmnElement="Flow_0gubpgz"> - <di:waypoint x="3020" y="370" /> - <di:waypoint x="3050" y="370" /> + <di:waypoint x="3210" y="370" /> + <di:waypoint x="3240" y="370" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_00ieeud" bpmnElement="Flow_1du5wys"> - <di:waypoint x="3150" y="370" /> - <di:waypoint x="3172" y="370" /> + <di:waypoint x="3340" y="370" /> + <di:waypoint x="3362" y="370" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0t4fqb7" bpmnElement="Flow_0iuuyo1"> - <di:waypoint x="485" y="360" /> - <di:waypoint x="815" y="360" /> + <di:waypoint x="675" y="360" /> + <di:waypoint x="1005" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_1e1kjcl" bpmnElement="Flow_1c15ef2"> - <di:waypoint x="865" y="360" /> - <di:waypoint x="900" y="360" /> + <di:waypoint x="1055" y="360" /> + <di:waypoint x="1090" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fxlsv3_di" bpmnElement="Flow_0fxlsv3"> - <di:waypoint x="360" y="360" /> - <di:waypoint x="435" y="360" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0e35w2m_di" bpmnElement="Flow_0e35w2m"> - <di:waypoint x="188" y="360" /> - <di:waypoint x="260" y="360" /> + <di:waypoint x="550" y="360" /> + <di:waypoint x="625" y="360" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0ejw9k5_di" bpmnElement="Flow_0ejw9k5"> - <di:waypoint x="840" y="580" /> - <di:waypoint x="840" y="385" /> + <di:waypoint x="1030" y="580" /> + <di:waypoint x="1030" y="385" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1op4sei_di" bpmnElement="Flow_1op4sei"> - <di:waypoint x="630" y="500" /> - <di:waypoint x="665" y="500" /> + <di:waypoint x="820" y="500" /> + <di:waypoint x="855" y="500" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0z3dgxw_di" bpmnElement="Flow_0z3dgxw"> - <di:waypoint x="690" y="525" /> - <di:waypoint x="690" y="620" /> - <di:waypoint x="790" y="620" /> + <di:waypoint x="880" y="525" /> + <di:waypoint x="880" y="620" /> + <di:waypoint x="980" y="620" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1qyomuj_di" bpmnElement="Flow_1qyomuj"> - <di:waypoint x="715" y="500" /> - <di:waypoint x="840" y="500" /> - <di:waypoint x="840" y="385" /> + <di:waypoint x="905" y="500" /> + <di:waypoint x="1030" y="500" /> + <di:waypoint x="1030" y="385" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_149mrr9" bpmnElement="Association_0xonsp5"> - <di:waypoint x="539" y="540" /> - <di:waypoint x="498" y="580" /> + <di:waypoint x="729" y="540" /> + <di:waypoint x="688" y="580" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_0yofzg9" bpmnElement="Association_1f86scd"> - <di:waypoint x="3013" y="490" /> - <di:waypoint x="2984" y="410" /> + <di:waypoint x="3203" y="490" /> + <di:waypoint x="3174" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="BPMNEdge_08oczt4" bpmnElement="Association_02mkojs"> - <di:waypoint x="3079" y="330" /> - <di:waypoint x="3058" y="288" /> + <di:waypoint x="3269" y="330" /> + <di:waypoint x="3248" y="288" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1hor4v7_di" bpmnElement="Flow_1hor4v7"> + <di:waypoint x="188" y="360" /> + <di:waypoint x="270" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0xy3953_di" bpmnElement="Flow_0xy3953"> + <di:waypoint x="370" y="360" /> + <di:waypoint x="450" y="360" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/src/main/resources/fhir/CodeSystem/dsf-ping.xml b/src/main/resources/fhir/CodeSystem/dsf-ping.xml index d8c044a9..100877d6 100644 --- a/src/main/resources/fhir/CodeSystem/dsf-ping.xml +++ b/src/main/resources/fhir/CodeSystem/dsf-ping.xml @@ -76,4 +76,9 @@ <display value="Error"/> <definition value="Error to be added as an output parameter in the Start Ping Task"/> </concept> + <concept> + <code value="pong-timeout-duration"/> + <display value="Pong Timeout Duration"/> + <definition value="Time to wait until a pong message is received in ISO 8601 duration format e.g. PT1H5M30S for a duration of 1 hour, 5 minutes and 30 seconds"/> + </concept> </CodeSystem> \ No newline at end of file diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml index 49e249f7..2cbb4f0f 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping-autostart.xml @@ -31,7 +31,7 @@ </extension> <path value="Task.input" /> <min value="2" /> - <max value="5" /> + <max value="6" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -150,6 +150,58 @@ <expression value="matches('^P(?:([0-9]+)Y)?(?:([0-9]+)M)?(?:([0-9]+)D)?(T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:([0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?$')" /> </constraint> </element> + <element id="Task.input:pong-timeout-duration"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="pong-timeout-duration" /> + <min value="0" /> + <max value="1" /> + </element> + <element id="Task.input:pong-timeout-duration.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> + </binding> + </element> + <element id="Task.input:pong-timeout-duration.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:pong-timeout-duration.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:pong-timeout-duration.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> + </element> + <element id="Task.input:pong-timeout-duration.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="pong-timeout-duration" /> + </element> + <element id="Task.input:pong-timeout-duration.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="string" /> + </type> + <constraint> + <key value="pong-timeout-regex" /> + <severity value="error" /> + <human value="Must be ISO 8601 time duration pattern" /> + <expression value="matches('^P(?:([0-9]+)Y)?(?:([0-9]+)M)?(?:([0-9]+)D)?(T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:([0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?$')" /> + </constraint> + </element> <element id="Task.input:download-resource-size-bytes"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> diff --git a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml index fce3e8b3..f868956e 100644 --- a/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/StructureDefinition/dsf-task-start-ping.xml @@ -31,7 +31,7 @@ </extension> <path value="Task.input" /> <min value="1" /> - <max value="4" /> + <max value="5" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -133,6 +133,58 @@ <min value="1" /> <fixedCode value="download-resource-size-bytes" /> </element> + <element id="Task.input:pong-timeout-duration"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="pong-timeout-duration" /> + <min value="0" /> + <max value="1" /> + </element> + <element id="Task.input:pong-timeout-duration.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://dsf.dev/fhir/ValueSet/ping|#{version}" /> + </binding> + </element> + <element id="Task.input:pong-timeout-duration.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:pong-timeout-duration.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://dsf.dev/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:pong-timeout-duration.type.coding.version"> + <path value="Task.input.type.coding.version"/> + <min value="1"/> + <max value="1"/> + <fixedString value="#{version}"/> + </element> + <element id="Task.input:pong-timeout-duration.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="pong-timeout-duration" /> + </element> + <element id="Task.input:pong-timeout-duration.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="string" /> + </type> + <constraint> + <key value="pong-timeout-regex" /> + <severity value="error" /> + <human value="Must be ISO 8601 time duration pattern" /> + <expression value="matches('^P(?:([0-9]+)Y)?(?:([0-9]+)M)?(?:([0-9]+)D)?(T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:([0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?$')" /> + </constraint> + </element> <element id="Task.output:process-error"> <path value="Task.output"/> <sliceName value="process-error"/> diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml index 92773665..c74ab172 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping-autostart.xml @@ -65,4 +65,14 @@ </type> <valueDecimal value="10000000"/> </input> + <input> + <type> + <coding> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <version value="#{version}"/> + <code value="pong-timeout-duration"/> + </coding> + </type> + <valueString value="PT30S"/> + </input> </Task> diff --git a/src/main/resources/fhir/Task/dsf-task-start-ping.xml b/src/main/resources/fhir/Task/dsf-task-start-ping.xml index 79340db5..97741f32 100644 --- a/src/main/resources/fhir/Task/dsf-task-start-ping.xml +++ b/src/main/resources/fhir/Task/dsf-task-start-ping.xml @@ -1,58 +1,68 @@ <Task xmlns="http://hl7.org/fhir"> - <meta> - <profile value="http://dsf.dev/fhir/StructureDefinition/task-start-ping|#{version}"/> - </meta> - <identifier> - <system value="http://dsf.dev/sid/task-identifier"/> - <value value="http://dsf.dev/bpe/Process/ping/#{version}/task-start-ping"/> - </identifier> - <instantiatesCanonical value="http://dsf.dev/bpe/Process/ping|#{version}"/> - <status value="draft"/> - <intent value="order"/> - <authoredOn value="#{date}"/> - <requester> - <type value="Organization"/> - <identifier> - <system value="http://dsf.dev/sid/organization-identifier"/> - <value value="#{organization}"/> - </identifier> - </requester> - <restriction> - <recipient> - <type value="Organization"/> - <identifier> - <system value="http://dsf.dev/sid/organization-identifier"/> - <value value="#{organization}"/> - </identifier> - </recipient> - </restriction> - <input> - <type> - <coding> - <system value="http://dsf.dev/fhir/CodeSystem/bpmn-message"/> - <code value="message-name"/> - </coding> - </type> - <valueString value="startPing"/> - </input> - <input> - <type> - <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping"/> - <version value="#{version}"/> - <code value="download-resource-size-bytes" /> - </coding> - </type> - <valueDecimal value="1000000"/> - </input> - <input> - <type> - <coding> - <system value="http://dsf.dev/fhir/CodeSystem/ping"/> - <version value="#{version}"/> - <code value="target-endpoints"/> - </coding> - </type> - <valueString value="Endpoint?status=active&identifier=http://dsf.dev/sid/endpoint-identifier|"/> - </input> + <meta> + <profile value="http://dsf.dev/fhir/StructureDefinition/task-start-ping|#{version}"/> + </meta> + <identifier> + <system value="http://dsf.dev/sid/task-identifier"/> + <value value="http://dsf.dev/bpe/Process/ping/#{version}/task-start-ping"/> + </identifier> + <instantiatesCanonical value="http://dsf.dev/bpe/Process/ping|#{version}"/> + <status value="draft"/> + <intent value="order"/> + <authoredOn value="#{date}"/> + <requester> + <type value="Organization"/> + <identifier> + <system value="http://dsf.dev/sid/organization-identifier"/> + <value value="#{organization}"/> + </identifier> + </requester> + <restriction> + <recipient> + <type value="Organization"/> + <identifier> + <system value="http://dsf.dev/sid/organization-identifier"/> + <value value="#{organization}"/> + </identifier> + </recipient> + </restriction> + <input> + <type> + <coding> + <system value="http://dsf.dev/fhir/CodeSystem/bpmn-message"/> + <code value="message-name"/> + </coding> + </type> + <valueString value="startPing"/> + </input> + <input> + <type> + <coding> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <version value="#{version}"/> + <code value="target-endpoints"/> + </coding> + </type> + <valueString value="Endpoint?status=active&identifier=http://dsf.dev/sid/endpoint-identifier|"/> + </input> + <input> + <type> + <coding> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <version value="#{version}"/> + <code value="download-resource-size-bytes"/> + </coding> + </type> + <valueDecimal value="1000000"/> + </input> + <input> + <type> + <coding> + <system value="http://dsf.dev/fhir/CodeSystem/ping"/> + <version value="#{version}"/> + <code value="pong-timeout-duration"/> + </coding> + </type> + <valueString value="PT30S"/> + </input> </Task> From eda0388ea2b33c81fce4455e4fadba83d38900d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 19 Sep 2025 12:30:34 +0200 Subject: [PATCH 379/382] Improved readability of environment variables --- .../dev/dsf/bpe/service/ping/SetPongTimeoutDuration.java | 3 ++- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/SetPongTimeoutDuration.java b/src/main/java/dev/dsf/bpe/service/ping/SetPongTimeoutDuration.java index 4cd07144..7faa80fb 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/SetPongTimeoutDuration.java +++ b/src/main/java/dev/dsf/bpe/service/ping/SetPongTimeoutDuration.java @@ -43,7 +43,8 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw { throw new RuntimeException("Pong timeout duration is invalid"); } - } else + } + else { logger.debug("No pong timeout duration specified"); } diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 289a7121..13f12b0c 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -63,17 +63,17 @@ public class PingConfig private boolean sendPongProcessFailedMail; @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.", processNames = "dsfdev_ping, dsfdev_pong") - @Value("${dev.dsf.bpe.ping.maxDownloadSizeBytes:400000000}") + @Value("${dev.dsf.bpe.ping.max.download.size.bytes:400000000}") private long maxDownloadSizeBytes; @ProcessDocumentation(description = "Sets the upload limit on resource uploads, essentially limiting the amount of data other ping instances are able to download from this instance.", processNames = { "dsfdev_ping", "dsfdev_pong" }) - @Value("${dev.dsf.bpe.ping.maxUploadSizeBytes:400000000}") + @Value("${dev.dsf.bpe.ping.max.upload.size.bytes:400000000}") private long maxUploadSizeBytes; @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values are: \"bps\", \"kbps\", \"Mbps\", \"Gbps\", \"Bps\", \"kBps\", \"MBps\", \"GBps\". Default is \"mbps\".", processNames = { "dsfdev_ping", "dsfdev_pong" }) - @Value("${dev.dsf.bpe.ping.networkSpeedUnit:#{null}}") + @Value("${dev.dsf.bpe.ping.network.speed.unit:#{null}}") private CodeSystem.DsfPingUnits.Code networkSpeedUnit; public CodeSystem.DsfPingUnits.Code getNetworkSpeedUnit() From aeb0431ce3cf881fef974f3087e2c0e91e26becc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 19 Sep 2025 14:10:34 +0200 Subject: [PATCH 380/382] Update process documentation --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 13f12b0c..2941e39e 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -62,7 +62,7 @@ public class PingConfig @Value("${dev.dsf.bpe.ping.mail.onPongProcessFailed:false}") private boolean sendPongProcessFailedMail; - @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (\"old\") ping process.", processNames = "dsfdev_ping, dsfdev_pong") + @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (v1.x) ping process.", processNames = "dsfdev_ping, dsfdev_pong") @Value("${dev.dsf.bpe.ping.max.download.size.bytes:400000000}") private long maxDownloadSizeBytes; @@ -71,7 +71,7 @@ public class PingConfig @Value("${dev.dsf.bpe.ping.max.upload.size.bytes:400000000}") private long maxUploadSizeBytes; - @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values are: \"bps\", \"kbps\", \"Mbps\", \"Gbps\", \"Bps\", \"kBps\", \"MBps\", \"GBps\". Default is \"mbps\".", processNames = { + @ProcessDocumentation(description = "Unit to display upload and download speeds in. Eligible values are: \"bps\", \"kbps\", \"Mbps\", \"Gbps\", \"Bps\", \"kBps\", \"MBps\", \"GBps\". If left empty, the process will try to fit the network speed to appropriate units.", processNames = { "dsfdev_ping", "dsfdev_pong" }) @Value("${dev.dsf.bpe.ping.network.speed.unit:#{null}}") private CodeSystem.DsfPingUnits.Code networkSpeedUnit; From 80a5653dda21a9daaf18ea4af022ae610a0fb4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 19 Sep 2025 14:23:00 +0200 Subject: [PATCH 381/382] Fixed documentation --- src/main/java/dev/dsf/bpe/spring/config/PingConfig.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java index 2941e39e..e80c32a7 100644 --- a/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java +++ b/src/main/java/dev/dsf/bpe/spring/config/PingConfig.java @@ -62,7 +62,8 @@ public class PingConfig @Value("${dev.dsf.bpe.ping.mail.onPongProcessFailed:false}") private boolean sendPongProcessFailedMail; - @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (v1.x) ping process.", processNames = "dsfdev_ping, dsfdev_pong") + @ProcessDocumentation(description = "Sets the download limit on resource downloads, essentially limiting the amount of data downloaded from other ping instances. Setting this to a negative value will disable resource downloads, effectively resulting in running the slim (v1.x) ping process.", processNames = { + "dsfdev_ping", "dsfdev_pong" }) @Value("${dev.dsf.bpe.ping.max.download.size.bytes:400000000}") private long maxDownloadSizeBytes; From 718fbc0a7b04cc9b33aab21f5ccd5bd51437467c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hringer?= <jan.boehringer@hs-heilbronn.de> Date: Fri, 19 Sep 2025 15:49:18 +0200 Subject: [PATCH 382/382] Fixed upload and download speeds not having their unit set independently --- .../dsf/bpe/service/ping/StoreResults.java | 37 +++++++++++++------ .../output/generator/PingStatusGenerator.java | 26 ++++++++----- .../dsf/fhir/profiles/TaskProfileTest.java | 3 +- 3 files changed, 43 insertions(+), 23 deletions(-) diff --git a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java index f631a77e..1fd5c75c 100644 --- a/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java +++ b/src/main/java/dev/dsf/bpe/service/ping/StoreResults.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.BpmnError; @@ -77,18 +78,28 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw Duration downloadedDuration = (Duration) variables .getVariable(ExecutionVariables.downloadedDuration.correlatedValue(correlationKey)); - BigDecimal downloadSpeed = calculateNetworkSpeed(downloadedBytes, downloadedDuration); + Optional<CodeSystem.DsfPingUnits.Code.SpeedAndUnit> downloadSpeedAndUnit = calculateNetworkSpeed( + downloadedBytes, downloadedDuration); + BigDecimal downloadSpeed = downloadSpeedAndUnit.map(CodeSystem.DsfPingUnits.Code.SpeedAndUnit::speed) + .orElse(null); + CodeSystem.DsfPingUnits.Code downloadSpeedUnit = downloadSpeedAndUnit + .map(CodeSystem.DsfPingUnits.Code.SpeedAndUnit::unit).orElse(null); Long uploadedBytes = variables .getLong(ExecutionVariables.uploadedBytes.correlatedValue(correlationKey)); Duration uploadedDurationMillis = (Duration) variables .getVariable(ExecutionVariables.uploadedDuration.correlatedValue(correlationKey)); - BigDecimal uploadSpeed = calculateNetworkSpeed(uploadedBytes, uploadedDurationMillis); + Optional<CodeSystem.DsfPingUnits.Code.SpeedAndUnit> uploadSpeedAndUnit = calculateNetworkSpeed( + uploadedBytes, uploadedDurationMillis); + BigDecimal uploadSpeed = uploadSpeedAndUnit.map(CodeSystem.DsfPingUnits.Code.SpeedAndUnit::speed) + .orElse(null); + CodeSystem.DsfPingUnits.Code uploadSpeedUnit = uploadSpeedAndUnit + .map(CodeSystem.DsfPingUnits.Code.SpeedAndUnit::unit).orElse(null); task.addOutput(PingStatusGenerator.createPingStatusOutput(target, statusCode, errors.getEntries(), - downloadSpeed, uploadSpeed, networkSpeedUnit)); + downloadSpeed, downloadSpeedUnit, uploadSpeed, uploadSpeedUnit)); } else // if slim-ping { @@ -104,23 +115,25 @@ protected void doExecute(DelegateExecution execution, Variables variables) throw logger.debug("Successfully stored results for task {}", variables.getStartTask().getIdElement().getValue()); } - private BigDecimal calculateNetworkSpeed(Long downloadedBytes, Duration downloadedDuration) + private Optional<CodeSystem.DsfPingUnits.Code.SpeedAndUnit> calculateNetworkSpeed(Long transferredBytes, + Duration transferDuration) { - BigDecimal downloadSpeed = null; - if (downloadedBytes != null && downloadedDuration != null) + if (transferredBytes != null && transferDuration != null) { if (Objects.isNull(networkSpeedUnit)) { - CodeSystem.DsfPingUnits.Code.SpeedAndUnit speedAndUnit = CodeSystem.DsfPingUnits.Code - .calculateSpeedWithFittingUnit(downloadedBytes, downloadedDuration); - downloadSpeed = speedAndUnit.speed(); - networkSpeedUnit = speedAndUnit.unit(); + return Optional.of( + CodeSystem.DsfPingUnits.Code.calculateSpeedWithFittingUnit(transferredBytes, transferDuration)); } else { - downloadSpeed = networkSpeedUnit.calculateSpeed(downloadedBytes, downloadedDuration); + return Optional.of(new CodeSystem.DsfPingUnits.Code.SpeedAndUnit( + networkSpeedUnit.calculateSpeed(transferredBytes, transferDuration), networkSpeedUnit)); } } - return downloadSpeed; + else + { + return Optional.empty(); + } } } diff --git a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java index a34252c4..1e004ab4 100644 --- a/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java +++ b/src/main/java/dev/dsf/bpe/util/task/output/generator/PingStatusGenerator.java @@ -264,33 +264,38 @@ public static TaskOutputComponent createPingStatusOutput(Target target, CodeSyst List<ProcessError> errors) { return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS, statusCode, errors, null, null, null, - null, null); + null, null, null, null, null); } public static TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, - List<ProcessError> errors, BigDecimal downloadSpeed, BigDecimal uploadSpeed, - CodeSystem.DsfPingUnits.Code unit) + List<ProcessError> errors, BigDecimal downloadSpeed, CodeSystem.DsfPingUnits.Code downloadUnit, + BigDecimal uploadSpeed, CodeSystem.DsfPingUnits.Code uploadUnit) { return createStatusOutput(target, CodeSystem.DsfPing.Code.PING_STATUS, statusCode, errors, downloadSpeed, - uploadSpeed, unit != null ? unit.name() : null, CODESYSTEM_UCUM, unit != null ? unit.toUcum() : null); + downloadUnit != null ? downloadUnit.name() : null, CODESYSTEM_UCUM, + downloadUnit != null ? downloadUnit.toUcum() : null, uploadSpeed, + uploadUnit != null ? uploadUnit.name() : null, CODESYSTEM_UCUM, + uploadUnit != null ? uploadUnit.toUcum() : null); } public static TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors) { return createStatusOutput(target, CodeSystem.DsfPing.Code.PONG_STATUS, statusCode, errors, null, null, null, - null, null); + null, null, null, null, null); } private static TaskOutputComponent createStatusOutput(Target target, CodeSystem.DsfPing.Code outputParameter, CodeSystem.DsfPingStatus.Code statusCode, List<ProcessError> errors, BigDecimal downloadSpeed, - BigDecimal uploadSpeed, String unit, String unitSystem, String unitCode) + String downloadUnit, String downloadUnitSystem, String downloadUnitCode, BigDecimal uploadSpeed, + String uploadUnit, String uploadUnitSystem, String uploadUnitCode) { TaskOutputComponent output = new TaskOutputComponent(); addStatus(output, outputParameter, statusCode); addTarget(output, target); addErrors(output, errors); - addNetworkSpeed(output, downloadSpeed, uploadSpeed, unit, unitSystem, unitCode); + addNetworkSpeed(output, downloadSpeed, downloadUnit, downloadUnitSystem, downloadUnitCode, uploadSpeed, + uploadUnit, uploadUnitSystem, uploadUnitCode); return output; } @@ -437,10 +442,11 @@ private static TaskOutputComponent updateErrors(TaskOutputComponent outputCompon } private static TaskOutputComponent addNetworkSpeed(TaskOutputComponent outputComponent, BigDecimal downloadSpeed, - BigDecimal uploadSpeed, String unit, String unitSystem, String unitCode) + String downloadUnit, String downloadUnitSystem, String downloadUnitCode, BigDecimal uploadSpeed, + String uploadUnit, String uploadUnitSystem, String uploadUnitCode) { - addDownloadSpeed(outputComponent, downloadSpeed, unit, unitSystem, unitCode); - addUploadSpeed(outputComponent, uploadSpeed, unit, unitSystem, unitCode); + addDownloadSpeed(outputComponent, downloadSpeed, downloadUnit, downloadUnitSystem, downloadUnitCode); + addUploadSpeed(outputComponent, uploadSpeed, uploadUnit, uploadUnitSystem, uploadUnitCode); return outputComponent; } diff --git a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java index 4db24afc..72a65a84 100644 --- a/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java +++ b/src/test/java/dev/dsf/fhir/profiles/TaskProfileTest.java @@ -703,7 +703,8 @@ private String fillPlaceholders(String xml) private Task.TaskOutputComponent createPingStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode, BigDecimal downloadSpeed, BigDecimal uploadSpeed, CodeSystem.DsfPingUnits.Code unit) { - return PingStatusGenerator.createPingStatusOutput(target, statusCode, null, downloadSpeed, uploadSpeed, unit); + return PingStatusGenerator.createPingStatusOutput(target, statusCode, null, downloadSpeed, unit, uploadSpeed, + unit); } private Task.TaskOutputComponent createPongStatusOutput(Target target, CodeSystem.DsfPingStatus.Code statusCode)