diff --git a/pom.xml b/pom.xml
index a92adcb0..db83f5ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,8 @@
17
17
- 1.8.0
+ 1.9.0
+ 6.2.12
../dsf
@@ -45,21 +46,14 @@
org.springframework
spring-web
- 6.0.10
- provided
-
-
-
- org.slf4j
- slf4j-api
- 2.0.7
+ ${spring.version}
provided
com.fasterxml.jackson.datatype
jackson-datatype-jsr310
- 2.19.0
+ 2.20.0
com.fasterxml.jackson.core
@@ -103,7 +97,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.11.0
+ 3.14.1
${compileSource}
${compileTarget}
@@ -112,12 +106,12 @@
org.apache.maven.plugins
maven-surefire-plugin
- 3.1.2
+ 3.5.4
org.apache.maven.plugins
maven-jar-plugin
- 3.3.0
+ 3.4.2
@@ -134,7 +128,7 @@
org.apache.maven.plugins
maven-shade-plugin
- 3.5.0
+ 3.6.1
package
@@ -158,18 +152,18 @@
org.apache.maven.plugins
maven-dependency-plugin
- 3.6.0
+ 3.9.0
org.apache.maven.plugins
maven-clean-plugin
- 3.3.1
+ 3.5.0
org.codehaus.mojo
buildnumber-maven-plugin
- 1.4
+ 3.2.1
validate
@@ -186,7 +180,7 @@
net.revelc.code.formatter
formatter-maven-plugin
- 2.23.0
+ 2.29.0
eclipse-formatter-config.xml
@@ -194,7 +188,7 @@
net.revelc.code
impsort-maven-plugin
- 1.9.0
+ 1.12.0
17
java.,javax.,org.,com.
@@ -218,6 +212,27 @@
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 3.6.2
+
+
+ enforce-maven
+
+ enforce
+
+
+
+
+ 3.6.3
+
+
+ true
+
+
+
+
diff --git a/src/main/java/dev/dsf/bpe/CodeSystem.java b/src/main/java/dev/dsf/bpe/CodeSystem.java
index eec4075e..1d618af9 100644
--- a/src/main/java/dev/dsf/bpe/CodeSystem.java
+++ b/src/main/java/dev/dsf/bpe/CodeSystem.java
@@ -194,7 +194,7 @@ public BigDecimal calculateSpeed(long bytes, Duration duration)
@Override
public String toUcum()
{
- return "Kbit/s";
+ return "kbit/s";
}
},
Mbps
@@ -281,7 +281,7 @@ public BigDecimal calculateSpeed(long bytes, Duration duration)
@Override
public String toUcum()
{
- return "KBy/s";
+ return "kBy/s";
}
},
MBps
diff --git a/src/main/java/dev/dsf/bpe/ConstantsPing.java b/src/main/java/dev/dsf/bpe/ConstantsPing.java
index b7392619..cca333b8 100644
--- a/src/main/java/dev/dsf/bpe/ConstantsPing.java
+++ b/src/main/java/dev/dsf/bpe/ConstantsPing.java
@@ -61,6 +61,8 @@ private ConstantsPing()
public static final String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H";
+ public static final String PONG_TIMEOUT_DURATION_DEFAULT_VALUE = "PT30S";
+
public static final String BPMN_ERROR_CODE_UNEXPECTED_ERROR = "unexpected-error";
public static final String POTENTIAL_FIX_URL_BASE = "https://dsf.dev/s";
diff --git a/src/main/java/dev/dsf/bpe/listener/PingPongProcessPluginDeploymentStateListener.java b/src/main/java/dev/dsf/bpe/listener/PingPongProcessPluginDeploymentStateListener.java
index 5bf59b0b..b7e43913 100644
--- a/src/main/java/dev/dsf/bpe/listener/PingPongProcessPluginDeploymentStateListener.java
+++ b/src/main/java/dev/dsf/bpe/listener/PingPongProcessPluginDeploymentStateListener.java
@@ -1,23 +1,30 @@
package dev.dsf.bpe.listener;
+import static dev.dsf.bpe.PingProcessPluginDefinition.RESOURCE_VERSION;
+
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Optional;
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.Coding;
+import org.hl7.fhir.r4.model.DecimalType;
import org.hl7.fhir.r4.model.MetadataResource;
import org.hl7.fhir.r4.model.Resource;
+import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.StructureDefinition;
+import org.hl7.fhir.r4.model.Task;
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;
+import dev.dsf.fhir.client.FhirWebserviceClient;
public class PingPongProcessPluginDeploymentStateListener
implements ProcessPluginDeploymentStateListener, InitializingBean
@@ -52,6 +59,62 @@ public void onProcessesDeployed(List activeProcesses)
updateOlderResourcesIfCurrentIsNewestResource(ConstantsPing.STRUCTURE_DEFINITION_URL_EXTENSION_PING_STATUS,
StructureDefinition.class, adaptExtensionStructureDefinitions());
+
+ updateDraftTaskResources();
+ }
+
+ private void updateDraftTaskResources()
+ {
+ FhirWebserviceClient client = api.getFhirWebserviceClientProvider().getLocalWebserviceClient();
+
+ String pingProcessPrefix = "http://dsf.dev/bpe/Process/ping/" + RESOURCE_VERSION;
+ List draftTaskResourceIdentifiers = List.of(pingProcessPrefix + "/task-start-ping",
+ pingProcessPrefix + "task-start-ping-autostart");
+
+ for (String identifier : draftTaskResourceIdentifiers)
+ {
+ Optional optionalTask = searchTask(identifier).getEntry().stream()
+ .map(Bundle.BundleEntryComponent::getResource).map(Task.class::cast).findFirst();
+
+ if (optionalTask.isPresent())
+ {
+ Task toUpdate = optionalTask.get();
+ adaptDraftTask(toUpdate);
+ client.update(toUpdate);
+ }
+ }
+ }
+
+ private void adaptDraftTask(Task task)
+ {
+ Coding downloadResourceSizeBytesCoding = new Coding();
+ downloadResourceSizeBytesCoding.setSystem(dev.dsf.bpe.CodeSystem.DsfPing.URL)
+ .setCode(dev.dsf.bpe.CodeSystem.DsfPing.Code.DOWNLOAD_RESOURCE_SIZE_BYTES.getValue())
+ .setVersion(RESOURCE_VERSION);
+
+ Optional optInput = api.getTaskHelper().getFirstInputParameter(task,
+ downloadResourceSizeBytesCoding, DecimalType.class);
+ if (optInput.isEmpty())
+ {
+ Task.ParameterComponent downloadResourceSizeBytes = new Task.ParameterComponent();
+ downloadResourceSizeBytes.getType().addCoding(downloadResourceSizeBytesCoding);
+ downloadResourceSizeBytes.setValue(new DecimalType(ConstantsPing.DOWNLOAD_RESOURCE_SIZE_BYTES_DEFAULT));
+ task.addInput(downloadResourceSizeBytes);
+ }
+
+ Coding pongTimeoutDurationCoding = new Coding();
+ pongTimeoutDurationCoding.setSystem(dev.dsf.bpe.CodeSystem.DsfPing.URL)
+ .setCode(dev.dsf.bpe.CodeSystem.DsfPing.Code.PONG_TIMEOUT_DURATION_ISO_8601.getValue())
+ .setVersion(RESOURCE_VERSION);
+
+ optInput = api.getTaskHelper().getFirstInputParameter(task, pongTimeoutDurationCoding, StringType.class);
+ if (optInput.isEmpty())
+ {
+ Task.ParameterComponent pongTimeoutDuration = new Task.ParameterComponent();
+ pongTimeoutDuration.getType().addCoding(pongTimeoutDurationCoding);
+ pongTimeoutDuration.setValue(new StringType(ConstantsPing.PONG_TIMEOUT_DURATION_DEFAULT_VALUE));
+ task.addInput(pongTimeoutDuration);
+ }
}
private void updateOlderResourcesIfCurrentIsNewestResource(String url, Class type,
@@ -74,6 +137,12 @@ private Bundle search(Class extends Resource> type, String url)
Map.of("url", List.of(url)));
}
+ private Bundle searchTask(String identifier)
+ {
+ return api.getFhirWebserviceClientProvider().getLocalWebserviceClient().search(Task.class,
+ Map.of("identifier", List.of(identifier), "status", List.of("draft")));
+ }
+
private List extractAndSortResources(Bundle bundle, Class type, String url)
{
return bundle.getEntry().stream().filter(Bundle.BundleEntryComponent::hasResource)
@@ -100,8 +169,7 @@ else if (version1.major < version2.major)
private boolean currentIsNewestResource(List extends MetadataResource> resources)
{
- return !resources.isEmpty() && PingProcessPluginDefinition.RESOURCE_VERSION
- .equals(resources.get(resources.size() - 1).getVersion());
+ return !resources.isEmpty() && RESOURCE_VERSION.equals(resources.get(resources.size() - 1).getVersion());
}
private MinorMajorVersion getMajorMinorVersion(String version)
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 581464e5..6dc55e8f 100644
--- a/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java
+++ b/src/main/java/dev/dsf/bpe/service/ping/CheckPingTaskStatus.java
@@ -1,7 +1,5 @@
package dev.dsf.bpe.service.ping;
-import java.util.Objects;
-
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.hl7.fhir.r4.model.Task;
@@ -38,28 +36,34 @@ protected void doExecuteWithErrorHandling(DelegateExecution delegateExecution, V
Target target = variables.getTarget();
String correlationKey = target.getCorrelationKey();
- String taskId = (String) delegateExecution.getVariableLocal(ExecutionVariables.pingTaskId.name());
+ // Do not use getVariableLocal() here. CheckPingTaskStatus gets executed in a child execution of the one that
+ // stored the variable. GetVariableLocal() will only look in the child execution's variables and find nothing.
+ // GetVariable() or the DSF API's getString() does look for values in the parent execution's variables.
+ String taskId = variables.getString(ExecutionVariables.pingTaskId.name());
- Objects.requireNonNull(taskId);
- FhirWebserviceClient fhirWebserviceClient = api.getFhirWebserviceClientProvider()
- .getWebserviceClient(target.getEndpointUrl());
try
{
- Task pingTask = fhirWebserviceClient.withRetry(3, 1000).read(Task.class, taskId);
- ProcessError error = switch (pingTask.getStatus())
+ if (taskId != null)
{
- 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);
+ FhirWebserviceClient fhirWebserviceClient = api.getFhirWebserviceClientProvider()
+ .getWebserviceClient(target.getEndpointUrl());
+
+ Task pingTask = fhirWebserviceClient.withRetry(3, 1000).read(Task.class, taskId);
+ ProcessError error = switch (pingTask.getStatus())
+ {
+ 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)
{
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 213fa58b..0fac4f4d 100644
--- a/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java
+++ b/src/main/java/dev/dsf/bpe/util/task/SendTaskErrorConverter.java
@@ -286,8 +286,7 @@ private static ProcessErrorWithStatusCode convertWebApplicationException(WebAppl
CodeSystem.DsfPingError.Concept.SEND_MESSAGE_HTTP_401,
ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP),
CodeSystem.DsfPingStatus.Code.NOT_ALLOWED);
- case 403 ->
- {
+ case 403 -> {
if (messageWithReference)
{
yield new ProcessErrorWithStatusCode(
@@ -332,8 +331,7 @@ yield new ProcessErrorWithStatusCode(
CodeSystem.DsfPingError.Concept.RECEIVE_MESSAGE_HTTP_401,
ConstantsPing.POTENTIAL_FIX_URL_ERROR_HTTP),
CodeSystem.DsfPingStatus.Code.NOT_ALLOWED);
- case 403 ->
- {
+ case 403 -> {
if (messageWithReference)
{
yield new ProcessErrorWithStatusCode(
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 c74ab172..b7d63573 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
@@ -55,7 +55,9 @@
-
+
+
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 97741f32..f83d1b20 100644
--- a/src/main/resources/fhir/Task/dsf-task-start-ping.xml
+++ b/src/main/resources/fhir/Task/dsf-task-start-ping.xml
@@ -45,7 +45,9 @@
-
+
+
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 dc170e51..647e36fe 100644
--- a/src/main/resources/fhir/ValueSet/dsf-network-speed-units.xml
+++ b/src/main/resources/fhir/ValueSet/dsf-network-speed-units.xml
@@ -27,19 +27,19 @@
-
+
-
+
-
+