diff --git a/.gitattributes b/.gitattributes
index c1587406e..de781ea1f 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -10,6 +10,7 @@
# Declare files that will always have certain line endings on checkout.
*.bat text eol=crlf
*.sh text eol=lf
+*.conf text eol=lf
# Denote all files that are truly binary and should not be modified.
*.png binary
diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml
index 71ce31358..76cf8b828 100644
--- a/.github/workflows/maven-build.yml
+++ b/.github/workflows/maven-build.yml
@@ -18,4 +18,4 @@ jobs:
java-version: 21
cache: 'maven'
- name: Build with Maven
- run: mvn --batch-mode --fail-at-end --threads 1C -DforkCount=2 -Dgpg.skip clean verify
+ run: mvn --batch-mode --fail-at-end -DforkCount=2 -Dgpg.skip clean verify
diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml
index 6b65e2fc8..82d10590e 100644
--- a/.github/workflows/maven-publish.yml
+++ b/.github/workflows/maven-publish.yml
@@ -25,4 +25,4 @@ jobs:
- name: Publish with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: mvn --batch-mode --fail-at-end --threads 1C -DforkCount=2 -Dgpg.skip clean deploy
+ run: mvn --batch-mode --fail-at-end -DforkCount=2 -Dgpg.skip clean deploy
diff --git a/.gitignore b/.gitignore
index 4ab205c7a..6b29325a5 100755
--- a/.gitignore
+++ b/.gitignore
@@ -12,8 +12,6 @@
###
# dsf-bpe ignores
###
-dsf-bpe/dsf-bpe-server-jetty/api/v1/*.jar
-dsf-bpe/dsf-bpe-server-jetty/api/v2/*.jar
dsf-bpe/dsf-bpe-server-jetty/conf/config.properties
dsf-bpe/dsf-bpe-server-jetty/docker/api/v1/*.jar
dsf-bpe/dsf-bpe-server-jetty/docker/api/v2/*.jar
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/pom.xml b/dsf-bpe/dsf-bpe-process-api-v1-impl/pom.xml
index d27cfd40c..89d5ee886 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/pom.xml
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/pom.xml
@@ -8,7 +8,7 @@
dsf-bpe-pom
2.0.0-SNAPSHOT
-
+
dev.dsf
@@ -27,10 +27,6 @@
org.glassfish.jersey.inject
jersey-hk2
-
- org.glassfish.jersey.media
- jersey-media-jaxb
-
org.glassfish.jersey.media
jersey-media-json-jackson
@@ -48,10 +44,10 @@
ca.uhn.hapi.fhir
- hapi-fhir-structures-r4
+ hapi-fhir-validation-resources-r4
${hapi.fhir.version.v1}
-
+
org.apache.logging.log4j
log4j-slf4j2-impl
@@ -63,4 +59,146 @@
test
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-api-v1-dependencies-to-docker
+ pre-integration-test
+
+ copy
+
+
+ ../dsf-bpe-server-jetty/docker/api/v1
+
+
+ dev.dsf
+ dsf-bpe-process-api-v1
+
+
+ dev.dsf
+ dsf-bpe-process-api-v1-impl
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-structures-r4
+ ${hapi.fhir.version.v1}
+
+
+ ca.uhn.hapi.fhir
+ org.hl7.fhir.utilities
+ ${hapi.fhir.version.v1}
+
+
+ ca.uhn.hapi.fhir
+ org.hl7.fhir.r4
+ ${hapi.fhir.version.v1}
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-validation
+ ${hapi.fhir.version.v1}
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-converter
+ ${hapi.fhir.version.v1}
+
+
+ ca.uhn.hapi.fhir
+ org.hl7.fhir.convertors
+ ${hapi.fhir.version.v1}
+
+
+ ca.uhn.hapi.fhir
+ org.hl7.fhir.r5
+ ${hapi.fhir.version.v1}
+
+
+ net.sf.saxon
+ Saxon-HE
+ 9.5.1-5
+
+
+ ca.uhn.hapi.fhir
+ org.hl7.fhir.validation
+ ${hapi.fhir.version.v1}
+
+
+
+ org.apache.commons
+ commons-compress
+
+
+ org.fhir
+ ucum
+ 1.0.2
+
+
+ com.github.ben-manes.caffeine
+ caffeine
+ 2.7.0
+
+
+ org.checkerframework
+ checker-qual
+ 2.6.0
+
+
+ com.google.errorprone
+ error_prone_annotations
+ 2.3.3
+
+
+ com.google.code.gson
+ gson
+
+
+ de.hs-heilbronn.mi
+ crypto-utils
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-validation-resources-r4
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-base
+ ${hapi.fhir.version.v1}
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+
+
+
+ ../dsf-bpe-server-jetty/docker/api
+
+ v1/*.jar
+
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/ContinueListener.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/ContinueListener.java
index 3f160d899..a77f2bf23 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/ContinueListener.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/listener/ContinueListener.java
@@ -72,6 +72,5 @@ processUrl, getCurrentTime(), continueTaskUrl, requester, businessKey, correlati
logger.info("Continuing process {} at {} [task: {}, requester: {}, business-key: {}, message: {}]",
processUrl, getCurrentTime(), continueTaskUrl, requester, businessKey, messageName);
}
-
}
}
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/plugin/ProcessPluginImpl.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/plugin/ProcessPluginImpl.java
index d45c4506b..1f663c3a8 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/plugin/ProcessPluginImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/plugin/ProcessPluginImpl.java
@@ -41,7 +41,7 @@
import dev.dsf.bpe.v1.ProcessPluginApi;
import dev.dsf.bpe.v1.ProcessPluginDefinition;
import dev.dsf.bpe.v1.ProcessPluginDeploymentStateListener;
-import dev.dsf.bpe.v1.constants.CodeSystems;
+import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage;
import dev.dsf.bpe.v1.constants.NamingSystems.OrganizationIdentifier;
import dev.dsf.bpe.v1.constants.NamingSystems.TaskIdentifier;
import dev.dsf.bpe.v1.variables.FhirResourceValues;
@@ -143,21 +143,18 @@ else if (filename.endsWith(XML_SUFFIX))
})
: Optional.empty();
- Predicate hasTaskInputMessageName = t -> t
- .getInput().stream().filter(
- i -> i.getType().getCoding().stream()
- .anyMatch(c -> CodeSystems.BpmnMessage.URL.equals(c.getSystem())
- && CodeSystems.BpmnMessage.Codes.MESSAGE_NAME.equals(c.getCode())))
+ Predicate hasTaskInputMessageName = t -> t.getInput().stream()
+ .filter(i -> i.getType().getCoding().stream().anyMatch(c -> BpmnMessage.URL.equals(c.getSystem())
+ && BpmnMessage.Codes.MESSAGE_NAME.equals(c.getCode())))
.count() == 1;
return new ProcessPluginFhirConfig<>(ActivityDefinition.class, CodeSystem.class, Library.class, Measure.class,
NamingSystem.class, Questionnaire.class, StructureDefinition.class, Task.class, ValueSet.class,
- OrganizationIdentifier.SID, TaskIdentifier.SID, TaskStatus.DRAFT.toCode(), CodeSystems.BpmnMessage.URL,
- CodeSystems.BpmnMessage.Codes.MESSAGE_NAME, parseResource, encodeResource, getResourceName,
- hasMetadataResourceUrl, hasMetadataResourceVersion, getMetadataResourceVersion,
- getActivityDefinitionUrl, NamingSystem::hasName, getTaskInstantiatesCanonical, getTaskIdentifierValue,
- isTaskStatusDraft, getRequester, getRecipient, Task::hasInput, hasTaskInputMessageName,
- Task::hasOutput);
+ OrganizationIdentifier.SID, TaskIdentifier.SID, TaskStatus.DRAFT.toCode(), BpmnMessage.URL,
+ BpmnMessage.Codes.MESSAGE_NAME, parseResource, encodeResource, getResourceName, hasMetadataResourceUrl,
+ hasMetadataResourceVersion, getMetadataResourceVersion, getActivityDefinitionUrl, NamingSystem::hasName,
+ getTaskInstantiatesCanonical, getTaskIdentifierValue, isTaskStatusDraft, getRequester, getRecipient,
+ Task::hasInput, hasTaskInputMessageName, Task::hasOutput);
}
private IParser newXmlParser()
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/AbstractResourceProvider.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/AbstractResourceProvider.java
index cea3491b9..69d49254b 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/AbstractResourceProvider.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/AbstractResourceProvider.java
@@ -3,7 +3,6 @@
import static org.hl7.fhir.instance.model.api.IBaseBundle.LINK_NEXT;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -72,9 +71,9 @@ protected final List search(Class extends Resource> se
private Bundle search(Class extends Resource> searchType, Map> parameters, int page)
{
Map> parametersAndPage = new HashMap<>(parameters);
- parametersAndPage.put("_page", Collections.singletonList(String.valueOf(page)));
+ parametersAndPage.put("_page", List.of(String.valueOf(page)));
if (!parameters.containsKey("_sort"))
- parametersAndPage.put("_sort", Collections.singletonList("_id"));
+ parametersAndPage.put("_sort", List.of("_id"));
return clientProvider.getLocalWebserviceClient().searchWithStrictHandling(searchType, parametersAndPage);
}
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/EndpointProviderImpl.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/EndpointProviderImpl.java
index 02e9119ca..70d856713 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/EndpointProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/EndpointProviderImpl.java
@@ -1,6 +1,5 @@
package dev.dsf.bpe.v1.service;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -30,8 +29,7 @@ public EndpointProviderImpl(FhirWebserviceClientProvider clientProvider, String
public Optional getLocalEndpoint()
{
Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Endpoint.class,
- Map.of("status", Collections.singletonList("active"), "address",
- Collections.singletonList(localEndpointAddress)));
+ Map.of("status", List.of("active"), "address", List.of(localEndpointAddress)));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getEntry().size() != 1
|| resultBundle.getEntryFirstRep().getResource() == null
@@ -61,8 +59,8 @@ public Optional getEndpoint(Identifier endpointIdentifier)
String endpointIdSp = toSearchParameter(endpointIdentifier);
- Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Endpoint.class, Map.of(
- "status", Collections.singletonList("active"), "identifier", Collections.singletonList(endpointIdSp)));
+ Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Endpoint.class,
+ Map.of("status", List.of("active"), "identifier", List.of(endpointIdSp)));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getTotal() != 1
|| resultBundle.getEntryFirstRep().getResource() == null
@@ -81,17 +79,17 @@ public Optional getEndpoint(Identifier parentOrganizationIdentifier,
{
if (parentOrganizationIdentifier == null)
{
- logger.debug("Parent organiztion identifier is null");
+ logger.debug("Parent organization identifier is null");
return Optional.empty();
}
else if (memberOrganizationIdentifier == null)
{
- logger.debug("Member organiztion identifier is null");
+ logger.debug("Member organization identifier is null");
return Optional.empty();
}
else if (memberOrganizationRole == null)
{
- logger.debug("Member organiztion role is null");
+ logger.debug("Member organization role is null");
return Optional.empty();
}
@@ -101,11 +99,9 @@ else if (memberOrganizationRole == null)
Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(
OrganizationAffiliation.class,
- Map.of("active", Collections.singletonList("true"), "primary-organization:identifier",
- Collections.singletonList(parentOrganizationIdSp), "participating-organization:identifier",
- Collections.singletonList(memberOrganizationIdSp), "role",
- Collections.singletonList(memberOrganizationRoleSp), "_include",
- Collections.singletonList("OrganizationAffiliation:endpoint")));
+ Map.of("active", List.of("true"), "primary-organization:identifier", List.of(parentOrganizationIdSp),
+ "participating-organization:identifier", List.of(memberOrganizationIdSp), "role",
+ List.of(memberOrganizationRoleSp), "_include", List.of("OrganizationAffiliation:endpoint")));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getTotal() != 1
|| resultBundle.getEntryFirstRep().getResource() == null
@@ -141,22 +137,21 @@ public List getEndpoints(Identifier parentOrganizationIdentifier, Codi
{
if (parentOrganizationIdentifier == null)
{
- logger.debug("Parent organiztion identifier is null");
- return Collections.emptyList();
+ logger.debug("Parent organization identifier is null");
+ return List.of();
}
else if (memberOrganizationRole == null)
{
- logger.debug("Member organiztion role is null");
- return Collections.emptyList();
+ logger.debug("Member organization role is null");
+ return List.of();
}
String parentOrganizationIdSp = toSearchParameter(parentOrganizationIdentifier);
String memberOrganizationRoleSp = toSearchParameter(memberOrganizationRole);
- Map> parameters = Map.of("active", Collections.singletonList("true"),
- "primary-organization:identifier", Collections.singletonList(parentOrganizationIdSp), "role",
- Collections.singletonList(memberOrganizationRoleSp), "_include",
- Collections.singletonList("OrganizationAffiliation:endpoint"));
+ Map> parameters = Map.of("active", List.of("true"), "primary-organization:identifier",
+ List.of(parentOrganizationIdSp), "role", List.of(memberOrganizationRoleSp), "_include",
+ List.of("OrganizationAffiliation:endpoint"));
return search(OrganizationAffiliation.class, parameters, SearchEntryMode.INCLUDE, Endpoint.class,
e -> EndpointStatus.ACTIVE.equals(e.getStatus()));
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/OrganizationProviderImpl.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/OrganizationProviderImpl.java
index 32174025b..d7a7b892c 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/OrganizationProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/service/OrganizationProviderImpl.java
@@ -1,6 +1,5 @@
package dev.dsf.bpe.v1.service;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -30,9 +29,8 @@ public OrganizationProviderImpl(FhirWebserviceClientProvider clientProvider, Str
public Optional getLocalOrganization()
{
Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Endpoint.class,
- Map.of("status", Collections.singletonList("active"), "address",
- Collections.singletonList(localEndpointAddress), "_include",
- Collections.singletonList("Endpoint:organization")));
+ Map.of("status", List.of("active"), "address", List.of(localEndpointAddress), "_include",
+ List.of("Endpoint:organization")));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getEntry().size() != 2
|| resultBundle.getEntry().get(0).getResource() == null
@@ -40,12 +38,12 @@ public Optional getLocalOrganization()
|| resultBundle.getEntry().get(1).getResource() == null
|| !(resultBundle.getEntry().get(1).getResource() instanceof Organization))
{
- logger.warn("No active (or more than one) Endpoint found for address '{}'", localEndpointAddress);
+ logger.warn("No active (or more than one) endpoint found for address '{}'", localEndpointAddress);
return Optional.empty();
}
else if (getActiveOrganizationFromIncludes(resultBundle).count() != 1)
{
- logger.warn("No active (or more than one) Organization found by active Endpoint with address '{}'",
+ logger.warn("No active (or more than one) organization found by active endpoint with address '{}'",
localEndpointAddress);
return Optional.empty();
}
@@ -73,14 +71,13 @@ public Optional getOrganization(Identifier organizationIdentifier)
String organizationIdSp = toSearchParameter(organizationIdentifier);
Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Organization.class,
- Map.of("active", Collections.singletonList("true"), "identifier",
- Collections.singletonList(organizationIdSp)));
+ Map.of("active", List.of("true"), "identifier", List.of(organizationIdSp)));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getTotal() != 1
|| resultBundle.getEntryFirstRep().getResource() == null
|| !(resultBundle.getEntryFirstRep().getResource() instanceof Organization))
{
- logger.warn("No active (or more than one) Organization found for identifier '{}'", organizationIdSp);
+ logger.warn("No active (or more than one) organization found for identifier '{}'", organizationIdSp);
return Optional.empty();
}
@@ -92,15 +89,15 @@ public List getOrganizations(Identifier parentOrganizationIdentifi
{
if (parentOrganizationIdentifier == null)
{
- logger.debug("Parent organiztion identifier is null");
- return Collections.emptyList();
+ logger.debug("Parent organization identifier is null");
+ return List.of();
}
String parentOrganizationIdSp = toSearchParameter(parentOrganizationIdentifier);
- Map> parameters = Map.of("active", Collections.singletonList("true"),
- "primary-organization:identifier", Collections.singletonList(parentOrganizationIdSp), "_include",
- Collections.singletonList("OrganizationAffiliation:participating-organization"));
+ Map> parameters = Map.of("active", List.of("true"), "primary-organization:identifier",
+ List.of(parentOrganizationIdSp), "_include",
+ List.of("OrganizationAffiliation:participating-organization"));
return search(OrganizationAffiliation.class, parameters, SearchEntryMode.INCLUDE, Organization.class,
Organization::getActive);
@@ -111,22 +108,21 @@ public List getOrganizations(Identifier parentOrganizationIdentifi
{
if (parentOrganizationIdentifier == null)
{
- logger.debug("Parent organiztion identifier is null");
- return Collections.emptyList();
+ logger.debug("Parent organization identifier is null");
+ return List.of();
}
else if (memberOrganizationRole == null)
{
- logger.debug("Member organiztion role is null");
- return Collections.emptyList();
+ logger.debug("Member organization role is null");
+ return List.of();
}
String parentOrganizationIdSp = toSearchParameter(parentOrganizationIdentifier);
String memberOrganizationRoleSp = toSearchParameter(memberOrganizationRole);
- Map> parameters = Map.of("active", Collections.singletonList("true"),
- "primary-organization:identifier", Collections.singletonList(parentOrganizationIdSp), "role",
- Collections.singletonList(memberOrganizationRoleSp), "_include",
- Collections.singletonList("OrganizationAffiliation:participating-organization"));
+ Map> parameters = Map.of("active", List.of("true"), "primary-organization:identifier",
+ List.of(parentOrganizationIdSp), "role", List.of(memberOrganizationRoleSp), "_include",
+ List.of("OrganizationAffiliation:participating-organization"));
return search(OrganizationAffiliation.class, parameters, SearchEntryMode.INCLUDE, Organization.class,
Organization::getActive);
@@ -139,12 +135,12 @@ public List getRemoteOrganizations()
if (localOrganizationIdentifier.isEmpty())
{
- logger.debug("Local organiztion identifier unknown");
- return Collections.emptyList();
+ logger.debug("Local organization identifier unknown");
+ return List.of();
}
- Map> searchParameters = Map.of("active", Collections.singletonList("true"),
- "identifier:not", Collections.singletonList(toSearchParameter(localOrganizationIdentifier.get())));
+ Map> searchParameters = Map.of("active", List.of("true"), "identifier:not",
+ List.of(toSearchParameter(localOrganizationIdentifier.get())));
return search(Organization.class, searchParameters, SearchEntryMode.MATCH, Organization.class, o -> true);
}
}
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/spring/ApiServiceConfig.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/spring/ApiServiceConfig.java
index 8873ece3b..18e83a0a2 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/spring/ApiServiceConfig.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/spring/ApiServiceConfig.java
@@ -126,6 +126,7 @@ public ReferenceExtractor referenceExtractor()
public FhirContext fhirContext()
{
// workaround for https://github.com/hapifhir/hapi-fhir/issues/5205
+ // Do not remove as HAPI dependency of v1 will not be upgraded to a fixed version
StreamReadConstraints.overrideDefaultStreamReadConstraints(
StreamReadConstraints.builder().maxStringLength(Integer.MAX_VALUE).build());
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourcesList.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourcesList.java
index a4c93d881..e26d9b132 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourcesList.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/FhirResourcesList.java
@@ -1,7 +1,6 @@
package dev.dsf.bpe.v1.variables;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -26,7 +25,7 @@ public FhirResourcesList(@JsonProperty("resources") Collection extends Resourc
public FhirResourcesList(Resource... resources)
{
- this(Arrays.asList(resources));
+ this(List.of(resources));
}
@JsonProperty("resources")
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/VariablesImpl.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/VariablesImpl.java
index 79303ef0d..4b7589c48 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/VariablesImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/bpe/v1/variables/VariablesImpl.java
@@ -111,7 +111,7 @@ public Target getTarget()
public Targets createTargets(List extends Target> targets)
{
if (targets == null)
- return new TargetsImpl(Collections.emptyList());
+ return new TargetsImpl(List.of());
Optional extends Target> firstNonMatch = targets.stream().filter(t -> !(t instanceof TargetImpl)).findFirst();
if (firstNonMatch.isPresent())
@@ -219,7 +219,7 @@ public List getCurrentTasks()
Stream start = execution.getParentId() == null ? Stream.of(getStartTask()) : Stream.empty();
Stream current = getResourceListOrDefault(TASKS_PREFIX + execution.getParentActivityInstanceId(),
- Collections. emptyList()).stream();
+ List. of()).stream();
return Collections.unmodifiableList(Stream.concat(start, current).toList());
}
@@ -237,7 +237,7 @@ public void updateTask(Task task)
else
{
String instanceId = execution.getParentActivityInstanceId();
- List tasks = getResourceListOrDefault(TASKS_PREFIX + instanceId, Collections.emptyList());
+ List tasks = getResourceListOrDefault(TASKS_PREFIX + instanceId, List.of());
if (tasks.stream().anyMatch(t -> t.getIdElement().getIdPart().equals(task.getIdElement().getIdPart())))
setResourceList(TASKS_PREFIX + instanceId, tasks);
@@ -292,8 +292,7 @@ public void onContinue(Task task)
{
String instanceId = execution.getParentActivityInstanceId();
- List tasks = new ArrayList<>(
- getResourceListOrDefault(TASKS_PREFIX + instanceId, Collections.emptyList()));
+ List tasks = new ArrayList<>(getResourceListOrDefault(TASKS_PREFIX + instanceId, List.of()));
tasks.add(task);
setResourceList(TASKS_PREFIX + instanceId, tasks);
@@ -308,8 +307,7 @@ public void onEnd()
logger.trace("onEnd");
String instanceId = execution.getParentActivityInstanceId();
- List tasks = new ArrayList<>(
- getResourceListOrDefault(TASKS_PREFIX + instanceId, Collections.emptyList()));
+ List tasks = new ArrayList<>(getResourceListOrDefault(TASKS_PREFIX + instanceId, List.of()));
tasks.removeAll(getCurrentTasks());
setResourceList(TASKS_PREFIX + instanceId, tasks);
}
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/authorization/read/ReadAccessHelperImpl.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/authorization/read/ReadAccessHelperImpl.java
index 5996978a5..8d758f312 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/authorization/read/ReadAccessHelperImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/authorization/read/ReadAccessHelperImpl.java
@@ -1,6 +1,5 @@
package dev.dsf.fhir.authorization.read;
-import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -19,7 +18,7 @@
public class ReadAccessHelperImpl implements ReadAccessHelper
{
- private static final List READ_ACCESS_TAG_VALUES = Arrays.asList(READ_ACCESS_TAG_VALUE_LOCAL,
+ private static final List READ_ACCESS_TAG_VALUES = List.of(READ_ACCESS_TAG_VALUE_LOCAL,
READ_ACCESS_TAG_VALUE_ORGANIZATION, READ_ACCESS_TAG_VALUE_ROLE, READ_ACCESS_TAG_VALUE_ALL);
private Predicate matchesTagValue(String value)
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java
index 8a1257ad8..b94236618 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/main/java/dev/dsf/fhir/client/FhirWebserviceClientJersey.java
@@ -3,7 +3,6 @@
import java.io.InputStream;
import java.security.KeyStore;
import java.text.SimpleDateFormat;
-import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;
@@ -80,8 +79,8 @@ public FhirWebserviceClientJersey(String baseUrl, KeyStore trustStore, KeyStore
ReferenceCleaner referenceCleaner)
{
super(baseUrl, trustStore, keyStore, keyStorePassword, objectMapper,
- Collections.singleton(new FhirAdapter(fhirContext, referenceCleaner)), proxySchemeHostPort,
- proxyUserName, proxyPassword, connectTimeout, readTimeout, logRequests, userAgentValue);
+ List.of(new FhirAdapter(fhirContext, referenceCleaner)), proxySchemeHostPort, proxyUserName,
+ proxyPassword, connectTimeout, readTimeout, logRequests, userAgentValue);
preferReturnMinimal = new PreferReturnMinimalWithRetryImpl(this);
preferReturnOutcome = new PreferReturnOutcomeWithRetryImpl(this);
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/test/java/dev/dsf/bpe/v1/plugin/ProcessPluginImplTest.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/test/java/dev/dsf/bpe/v1/plugin/ProcessPluginImplTest.java
index 0d10752de..f9131f4ec 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/test/java/dev/dsf/bpe/v1/plugin/ProcessPluginImplTest.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/test/java/dev/dsf/bpe/v1/plugin/ProcessPluginImplTest.java
@@ -10,7 +10,6 @@
import java.nio.file.Paths;
import java.time.LocalDate;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -207,8 +206,7 @@ public void testInitializeAndValidateResourcesAllNull() throws Exception
@Test
public void testInitializeAndValidateResourcesEmptySpringConfigBpmnAndFhirResources() throws Exception
{
- var definition = createPluginDefinition("1.0.0.0", LocalDate.now(), Collections.emptyList(),
- Collections.emptyList(), Collections.emptyMap());
+ var definition = createPluginDefinition("1.0.0.0", LocalDate.now(), List.of(), List.of(), Map.of());
AbstractProcessPlugin plugin = createPlugin(definition, false);
assertFalse(plugin.initializeAndValidateResources(null));
diff --git a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/test/java/dev/dsf/bpe/v1/variables/TargetsJsonSerializationTest.java b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/test/java/dev/dsf/bpe/v1/variables/TargetsJsonSerializationTest.java
index cdf251b1f..746594233 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1-impl/src/test/java/dev/dsf/bpe/v1/variables/TargetsJsonSerializationTest.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1-impl/src/test/java/dev/dsf/bpe/v1/variables/TargetsJsonSerializationTest.java
@@ -5,7 +5,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import java.util.Collections;
+import java.util.List;
import java.util.UUID;
import org.junit.Test;
@@ -25,7 +25,7 @@ public void testEmptyTargetsSerialization() throws Exception
{
ObjectMapper mapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4());
- Targets targets = new TargetsImpl(Collections.emptyList());
+ Targets targets = new TargetsImpl(List.of());
String targetsAsString = mapper.writeValueAsString(targets);
assertNotNull(targetsAsString);
@@ -44,7 +44,7 @@ public void testTargetsWithBiDirectionalTargetSerialization() throws Exception
TargetImpl target = new TargetImpl("target.org", "endpoint.target.org", "https://endpoint.target.org/fhir",
UUID.randomUUID().toString());
- Targets targets = new TargetsImpl(Collections.singletonList(target));
+ Targets targets = new TargetsImpl(List.of(target));
String targetsAsString = mapper.writeValueAsString(targets);
assertNotNull(targetsAsString);
@@ -67,7 +67,7 @@ public void testTargetsWithUniDirectionalTargetSerialization() throws Exception
TargetImpl target = new TargetImpl("target.org", "endpoint.target.org", "https://endpoint.target.org/fhir",
null);
- Targets targets = new TargetsImpl(Collections.singletonList(target));
+ Targets targets = new TargetsImpl(List.of(target));
String targetsAsString = mapper.writeValueAsString(targets);
assertNotNull(targetsAsString);
diff --git a/dsf-bpe/dsf-bpe-process-api-v1/pom.xml b/dsf-bpe/dsf-bpe-process-api-v1/pom.xml
index ffd49153a..0ff93958d 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1/pom.xml
+++ b/dsf-bpe/dsf-bpe-process-api-v1/pom.xml
@@ -8,7 +8,7 @@
dsf-bpe-pom
2.0.0-SNAPSHOT
-
+
ca.uhn.hapi.fhir
@@ -33,7 +33,7 @@
jakarta.ws.rs-api
- jakarta.ws.rs
+ jakarta.ws.rs
@@ -47,5 +47,17 @@
crypto-utils
true
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-validation
+ ${hapi.fhir.version.v1}
+ true
+
+
+ commons-logging
+ commons-logging
+
+
+
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/activity/DefaultUserTaskListener.java b/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/activity/DefaultUserTaskListener.java
index b17fe985b..244977ed7 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/activity/DefaultUserTaskListener.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/activity/DefaultUserTaskListener.java
@@ -130,7 +130,6 @@ private Questionnaire readQuestionnaire(String urlWithVersion)
return questionnaires.get(0);
}
-
private QuestionnaireResponse createDefaultQuestionnaireResponse(String questionnaireUrlWithVersion,
String businessKey, String userTaskId)
{
diff --git a/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/service/EndpointProvider.java b/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/service/EndpointProvider.java
index 2a2995ffb..2a7658c08 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/service/EndpointProvider.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/service/EndpointProvider.java
@@ -6,6 +6,7 @@
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Endpoint;
import org.hl7.fhir.r4.model.Identifier;
+import org.hl7.fhir.r4.model.OrganizationAffiliation;
import dev.dsf.bpe.v1.constants.NamingSystems.EndpointIdentifier;
import dev.dsf.bpe.v1.constants.NamingSystems.OrganizationIdentifier;
@@ -52,15 +53,15 @@ default Optional getLocalEndpointIdentifierValue()
/**
* @param endpointIdentifier
* may be null
- * @return {@link Endpoint} resource from the local DSF FHIR server with the given endpointIdentifier, empty
- * {@link Optional} if no such resource exists or the given identifier is null
+ * @return Active {@link Endpoint} resource from the local DSF FHIR server with the given endpointIdentifier,
+ * empty {@link Optional} if no such resource exists or the given identifier is null
*/
Optional getEndpoint(Identifier endpointIdentifier);
/**
* @param endpointIdentifierValue
* may be null
- * @return {@link Endpoint} resource from the local DSF FHIR server with the given DSF
+ * @return Active {@link Endpoint} resource from the local DSF FHIR server with the given DSF
* endpointIdentifierValue, empty {@link Optional} if no such resource exists or the given identifier
* value is null
* @see EndpointIdentifier
@@ -74,7 +75,7 @@ default Optional getEndpoint(String endpointIdentifierValue)
/**
* @param endpointIdentifier
* may be null
- * @return Address (base URL) of the {@link Endpoint} resource from the local DSF FHIR server with the given
+ * @return Address (base URL) of the active {@link Endpoint} resource from the local DSF FHIR server with the given
* endpointIdentifier, empty {@link Optional} if no such resource exists or the given identifier is
* null
*/
@@ -86,9 +87,9 @@ default Optional getEndpointAddress(Identifier endpointIdentifier)
/**
* @param endpointIdentifierValue
* may be null
- * @return Address (base URL) of the {@link Endpoint} resource from the local DSF FHIR server with the given DSF
- * endpointIdentifierValue, empty {@link Optional} if no such resource exists or the given identifier
- * value is null
+ * @return Address (base URL) of the active {@link Endpoint} resource from the local DSF FHIR server with the given
+ * DSF endpointIdentifierValue, empty {@link Optional} if no such resource exists or the given
+ * identifier value is null
*/
default Optional getEndpointAddress(String endpointIdentifierValue)
{
@@ -103,10 +104,11 @@ default Optional getEndpointAddress(String endpointIdentifierValue)
* may be null
* @param memberOrganizationRole
* may be null
- * @return {@link Endpoint} resource from the local DSF FHIR server associated with the given
+ * @return Active {@link Endpoint} resource from the local DSF FHIR server associated with the given
* memberOrganizationIdentifier and memberOrganizationRole in a parent organization with the
* given parentOrganizationIdentifier, empty {@link Optional} if no such resource exists or one of
- * the parameters is null
+ * the parameters is null; only considers Endpoints from active {@link OrganizationAffiliation}
+ * resources
*/
Optional getEndpoint(Identifier parentOrganizationIdentifier, Identifier memberOrganizationIdentifier,
Coding memberOrganizationRole);
@@ -118,10 +120,11 @@ Optional getEndpoint(Identifier parentOrganizationIdentifier, Identifi
* may be null
* @param memberOrganizationRole
* may be null
- * @return {@link Endpoint} resource from the local DSF FHIR server associated with the given DSF
+ * @return Active {@link Endpoint} resource from the local DSF FHIR server associated with the given DSF
* memberOrganizationIdentifierValue and memberOrganizationRole in a parent organization with
* the given DSF parentOrganizationIdentifierValue, empty {@link Optional} if no such resource exists
- * or one of the parameters is null
+ * or one of the parameters is null; only considers Endpoints from active
+ * {@link OrganizationAffiliation} resources
* @see OrganizationIdentifier
*/
default Optional getEndpoint(String parentOrganizationIdentifierValue,
@@ -142,10 +145,11 @@ default Optional getEndpoint(String parentOrganizationIdentifierValue,
* may be null
* @param memberOrganizationRole
* may be null
- * @return Address (base URL) of the {@link Endpoint} resource from the local DSF FHIR server associated with the
- * given memberOrganizationIdentifier and memberOrganizationRole in a parent organization with
- * the given parentOrganizationIdentifier, empty {@link Optional} if no such resource exists or one
- * of the parameters is null
+ * @return Address (base URL) of the active {@link Endpoint} resource from the local DSF FHIR server associated with
+ * the given memberOrganizationIdentifier and memberOrganizationRole in a parent organization
+ * with the given parentOrganizationIdentifier, empty {@link Optional} if no such resource exists or
+ * one of the parameters is null; only considers Endpoints from active
+ * {@link OrganizationAffiliation} resources
*/
default Optional getEndpointAddress(Identifier parentOrganizationIdentifier,
Identifier memberOrganizationIdentifier, Coding memberOrganizationRole)
@@ -161,10 +165,11 @@ default Optional getEndpointAddress(Identifier parentOrganizationIdentif
* may be null
* @param memberOrganizationRole
* may be null
- * @return Address (base URL) of the {@link Endpoint} resource from the local DSF FHIR server associated with the
- * given DSF memberOrganizationIdentifierValue and memberOrganizationRole in a parent
+ * @return Address (base URL) of the active {@link Endpoint} resource from the local DSF FHIR server associated with
+ * the given DSF memberOrganizationIdentifierValue and memberOrganizationRole in a parent
* organization with the given DSF parentOrganizationIdentifierValue, empty {@link Optional} if no
- * such resource exists or one of the parameters is null
+ * such resource exists or one of the parameters is null; only considers Endpoints from active
+ * {@link OrganizationAffiliation} resources
* @see OrganizationIdentifier
*/
default Optional getEndpointAddress(String parentOrganizationIdentifierValue,
@@ -183,10 +188,10 @@ default Optional getEndpointAddress(String parentOrganizationIdentifierV
* may be null
* @param memberOrganizationRole
* may be null
- * @return {@link Endpoint} resources from the local DSF FHIR server associated with the given
+ * @return Active {@link Endpoint} resources from the local DSF FHIR server associated with the given
* memberOrganizationRole in a parent organization with the given
* parentOrganizationIdentifier, empty {@link List} if no resources exist or one of the parameters is
- * null
+ * null; only considers Endpoints from active {@link OrganizationAffiliation} resources
*/
List getEndpoints(Identifier parentOrganizationIdentifier, Coding memberOrganizationRole);
@@ -195,10 +200,11 @@ default Optional getEndpointAddress(String parentOrganizationIdentifierV
* may be null
* @param memberOrganizationRole
* may be null
- * @return {@link Endpoint} resources from the local DSF FHIR server associated with the given
+ * @return Active {@link Endpoint} resources from the local DSF FHIR server associated with the given
* memberOrganizationRole in a parent organization with the given DSF
* parentOrganizationIdentifierValue, empty {@link List} if no resources exist or one of the
- * parameters is null
+ * parameters is null; only considers Endpoints from active {@link OrganizationAffiliation}
+ * resources
* @see OrganizationIdentifier
*/
default List getEndpoints(String parentOrganizationIdentifierValue, Coding memberOrganizationRole)
diff --git a/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/service/OrganizationProvider.java b/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/service/OrganizationProvider.java
index b6a13643b..4f41ba12b 100644
--- a/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/service/OrganizationProvider.java
+++ b/dsf-bpe/dsf-bpe-process-api-v1/src/main/java/dev/dsf/bpe/v1/service/OrganizationProvider.java
@@ -52,16 +52,16 @@ default Optional getLocalOrganizationIdentifierValue()
/**
* @param organizationIdentifier
* may be null
- * @return {@link Organization} with the given organizationIdentifier, empty {@link Optional} if no such
- * resource exists or the given identifier is null
+ * @return Active {@link Organization} with the given organizationIdentifier, empty {@link Optional} if no
+ * such resource exists or the given identifier is null
*/
Optional getOrganization(Identifier organizationIdentifier);
/**
* @param organizationIdentifierValue
* may be null
- * @return {@link Organization} with the given DSF organizationIdentifier, empty {@link Optional} if no such
- * resource exists or the given identifier value is null
+ * @return Active {@link Organization} with the given DSF organizationIdentifier, empty {@link Optional} if
+ * no such resource exists or the given identifier value is null
* @see OrganizationIdentifier
*/
default Optional getOrganization(String organizationIdentifierValue)
@@ -73,20 +73,20 @@ default Optional getOrganization(String organizationIdentifierValu
/**
* @param parentOrganizationIdentifier
* may be null
- * @return Organizations configured as participatingOrganization for a parent {@link Organization} with the given
- * parentOrganizationIdentifier, empty {@link List} if no parent organization found, parent has no
- * participating organizations configured via {@link OrganizationAffiliation} resources or the given
- * identifier is null
+ * @return Active Organizations configured as participatingOrganization for an active parent {@link Organization}
+ * with the given parentOrganizationIdentifier, empty {@link List} if no parent organization found,
+ * parent has no participating organizations configured via {@link OrganizationAffiliation} resources or the
+ * given identifier is null
*/
List getOrganizations(Identifier parentOrganizationIdentifier);
/**
* @param parentOrganizationIdentifierValue
* may be null
- * @return Organizations configured as participatingOrganization for a parent {@link Organization} with the given
- * DSF parentOrganizationIdentifierValue, empty {@link List} if no parent organization found, parent
- * has no participating organizations configured via {@link OrganizationAffiliation} resources or the given
- * identifier is null
+ * @return Active Organizations configured as participatingOrganization for an active parent {@link Organization}
+ * with the given DSF parentOrganizationIdentifierValue, empty {@link List} if no parent organization
+ * found, parent has no participating organizations configured via {@link OrganizationAffiliation} resources
+ * or the given identifier is null
* @see OrganizationIdentifier
*/
default List getOrganizations(String parentOrganizationIdentifierValue)
@@ -100,11 +100,11 @@ default List getOrganizations(String parentOrganizationIdentifierV
* may be null
* @param memberOrganizationRole
* may be null
- * @return Organizations configured as participatingOrganization for a parent {@link Organization} with the given
- * parentOrganizationIdentifier and role equal to the given memberOrganizationRole, empty
- * {@link List} if no parent organization found, parent has no participating organizations configured via
- * {@link OrganizationAffiliation} resources with the given role or the given identifier is
- * null
+ * @return Active Organizations configured as participatingOrganization for an active parent {@link Organization}
+ * with the given parentOrganizationIdentifier and role equal to the given
+ * memberOrganizationRole, empty {@link List} if no parent organization found, parent has no
+ * participating organizations configured via {@link OrganizationAffiliation} resources with the given role
+ * or the given identifier is null
*/
List getOrganizations(Identifier parentOrganizationIdentifier, Coding memberOrganizationRole);
@@ -113,11 +113,11 @@ default List getOrganizations(String parentOrganizationIdentifierV
* may be null
* @param memberOrganizationRole
* may be null
- * @return Organizations configured as participatingOrganization for a parent {@link Organization} with the given
- * parentOrganizationIdentifier and role equal to the given memberOrganizationRole, empty
- * {@link List} if no parent organization found, parent has no participating organizations configured via
- * {@link OrganizationAffiliation} resources with the given role or the given identifier is
- * null
+ * @return Active Organizations configured as participatingOrganization for an active parent {@link Organization}
+ * with the given parentOrganizationIdentifier and role equal to the given
+ * memberOrganizationRole, empty {@link List} if no parent organization found, parent has no
+ * participating organizations configured via {@link OrganizationAffiliation} resources with the given role
+ * or the given identifier is null
* @see OrganizationIdentifier
*/
default List getOrganizations(String parentOrganizationIdentifierValue, Coding memberOrganizationRole)
@@ -127,7 +127,7 @@ default List getOrganizations(String parentOrganizationIdentifierV
}
/**
- * @return All {@link Organization} resources except the local {@link Organization}
+ * @return All active {@link Organization} resources except the local {@link Organization}
* @see #getLocalOrganization()
*/
List getRemoteOrganizations();
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/pom.xml b/dsf-bpe/dsf-bpe-process-api-v2-impl/pom.xml
index 9018032a9..e87edf5ea 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/pom.xml
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/pom.xml
@@ -8,7 +8,7 @@
dsf-bpe-pom
2.0.0-SNAPSHOT
-
+
dev.dsf
@@ -27,10 +27,6 @@
org.glassfish.jersey.inject
jersey-hk2
-
- org.glassfish.jersey.media
- jersey-media-jaxb
-
org.glassfish.jersey.media
jersey-media-json-jackson
@@ -48,10 +44,10 @@
ca.uhn.hapi.fhir
- hapi-fhir-structures-r4
+ hapi-fhir-validation-resources-r4
${hapi.fhir.version.v2}
-
+
org.apache.logging.log4j
log4j-slf4j2-impl
@@ -63,4 +59,197 @@
test
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-api-v2-dependencies-to-docker
+ pre-integration-test
+
+ copy
+
+
+ ../dsf-bpe-server-jetty/docker/api/v2
+
+
+ dev.dsf
+ dsf-bpe-process-api-v2
+
+
+ dev.dsf
+ dsf-bpe-process-api-v2-impl
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-structures-r4
+ ${hapi.fhir.version.v2}
+
+
+ ca.uhn.hapi.fhir
+ org.hl7.fhir.utilities
+ ${hapi.fhir.org.hl7.version.v2}
+
+
+ com.ibm.icu
+ icu4j
+ 72.1
+
+
+ ca.uhn.hapi.fhir
+ org.hl7.fhir.r4
+ ${hapi.fhir.org.hl7.version.v2}
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-caching-api
+ ${hapi.fhir.version.v2}
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-validation
+ ${hapi.fhir.version.v2}
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-converter
+ ${hapi.fhir.version.v2}
+
+
+ ca.uhn.hapi.fhir
+ org.hl7.fhir.convertors
+ ${hapi.fhir.org.hl7.version.v2}
+
+
+ org.xerial
+ sqlite-jdbc
+ 3.45.1.0
+
+
+ ca.uhn.hapi.fhir
+ org.hl7.fhir.validation
+ ${hapi.fhir.org.hl7.version.v2}
+
+
+ ca.uhn.hapi.fhir
+ org.hl7.fhir.r5
+ ${hapi.fhir.org.hl7.version.v2}
+
+
+ com.nimbusds
+ nimbus-jose-jwt
+ 9.37.3
+
+
+ com.github.stephenc.jcip
+ jcip-annotations
+ 1.0-1
+
+
+ net.sourceforge.plantuml
+ plantuml-mit
+ 1.2023.9
+
+
+ net.sf.saxon
+ Saxon-HE
+ 9.8.0-15
+
+
+
+ jakarta-regexp
+ jakarta-regexp
+ 1.4
+
+
+ org.apache.commons
+ commons-compress
+
+
+ org.fhir
+ ucum
+ 1.0.8
+
+
+ com.google.code.gson
+ gson
+
+
+ com.google.errorprone
+ error_prone_annotations
+ 2.27.0
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-structures-r5
+ ${hapi.fhir.version.v2}
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-client
+ ${hapi.fhir.version.v2}
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-validation-resources-r4
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-base
+ ${hapi.fhir.version.v2}
+
+
+ org.checkerframework
+ checker-qual
+ 3.43.0
+
+
+ com.google.j2objc
+ j2objc-annotations
+ 3.0.0
+
+
+ io.opentelemetry
+ opentelemetry-api
+ 1.38.0
+
+
+ io.opentelemetry
+ opentelemetry-context
+ 1.38.0
+
+
+ io.opentelemetry.instrumentation
+ opentelemetry-instrumentation-annotations
+ 2.4.0
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+
+
+
+ ../dsf-bpe-server-jetty/docker/api
+
+ v2/*.jar
+
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/FhirWebserviceClientJersey.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/FhirWebserviceClientJersey.java
index 99f28560d..a911fa8ad 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/FhirWebserviceClientJersey.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/client/FhirWebserviceClientJersey.java
@@ -3,7 +3,6 @@
import java.io.InputStream;
import java.security.KeyStore;
import java.text.SimpleDateFormat;
-import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;
@@ -76,8 +75,8 @@ public FhirWebserviceClientJersey(String baseUrl, KeyStore trustStore, KeyStore
ReferenceCleaner referenceCleaner)
{
super(baseUrl, trustStore, keyStore, keyStorePassword, objectMapper,
- Collections.singleton(new FhirAdapter(fhirContext, referenceCleaner)), proxySchemeHostPort,
- proxyUserName, proxyPassword, connectTimeout, readTimeout, logRequests, userAgentValue);
+ List.of(new FhirAdapter(fhirContext, referenceCleaner)), proxySchemeHostPort, proxyUserName,
+ proxyPassword, connectTimeout, readTimeout, logRequests, userAgentValue);
preferReturnMinimal = new PreferReturnMinimalWithRetryImpl(this);
preferReturnOutcome = new PreferReturnOutcomeWithRetryImpl(this);
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/ContinueListener.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/ContinueListener.java
index 1e39e6798..3320bf8e9 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/ContinueListener.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/ContinueListener.java
@@ -72,6 +72,5 @@ processUrl, getCurrentTime(), continueTaskUrl, requester, businessKey, correlati
logger.info("Continuing process {} at {} [task: {}, requester: {}, business-key: {}, message: {}]",
processUrl, getCurrentTime(), continueTaskUrl, requester, businessKey, messageName);
}
-
}
}
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/plugin/ProcessPluginImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/plugin/ProcessPluginImpl.java
index e193b232a..919e82ea0 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/plugin/ProcessPluginImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/plugin/ProcessPluginImpl.java
@@ -40,7 +40,7 @@
import dev.dsf.bpe.v2.ProcessPluginApi;
import dev.dsf.bpe.v2.ProcessPluginDefinition;
import dev.dsf.bpe.v2.ProcessPluginDeploymentListener;
-import dev.dsf.bpe.v2.constants.CodeSystems;
+import dev.dsf.bpe.v2.constants.CodeSystems.BpmnMessage;
import dev.dsf.bpe.v2.constants.NamingSystems.OrganizationIdentifier;
import dev.dsf.bpe.v2.constants.NamingSystems.TaskIdentifier;
import dev.dsf.bpe.v2.variables.FhirResourceValues;
@@ -142,21 +142,16 @@ else if (filename.endsWith(XML_SUFFIX))
})
: Optional.empty();
- Predicate hasTaskInputMessageName = t -> t
- .getInput().stream().filter(
- i -> i.getType().getCoding().stream()
- .anyMatch(c -> CodeSystems.BpmnMessage.URL.equals(c.getSystem())
- && CodeSystems.BpmnMessage.Codes.MESSAGE_NAME.equals(c.getCode())))
- .count() == 1;
+ Predicate hasTaskInputMessageName = t -> t.getInput().stream()
+ .filter(i -> i.getType().getCoding().stream().anyMatch(BpmnMessage::isMessageName)).count() == 1;
return new ProcessPluginFhirConfig<>(ActivityDefinition.class, CodeSystem.class, Library.class, Measure.class,
NamingSystem.class, Questionnaire.class, StructureDefinition.class, Task.class, ValueSet.class,
- OrganizationIdentifier.SID, TaskIdentifier.SID, TaskStatus.DRAFT.toCode(), CodeSystems.BpmnMessage.URL,
- CodeSystems.BpmnMessage.Codes.MESSAGE_NAME, parseResource, encodeResource, getResourceName,
- hasMetadataResourceUrl, hasMetadataResourceVersion, getMetadataResourceVersion,
- getActivityDefinitionUrl, NamingSystem::hasName, getTaskInstantiatesCanonical, getTaskIdentifierValue,
- isTaskStatusDraft, getRequester, getRecipient, Task::hasInput, hasTaskInputMessageName,
- Task::hasOutput);
+ OrganizationIdentifier.SID, TaskIdentifier.SID, TaskStatus.DRAFT.toCode(), BpmnMessage.SYSTEM,
+ BpmnMessage.Codes.MESSAGE_NAME, parseResource, encodeResource, getResourceName, hasMetadataResourceUrl,
+ hasMetadataResourceVersion, getMetadataResourceVersion, getActivityDefinitionUrl, NamingSystem::hasName,
+ getTaskInstantiatesCanonical, getTaskIdentifierValue, isTaskStatusDraft, getRequester, getRecipient,
+ Task::hasInput, hasTaskInputMessageName, Task::hasOutput);
}
private IParser newXmlParser()
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/AbstractResourceProvider.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/AbstractResourceProvider.java
index 8817b17f5..2f26cbf0b 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/AbstractResourceProvider.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/AbstractResourceProvider.java
@@ -3,7 +3,6 @@
import static org.hl7.fhir.instance.model.api.IBaseBundle.LINK_NEXT;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -72,9 +71,9 @@ protected final List search(Class extends Resource> se
private Bundle search(Class extends Resource> searchType, Map> parameters, int page)
{
Map> parametersAndPage = new HashMap<>(parameters);
- parametersAndPage.put("_page", Collections.singletonList(String.valueOf(page)));
+ parametersAndPage.put("_page", List.of(String.valueOf(page)));
if (!parameters.containsKey("_sort"))
- parametersAndPage.put("_sort", Collections.singletonList("_id"));
+ parametersAndPage.put("_sort", List.of("_id"));
return clientProvider.getLocalWebserviceClient().searchWithStrictHandling(searchType, parametersAndPage);
}
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/EndpointProviderImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/EndpointProviderImpl.java
index dfcee39c5..8ed9f82ab 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/EndpointProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/EndpointProviderImpl.java
@@ -1,6 +1,5 @@
package dev.dsf.bpe.v2.service;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -30,8 +29,7 @@ public EndpointProviderImpl(FhirWebserviceClientProvider clientProvider, String
public Optional getLocalEndpoint()
{
Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Endpoint.class,
- Map.of("status", Collections.singletonList("active"), "address",
- Collections.singletonList(localEndpointAddress)));
+ Map.of("status", List.of("active"), "address", List.of(localEndpointAddress)));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getEntry().size() != 1
|| resultBundle.getEntryFirstRep().getResource() == null
@@ -61,8 +59,8 @@ public Optional getEndpoint(Identifier endpointIdentifier)
String endpointIdSp = toSearchParameter(endpointIdentifier);
- Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Endpoint.class, Map.of(
- "status", Collections.singletonList("active"), "identifier", Collections.singletonList(endpointIdSp)));
+ Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Endpoint.class,
+ Map.of("status", List.of("active"), "identifier", List.of(endpointIdSp)));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getTotal() != 1
|| resultBundle.getEntryFirstRep().getResource() == null
@@ -81,17 +79,17 @@ public Optional getEndpoint(Identifier parentOrganizationIdentifier,
{
if (parentOrganizationIdentifier == null)
{
- logger.debug("Parent organiztion identifier is null");
+ logger.debug("Parent organization identifier is null");
return Optional.empty();
}
else if (memberOrganizationIdentifier == null)
{
- logger.debug("Member organiztion identifier is null");
+ logger.debug("Member organization identifier is null");
return Optional.empty();
}
else if (memberOrganizationRole == null)
{
- logger.debug("Member organiztion role is null");
+ logger.debug("Member organization role is null");
return Optional.empty();
}
@@ -101,11 +99,9 @@ else if (memberOrganizationRole == null)
Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(
OrganizationAffiliation.class,
- Map.of("active", Collections.singletonList("true"), "primary-organization:identifier",
- Collections.singletonList(parentOrganizationIdSp), "participating-organization:identifier",
- Collections.singletonList(memberOrganizationIdSp), "role",
- Collections.singletonList(memberOrganizationRoleSp), "_include",
- Collections.singletonList("OrganizationAffiliation:endpoint")));
+ Map.of("active", List.of("true"), "primary-organization:identifier", List.of(parentOrganizationIdSp),
+ "participating-organization:identifier", List.of(memberOrganizationIdSp), "role",
+ List.of(memberOrganizationRoleSp), "_include", List.of("OrganizationAffiliation:endpoint")));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getTotal() != 1
|| resultBundle.getEntryFirstRep().getResource() == null
@@ -141,22 +137,21 @@ public List getEndpoints(Identifier parentOrganizationIdentifier, Codi
{
if (parentOrganizationIdentifier == null)
{
- logger.debug("Parent organiztion identifier is null");
- return Collections.emptyList();
+ logger.debug("Parent organization identifier is null");
+ return List.of();
}
else if (memberOrganizationRole == null)
{
- logger.debug("Member organiztion role is null");
- return Collections.emptyList();
+ logger.debug("Member organization role is null");
+ return List.of();
}
String parentOrganizationIdSp = toSearchParameter(parentOrganizationIdentifier);
String memberOrganizationRoleSp = toSearchParameter(memberOrganizationRole);
- Map> parameters = Map.of("active", Collections.singletonList("true"),
- "primary-organization:identifier", Collections.singletonList(parentOrganizationIdSp), "role",
- Collections.singletonList(memberOrganizationRoleSp), "_include",
- Collections.singletonList("OrganizationAffiliation:endpoint"));
+ Map> parameters = Map.of("active", List.of("true"), "primary-organization:identifier",
+ List.of(parentOrganizationIdSp), "role", List.of(memberOrganizationRoleSp), "_include",
+ List.of("OrganizationAffiliation:endpoint"));
return search(OrganizationAffiliation.class, parameters, SearchEntryMode.INCLUDE, Endpoint.class,
e -> EndpointStatus.ACTIVE.equals(e.getStatus()));
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/OrganizationProviderImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/OrganizationProviderImpl.java
index a077b97e5..0c81c1f57 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/OrganizationProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/OrganizationProviderImpl.java
@@ -1,6 +1,5 @@
package dev.dsf.bpe.v2.service;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -30,9 +29,8 @@ public OrganizationProviderImpl(FhirWebserviceClientProvider clientProvider, Str
public Optional getLocalOrganization()
{
Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Endpoint.class,
- Map.of("status", Collections.singletonList("active"), "address",
- Collections.singletonList(localEndpointAddress), "_include",
- Collections.singletonList("Endpoint:organization")));
+ Map.of("status", List.of("active"), "address", List.of(localEndpointAddress), "_include",
+ List.of("Endpoint:organization")));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getEntry().size() != 2
|| resultBundle.getEntry().get(0).getResource() == null
@@ -40,12 +38,12 @@ public Optional getLocalOrganization()
|| resultBundle.getEntry().get(1).getResource() == null
|| !(resultBundle.getEntry().get(1).getResource() instanceof Organization))
{
- logger.warn("No active (or more than one) Endpoint found for address '{}'", localEndpointAddress);
+ logger.warn("No active (or more than one) endpoint found for address '{}'", localEndpointAddress);
return Optional.empty();
}
else if (getActiveOrganizationFromIncludes(resultBundle).count() != 1)
{
- logger.warn("No active (or more than one) Organization found by active Endpoint with address '{}'",
+ logger.warn("No active (or more than one) organization found by active endpoint with address '{}'",
localEndpointAddress);
return Optional.empty();
}
@@ -73,14 +71,13 @@ public Optional getOrganization(Identifier organizationIdentifier)
String organizationIdSp = toSearchParameter(organizationIdentifier);
Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Organization.class,
- Map.of("active", Collections.singletonList("true"), "identifier",
- Collections.singletonList(organizationIdSp)));
+ Map.of("active", List.of("true"), "identifier", List.of(organizationIdSp)));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getTotal() != 1
|| resultBundle.getEntryFirstRep().getResource() == null
|| !(resultBundle.getEntryFirstRep().getResource() instanceof Organization))
{
- logger.warn("No active (or more than one) Organization found for identifier '{}'", organizationIdSp);
+ logger.warn("No active (or more than one) organization found for identifier '{}'", organizationIdSp);
return Optional.empty();
}
@@ -92,15 +89,15 @@ public List getOrganizations(Identifier parentOrganizationIdentifi
{
if (parentOrganizationIdentifier == null)
{
- logger.debug("Parent organiztion identifier is null");
- return Collections.emptyList();
+ logger.debug("Parent organization identifier is null");
+ return List.of();
}
String parentOrganizationIdSp = toSearchParameter(parentOrganizationIdentifier);
- Map> parameters = Map.of("active", Collections.singletonList("true"),
- "primary-organization:identifier", Collections.singletonList(parentOrganizationIdSp), "_include",
- Collections.singletonList("OrganizationAffiliation:participating-organization"));
+ Map> parameters = Map.of("active", List.of("true"), "primary-organization:identifier",
+ List.of(parentOrganizationIdSp), "_include",
+ List.of("OrganizationAffiliation:participating-organization"));
return search(OrganizationAffiliation.class, parameters, SearchEntryMode.INCLUDE, Organization.class,
Organization::getActive);
@@ -111,22 +108,21 @@ public List getOrganizations(Identifier parentOrganizationIdentifi
{
if (parentOrganizationIdentifier == null)
{
- logger.debug("Parent organiztion identifier is null");
- return Collections.emptyList();
+ logger.debug("Parent organization identifier is null");
+ return List.of();
}
else if (memberOrganizationRole == null)
{
- logger.debug("Member organiztion role is null");
- return Collections.emptyList();
+ logger.debug("Member organization role is null");
+ return List.of();
}
String parentOrganizationIdSp = toSearchParameter(parentOrganizationIdentifier);
String memberOrganizationRoleSp = toSearchParameter(memberOrganizationRole);
- Map> parameters = Map.of("active", Collections.singletonList("true"),
- "primary-organization:identifier", Collections.singletonList(parentOrganizationIdSp), "role",
- Collections.singletonList(memberOrganizationRoleSp), "_include",
- Collections.singletonList("OrganizationAffiliation:participating-organization"));
+ Map> parameters = Map.of("active", List.of("true"), "primary-organization:identifier",
+ List.of(parentOrganizationIdSp), "role", List.of(memberOrganizationRoleSp), "_include",
+ List.of("OrganizationAffiliation:participating-organization"));
return search(OrganizationAffiliation.class, parameters, SearchEntryMode.INCLUDE, Organization.class,
Organization::getActive);
@@ -139,12 +135,21 @@ public List getRemoteOrganizations()
if (localOrganizationIdentifier.isEmpty())
{
- logger.debug("Local organiztion identifier unknown");
- return Collections.emptyList();
+ logger.debug("Local organization identifier unknown");
+ return List.of();
}
- Map> searchParameters = Map.of("active", Collections.singletonList("true"),
- "identifier:not", Collections.singletonList(toSearchParameter(localOrganizationIdentifier.get())));
+ Map> searchParameters = Map.of("active", List.of("true"), "identifier:not",
+ List.of(toSearchParameter(localOrganizationIdentifier.get())), "_profile",
+ List.of("http://dsf.dev/fhir/StructureDefinition/organization"));
+ return search(Organization.class, searchParameters, SearchEntryMode.MATCH, Organization.class, o -> true);
+ }
+
+ @Override
+ public List getParentOrganizations()
+ {
+ Map> searchParameters = Map.of("active", List.of("true"), "_profile",
+ List.of("http://dsf.dev/fhir/StructureDefinition/organization-parent"));
return search(Organization.class, searchParameters, SearchEntryMode.MATCH, Organization.class, o -> true);
}
}
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ReadAccessHelperImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ReadAccessHelperImpl.java
index 66a6d315c..e56ffccbf 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ReadAccessHelperImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/ReadAccessHelperImpl.java
@@ -1,6 +1,5 @@
package dev.dsf.bpe.v2.service;
-import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -33,7 +32,7 @@ public class ReadAccessHelperImpl implements ReadAccessHelper
private static final String EXTENSION_READ_ACCESS_PARENT_ORGANIZATION_ROLE_PARENT_ORGANIZATION = "parent-organization";
private static final String EXTENSION_READ_ACCESS_PARENT_ORGANIZATION_ROLE_ORGANIZATION_ROLE = "organization-role";
- private static final List READ_ACCESS_TAG_VALUES = Arrays.asList(READ_ACCESS_TAG_VALUE_LOCAL,
+ private static final List READ_ACCESS_TAG_VALUES = List.of(READ_ACCESS_TAG_VALUE_LOCAL,
READ_ACCESS_TAG_VALUE_ORGANIZATION, READ_ACCESS_TAG_VALUE_ROLE, READ_ACCESS_TAG_VALUE_ALL);
private Predicate matchesTagValue(String value)
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/All.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/All.java
index fb71c7982..f66ac5a74 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/All.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/All.java
@@ -1,6 +1,5 @@
package dev.dsf.bpe.v2.service.process;
-import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@@ -64,7 +63,7 @@ private Set getPractitionerRoles(Identity identity)
if (identity instanceof PractitionerIdentity p)
return p.getPractionerRoles();
else
- return Collections.emptySet();
+ return Set.of();
}
private boolean hasPractitionerRole(Set practitionerRoles)
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/Organization.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/Organization.java
index 77f945885..443ad7a35 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/Organization.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/Organization.java
@@ -1,6 +1,5 @@
package dev.dsf.bpe.v2.service.process;
-import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -85,7 +84,7 @@ private Set getPractitionerRoles(Identity identity)
if (identity instanceof PractitionerIdentity p)
return p.getPractionerRoles();
else
- return Collections.emptySet();
+ return Set.of();
}
private boolean hasPractitionerRole(Set practitionerRoles)
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/Role.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/Role.java
index 35fa19017..169772d80 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/Role.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/service/process/Role.java
@@ -1,6 +1,5 @@
package dev.dsf.bpe.v2.service.process;
-import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -126,7 +125,7 @@ private Set getPractitionerRoles(Identity identity)
if (identity instanceof PractitionerIdentity p)
return p.getPractionerRoles();
else
- return Collections.emptySet();
+ return Set.of();
}
private boolean hasPractitionerRole(Set practitionerRoles)
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourcesList.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourcesList.java
index 0bc87a9c9..f081f9297 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourcesList.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/FhirResourcesList.java
@@ -1,7 +1,6 @@
package dev.dsf.bpe.v2.variables;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -26,7 +25,7 @@ public FhirResourcesList(@JsonProperty("resources") Collection extends Resourc
public FhirResourcesList(Resource... resources)
{
- this(Arrays.asList(resources));
+ this(List.of(resources));
}
@JsonProperty("resources")
diff --git a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/VariablesImpl.java b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/VariablesImpl.java
index 59b4000f4..bac071f84 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/VariablesImpl.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/variables/VariablesImpl.java
@@ -111,7 +111,7 @@ public Target getTarget()
public Targets createTargets(List extends Target> targets)
{
if (targets == null)
- return new TargetsImpl(Collections.emptyList());
+ return new TargetsImpl(List.of());
Optional extends Target> firstNonMatch = targets.stream().filter(t -> !(t instanceof TargetImpl)).findFirst();
if (firstNonMatch.isPresent())
@@ -219,7 +219,7 @@ public List getCurrentTasks()
Stream start = execution.getParentId() == null ? Stream.of(getStartTask()) : Stream.empty();
Stream current = getResourceListOrDefault(TASKS_PREFIX + execution.getParentActivityInstanceId(),
- Collections. emptyList()).stream();
+ List. of()).stream();
return Collections.unmodifiableList(Stream.concat(start, current).toList());
}
@@ -237,7 +237,7 @@ public void updateTask(Task task)
else
{
String instanceId = execution.getParentActivityInstanceId();
- List tasks = getResourceListOrDefault(TASKS_PREFIX + instanceId, Collections.emptyList());
+ List tasks = getResourceListOrDefault(TASKS_PREFIX + instanceId, List.of());
if (tasks.stream().anyMatch(t -> t.getIdElement().getIdPart().equals(task.getIdElement().getIdPart())))
setResourceList(TASKS_PREFIX + instanceId, tasks);
@@ -292,8 +292,7 @@ public void onContinue(Task task)
{
String instanceId = execution.getParentActivityInstanceId();
- List tasks = new ArrayList<>(
- getResourceListOrDefault(TASKS_PREFIX + instanceId, Collections.emptyList()));
+ List tasks = new ArrayList<>(getResourceListOrDefault(TASKS_PREFIX + instanceId, List.of()));
tasks.add(task);
setResourceList(TASKS_PREFIX + instanceId, tasks);
@@ -308,8 +307,7 @@ public void onEnd()
logger.trace("onEnd");
String instanceId = execution.getParentActivityInstanceId();
- List tasks = new ArrayList<>(
- getResourceListOrDefault(TASKS_PREFIX + instanceId, Collections.emptyList()));
+ List tasks = new ArrayList<>(getResourceListOrDefault(TASKS_PREFIX + instanceId, List.of()));
tasks.removeAll(getCurrentTasks());
setResourceList(TASKS_PREFIX + instanceId, tasks);
}
diff --git a/dsf-bpe/dsf-bpe-process-api-v2/pom.xml b/dsf-bpe/dsf-bpe-process-api-v2/pom.xml
index ca81616fa..1ea0db433 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2/pom.xml
+++ b/dsf-bpe/dsf-bpe-process-api-v2/pom.xml
@@ -8,13 +8,29 @@
dsf-bpe-pom
2.0.0-SNAPSHOT
-
+
ca.uhn.hapi.fhir
hapi-fhir-structures-r4
${hapi.fhir.version.v2}
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-validation
+ ${hapi.fhir.version.v2}
+
+
+ commons-logging
+ commons-logging
+
+
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-client
+ ${hapi.fhir.version.v2}
+
org.camunda.bpm
camunda-engine
@@ -33,7 +49,7 @@
jakarta.ws.rs-api
- jakarta.ws.rs
+ jakarta.ws.rs
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/activity/DefaultUserTaskListener.java b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/activity/DefaultUserTaskListener.java
index 4669272f2..0bbd092d9 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/activity/DefaultUserTaskListener.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/activity/DefaultUserTaskListener.java
@@ -1,6 +1,5 @@
package dev.dsf.bpe.v2.activity;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -26,7 +25,6 @@
import org.springframework.context.annotation.Bean;
import dev.dsf.bpe.v2.ProcessPluginApi;
-import dev.dsf.bpe.v2.activity.DefaultUserTaskListener;
import dev.dsf.bpe.v2.constants.CodeSystems.BpmnMessage;
import dev.dsf.bpe.v2.constants.CodeSystems.BpmnUserTask;
import dev.dsf.bpe.v2.variables.Variables;
@@ -116,7 +114,7 @@ public final void notify(DelegateTask userTask)
private Questionnaire readQuestionnaire(String urlWithVersion)
{
Bundle search = api.getFhirWebserviceClientProvider().getLocalWebserviceClient().search(Questionnaire.class,
- Map.of("url", Collections.singletonList(urlWithVersion)));
+ Map.of("url", List.of(urlWithVersion)));
List questionnaires = search.getEntry().stream().filter(Bundle.BundleEntryComponent::hasResource)
.map(Bundle.BundleEntryComponent::getResource).filter(r -> r instanceof Questionnaire)
@@ -132,7 +130,6 @@ private Questionnaire readQuestionnaire(String urlWithVersion)
return questionnaires.get(0);
}
-
private QuestionnaireResponse createDefaultQuestionnaireResponse(String questionnaireUrlWithVersion,
String businessKey, String userTaskId)
{
diff --git a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/constants/CodeSystems.java b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/constants/CodeSystems.java
index 035c50f16..be5c6c5b1 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/constants/CodeSystems.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/constants/CodeSystems.java
@@ -23,7 +23,12 @@ private BpmnMessage()
{
}
- public static final String URL = "http://dsf.dev/fhir/CodeSystem/bpmn-message";
+ public static final String SYSTEM = "http://dsf.dev/fhir/CodeSystem/bpmn-message";
+
+ public static Coding withCode(String code)
+ {
+ return new Coding().setSystem(SYSTEM).setCode(code);
+ }
public static final class Codes
{
@@ -39,22 +44,42 @@ private Codes()
public static final Coding messageName()
{
- return new Coding(URL, Codes.MESSAGE_NAME, null);
+ return new Coding(SYSTEM, Codes.MESSAGE_NAME, null);
}
public static final Coding businessKey()
{
- return new Coding(URL, Codes.BUSINESS_KEY, null);
+ return new Coding(SYSTEM, Codes.BUSINESS_KEY, null);
}
public static final Coding correlationKey()
{
- return new Coding(URL, Codes.CORRELATION_KEY, null);
+ return new Coding(SYSTEM, Codes.CORRELATION_KEY, null);
}
public static final Coding error()
{
- return new Coding(URL, Codes.ERROR, null);
+ return new Coding(SYSTEM, Codes.ERROR, null);
+ }
+
+ public static final boolean isMessageName(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.MESSAGE_NAME, coding);
+ }
+
+ public static final boolean isBusinessKey(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.BUSINESS_KEY, coding);
+ }
+
+ public static final boolean isCorrelationKey(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.CORRELATION_KEY, coding);
+ }
+
+ public static final boolean isError(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.ERROR, coding);
}
}
@@ -64,7 +89,12 @@ private BpmnUserTask()
{
}
- public static final String URL = "http://dsf.dev/fhir/CodeSystem/bpmn-user-task";
+ public static final String SYSTEM = "http://dsf.dev/fhir/CodeSystem/bpmn-user-task";
+
+ public static Coding withCode(String code)
+ {
+ return new Coding().setSystem(SYSTEM).setCode(code);
+ }
public static final class Codes
{
@@ -78,12 +108,22 @@ private Codes()
public static final Coding businessKey()
{
- return new Coding(URL, Codes.BUSINESS_KEY, null);
+ return new Coding(SYSTEM, Codes.BUSINESS_KEY, null);
}
public static final Coding userTaskId()
{
- return new Coding(URL, Codes.USER_TASK_ID, null);
+ return new Coding(SYSTEM, Codes.USER_TASK_ID, null);
+ }
+
+ public static final boolean isBusinessKey(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.BUSINESS_KEY, coding);
+ }
+
+ public static final boolean isUserTaskId(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.USER_TASK_ID, coding);
}
}
@@ -93,7 +133,12 @@ private ProcessAuthorization()
{
}
- public static final String URL = "http://dsf.dev/fhir/CodeSystem/process-authorization";
+ public static final String SYSTEM = "http://dsf.dev/fhir/CodeSystem/process-authorization";
+
+ public static Coding withCode(String code)
+ {
+ return new Coding().setSystem(SYSTEM).setCode(code);
+ }
public static final class Codes
{
@@ -114,92 +159,345 @@ private Codes()
public static final Coding localOrganization()
{
- return new Coding(URL, Codes.LOCAL_ORGANIZATION, null);
+ return new Coding(SYSTEM, Codes.LOCAL_ORGANIZATION, null);
}
public static final Coding localOrganizationPractitioner()
{
- return new Coding(URL, Codes.LOCAL_ORGANIZATION_PRACTITIONER, null);
+ return new Coding(SYSTEM, Codes.LOCAL_ORGANIZATION_PRACTITIONER, null);
}
public static final Coding remoteOrganization()
{
- return new Coding(URL, Codes.REMOTE_ORGANIZATION, null);
+ return new Coding(SYSTEM, Codes.REMOTE_ORGANIZATION, null);
}
public static final Coding localRole()
{
- return new Coding(URL, Codes.LOCAL_ROLE, null);
+ return new Coding(SYSTEM, Codes.LOCAL_ROLE, null);
}
public static final Coding localRolePractitioner()
{
- return new Coding(URL, Codes.LOCAL_ROLE_PRACTITIONER, null);
+ return new Coding(SYSTEM, Codes.LOCAL_ROLE_PRACTITIONER, null);
}
public static final Coding remoteRole()
{
- return new Coding(URL, Codes.REMOTE_ROLE, null);
+ return new Coding(SYSTEM, Codes.REMOTE_ROLE, null);
}
public static final Coding localAll()
{
- return new Coding(URL, Codes.LOCAL_ALL, null);
+ return new Coding(SYSTEM, Codes.LOCAL_ALL, null);
}
public static final Coding localAllPractitioner()
{
- return new Coding(URL, Codes.LOCAL_ALL_PRACTITIONER, null);
+ return new Coding(SYSTEM, Codes.LOCAL_ALL_PRACTITIONER, null);
}
public static final Coding remoteAll()
{
- return new Coding(URL, Codes.REMOTE_ALL, null);
+ return new Coding(SYSTEM, Codes.REMOTE_ALL, null);
}
public static final boolean isLocalOrganization(Coding coding)
{
- return isSame(URL, Codes.LOCAL_ORGANIZATION, coding);
+ return isSame(SYSTEM, Codes.LOCAL_ORGANIZATION, coding);
}
public static final boolean isLocalOrganizationPractitioner(Coding coding)
{
- return isSame(URL, Codes.LOCAL_ORGANIZATION_PRACTITIONER, coding);
+ return isSame(SYSTEM, Codes.LOCAL_ORGANIZATION_PRACTITIONER, coding);
}
public static final boolean isRemoteOrganization(Coding coding)
{
- return isSame(URL, Codes.REMOTE_ORGANIZATION, coding);
+ return isSame(SYSTEM, Codes.REMOTE_ORGANIZATION, coding);
}
public static final boolean isLocalRole(Coding coding)
{
- return isSame(URL, Codes.LOCAL_ROLE, coding);
+ return isSame(SYSTEM, Codes.LOCAL_ROLE, coding);
}
public static final boolean isLocalRolePractitioner(Coding coding)
{
- return isSame(URL, Codes.LOCAL_ROLE_PRACTITIONER, coding);
+ return isSame(SYSTEM, Codes.LOCAL_ROLE_PRACTITIONER, coding);
}
public static final boolean isRemoteRole(Coding coding)
{
- return isSame(URL, Codes.REMOTE_ROLE, coding);
+ return isSame(SYSTEM, Codes.REMOTE_ROLE, coding);
}
public static final boolean isLocalAll(Coding coding)
{
- return isSame(URL, Codes.LOCAL_ALL, coding);
+ return isSame(SYSTEM, Codes.LOCAL_ALL, coding);
}
public static final boolean isLocalAllPractitioner(Coding coding)
{
- return isSame(URL, Codes.LOCAL_ALL_PRACTITIONER, coding);
+ return isSame(SYSTEM, Codes.LOCAL_ALL_PRACTITIONER, coding);
}
public static final boolean isRemoteAll(Coding coding)
{
- return isSame(URL, Codes.REMOTE_ALL, coding);
+ return isSame(SYSTEM, Codes.REMOTE_ALL, coding);
+ }
+ }
+
+ public static final class OrganizationRole
+ {
+ private OrganizationRole()
+ {
+ }
+
+ public static final String SYSTEM = "http://dsf.dev/fhir/CodeSystem/organization-role";
+
+ public static Coding withCode(String code)
+ {
+ return new Coding().setSystem(SYSTEM).setCode(code);
+ }
+
+ public static final class Codes
+ {
+ private Codes()
+ {
+ }
+
+ public static final String UAC = "UAC";
+ public static final String COS = "COS";
+ public static final String CRR = "CRR";
+ public static final String DIC = "DIC";
+ public static final String DMS = "DMS";
+ public static final String DTS = "DTS";
+ public static final String HRP = "HRP";
+ public static final String TTP = "TTP";
+ public static final String AMS = "AMS";
+ }
+
+ public static final Coding uac()
+ {
+ return new Coding(SYSTEM, Codes.UAC, "Use-and-Access Committee");
+ }
+
+ public static final Coding cos()
+ {
+ return new Coding(SYSTEM, Codes.COS, "Coordinating Site");
+ }
+
+ public static final Coding crr()
+ {
+ return new Coding(SYSTEM, Codes.CRR, "Central Research Repository");
+ }
+
+ public static final Coding dic()
+ {
+ return new Coding(SYSTEM, Codes.DIC, "Data Integration Center");
+ }
+
+ public static final Coding dms()
+ {
+ return new Coding(SYSTEM, Codes.DMS, "Data Management Site");
+ }
+
+ public static final Coding dts()
+ {
+ return new Coding(SYSTEM, Codes.DTS, "Data Transfer Site");
+ }
+
+ public static final Coding hrp()
+ {
+ return new Coding(SYSTEM, Codes.HRP, "Health Research Platform");
+ }
+
+ public static final Coding ttp()
+ {
+ return new Coding(SYSTEM, Codes.TTP, "Trusted Third Party");
+ }
+
+ public static final Coding ams()
+ {
+ return new Coding(SYSTEM, Codes.AMS, "Allowlist Management Site");
+ }
+
+ public static final boolean isUac(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.UAC, coding);
+ }
+
+ public static final boolean isCos(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.COS, coding);
+ }
+
+ public static final boolean isCrr(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.CRR, coding);
+ }
+
+ public static final boolean isDic(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.DIC, coding);
+ }
+
+ public static final boolean isDms(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.DMS, coding);
+ }
+
+ public static final boolean isDts(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.DTS, coding);
+ }
+
+ public static final boolean isHrp(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.HRP, coding);
+ }
+
+ public static final boolean isTtp(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.TTP, coding);
+ }
+
+ public static final boolean isAms(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.AMS, coding);
+ }
+ }
+
+ public static final class PractitionerRole
+ {
+ private PractitionerRole()
+ {
+ }
+
+ public static final String SYSTEM = "http://dsf.dev/fhir/CodeSystem/practitioner-role";
+
+ public static Coding withCode(String code)
+ {
+ return new Coding().setSystem(SYSTEM).setCode(code);
+ }
+
+ public static final class Codes
+ {
+ private Codes()
+ {
+ }
+
+ public static final String UAC_USER = "UAC_USER";
+ public static final String COS_USER = "COS_USER";
+ public static final String CRR_USER = "CRR_USER";
+ public static final String DIC_USER = "DIC_USER";
+ public static final String DMS_USER = "DMS_USER";
+ public static final String DTS_USER = "DTS_USER";
+ public static final String HRP_USER = "HRP_USER";
+ public static final String TTP_USER = "TTP_USER";
+ public static final String AMS_USER = "AMS_USER";
+ public static final String DSF_ADMIN = "DSF_ADMIN";
+ }
+
+ public static final Coding uacUser()
+ {
+ return new Coding(SYSTEM, Codes.UAC_USER, "Use-and-Access Committee Member");
+ }
+
+ public static final Coding cosUser()
+ {
+ return new Coding(SYSTEM, Codes.COS_USER, "Coordinating Site Member");
+ }
+
+ public static final Coding crrUser()
+ {
+ return new Coding(SYSTEM, Codes.CRR_USER, "Central Research Repository Member");
+ }
+
+ public static final Coding dicUser()
+ {
+ return new Coding(SYSTEM, Codes.DIC_USER, "Data Integration Center Member");
+ }
+
+ public static final Coding dmsUser()
+ {
+ return new Coding(SYSTEM, Codes.DMS_USER, "Data Management Site Member");
+ }
+
+ public static final Coding dtsUser()
+ {
+ return new Coding(SYSTEM, Codes.DTS_USER, "Data Transfer Site Member");
+ }
+
+ public static final Coding hrpUser()
+ {
+ return new Coding(SYSTEM, Codes.HRP_USER, "Health Research Platform Member");
+ }
+
+ public static final Coding ttpUser()
+ {
+ return new Coding(SYSTEM, Codes.TTP_USER, "Trusted Third Party Member");
+ }
+
+ public static final Coding amsUser()
+ {
+ return new Coding(SYSTEM, Codes.AMS_USER, "Allowlist Management Site Member");
+ }
+
+ public static final Coding dsfAdmin()
+ {
+ return new Coding(SYSTEM, Codes.DSF_ADMIN, "DSF Administrator");
+ }
+
+ public static final boolean isUacUser(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.UAC_USER, coding);
+ }
+
+ public static final boolean isCosUser(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.COS_USER, coding);
+ }
+
+ public static final boolean isCrrUser(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.CRR_USER, coding);
+ }
+
+ public static final boolean isDicUser(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.DIC_USER, coding);
+ }
+
+ public static final boolean isDmsUser(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.DMS_USER, coding);
+ }
+
+ public static final boolean isDtsUser(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.DTS_USER, coding);
+ }
+
+ public static final boolean isHrpUser(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.HRP_USER, coding);
+ }
+
+ public static final boolean isTtpUser(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.TTP_USER, coding);
+ }
+
+ public static final boolean isAmsUser(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.AMS_USER, coding);
+ }
+
+ public static final boolean isDsfAdmin(Coding coding)
+ {
+ return isSame(SYSTEM, Codes.DSF_ADMIN, coding);
}
}
}
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/EndpointProvider.java b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/EndpointProvider.java
index 6902043e9..ef6131b28 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/EndpointProvider.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/EndpointProvider.java
@@ -6,7 +6,9 @@
import org.hl7.fhir.r4.model.Coding;
import org.hl7.fhir.r4.model.Endpoint;
import org.hl7.fhir.r4.model.Identifier;
+import org.hl7.fhir.r4.model.OrganizationAffiliation;
+import dev.dsf.bpe.v2.constants.CodeSystems.OrganizationRole;
import dev.dsf.bpe.v2.constants.NamingSystems.EndpointIdentifier;
import dev.dsf.bpe.v2.constants.NamingSystems.OrganizationIdentifier;
@@ -52,18 +54,19 @@ default Optional getLocalEndpointIdentifierValue()
/**
* @param endpointIdentifier
* may be null
- * @return {@link Endpoint} resource from the local DSF FHIR server with the given endpointIdentifier, empty
- * {@link Optional} if no such resource exists or the given identifier is null
+ * @return Active {@link Endpoint} resource from the local DSF FHIR server with the given endpointIdentifier,
+ * empty {@link Optional} if no such resource exists or the given identifier is null
+ * @see EndpointIdentifier#withValue(String)
*/
Optional getEndpoint(Identifier endpointIdentifier);
/**
* @param endpointIdentifierValue
* may be null
- * @return {@link Endpoint} resource from the local DSF FHIR server with the given DSF
+ * @return Active {@link Endpoint} resource from the local DSF FHIR server with the given DSF
* endpointIdentifierValue, empty {@link Optional} if no such resource exists or the given identifier
* value is null
- * @see EndpointIdentifier
+ * @see EndpointIdentifier#withValue(String)
*/
default Optional getEndpoint(String endpointIdentifierValue)
{
@@ -74,9 +77,10 @@ default Optional getEndpoint(String endpointIdentifierValue)
/**
* @param endpointIdentifier
* may be null
- * @return Address (base URL) of the {@link Endpoint} resource from the local DSF FHIR server with the given
+ * @return Address (base URL) of the active {@link Endpoint} resource from the local DSF FHIR server with the given
* endpointIdentifier, empty {@link Optional} if no such resource exists or the given identifier is
* null
+ * @see EndpointIdentifier#withValue(String)
*/
default Optional getEndpointAddress(Identifier endpointIdentifier)
{
@@ -86,9 +90,10 @@ default Optional getEndpointAddress(Identifier endpointIdentifier)
/**
* @param endpointIdentifierValue
* may be null
- * @return Address (base URL) of the {@link Endpoint} resource from the local DSF FHIR server with the given DSF
- * endpointIdentifierValue, empty {@link Optional} if no such resource exists or the given identifier
- * value is null
+ * @return Address (base URL) of the active {@link Endpoint} resource from the local DSF FHIR server with the given
+ * DSF endpointIdentifierValue, empty {@link Optional} if no such resource exists or the given
+ * identifier value is null
+ * @see EndpointIdentifier#withValue(String)
*/
default Optional getEndpointAddress(String endpointIdentifierValue)
{
@@ -103,10 +108,13 @@ default Optional getEndpointAddress(String endpointIdentifierValue)
* may be null
* @param memberOrganizationRole
* may be null
- * @return {@link Endpoint} resource from the local DSF FHIR server associated with the given
+ * @return Active {@link Endpoint} resource from the local DSF FHIR server associated with the given
* memberOrganizationIdentifier and memberOrganizationRole in a parent organization with the
* given parentOrganizationIdentifier, empty {@link Optional} if no such resource exists or one of
- * the parameters is null
+ * the parameters is null; only considers Endpoints from active {@link OrganizationAffiliation}
+ * resources
+ * @see OrganizationIdentifier#withValue(String)
+ * @see OrganizationRole#withCode(String)
*/
Optional getEndpoint(Identifier parentOrganizationIdentifier, Identifier memberOrganizationIdentifier,
Coding memberOrganizationRole);
@@ -116,23 +124,25 @@ Optional getEndpoint(Identifier parentOrganizationIdentifier, Identifi
* may be null
* @param memberOrganizationIdentifierValue
* may be null
- * @param memberOrganizationRole
+ * @param memberOrganizationRoleCode
* may be null
- * @return {@link Endpoint} resource from the local DSF FHIR server associated with the given DSF
- * memberOrganizationIdentifierValue and memberOrganizationRole in a parent organization with
- * the given DSF parentOrganizationIdentifierValue, empty {@link Optional} if no such resource exists
- * or one of the parameters is null
- * @see OrganizationIdentifier
+ * @return Active {@link Endpoint} resource from the local DSF FHIR server associated with the given DSF
+ * memberOrganizationIdentifierValue and memberOrganizationRoleCode in a parent organization
+ * with the given DSF parentOrganizationIdentifierValue, empty {@link Optional} if no such resource
+ * exists or one of the parameters is null; only considers Endpoints from active
+ * {@link OrganizationAffiliation} resources
+ * @see OrganizationIdentifier#withValue(String)
+ * @see OrganizationRole#withCode(String)
*/
default Optional getEndpoint(String parentOrganizationIdentifierValue,
- String memberOrganizationIdentifierValue, Coding memberOrganizationRole)
+ String memberOrganizationIdentifierValue, String memberOrganizationRoleCode)
{
return getEndpoint(
parentOrganizationIdentifierValue == null ? null
: OrganizationIdentifier.withValue(parentOrganizationIdentifierValue),
memberOrganizationIdentifierValue == null ? null
: OrganizationIdentifier.withValue(memberOrganizationIdentifierValue),
- memberOrganizationRole);
+ memberOrganizationRoleCode == null ? null : OrganizationRole.withCode(memberOrganizationRoleCode));
}
/**
@@ -142,10 +152,13 @@ default Optional getEndpoint(String parentOrganizationIdentifierValue,
* may be null
* @param memberOrganizationRole
* may be null
- * @return Address (base URL) of the {@link Endpoint} resource from the local DSF FHIR server associated with the
- * given memberOrganizationIdentifier and memberOrganizationRole in a parent organization with
- * the given parentOrganizationIdentifier, empty {@link Optional} if no such resource exists or one
- * of the parameters is null
+ * @return Address (base URL) of the active {@link Endpoint} resource from the local DSF FHIR server associated with
+ * the given memberOrganizationIdentifier and memberOrganizationRole in a parent organization
+ * with the given parentOrganizationIdentifier, empty {@link Optional} if no such resource exists or
+ * one of the parameters is null; only considers Endpoints from active
+ * {@link OrganizationAffiliation} resources
+ * @see OrganizationIdentifier#withValue(String)
+ * @see OrganizationRole#withCode(String)
*/
default Optional getEndpointAddress(Identifier parentOrganizationIdentifier,
Identifier memberOrganizationIdentifier, Coding memberOrganizationRole)
@@ -159,23 +172,25 @@ default Optional getEndpointAddress(Identifier parentOrganizationIdentif
* may be null
* @param memberOrganizationIdentifierValue
* may be null
- * @param memberOrganizationRole
+ * @param memberOrganizationRoleCode
* may be null
- * @return Address (base URL) of the {@link Endpoint} resource from the local DSF FHIR server associated with the
- * given DSF memberOrganizationIdentifierValue and memberOrganizationRole in a parent
+ * @return Address (base URL) of the active {@link Endpoint} resource from the local DSF FHIR server associated with
+ * the given DSF memberOrganizationIdentifierValue and memberOrganizationRoleCode in a parent
* organization with the given DSF parentOrganizationIdentifierValue, empty {@link Optional} if no
- * such resource exists or one of the parameters is null
- * @see OrganizationIdentifier
+ * such resource exists or one of the parameters is null; only considers Endpoints from active
+ * {@link OrganizationAffiliation} resources
+ * @see OrganizationIdentifier#withValue(String)
+ * @see OrganizationRole#withCode(String)
*/
default Optional getEndpointAddress(String parentOrganizationIdentifierValue,
- String memberOrganizationIdentifierValue, Coding memberOrganizationRole)
+ String memberOrganizationIdentifierValue, String memberOrganizationRoleCode)
{
return getEndpointAddress(
parentOrganizationIdentifierValue == null ? null
: OrganizationIdentifier.withValue(parentOrganizationIdentifierValue),
memberOrganizationIdentifierValue == null ? null
: OrganizationIdentifier.withValue(memberOrganizationIdentifierValue),
- memberOrganizationRole);
+ memberOrganizationRoleCode == null ? null : OrganizationRole.withCode(memberOrganizationRoleCode));
}
/**
@@ -183,27 +198,33 @@ default Optional getEndpointAddress(String parentOrganizationIdentifierV
* may be null
* @param memberOrganizationRole
* may be null
- * @return {@link Endpoint} resources from the local DSF FHIR server associated with the given
+ * @return Active {@link Endpoint} resources from the local DSF FHIR server associated with the given
* memberOrganizationRole in a parent organization with the given
* parentOrganizationIdentifier, empty {@link List} if no resources exist or one of the parameters is
- * null
+ * null; only considers Endpoints from active {@link OrganizationAffiliation} resources
+ * @see OrganizationIdentifier#withValue(String)
+ * @see OrganizationRole#withCode(String)
*/
List getEndpoints(Identifier parentOrganizationIdentifier, Coding memberOrganizationRole);
/**
* @param parentOrganizationIdentifierValue
* may be null
- * @param memberOrganizationRole
+ * @param memberOrganizationRoleCode
* may be null
- * @return {@link Endpoint} resources from the local DSF FHIR server associated with the given
- * memberOrganizationRole in a parent organization with the given DSF
+ * @return Active {@link Endpoint} resources from the local DSF FHIR server associated with the given
+ * memberOrganizationRoleCode in a parent organization with the given DSF
* parentOrganizationIdentifierValue, empty {@link List} if no resources exist or one of the
- * parameters is null
- * @see OrganizationIdentifier
+ * parameters is null; only considers Endpoints from active {@link OrganizationAffiliation}
+ * resources
+ * @see OrganizationIdentifier#withValue(String)
+ * @see OrganizationRole#withCode(String)
*/
- default List getEndpoints(String parentOrganizationIdentifierValue, Coding memberOrganizationRole)
+ default List getEndpoints(String parentOrganizationIdentifierValue, String memberOrganizationRoleCode)
{
- return getEndpoints(parentOrganizationIdentifierValue == null ? null
- : OrganizationIdentifier.withValue(parentOrganizationIdentifierValue), memberOrganizationRole);
+ return getEndpoints(
+ parentOrganizationIdentifierValue == null ? null
+ : OrganizationIdentifier.withValue(parentOrganizationIdentifierValue),
+ memberOrganizationRoleCode == null ? null : OrganizationRole.withCode(memberOrganizationRoleCode));
}
}
diff --git a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/MailService.java b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/MailService.java
index 70f25aa7c..5f99062b1 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/MailService.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/MailService.java
@@ -2,7 +2,7 @@
import java.nio.charset.StandardCharsets;
import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
import java.util.function.Consumer;
import javax.mail.Message.RecipientType;
@@ -40,7 +40,7 @@ default void send(String subject, String message)
*/
default void send(String subject, String message, String to)
{
- send(subject, message, to == null ? null : Collections.singleton(to));
+ send(subject, message, to == null ? null : List.of(to));
}
/**
@@ -95,7 +95,7 @@ default void send(String subject, MimeBodyPart body)
*/
default void send(String subject, MimeBodyPart body, String to)
{
- send(subject, body, to == null ? null : Collections.singleton(to));
+ send(subject, body, to == null ? null : List.of(to));
}
/**
diff --git a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/OrganizationProvider.java b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/OrganizationProvider.java
index 6f38b827c..5a9046cc9 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/OrganizationProvider.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/OrganizationProvider.java
@@ -9,6 +9,7 @@
import org.hl7.fhir.r4.model.Organization;
import org.hl7.fhir.r4.model.OrganizationAffiliation;
+import dev.dsf.bpe.v2.constants.CodeSystems.OrganizationRole;
import dev.dsf.bpe.v2.constants.NamingSystems.OrganizationIdentifier;
/**
@@ -52,16 +53,16 @@ default Optional getLocalOrganizationIdentifierValue()
/**
* @param organizationIdentifier
* may be null
- * @return {@link Organization} with the given organizationIdentifier, empty {@link Optional} if no such
- * resource exists or the given identifier is null
+ * @return Active {@link Organization} with the given organizationIdentifier, empty {@link Optional} if no
+ * such resource exists or the given identifier is null
*/
Optional getOrganization(Identifier organizationIdentifier);
/**
* @param organizationIdentifierValue
* may be null
- * @return {@link Organization} with the given DSF organizationIdentifier, empty {@link Optional} if no such
- * resource exists or the given identifier value is null
+ * @return Active {@link Organization} with the given DSF organizationIdentifier, empty {@link Optional} if
+ * no such resource exists or the given identifier value is null
* @see OrganizationIdentifier
*/
default Optional getOrganization(String organizationIdentifierValue)
@@ -73,20 +74,20 @@ default Optional getOrganization(String organizationIdentifierValu
/**
* @param parentOrganizationIdentifier
* may be null
- * @return Organizations configured as participatingOrganization for a parent {@link Organization} with the given
- * parentOrganizationIdentifier, empty {@link List} if no parent organization found, parent has no
- * participating organizations configured via {@link OrganizationAffiliation} resources or the given
- * identifier is null
+ * @return Active Organizations configured as participatingOrganization for an active parent {@link Organization}
+ * with the given parentOrganizationIdentifier, empty {@link List} if no parent organization found,
+ * parent has no participating organizations configured via {@link OrganizationAffiliation} resources or the
+ * given identifier is null
*/
List getOrganizations(Identifier parentOrganizationIdentifier);
/**
* @param parentOrganizationIdentifierValue
* may be null
- * @return Organizations configured as participatingOrganization for a parent {@link Organization} with the given
- * DSF parentOrganizationIdentifierValue, empty {@link List} if no parent organization found, parent
- * has no participating organizations configured via {@link OrganizationAffiliation} resources or the given
- * identifier is null
+ * @return Active Organizations configured as participatingOrganization for an active parent {@link Organization}
+ * with the given DSF parentOrganizationIdentifierValue, empty {@link List} if no parent organization
+ * found, parent has no participating organizations configured via {@link OrganizationAffiliation} resources
+ * or the given identifier is null
* @see OrganizationIdentifier
*/
default List getOrganizations(String parentOrganizationIdentifierValue)
@@ -100,35 +101,47 @@ default List getOrganizations(String parentOrganizationIdentifierV
* may be null
* @param memberOrganizationRole
* may be null
- * @return Organizations configured as participatingOrganization for a parent {@link Organization} with the given
- * parentOrganizationIdentifier and role equal to the given memberOrganizationRole, empty
- * {@link List} if no parent organization found, parent has no participating organizations configured via
- * {@link OrganizationAffiliation} resources with the given role or the given identifier is
- * null
+ * @return Active Organizations configured as participatingOrganization for an active parent {@link Organization}
+ * with the given parentOrganizationIdentifier and role equal to the given
+ * memberOrganizationRole, empty {@link List} if no parent organization found, parent has no
+ * participating organizations configured via {@link OrganizationAffiliation} resources with the given role
+ * or the given identifier is null
*/
List getOrganizations(Identifier parentOrganizationIdentifier, Coding memberOrganizationRole);
/**
* @param parentOrganizationIdentifierValue
* may be null
- * @param memberOrganizationRole
+ * @param memberOrganizationRoleCode
* may be null
- * @return Organizations configured as participatingOrganization for a parent {@link Organization} with the given
- * parentOrganizationIdentifier and role equal to the given memberOrganizationRole, empty
- * {@link List} if no parent organization found, parent has no participating organizations configured via
- * {@link OrganizationAffiliation} resources with the given role or the given identifier is
- * null
+ * @return Active Organizations configured as participatingOrganization for an active parent {@link Organization}
+ * with the given parentOrganizationIdentifier and role equal to the given
+ * memberOrganizationRole, empty {@link List} if no parent organization found, parent has no
+ * participating organizations configured via {@link OrganizationAffiliation} resources with the given role
+ * or the given identifier is null
* @see OrganizationIdentifier
*/
- default List getOrganizations(String parentOrganizationIdentifierValue, Coding memberOrganizationRole)
+ default List getOrganizations(String parentOrganizationIdentifierValue,
+ String memberOrganizationRoleCode)
{
- return getOrganizations(parentOrganizationIdentifierValue == null ? null
- : OrganizationIdentifier.withValue(parentOrganizationIdentifierValue), memberOrganizationRole);
+ return getOrganizations(
+ parentOrganizationIdentifierValue == null ? null
+ : OrganizationIdentifier.withValue(parentOrganizationIdentifierValue),
+ memberOrganizationRoleCode == null ? null : OrganizationRole.withCode(memberOrganizationRoleCode));
}
/**
- * @return All {@link Organization} resources except the local {@link Organization}
+ * @return All active {@link Organization} resources except the local {@link Organization} and parent
+ * {@link Organization} resources
* @see #getLocalOrganization()
+ * @see #getParentOrganizations()
*/
List getRemoteOrganizations();
+
+ /**
+ * @return All active parent {@link Organization} resources
+ * @see #getLocalOrganization()
+ * @see #getRemoteOrganizations()
+ */
+ List getParentOrganizations();
}
diff --git a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/process/ProcessAuthorizationHelper.java b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/process/ProcessAuthorizationHelper.java
index 6d198a041..61634e6aa 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/process/ProcessAuthorizationHelper.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/service/process/ProcessAuthorizationHelper.java
@@ -1,7 +1,7 @@
package dev.dsf.bpe.v2.service.process;
import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Stream;
@@ -63,8 +63,7 @@ boolean isValid(ActivityDefinition activityDefinition, Predicate
default Stream getRequesters(ActivityDefinition activityDefinition, String processUrl,
String processVersion, String messageName, String taskProfile)
{
- return getRequesters(activityDefinition, processUrl, processVersion, messageName,
- Collections.singleton(taskProfile));
+ return getRequesters(activityDefinition, processUrl, processVersion, messageName, List.of(taskProfile));
}
Stream getRequesters(ActivityDefinition activityDefinition, String processUrl, String processVersion,
@@ -73,8 +72,7 @@ Stream getRequesters(ActivityDefinition activityDefinition, String pr
default Stream getRecipients(ActivityDefinition activityDefinition, String processUrl,
String processVersion, String messageName, String taskProfiles)
{
- return getRecipients(activityDefinition, processUrl, processVersion, messageName,
- Collections.singleton(taskProfiles));
+ return getRecipients(activityDefinition, processUrl, processVersion, messageName, List.of(taskProfiles));
}
Stream getRecipients(ActivityDefinition activityDefinition, String processUrl, String processVersion,
diff --git a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/variables/Variables.java b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/variables/Variables.java
index 5f374d67a..cc7753428 100644
--- a/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/variables/Variables.java
+++ b/dsf-bpe/dsf-bpe-process-api-v2/src/main/java/dev/dsf/bpe/v2/variables/Variables.java
@@ -1,7 +1,6 @@
package dev.dsf.bpe.v2.variables;
import java.io.File;
-import java.util.Arrays;
import java.util.Date;
import java.util.List;
@@ -117,7 +116,7 @@ default Target createTarget(String organizationIdentifierValue, String endpointI
*/
default Targets createTargets(Target... targets)
{
- return createTargets(Arrays.asList(targets));
+ return createTargets(List.of(targets));
}
/**
diff --git a/dsf-bpe/dsf-bpe-process-api/pom.xml b/dsf-bpe/dsf-bpe-process-api/pom.xml
index 2be786d6e..5a60e94a7 100644
--- a/dsf-bpe/dsf-bpe-process-api/pom.xml
+++ b/dsf-bpe/dsf-bpe-process-api/pom.xml
@@ -24,9 +24,5 @@
org.springframework
spring-context
-
- commons-io
- commons-io
-
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPlugin.java b/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPlugin.java
index 75a488f01..195294e9c 100644
--- a/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPlugin.java
+++ b/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPlugin.java
@@ -22,7 +22,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.apache.commons.io.IOUtils;
import org.camunda.bpm.engine.delegate.ExecutionListener;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.delegate.TaskListener;
@@ -584,7 +583,7 @@ file, getDefinitionName(), getDefinitionVersion(), VERSION_PLACEHOLDER_PATTERN_S
return null;
}
- String content = IOUtils.toString(in, StandardCharsets.UTF_8);
+ String content = new String(in.readAllBytes(), StandardCharsets.UTF_8);
content = VERSION_PLACEHOLDER_PATTERN.matcher(content).replaceAll(getDefinitionResourceVersion());
content = DATE_PLACEHOLDER_PATTERN.matcher(content).replaceAll(resourceDateValue);
@@ -795,7 +794,7 @@ && taskFieldsAvailable(process, "MessageEndEvent", e.getId(),
public boolean taskFieldsAvailable(Process process, String elementType, String elementId,
ExtensionElements extensionElements)
{
- Collection fields = extensionElements == null ? Collections.emptySet()
+ Collection fields = extensionElements == null ? List.of()
: extensionElements.getChildElementsByType(CamundaField.class);
String instantiatesCanonical = null;
@@ -954,7 +953,7 @@ file, getDefinitionName(), getDefinitionVersion(), VERSION_PLACEHOLDER_PATTERN_S
return null;
}
- String content = IOUtils.toString(in, StandardCharsets.UTF_8);
+ String content = new String(in.readAllBytes(), StandardCharsets.UTF_8);
content = VERSION_PLACEHOLDER_PATTERN.matcher(content).replaceAll(getDefinitionResourceVersion());
content = DATE_PLACEHOLDER_PATTERN.matcher(content).replaceAll(resourceDateValue);
@@ -1241,7 +1240,7 @@ private Predicate hasMatchingActivityDefinition(
{
ProcessIdAndVersion processIdAndVersion = model.getProcessIdAndVersion();
- List resources = fhirResources.getOrDefault(processIdAndVersion, Collections.emptyList());
+ List resources = fhirResources.getOrDefault(processIdAndVersion, List.of());
if (resources.isEmpty())
{
logger.warn(
diff --git a/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPluginFactory.java b/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPluginFactory.java
index 86c3e557d..746e787dd 100644
--- a/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPluginFactory.java
+++ b/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/AbstractProcessPluginFactory.java
@@ -67,12 +67,12 @@ public Class extends TaskListener> getDefaultUserTaskListener()
}
@Override
- public ProcessPlugin load(Path jar)
+ public ProcessPlugin load(Path pluginPath)
{
try
{
- URLClassLoader pluginClassLoader = new URLClassLoader(jar.getFileName().toString(),
- new URL[] { toUrl(jar) }, apiClassLoader);
+ URLClassLoader pluginClassLoader = new URLClassLoader(pluginPath.getFileName().toString(),
+ new URL[] { toUrl(pluginPath) }, apiClassLoader);
List> definitions = ServiceLoader.load(processPluginDefinitionType, pluginClassLoader).stream()
.collect(Collectors.toList());
@@ -80,20 +80,20 @@ public ProcessPlugin load(Path jar)
if (definitions.size() != 1)
return null;
- String filename = jar.getFileName().toString();
+ String filename = pluginPath.getFileName().toString();
boolean isSnapshot = filename.endsWith(SNAPSHOT_FILE_SUFFIX);
boolean isMilestone = filename.matches(MILESTONE_FILE_PATTERN);
boolean isReleaseCandidate = filename.matches(RELEASE_CANDIDATE_FILE_PATTERN);
boolean draft = isSnapshot || isMilestone || isReleaseCandidate;
- return createProcessPlugin(definitions.get(0).get(), draft, jar, pluginClassLoader);
+ return createProcessPlugin(definitions.get(0).get(), draft, pluginPath, pluginClassLoader);
}
catch (Exception e)
{
- logger.debug("Ignoring {}: Unable to load process plugin", jar.toString(), e);
- logger.warn("Ignoring {}: Unable to load process plugin: {} - {}", jar.toString(), e.getClass().getName(),
- e.getMessage());
+ logger.debug("Ignoring {}: Unable to load process plugin", pluginPath.toString(), e);
+ logger.warn("Ignoring {}: Unable to load process plugin: {} - {}", pluginPath.toString(),
+ e.getClass().getName(), e.getMessage());
return null;
}
diff --git a/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/ProcessPluginFactory.java b/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/ProcessPluginFactory.java
index 1886345f4..4fa6247e1 100644
--- a/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/ProcessPluginFactory.java
+++ b/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/plugin/ProcessPluginFactory.java
@@ -19,5 +19,5 @@ public interface ProcessPluginFactory
Class extends TaskListener> getDefaultUserTaskListener();
- ProcessPlugin load(Path jar);
+ ProcessPlugin load(Path pluginPath);
}
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/service/BpeMailService.java b/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/service/BpeMailService.java
index f6b740967..f7dd2a9f8 100644
--- a/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/service/BpeMailService.java
+++ b/dsf-bpe/dsf-bpe-process-api/src/main/java/dev/dsf/bpe/api/service/BpeMailService.java
@@ -2,7 +2,7 @@
import java.nio.charset.StandardCharsets;
import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
import java.util.function.Consumer;
import javax.mail.Message.RecipientType;
@@ -40,7 +40,7 @@ default void send(String subject, String message)
*/
default void send(String subject, String message, String to)
{
- send(subject, message, to == null ? null : Collections.singleton(to));
+ send(subject, message, to == null ? null : List.of(to));
}
/**
@@ -95,7 +95,7 @@ default void send(String subject, MimeBodyPart body)
*/
default void send(String subject, MimeBodyPart body, String to)
{
- send(subject, body, to == null ? null : Collections.singleton(to));
+ send(subject, body, to == null ? null : List.of(to));
}
/**
diff --git a/dsf-bpe/dsf-bpe-server-jetty/api/v1/README.md b/dsf-bpe/dsf-bpe-server-jetty/api/v1/README.md
deleted file mode 100644
index 1cde66f27..000000000
--- a/dsf-bpe/dsf-bpe-server-jetty/api/v1/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Empty v1 directory for jar-files used in dev setup
diff --git a/dsf-bpe/dsf-bpe-server-jetty/api/v2/README.md b/dsf-bpe/dsf-bpe-server-jetty/api/v2/README.md
deleted file mode 100644
index 851b656a2..000000000
--- a/dsf-bpe/dsf-bpe-server-jetty/api/v2/README.md
+++ /dev/null
@@ -1 +0,0 @@
-Empty v2 directory for jar-files used in dev setup
diff --git a/dsf-bpe/dsf-bpe-server-jetty/conf/jetty.properties b/dsf-bpe/dsf-bpe-server-jetty/conf/jetty.properties
index c672ed4c0..31b3a527e 100755
--- a/dsf-bpe/dsf-bpe-server-jetty/conf/jetty.properties
+++ b/dsf-bpe/dsf-bpe-server-jetty/conf/jetty.properties
@@ -1,9 +1,9 @@
-dev.dsf.server.api.port=8002
-dev.dsf.server.status.port=10002
-dev.dsf.server.context.path=/bpe
-
-dev.dsf.server.certificate=target/localhost_certificate.pem
-dev.dsf.server.certificate.key=target/localhost_private-key.pem
-dev.dsf.server.certificate.key.password=password
-
+dev.dsf.server.api.port=8002
+dev.dsf.server.status.port=10002
+dev.dsf.server.context.path=/bpe
+
+dev.dsf.server.certificate=target/localhost_certificate.pem
+dev.dsf.server.certificate.key=target/localhost_private-key.pem
+dev.dsf.server.certificate.key.password=password
+
dev.dsf.server.auth.trust.client.certificate.cas=target/testca_certificate.pem
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-server-jetty/pom.xml b/dsf-bpe/dsf-bpe-server-jetty/pom.xml
index d193662fa..a676e7b7c 100755
--- a/dsf-bpe/dsf-bpe-server-jetty/pom.xml
+++ b/dsf-bpe/dsf-bpe-server-jetty/pom.xml
@@ -89,436 +89,6 @@
compile
-
- copy-api-v1-dependencies-to-docker
- install
-
- copy
-
-
-
-
- dev.dsf
- dsf-bpe-process-api-v1
-
-
- dev.dsf
- dsf-bpe-process-api-v1-impl
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-structures-r4
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-base
- ${hapi.fhir.version.v1}
-
-
- com.google.j2objc
- j2objc-annotations
- 2.8
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.utilities
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.r4
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-structures-r5
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.r5
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-validation
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-converter
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.convertors
- ${hapi.fhir.version.v1}
-
-
- net.sf.saxon
- Saxon-HE
- 9.5.1-5
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.validation
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.dstu2
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.dstu2016may
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.dstu3
- ${hapi.fhir.version.v1}
-
-
- org.apache.commons
- commons-compress
- 1.27.1
-
-
- org.fhir
- ucum
- 1.0.2
-
-
- com.github.ben-manes.caffeine
- caffeine
- 2.7.0
-
-
- org.checkerframework
- checker-qual
- 2.6.0
-
-
- com.google.errorprone
- error_prone_annotations
- 2.3.3
-
-
- com.google.code.gson
- gson
- 2.11.0
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-validation-resources-r4
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-validation-resources-r5
- ${hapi.fhir.version.v1}
-
-
- docker/api/v1
-
-
-
- copy-api-v1-dependencies-to-server-jetty
- generate-sources
-
- copy
-
-
-
-
- dev.dsf
- dsf-bpe-process-api-v1
-
-
- dev.dsf
- dsf-bpe-process-api-v1-impl
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-structures-r4
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-base
- ${hapi.fhir.version.v1}
-
-
- com.google.j2objc
- j2objc-annotations
- 2.8
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.utilities
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.r4
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-structures-r5
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.r5
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-validation
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-converter
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.convertors
- ${hapi.fhir.version.v1}
-
-
- net.sf.saxon
- Saxon-HE
- 9.5.1-5
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.validation
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.dstu2
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.dstu2016may
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.dstu3
- ${hapi.fhir.version.v1}
-
-
- org.apache.commons
- commons-compress
- 1.26.2
-
-
- org.fhir
- ucum
- 1.0.2
-
-
- com.github.ben-manes.caffeine
- caffeine
- 2.7.0
-
-
- org.checkerframework
- checker-qual
- 2.6.0
-
-
- com.google.errorprone
- error_prone_annotations
- 2.3.3
-
-
- com.google.code.gson
- gson
- 2.11.0
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-validation-resources-r4
- ${hapi.fhir.version.v1}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-validation-resources-r5
- ${hapi.fhir.version.v1}
-
-
- api/v1
-
-
-
- copy-api-v2-dependencies-to-docker
- install
-
- copy
-
-
-
-
- dev.dsf
- dsf-bpe-process-api-v2
-
-
- dev.dsf
- dsf-bpe-process-api-v2-impl
-
-
- org.checkerframework
- checker-qual
- 3.43.0
-
-
- com.google.errorprone
- error_prone_annotations
- 2.28.0
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-base
- ${hapi.fhir.version.v2}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-caching-api
- ${hapi.fhir.version.v2}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-structures-r4
- ${hapi.fhir.version.v2}
-
-
- com.ibm.icu
- icu4j
- 72.1
-
-
- com.google.j2objc
- j2objc-annotations
- 3.0.0
-
-
- io.opentelemetry
- opentelemetry-api
- 1.38.0
-
-
- io.opentelemetry
- opentelemetry-context
- 1.38.0
-
-
- io.opentelemetry.instrumentation
- opentelemetry-instrumentation-annotations
- 2.4.0
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.r4
- 6.3.11
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.utilities
- 6.3.11
-
-
- docker/api/v2
-
-
-
- copy-api-v2-dependencies-to-server-jetty
- generate-sources
-
- copy
-
-
-
-
- dev.dsf
- dsf-bpe-process-api-v2
-
-
- dev.dsf
- dsf-bpe-process-api-v2-impl
-
-
- org.checkerframework
- checker-qual
- 3.43.0
-
-
- com.google.errorprone
- error_prone_annotations
- 2.28.0
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-base
- ${hapi.fhir.version.v2}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-caching-api
- ${hapi.fhir.version.v2}
-
-
- ca.uhn.hapi.fhir
- hapi-fhir-structures-r4
- ${hapi.fhir.version.v2}
-
-
- com.ibm.icu
- icu4j
- 72.1
-
-
- com.google.j2objc
- j2objc-annotations
- 3.0.0
-
-
- io.opentelemetry
- opentelemetry-api
- 1.38.0
-
-
- io.opentelemetry
- opentelemetry-context
- 1.38.0
-
-
- io.opentelemetry.instrumentation
- opentelemetry-instrumentation-annotations
- 2.4.0
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.r4
- 6.3.11
-
-
- ca.uhn.hapi.fhir
- org.hl7.fhir.utilities
- 6.3.11
-
-
- api/v2
-
-
copy-server-jar-to-docker
install
@@ -549,23 +119,6 @@
dsf_bpe.jar
lib/*.jar
- api/v1/*.jar
- api/v2/*.jar
-
- false
-
-
- process
-
- *.jar
-
- false
-
-
- api
-
- v1/*.jar
- v2/*.jar
false
diff --git a/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/BpeJettyServer.java b/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/BpeJettyServer.java
index 2179eced6..805907d70 100755
--- a/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/BpeJettyServer.java
+++ b/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/BpeJettyServer.java
@@ -36,6 +36,8 @@ public static void main(String[] args)
BpeHttpJettyConfig.class))
{
JettyServer server = context.getBean(JettyServer.class);
+
+ server.addShutdownHook();
server.start();
}
}
diff --git a/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/BpeJettyServerHttps.java b/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/BpeJettyServerHttps.java
index eda4803f4..efb93ee66 100755
--- a/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/BpeJettyServerHttps.java
+++ b/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/BpeJettyServerHttps.java
@@ -36,6 +36,8 @@ public static void main(String[] args)
BpeHttpsJettyConfig.class))
{
JettyServer server = context.getBean(JettyServer.class);
+
+ server.addShutdownHook();
server.start();
}
}
diff --git a/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/config/BpeDbMigratorConfig.java b/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/config/BpeDbMigratorConfig.java
index dda8e1ed3..ef5a66e0a 100644
--- a/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/config/BpeDbMigratorConfig.java
+++ b/dsf-bpe/dsf-bpe-server-jetty/src/main/java/dev/dsf/bpe/config/BpeDbMigratorConfig.java
@@ -97,6 +97,12 @@ public char[] getDbLiquibasePassword()
return dbLiquibasePassword;
}
+ @Override
+ public String getChangelogFile()
+ {
+ return "bpe/db/db.changelog.xml";
+ }
+
@Override
public Map getChangeLogParameters()
{
diff --git a/dsf-bpe/dsf-bpe-server/pom.xml b/dsf-bpe/dsf-bpe-server/pom.xml
index 6ed75ff12..a7544798b 100755
--- a/dsf-bpe/dsf-bpe-server/pom.xml
+++ b/dsf-bpe/dsf-bpe-server/pom.xml
@@ -108,6 +108,10 @@
org.glassfish.jersey.media
jersey-media-json-jackson
+
+ org.glassfish.jersey.media
+ jersey-media-jaxb
+
org.glassfish.jersey.containers
jersey-container-servlet
@@ -160,8 +164,8 @@
- org.mockito
- mockito-core
+ dev.dsf
+ dsf-common-jetty
test
@@ -169,6 +173,16 @@
db-test-utils
test
+
+ org.mockito
+ mockito-core
+ test
+
+
+ org.slf4j
+ jul-to-slf4j
+ test
+
org.apache.logging.log4j
log4j-slf4j2-impl
@@ -180,6 +194,31 @@
disruptor
test
+
+
+ dev.dsf
+ dsf-fhir-server
+ test
+
+
+
+
+ dev.dsf
+ dsf-bpe-test-plugin
+ test
+
+
+
+
+ dev.dsf
+ dsf-bpe-test-plugin-v1
+ test
+
+
+ dev.dsf
+ dsf-bpe-test-plugin-v2
+ test
+
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/camunda/FallbackSerializerFactoryImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/camunda/FallbackSerializerFactoryImpl.java
index 4cb47fa2b..0b62334e3 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/camunda/FallbackSerializerFactoryImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/camunda/FallbackSerializerFactoryImpl.java
@@ -1,6 +1,5 @@
package dev.dsf.bpe.camunda;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -116,7 +115,7 @@ public TypedValueSerializer> getSerializer(TypedValue value)
{
logger.debug("Getting serializer for {} from class loader {}", getName(value), classLoader.getName());
- return serializersByClassLoader.getOrDefault(classLoader, Collections.emptyList()).stream()
+ return serializersByClassLoader.getOrDefault(classLoader, List.of()).stream()
.filter(s -> s.canHandle(value)).findFirst().orElse(null);
}
else
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/FhirWebserviceClientJersey.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/FhirWebserviceClientJersey.java
index 8f9ebe55e..953faa77a 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/FhirWebserviceClientJersey.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/client/FhirWebserviceClientJersey.java
@@ -2,7 +2,6 @@
import java.io.InputStream;
import java.security.KeyStore;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -43,9 +42,9 @@ public FhirWebserviceClientJersey(String baseUrl, KeyStore trustStore, KeyStore
ObjectMapper objectMapper, String proxySchemeHostPort, String proxyUserName, char[] proxyPassword,
int connectTimeout, int readTimeout, boolean logRequests, String userAgentValue, FhirContext fhirContext)
{
- super(baseUrl, trustStore, keyStore, keyStorePassword, objectMapper,
- Collections.singleton(new FhirAdapter(fhirContext)), proxySchemeHostPort, proxyUserName, proxyPassword,
- connectTimeout, readTimeout, logRequests, userAgentValue);
+ super(baseUrl, trustStore, keyStore, keyStorePassword, objectMapper, List.of(new FhirAdapter(fhirContext)),
+ proxySchemeHostPort, proxyUserName, proxyPassword, connectTimeout, readTimeout, logRequests,
+ userAgentValue);
preferReturnMinimal = new PreferReturnMinimalWithRetryImpl(this);
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/mail/BpeMailService.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/mail/BpeMailService.java
index c53c3044e..a541dcd84 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/mail/BpeMailService.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/mail/BpeMailService.java
@@ -2,7 +2,7 @@
import java.nio.charset.StandardCharsets;
import java.util.Collection;
-import java.util.Collections;
+import java.util.List;
import java.util.function.Consumer;
import javax.mail.Message.RecipientType;
@@ -40,7 +40,7 @@ default void send(String subject, String message)
*/
default void send(String subject, String message, String to)
{
- send(subject, message, to == null ? null : Collections.singleton(to));
+ send(subject, message, to == null ? null : List.of(to));
}
/**
@@ -95,7 +95,7 @@ default void send(String subject, MimeBodyPart body)
*/
default void send(String subject, MimeBodyPart body, String to)
{
- send(subject, body, to == null ? null : Collections.singleton(to));
+ send(subject, body, to == null ? null : List.of(to));
}
/**
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/FhirResourceHandlerImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/FhirResourceHandlerImpl.java
index 9dcff0ab2..1597946aa 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/FhirResourceHandlerImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/FhirResourceHandlerImpl.java
@@ -3,7 +3,6 @@
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
@@ -227,7 +226,7 @@ private void addResourcesRemovedFromDraftProcess(List
&& ProcessState.DRAFT.equals(change.getNewProcessState()))
{
List dbResources = dbResourcesByProcess.getOrDefault(change.getProcessKeyAndVersion(),
- Collections.emptyList());
+ List.of());
dbResources.forEach(dbRes ->
{
@@ -366,7 +365,7 @@ private Stream getCurrentOrOldResources(
if (resources == null)
{
logger.debug("No resources found in BPE DB for process {}", process);
- resources = Collections.emptyList();
+ resources = List.of();
}
return resources.stream().map(info -> ProcessesResource.from(info).add(process));
@@ -391,8 +390,8 @@ private Stream getResources(ProcessIdAndVersion process,
private Optional getResourceId(Map> dbResourcesByProcess,
ProcessIdAndVersion process, ResourceInfo resourceInfo)
{
- return dbResourcesByProcess.getOrDefault(process, Collections.emptyList()).stream()
- .filter(r -> r.equals(resourceInfo)).findFirst().map(ResourceInfo::getResourceId);
+ return dbResourcesByProcess.getOrDefault(process, List.of()).stream().filter(r -> r.equals(resourceInfo))
+ .findFirst().map(ResourceInfo::getResourceId);
}
private Map> getResourceInfosFromDb()
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoader.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoader.java
index bc41776ae..dd72bc452 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoader.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoader.java
@@ -23,19 +23,19 @@ public class ProcessPluginApiClassLoader extends URLClassLoader
private static final Logger logger = LoggerFactory.getLogger(ProcessPluginApiClassLoader.class);
private final Set allowedBpeClasses = new HashSet<>();
- private final Set apiResourcesWithPriority = new HashSet<>();
+ private final Set resourcesWithPriority = new HashSet<>();
private final Set allowedBpeResources = new HashSet<>();
public ProcessPluginApiClassLoader(String name, URL[] urls, ClassLoader bpeLoader, Set allowedBpeClasses,
- Set apiResourcesWithPriority, Set allowedBpeResources)
+ Set resourcesWithPriority, Set allowedBpeResources)
{
super(name, urls, bpeLoader);
if (allowedBpeClasses != null)
this.allowedBpeClasses.addAll(allowedBpeClasses);
- if (apiResourcesWithPriority != null)
- this.apiResourcesWithPriority.addAll(apiResourcesWithPriority);
+ if (resourcesWithPriority != null)
+ this.resourcesWithPriority.addAll(resourcesWithPriority);
if (allowedBpeResources != null)
this.allowedBpeResources.addAll(allowedBpeResources);
@@ -67,7 +67,7 @@ protected Class> loadClass(String className, boolean resolve) throws ClassNotF
if (isBpeClassAllowed(bpeClass))
return bpeClass;
- logger.warn("Class " + className + " not found or hidden");
+ logger.debug("Class " + className + " not found or hidden");
throw new ClassNotFoundException(className);
}
}
@@ -152,21 +152,22 @@ private boolean isBpeClassAllowed(Class> clazz)
|| allowedBpeClasses.contains(className))
return true;
- logger.debug("{} TODO: Should bpe class {} be allowed?", getName(), className);
+ logger.debug("{} TODO: Should bpe class {} be allowed? [default: false]", getName(), className);
return false;
}
/**
* @param name
* @param apiResourceUrl
- * @return true if resource from from api or process plugins has priority over resource from bpe
+ * @return true if resource from api or process plugins has priority over resource from bpe
*/
private boolean hasApiResourcePriority(String name, URL apiResourceUrl)
{
- if ("jar".equals(apiResourceUrl.getProtocol()) && apiResourcesWithPriority.contains(name))
+ if ("jar".equals(apiResourceUrl.getProtocol()) && resourcesWithPriority.contains(name))
return true;
- logger.debug("{} TODO: Should api resource {} / {} have priority?", getName(), name, apiResourceUrl);
+ logger.debug("{} TODO: Should api resource {} / {} have priority? [default: false]", getName(), name,
+ apiResourceUrl);
return false;
}
@@ -180,7 +181,8 @@ private boolean isBpeResourceAllowed(String name, URL bpeResourcetUrl)
if ("jar".equals(bpeResourcetUrl.getProtocol()) && allowedBpeResources.contains(name))
return true;
- logger.debug("{} TODO: Should bpe resource {} / {} be allowed?", getName(), name, bpeResourcetUrl);
+ logger.debug("{} TODO: Should bpe resource {} / {} be allowed? [default: false]", getName(), name,
+ bpeResourcetUrl);
return false;
}
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoaderFactory.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoaderFactory.java
index 0dabb92e8..a18f6bc2c 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoaderFactory.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiClassLoaderFactory.java
@@ -9,37 +9,73 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Objects;
import java.util.Set;
+import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.InitializingBean;
-public class ProcessPluginApiClassLoaderFactory
+public class ProcessPluginApiClassLoaderFactory implements InitializingBean
{
private static final Logger logger = LoggerFactory.getLogger(ProcessPluginApiClassLoaderFactory.class);
private static final String ALLOWED_BPE_CLASSES_LIST = "allowed-bpe-classes.list";
- private static final String API_RESOURCES_WITH_PRIORITY_LIST = "api-resources-with-priority.list";
+ private static final String RESOURCES_WITH_PRIORITY_LIST = "resources-with-priority.list";
private static final String ALLOWED_BPE_RESOURCES = "allowed-bpe-resources.list";
- private URL[] getApiClassPath(String apiVersion)
+ private final Path apiClassPathBaseDirectory;
+
+ private final Map allowedBpeClasses = new HashMap<>();
+ private final Map resourcesWithPriority = new HashMap<>();
+ private final Map allowedBpeResources = new HashMap<>();
+
+ public ProcessPluginApiClassLoaderFactory(Path apiClassPathBaseDirectory, Map allowedBpeClasses,
+ Map resourcesWithPriority, Map allowedBpeResources)
{
- Path apiClassPathFolder = Paths.get("api/v" + apiVersion);
+ this.apiClassPathBaseDirectory = apiClassPathBaseDirectory;
+
+ if (allowedBpeClasses != null)
+ this.allowedBpeClasses.putAll(allowedBpeClasses);
+ if (resourcesWithPriority != null)
+ this.resourcesWithPriority.putAll(resourcesWithPriority);
+ if (allowedBpeResources != null)
+ this.allowedBpeResources.putAll(allowedBpeResources);
+ }
+
+ @Override
+ public void afterPropertiesSet() throws Exception
+ {
+ Objects.requireNonNull(apiClassPathBaseDirectory, "apiClassPathBaseDirectory");
+ // list files may be null
+ }
+
+ private List getApiClassPath(int apiVersion)
+ {
+ Path apiClassPathDirectory = apiClassPathBaseDirectory.resolve("v" + apiVersion);
try
{
- return Files.list(apiClassPathFolder).filter(p -> p.getFileName().toString().endsWith(".jar"))
- .map(this::toUrl).toArray(URL[]::new);
+ List files = Files.list(apiClassPathDirectory)
+ .filter(p -> p.getFileName().toString().endsWith(".jar")).toList();
+
+ if (files.isEmpty())
+ throw new IllegalArgumentException("No jar files found for API v" + apiVersion + " class-path at "
+ + apiClassPathDirectory.toAbsolutePath().normalize().toString());
+
+ return files;
}
catch (IOException e)
{
- logger.warn("Unable to iterate files in api class path folder {}", apiClassPathFolder);
+ logger.warn("Unable to iterate files in api class path directory {}", apiClassPathDirectory);
throw new RuntimeException(
- "Unable to iterate files in api class path folder " + apiClassPathFolder.toString(), e);
+ "Unable to iterate files in api class path directory " + apiClassPathDirectory.toString(), e);
}
}
@@ -55,50 +91,66 @@ private URL toUrl(Path p)
}
}
- private Set readList(String apiVersion, String file)
+ private Set readList(int apiVersion, String file)
{
Path externalFile = getExternalFileIfReadable(apiVersion, file);
- return externalFile == null ? readInternal(apiVersion, file) : readExternal(externalFile);
+ return externalFile == null ? readInternal(apiVersion, file) : readExternal(apiVersion, file, externalFile);
}
- private Path getExternalFileIfReadable(String apiVersion, String file)
+ private Path getExternalFileIfReadable(int apiVersion, String file)
{
- Path externalFile = Paths.get("api/v" + apiVersion + "/" + file);
+ Path externalFile = switch (file)
+ {
+ case ALLOWED_BPE_CLASSES_LIST -> allowedBpeClasses.get(apiVersion);
+ case RESOURCES_WITH_PRIORITY_LIST -> resourcesWithPriority.get(apiVersion);
+ case ALLOWED_BPE_RESOURCES -> allowedBpeResources.get(apiVersion);
+
+ default -> throw new IllegalArgumentException("Unexpected file value: " + file);
+ };
+
+ if (externalFile == null)
+ {
+ logger.debug("External file for api v{} not configured, using {} from jar", apiVersion, file);
+ return null;
+ }
if (!Files.exists(externalFile))
{
- logger.debug("External file {} does not exist, using file from jar",
- externalFile.toAbsolutePath().toString());
+ logger.debug("External file for api v{} {} does not exist, using {} from jar", apiVersion,
+ externalFile.toAbsolutePath().normalize().toString(), file);
return null;
}
if (!Files.isReadable(externalFile))
{
- logger.debug("External file {} is not readable, using file from jar",
- externalFile.toAbsolutePath().toString());
+ logger.debug("External file for api v{} {} is not readable, using {} from jar", apiVersion,
+ externalFile.toAbsolutePath().normalize().toString(), file);
return null;
}
return externalFile;
}
- private Set readExternal(Path file)
+ private Set readExternal(int apiVersion, String file, Path externalFile)
{
try
{
- logger.debug("Reading {} ...", file.toAbsolutePath().toString());
- return new HashSet<>(Files.readAllLines(file));
+ logger.debug("Reading api v{} file {} from {} ...", apiVersion, file,
+ externalFile.toAbsolutePath().normalize().toString());
+ return new HashSet<>(Files.readAllLines(externalFile));
}
catch (IOException e)
{
- logger.warn("Unable to read external file {}", file.toAbsolutePath().toString());
- throw new RuntimeException("Unable to read external file " + file.toAbsolutePath().toString(), e);
+ logger.warn("Unable to read api v{} file {} from external file {}", apiVersion, file,
+ externalFile.toAbsolutePath().normalize().toString());
+ throw new RuntimeException(
+ "Unable to read external file " + externalFile.toAbsolutePath().normalize().toString(), e);
}
}
- private Set readInternal(String apiVersion, String file)
+ private Set readInternal(int apiVersion, String file)
{
- final String path = "api/v" + apiVersion + "/" + file;
+ final String path = "bpe/api/v" + apiVersion + "/" + file;
try (InputStream in = ProcessPluginApiClassLoaderFactory.class.getClassLoader().getResourceAsStream(path);
InputStreamReader inReader = new InputStreamReader(in, StandardCharsets.UTF_8);
@@ -121,15 +173,20 @@ private Set readInternal(String apiVersion, String file)
}
}
- public ProcessPluginApiClassLoader createApiClassLoader(String apiVersion)
+ public ProcessPluginApiClassLoader createApiClassLoader(int apiVersion)
{
- URL[] apiClassPath = getApiClassPath(apiVersion);
+ List apiClassPath = getApiClassPath(apiVersion);
Set allowedBpeClasses = readList(apiVersion, ALLOWED_BPE_CLASSES_LIST);
- Set apiResourcesWithPriority = readList(apiVersion, API_RESOURCES_WITH_PRIORITY_LIST);
+ Set resourcesWithPriority = readList(apiVersion, RESOURCES_WITH_PRIORITY_LIST);
Set allowedBpeResources = readList(apiVersion, ALLOWED_BPE_RESOURCES);
- return new ProcessPluginApiClassLoader("Plugin API v" + apiVersion, apiClassPath,
- ClassLoader.getSystemClassLoader(), allowedBpeClasses, apiResourcesWithPriority, allowedBpeResources);
+ logger.debug("Creating Plugin API class loader for v{} with jar files from {}: {}", apiVersion,
+ apiClassPathBaseDirectory.resolve("v" + apiVersion).toAbsolutePath().normalize(), apiClassPath.stream()
+ .map(Path::getFileName).map(Path::toString).collect(Collectors.joining(", ", "[", "]")));
+
+ return new ProcessPluginApiClassLoader("Plugin API v" + apiVersion,
+ apiClassPath.stream().map(this::toUrl).toArray(URL[]::new), ClassLoader.getSystemClassLoader(),
+ allowedBpeClasses, resourcesWithPriority, allowedBpeResources);
}
}
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiFactory.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiFactory.java
index 39b66db99..05c0177a5 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiFactory.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginApiFactory.java
@@ -4,7 +4,7 @@
import java.util.Objects;
import java.util.ServiceLoader;
import java.util.ServiceLoader.Provider;
-import java.util.stream.Stream;
+import java.util.stream.IntStream;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,10 +58,10 @@ public void afterPropertiesSet() throws Exception
public List initialize()
{
- return Stream.of("1", "2").map(this::init).toList();
+ return IntStream.of(1, 2).mapToObj(this::init).toList();
}
- private ProcessPluginFactory init(String apiVersion)
+ private ProcessPluginFactory init(int apiVersion)
{
ClassLoader apiClassLoader = classLoaderFactory.createApiClassLoader(apiVersion);
ProcessPluginApiBuilder apiBuilder = loadProcessPluginApiBuilder(apiClassLoader);
@@ -77,7 +77,7 @@ private ProcessPluginApiBuilder loadProcessPluginApiBuilder(ClassLoader apiClass
.get();
}
- private ApplicationContext createApiApplicationContext(String apiVersion, ClassLoader apiClassLoader,
+ private ApplicationContext createApiApplicationContext(int apiVersion, ClassLoader apiClassLoader,
Class> springServiceConfigClass)
{
try
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginLoaderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginLoaderImpl.java
index 532b921b2..6385c19ae 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginLoaderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginLoaderImpl.java
@@ -22,20 +22,24 @@ public class ProcessPluginLoaderImpl implements ProcessPluginLoader, Initializin
{
private static final Logger logger = LoggerFactory.getLogger(ProcessPluginLoaderImpl.class);
- private final Path pluginDirectory;
private final List processPluginFactories = new ArrayList<>();
+ private final Path pluginDirectory;
+ private final List explodedPluginDirectories = new ArrayList<>();
+
public ProcessPluginLoaderImpl(Collection extends ProcessPluginFactory> processPluginFactories,
- Path pluginDirectory)
+ Path pluginDirectory, Collection extends Path> explodedPluginDirectories)
{
- this.pluginDirectory = pluginDirectory;
-
if (processPluginFactories != null)
{
this.processPluginFactories.addAll(processPluginFactories);
this.processPluginFactories.sort(
Comparator. comparingInt(ProcessPluginFactory::getApiVersion).reversed());
}
+
+ this.pluginDirectory = pluginDirectory;
+ if (explodedPluginDirectories != null)
+ this.explodedPluginDirectories.addAll(explodedPluginDirectories);
}
@Override
@@ -47,16 +51,16 @@ public void afterPropertiesSet() throws Exception
@Override
public List loadPlugins()
{
+ List plugins = new ArrayList<>();
+
try (DirectoryStream directoryStream = Files.newDirectoryStream(pluginDirectory))
{
- List plugins = new ArrayList<>();
-
directoryStream.forEach(p ->
{
if (!Files.isReadable(p))
- logger.warn("Ignoring {}: {}", p.toAbsolutePath().toString(), "Not readable");
+ logger.warn("Ignoring {}: Not readable", p.toAbsolutePath().normalize().toString());
else if (!p.getFileName().toString().endsWith(".jar"))
- logger.warn("Ignoring {}: {}", p.toAbsolutePath().toString(), "Not a .jar file");
+ logger.warn("Ignoring {}: Not a .jar file", p.toAbsolutePath().normalize().toString());
else
{
ProcessPlugin plugin = load(p);
@@ -64,8 +68,6 @@ else if (!p.getFileName().toString().endsWith(".jar"))
plugins.add(plugin);
}
});
-
- return plugins;
}
catch (IOException e)
{
@@ -74,19 +76,33 @@ else if (!p.getFileName().toString().endsWith(".jar"))
throw new RuntimeException(e);
}
+
+ for (Path e : explodedPluginDirectories)
+ {
+ if (!Files.isDirectory(e))
+ logger.warn("Ignoring {}: Not a directory", e.toAbsolutePath().normalize().toString());
+ else
+ {
+ ProcessPlugin plugin = load(e);
+ if (plugin != null)
+ plugins.add(plugin);
+ }
+ }
+
+ return plugins;
}
- private ProcessPlugin load(Path jar)
+ private ProcessPlugin load(Path pluginPath)
{
for (ProcessPluginFactory factory : processPluginFactories)
{
- ProcessPlugin plugin = factory.load(jar);
+ ProcessPlugin plugin = factory.load(pluginPath);
if (plugin != null)
return plugin;
}
- logger.warn("Ignoring {}: No process plugin definition for API version{} {} found", jar.toString(),
+ logger.warn("Ignoring {}: No process plugin definition for API version{} {} found", pluginPath.toString(),
processPluginFactories.size() != 1 ? "s" : "",
processPluginFactories.size() == 1 ? processPluginFactories.get(0).getApiVersion()
: processPluginFactories.stream().map(f -> String.valueOf(f.getApiVersion()))
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginManagerImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginManagerImpl.java
index b3002d14e..2fa266e3f 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginManagerImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessPluginManagerImpl.java
@@ -2,7 +2,6 @@
import java.nio.file.Path;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
@@ -127,10 +126,8 @@ private BasicFhirWebserviceClient retryClient()
private Optional getLocalOrganizationIdentifierValue()
{
- Bundle resultBundle = retryClient().searchWithStrictHandling(Endpoint.class,
- Map.of("status", Collections.singletonList("active"), "address",
- Collections.singletonList(localEndpointAddress), "_include",
- Collections.singletonList("Endpoint:organization")));
+ Bundle resultBundle = retryClient().searchWithStrictHandling(Endpoint.class, Map.of("status", List.of("active"),
+ "address", List.of(localEndpointAddress), "_include", List.of("Endpoint:organization")));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getEntry().size() != 2
|| resultBundle.getEntry().get(0).getResource() == null
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessesResource.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessesResource.java
index 2978abb18..c5aeaafcc 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessesResource.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/plugin/ProcessesResource.java
@@ -3,7 +3,6 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -369,9 +368,9 @@ public List getExpectedStatus()
case MISSING -> switch (getNewProcessState())
{
// conditional create NamingSystem: name=..., Task: identifier=..., others: url=...&version=...
- case ACTIVE -> Arrays.asList("200", "201");
+ case ACTIVE -> List.of("200", "201");
// conditional create NamingSystem: name=..., Task: identifier=..., others: url=...&version=...
- case RETIRED -> Arrays.asList("200", "201");
+ case RETIRED -> List.of("200", "201");
default -> throw new RuntimeException(
"State change " + getOldProcessState() + " -> " + getNewProcessState() + " not supported");
@@ -379,11 +378,11 @@ public List getExpectedStatus()
case NEW -> switch (getNewProcessState())
{
// conditional create NamingSystem: name=..., Task: identifier=..., others: url=...&version=...
- case ACTIVE -> Arrays.asList("200", "201");
+ case ACTIVE -> List.of("200", "201");
// conditional create NamingSystem: name=..., Task: identifier=..., others: url=...&version=...
- case DRAFT -> Arrays.asList("200", "201");
+ case DRAFT -> List.of("200", "201");
// conditional create NamingSystem: name=..., Task: identifier=..., others: url=...&version=...
- case RETIRED -> Arrays.asList("200", "201");
+ case RETIRED -> List.of("200", "201");
default -> throw new RuntimeException(
"State change " + getOldProcessState() + " -> " + getNewProcessState() + " not supported");
@@ -391,11 +390,11 @@ public List getExpectedStatus()
case ACTIVE -> switch (getNewProcessState())
{
// standard update with resource id
- case DRAFT -> Collections.singletonList("200");
+ case DRAFT -> List.of("200");
// standard update with resource id
- case RETIRED -> Collections.singletonList("200");
+ case RETIRED -> List.of("200");
// standard delete with resource id
- case EXCLUDED -> Arrays.asList("200", "204");
+ case EXCLUDED -> List.of("200", "204");
default -> throw new RuntimeException(
"State change " + getOldProcessState() + " -> " + getNewProcessState() + " not supported");
@@ -403,13 +402,13 @@ public List getExpectedStatus()
case DRAFT -> switch (getNewProcessState())
{
// standard update with resource id
- case ACTIVE -> Collections.singletonList("200");
+ case ACTIVE -> List.of("200");
// standard update with resource id
- case DRAFT -> Collections.singletonList("200");
+ case DRAFT -> List.of("200");
// standard update with resource id
- case RETIRED -> Collections.singletonList("200");
+ case RETIRED -> List.of("200");
// standard delete with resource id
- case EXCLUDED -> Arrays.asList("200", "204");
+ case EXCLUDED -> List.of("200", "204");
default -> throw new RuntimeException(
"State change " + getOldProcessState() + " -> " + getNewProcessState() + " not supported");
@@ -417,11 +416,11 @@ public List getExpectedStatus()
case RETIRED -> switch (getNewProcessState())
{
// standard update with resource id
- case ACTIVE -> Collections.singletonList("200");
+ case ACTIVE -> List.of("200");
// standard update with resource id
- case DRAFT -> Collections.singletonList("200");
+ case DRAFT -> List.of("200");
// standard delete with resource id
- case EXCLUDED -> Arrays.asList("200", "204");
+ case EXCLUDED -> List.of("200", "204");
default -> throw new RuntimeException(
"State change " + getOldProcessState() + " -> " + getNewProcessState() + " not supported");
@@ -429,11 +428,11 @@ public List getExpectedStatus()
case EXCLUDED -> switch (getNewProcessState())
{
// conditional create NamingSystem: name=..., Task: identifier=..., others: url=...&version=...
- case ACTIVE -> Arrays.asList("200", "201");
+ case ACTIVE -> List.of("200", "201");
// conditional create NamingSystem: name=..., Task: identifier=..., others: url=...&version=...
- case DRAFT -> Arrays.asList("200", "201");
+ case DRAFT -> List.of("200", "201");
// conditional create NamingSystem: name=..., Task: identifier=..., others: url=...&version=...
- case RETIRED -> Arrays.asList("200", "201");
+ case RETIRED -> List.of("200", "201");
default -> throw new RuntimeException(
"State change " + getOldProcessState() + " -> " + getNewProcessState() + " not supported");
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/service/LocalOrganizationProviderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/service/LocalOrganizationProviderImpl.java
index f617b408d..97bab0e24 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/service/LocalOrganizationProviderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/service/LocalOrganizationProviderImpl.java
@@ -2,7 +2,7 @@
import java.time.LocalDateTime;
import java.time.temporal.TemporalAmount;
-import java.util.Collections;
+import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@@ -70,9 +70,8 @@ public Optional getLocalOrganization()
private Optional doGetLocalOrganization()
{
Bundle resultBundle = clientProvider.getLocalWebserviceClient().searchWithStrictHandling(Endpoint.class,
- Map.of("status", Collections.singletonList("active"), "address",
- Collections.singletonList(localEndpointAddress), "_include",
- Collections.singletonList("Endpoint:organization")));
+ Map.of("status", List.of("active"), "address", List.of(localEndpointAddress), "_include",
+ List.of("Endpoint:organization")));
if (resultBundle == null || resultBundle.getEntry() == null || resultBundle.getEntry().size() != 2
|| resultBundle.getEntry().get(0).getResource() == null
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PluginConfig.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PluginConfig.java
index d682565e7..6e8a2a3dc 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PluginConfig.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PluginConfig.java
@@ -44,12 +44,20 @@ public class PluginConfig
public ProcessPluginLoader processPluginLoader()
{
Path processPluginDirectoryPath = propertiesConfig.getProcessPluginDirectory();
+ List explodedPluginDirectories = propertiesConfig.getExplodedPluginDirectories();
if (!Files.isDirectory(processPluginDirectoryPath))
throw new RuntimeException(
- "Process plug in directory '" + processPluginDirectoryPath.toString() + "' not readable");
+ "Process plugin directory '" + processPluginDirectoryPath.toString() + "' not readable");
- return new ProcessPluginLoaderImpl(processPluginFactories, processPluginDirectoryPath);
+ explodedPluginDirectories.stream().forEach(p ->
+ {
+ if (!Files.isDirectory(p))
+ throw new RuntimeException("Exploded process plugin directory '" + p.toString() + "' not readable");
+ });
+
+ return new ProcessPluginLoaderImpl(processPluginFactories, processPluginDirectoryPath,
+ explodedPluginDirectories);
}
@Bean
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PluginFactoryConfig.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PluginFactoryConfig.java
index 2fdba90c2..9d7465d66 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PluginFactoryConfig.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PluginFactoryConfig.java
@@ -44,7 +44,9 @@ public class PluginFactoryConfig extends AbstractConfig
@Bean
public ProcessPluginApiClassLoaderFactory pluginApiClassLoaderFactory()
{
- return new ProcessPluginApiClassLoaderFactory();
+ return new ProcessPluginApiClassLoaderFactory(propertiesConfig.getApiClassPathBaseDirectory(),
+ propertiesConfig.getApiAllowedBpeClasses(), propertiesConfig.getApiResourcesWithPriority(),
+ propertiesConfig.getApiAllowedBpeResources());
}
@Bean
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PropertiesConfig.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PropertiesConfig.java
index 0d87055a7..4f218797f 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PropertiesConfig.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/PropertiesConfig.java
@@ -4,9 +4,13 @@
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -30,6 +34,9 @@ public class PropertiesConfig implements InitializingBean
{
private static final Logger logger = LoggerFactory.getLogger(PropertiesConfig.class);
+ private static final String API_VERSION_PATTERN_STRING = "v([1-9]+[0-9]*)";
+ private static final Pattern API_VERSION_PATTERN = Pattern.compile(API_VERSION_PATTERN_STRING);
+
// documentation in dev.dsf.bpe.config.BpeDbMigratorConfig
@Value("${dev.dsf.bpe.db.url}")
private String dbUrl;
@@ -111,11 +118,11 @@ public class PropertiesConfig implements InitializingBean
private boolean webserviceClientLocalVerbose;
@Documentation(description = "Subscription to receive notifications about task resources from the DSF FHIR server")
- @Value("${dev.dsf.bpe.fhir.task.subscription.search.parameter:?criteria=Task%3Fstatus%3Drequested&status=active&type=websocket&payload=application/fhir%2Bjson}")
+ @Value("${dev.dsf.bpe.fhir.task.subscription.search.parameter:?criteria:exact=Task%3Fstatus%3Drequested&status=active&type=websocket&payload=application/fhir%2Bjson}")
private String taskSubscriptionSearchParameter;
@Documentation(description = "Subscription to receive notifications about questionnaire response resources from the DSF FHIR server")
- @Value("${dev.dsf.bpe.fhir.questionnaire.response.subscription.search.parameter:?criteria=QuestionnaireResponse%3Fstatus%3Dcompleted&status=active&type=websocket&payload=application/fhir%2Bjson}")
+ @Value("${dev.dsf.bpe.fhir.questionnaire.response.subscription.search.parameter:?criteria:exact=QuestionnaireResponse%3Fstatus%3Dcompleted&status=active&type=websocket&payload=application/fhir%2Bjson}")
private String questionnaireResponseSubscriptionSearchParameter;
@Documentation(description = "Number of retries until a websocket connection can be established with the DSF FHIR server, `-1` means infinite number of retries")
@@ -127,9 +134,32 @@ public class PropertiesConfig implements InitializingBean
private long websocketRetrySleepMillis;
@Documentation(description = "Directory containing the DSF BPE process plugins for deployment on startup of the DSF BPE server", recommendation = "Change only if you don't use the provided directory structure from the installation guide or made changes to tit")
- @Value("${dev.dsf.bpe.process.plugin.directroy:process}")
+ @Value("${dev.dsf.bpe.process.plugin.directory:process}")
private String processPluginDirectory;
+ @Documentation(description = "Directories containing exploded DSF BPE process plugins for deployment on startup of the DSF BPE server; comma or space separated list, YAML block scalars supported", recommendation = "Only for testing")
+ @Value("#{'${dev.dsf.bpe.process.plugin.exploded:}'.trim().split('(,[ ]?)|(\\n)')}")
+ private List explodedPluginDirectories;
+
+ @Documentation(description = "Directory containing the DSF BPE process plugin api jar files", recommendation = "Change only during development")
+ @Value("${dev.dsf.bpe.process.api.directory:api}")
+ private String apiClassPathBaseDirectory;
+
+ @Documentation(description = "Map with files containing qualified classs names allowed to be loaded by plugins for api versions; map key must match "
+ + API_VERSION_PATTERN_STRING, recommendation = "Change only during development", example = "{v1: 'some/example.file', v2: 'other.file'}")
+ @Value("#{${dev.dsf.bpe.process.api.allowed.bpe.classes:{:}}}")
+ private Map apiAllowedBpeClasses;
+
+ @Documentation(description = "Map with files containing api/plugin resource with priority over bpe resources for plugins for api versions; map key must match "
+ + API_VERSION_PATTERN_STRING, recommendation = "Change only during development", example = "{v1: 'some/example.file', v2: 'other.file'}")
+ @Value("#{${dev.dsf.bpe.process.api.resources.with.priority:{:}}}")
+ private Map apiResourcesWithPriority;
+
+ @Documentation(description = "Map with files containing resources allowed to be loaded by plugins for api versions; map key must match "
+ + API_VERSION_PATTERN_STRING, recommendation = "Change only during development", example = "{v1: 'some/example.file', v2: 'other.file'}")
+ @Value("#{${dev.dsf.bpe.process.api.allowed.bpe.resource:{:}}}")
+ private Map apiAllowedBpeResources;
+
@Documentation(description = "List of process names that should be excluded from deployment during startup of the DSF BPE server; comma or space separated list, YAML block scalars supported", recommendation = "Only deploy processes that can be started depending on your organization's roles in the Allow-List", example = "dsfdev_updateAllowList|1.0, another_process|x.y")
@Value("#{'${dev.dsf.bpe.process.excluded:}'.trim().split('(,[ ]?)|(\\n)')}")
private List processExcluded;
@@ -299,7 +329,7 @@ public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderCon
public void afterPropertiesSet() throws Exception
{
URL url = new URI(fhirServerBaseUrl).toURL();
- if (!Arrays.asList("http", "https").contains(url.getProtocol()))
+ if (!List.of("http", "https").contains(url.getProtocol()))
{
logger.warn("Invalid DSF FHIR server base URL: '{}', URL not starting with 'http://' or 'https://'",
fhirServerBaseUrl);
@@ -455,6 +485,63 @@ public Path getProcessPluginDirectory()
return Paths.get(processPluginDirectory);
}
+ public List getExplodedPluginDirectories()
+ {
+ return explodedPluginDirectories.stream().filter(s -> s != null && !s.isBlank()).map(Paths::get).toList();
+ }
+
+ public Path getApiClassPathBaseDirectory()
+ {
+ return Paths.get(apiClassPathBaseDirectory);
+ }
+
+ public Map getApiAllowedBpeClasses()
+ {
+ return apiAllowedBpeClasses.entrySet().stream().filter(this::hasVersionKeyAndNotBlankValue)
+ .collect(Collectors.toMap(this::toVersion, this::toPath));
+ }
+
+ public Map getApiAllowedBpeResources()
+ {
+ return apiAllowedBpeResources.entrySet().stream().filter(this::hasVersionKeyAndNotBlankValue)
+ .collect(Collectors.toMap(this::toVersion, this::toPath));
+ }
+
+ public Map getApiResourcesWithPriority()
+ {
+ return apiResourcesWithPriority.entrySet().stream().filter(this::hasVersionKeyAndNotBlankValue)
+ .collect(Collectors.toMap(this::toVersion, this::toPath));
+ }
+
+ private boolean hasVersionKeyAndNotBlankValue(Entry entry)
+ {
+ return toVersion(entry) > 0 && toPath(entry) != null;
+ }
+
+ private int toVersion(Entry entry)
+ {
+ if (entry == null || entry.getKey() == null || entry.getKey().isBlank())
+ return Integer.MIN_VALUE;
+
+ try
+ {
+ Matcher matcher = API_VERSION_PATTERN.matcher(entry.getKey());
+ return matcher.matches() ? Integer.parseInt(matcher.group(1)) : Integer.MIN_VALUE;
+ }
+ catch (NumberFormatException e)
+ {
+ return Integer.MIN_VALUE;
+ }
+ }
+
+ private Path toPath(Entry entry)
+ {
+ if (entry == null || entry.getValue() == null || entry.getValue().isBlank())
+ return null;
+ else
+ return Paths.get(entry.getValue());
+ }
+
public List getProcessExcluded()
{
return Collections.unmodifiableList(processExcluded);
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebserviceConfig.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebserviceConfig.java
index 81af32731..ee9d07b63 100755
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebserviceConfig.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/spring/config/WebserviceConfig.java
@@ -62,7 +62,7 @@ public RootService rootService()
@Bean
public StaticResourcesService staticResourcesService()
{
- return new StaticResourcesService(propertiesConfig.getStaticResourceCacheEnabled());
+ return new StaticResourcesService("/bpe", propertiesConfig.getStaticResourceCacheEnabled());
}
@Bean
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoaderImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoaderImpl.java
index 8acc74678..74a441465 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoaderImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/ExistingResourceLoaderImpl.java
@@ -3,7 +3,6 @@
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
-import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@@ -61,11 +60,11 @@ private boolean doReadExistingResources(Map> searchCriteria
Optional readLastEventTime = readLastEventTime();
readLastEventTime.ifPresent(lastEventTime -> queryParams.put(PARAM_LAST_UPDATED,
- Collections.singletonList("gt" + lastEventTime.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME))));
+ List.of("gt" + lastEventTime.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME))));
- queryParams.put(PARAM_COUNT, Collections.singletonList(String.valueOf(RESULT_PAGE_COUNT)));
- queryParams.put(PARAM_PAGE, Collections.singletonList("1"));
- queryParams.put(PARAM_SORT, Collections.singletonList(PARAM_LAST_UPDATED));
+ queryParams.put(PARAM_COUNT, List.of(String.valueOf(RESULT_PAGE_COUNT)));
+ queryParams.put(PARAM_PAGE, List.of("1"));
+ queryParams.put(PARAM_SORT, List.of(PARAM_LAST_UPDATED));
UriBuilder builder = UriBuilder.fromPath(resourceName);
queryParams.forEach((k, v) -> builder.replaceQueryParam(k, v.toArray()));
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/QuestionnaireResponseHandler.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/QuestionnaireResponseHandler.java
index aa965006d..e7eb69f54 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/QuestionnaireResponseHandler.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/QuestionnaireResponseHandler.java
@@ -11,6 +11,7 @@
import org.camunda.bpm.engine.repository.ProcessDefinition;
import org.camunda.bpm.engine.variable.value.PrimitiveValue;
import org.hl7.fhir.r4.model.QuestionnaireResponse;
+import org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus;
import org.hl7.fhir.r4.model.StringType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,6 +48,12 @@ public void afterPropertiesSet() throws Exception
@Override
public void onResource(QuestionnaireResponse questionnaireResponse)
{
+ Objects.requireNonNull(questionnaireResponse, "questionnaireResponse");
+
+ if (!QuestionnaireResponseStatus.COMPLETED.equals(questionnaireResponse.getStatus()))
+ throw new IllegalArgumentException(
+ "QuestionnaireResponse.status != " + QuestionnaireResponseStatus.COMPLETED.toCode());
+
try
{
List items = questionnaireResponse.getItem();
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskHandler.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskHandler.java
index bd6707cde..f30e46113 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskHandler.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/subscription/TaskHandler.java
@@ -1,7 +1,6 @@
package dev.dsf.bpe.subscription;
import java.util.Collection;
-import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@@ -30,6 +29,7 @@
import org.hl7.fhir.r4.model.StringType;
import org.hl7.fhir.r4.model.Task;
import org.hl7.fhir.r4.model.Task.ParameterComponent;
+import org.hl7.fhir.r4.model.Task.TaskStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
@@ -123,6 +123,9 @@ public void onResource(Task task)
Objects.requireNonNull(task, "task");
Objects.requireNonNull(task.getInstantiatesCanonical(), "task.instantiatesCanonical");
+ if (!TaskStatus.REQUESTED.equals(task.getStatus()))
+ throw new IllegalArgumentException("Task.status != " + TaskStatus.REQUESTED.toCode());
+
Matcher matcher = INSTANTIATES_CANONICAL_PATTERN.matcher(task.getInstantiatesCanonical());
if (!matcher.matches())
throw new IllegalStateException("InstantiatesCanonical of Task with id " + task.getIdElement().getIdPart()
@@ -262,7 +265,7 @@ protected void onMessage(String businessKey, String correlationKey, String proce
Objects.requireNonNull(processDefinitionId, "processDefinitionId");
if (variables == null)
- variables = Collections.emptyMap();
+ variables = Map.of();
if (businessKey == null)
{
@@ -283,7 +286,7 @@ protected void onMessage(String businessKey, String correlationKey, String proce
if (instances.size() + instancesWithAlternativeBusinessKey.size() <= 0)
{
BpmnModelInstance model = repositoryService.getBpmnModelInstance(processDefinitionId);
- Collection startEvents = model == null ? Collections.emptySet()
+ Collection startEvents = model == null ? List.of()
: model.getModelElementsByType(StartEvent.class);
Stream startEventMesssageNames = startEvents.stream().flatMap(e ->
{
diff --git a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/ui/ThymeleafTemplateServiceImpl.java b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/ui/ThymeleafTemplateServiceImpl.java
index 00abdace4..b4572c6d7 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/ui/ThymeleafTemplateServiceImpl.java
+++ b/dsf-bpe/dsf-bpe-server/src/main/java/dev/dsf/bpe/ui/ThymeleafTemplateServiceImpl.java
@@ -39,7 +39,7 @@ public ThymeleafTemplateServiceImpl(String serverBaseUrl, Theme theme, boolean c
ClassLoaderTemplateResolver resolver = new ClassLoaderTemplateResolver();
resolver.setTemplateMode(TemplateMode.HTML);
- resolver.setPrefix("/template/");
+ resolver.setPrefix("/bpe/template/");
resolver.setSuffix(".html");
resolver.setCacheable(cacheEnabled);
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/api/v1/allowed-bpe-classes.list b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v1/allowed-bpe-classes.list
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/api/v1/allowed-bpe-classes.list
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v1/allowed-bpe-classes.list
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/api/v1/allowed-bpe-resources.list b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v1/allowed-bpe-resources.list
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/api/v1/allowed-bpe-resources.list
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v1/allowed-bpe-resources.list
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/api/v1/api-resources-with-priority.list b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v1/resources-with-priority.list
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/api/v1/api-resources-with-priority.list
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v1/resources-with-priority.list
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/api/v2/allowed-bpe-classes.list b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v2/allowed-bpe-classes.list
similarity index 99%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/api/v2/allowed-bpe-classes.list
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v2/allowed-bpe-classes.list
index 8bc43a914..cc7c5203a 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/api/v2/allowed-bpe-classes.list
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v2/allowed-bpe-classes.list
@@ -82,6 +82,7 @@ org.camunda.bpm.engine.delegate.TaskListener
org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer
org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer
org.camunda.bpm.engine.impl.variable.serializer.ValueFields
+org.camunda.bpm.engine.variable.Variables
org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl
org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl
org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/api/v2/allowed-bpe-resources.list b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v2/allowed-bpe-resources.list
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/api/v2/allowed-bpe-resources.list
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v2/allowed-bpe-resources.list
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/api/v2/api-resources-with-priority.list b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v2/resources-with-priority.list
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/api/v2/api-resources-with-priority.list
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/api/v2/resources-with-priority.list
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/camunda/postgres_engine_7.19.0.sql b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/camunda/postgres_engine_7.19.0.sql
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/camunda/postgres_engine_7.19.0.sql
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/camunda/postgres_engine_7.19.0.sql
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/camunda/postgres_engine_7.19_to_7.20.sql b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/camunda/postgres_engine_7.19_to_7.20.sql
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/camunda/postgres_engine_7.19_to_7.20.sql
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/camunda/postgres_engine_7.19_to_7.20.sql
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/camunda/postgres_engine_7.20_to_7.21.sql b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/camunda/postgres_engine_7.20_to_7.21.sql
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/camunda/postgres_engine_7.20_to_7.21.sql
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/camunda/postgres_engine_7.20_to_7.21.sql
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/camunda/postgres_engine_7.21_to_7.22.sql b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/camunda/postgres_engine_7.21_to_7.22.sql
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/camunda/postgres_engine_7.21_to_7.22.sql
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/camunda/postgres_engine_7.21_to_7.22.sql
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/camunda/postgres_identity_7.19.0.sql b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/camunda/postgres_identity_7.19.0.sql
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/camunda/postgres_identity_7.19.0.sql
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/camunda/postgres_identity_7.19.0.sql
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.0.0.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.0.0.xml
similarity index 97%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.0.0.xml
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.0.0.xml
index 6e38c7c62..66a6b3fe7 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.0.0.xml
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.0.0.xml
@@ -3,10 +3,11 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
- http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
+ logicalFilePath="db/db.camunda_engine.changelog-1.0.0.xml">
-
+
GRANT ALL ON TABLE ACT_GE_SCHEMA_LOG TO ${db.liquibase_user};
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.3.0.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.3.0.xml
similarity index 68%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.3.0.xml
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.3.0.xml
index 969939545..aac5c759a 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.3.0.xml
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.3.0.xml
@@ -3,10 +3,11 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
- http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
+ logicalFilePath="db/db.camunda_engine.changelog-1.3.0.xml">
-
+
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.5.1.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.5.1.xml
similarity index 68%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.5.1.xml
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.5.1.xml
index 6994af46a..42cca0b36 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.5.1.xml
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.5.1.xml
@@ -3,10 +3,11 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
- http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
+ logicalFilePath="db/db.camunda_engine.changelog-1.5.1.xml">
-
+
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.6.0.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.6.0.xml
similarity index 68%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.6.0.xml
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.6.0.xml
index c6967db93..c73ac0b05 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_engine.changelog-1.6.0.xml
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_engine.changelog-1.6.0.xml
@@ -3,10 +3,11 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
- http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
+ logicalFilePath="db/db.camunda_engine.changelog-1.6.0.xml">
-
+
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_identity.changelog-1.0.0.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_identity.changelog-1.0.0.xml
similarity index 88%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_identity.changelog-1.0.0.xml
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_identity.changelog-1.0.0.xml
index 0757f226a..d45b6ebc9 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.camunda_identity.changelog-1.0.0.xml
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.camunda_identity.changelog-1.0.0.xml
@@ -3,10 +3,11 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
- http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
+ logicalFilePath="db/db.camunda_identity.changelog-1.0.0.xml">
-
+
GRANT ALL ON TABLE ACT_ID_GROUP TO ${db.liquibase_user};
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.changelog.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.changelog.xml
new file mode 100644
index 000000000..bb4745933
--- /dev/null
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.changelog.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.create-db-users.changelog-1.0.0.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.create-db-users.changelog-1.0.0.xml
similarity index 94%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/db.create-db-users.changelog-1.0.0.xml
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.create-db-users.changelog-1.0.0.xml
index f77af3433..ed94d3759 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.create-db-users.changelog-1.0.0.xml
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.create-db-users.changelog-1.0.0.xml
@@ -2,7 +2,8 @@
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
+ logicalFilePath="db/db.create-db-users.changelog-1.0.0.xml">
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.last_event.changelog-1.0.0.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.last_event.changelog-1.0.0.xml
similarity index 92%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/db.last_event.changelog-1.0.0.xml
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.last_event.changelog-1.0.0.xml
index 23d272109..70353128f 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.last_event.changelog-1.0.0.xml
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.last_event.changelog-1.0.0.xml
@@ -3,7 +3,8 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
- http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
+ logicalFilePath="db/db.last_event.changelog-1.0.0.xml">
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.process_plugin_resources.changelog-1.0.0.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.process_plugin_resources.changelog-1.0.0.xml
similarity index 96%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/db.process_plugin_resources.changelog-1.0.0.xml
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.process_plugin_resources.changelog-1.0.0.xml
index 9bbf67178..f4c4a9de7 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.process_plugin_resources.changelog-1.0.0.xml
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.process_plugin_resources.changelog-1.0.0.xml
@@ -3,7 +3,8 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
- http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
+ logicalFilePath="db/db.process_plugin_resources.changelog-1.0.0.xml">
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.process_states.changelog-1.0.0.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.process_states.changelog-1.0.0.xml
similarity index 92%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/db/db.process_states.changelog-1.0.0.xml
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.process_states.changelog-1.0.0.xml
index 52eb4d243..6f5098f71 100644
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.process_states.changelog-1.0.0.xml
+++ b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/db/db.process_states.changelog-1.0.0.xml
@@ -3,7 +3,8 @@
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
- http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
+ http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
+ logicalFilePath="db/db.process_states.changelog-1.0.0.xml">
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/static/bpmn-viewer-dev.js b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/bpmn-viewer-dev.js
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/static/bpmn-viewer-dev.js
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/bpmn-viewer-dev.js
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/static/bpmn-viewer-prod.js b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/bpmn-viewer-prod.js
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/static/bpmn-viewer-prod.js
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/bpmn-viewer-prod.js
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/static/bpmn-viewer.css b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/bpmn-viewer.css
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/static/bpmn-viewer.css
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/bpmn-viewer.css
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/static/bpmn.js b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/bpmn.js
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/static/bpmn.js
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/bpmn.js
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/static/dsf.css b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/dsf.css
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/static/dsf.css
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/dsf.css
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/static/favicon.svg b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/favicon.svg
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/static/favicon.svg
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/favicon.svg
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/static/favicon_32x32.png b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/favicon_32x32.png
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/static/favicon_32x32.png
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/favicon_32x32.png
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/static/favicon_96x96.png b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/favicon_96x96.png
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/static/favicon_96x96.png
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/favicon_96x96.png
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/static/logo.svg b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/logo.svg
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/static/logo.svg
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/logo.svg
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/static/main.js b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/main.js
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/static/main.js
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/static/main.js
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/template/Process.html b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/template/Process.html
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/template/Process.html
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/template/Process.html
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/template/main.html b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/template/main.html
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/template/main.html
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/template/main.html
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/template/root.html b/dsf-bpe/dsf-bpe-server/src/main/resources/bpe/template/root.html
similarity index 100%
rename from dsf-bpe/dsf-bpe-server/src/main/resources/template/root.html
rename to dsf-bpe/dsf-bpe-server/src/main/resources/bpe/template/root.html
diff --git a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.changelog.xml b/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.changelog.xml
deleted file mode 100644
index 865d2bd97..000000000
--- a/dsf-bpe/dsf-bpe-server/src/main/resources/db/db.changelog.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/dao/AbstractDaoTest.java b/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/dao/AbstractDaoTest.java
index 6d0158a9a..5cc1dc54e 100644
--- a/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/dao/AbstractDaoTest.java
+++ b/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/dao/AbstractDaoTest.java
@@ -1,5 +1,7 @@
package dev.dsf.bpe.dao;
+import javax.sql.DataSource;
+
import org.apache.commons.dbcp2.BasicDataSource;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -14,13 +16,13 @@ public class AbstractDaoTest extends AbstractDbTest
{
public static final String DAO_DB_TEMPLATE_NAME = "dao_template";
- protected static BasicDataSource defaultDataSource;
- protected static BasicDataSource camundaDataSource;
+ protected static DataSource defaultDataSource;
+ protected static DataSource camundaDataSource;
@ClassRule
public static final PostgreSqlContainerLiquibaseTemplateClassRule liquibaseRule = new PostgreSqlContainerLiquibaseTemplateClassRule(
- DockerImageName.parse("postgres:15"), ROOT_USER, "bpe", "bpe_template", CHANGE_LOG_FILE,
- CHANGE_LOG_PARAMETERS, true);
+ DockerImageName.parse("postgres:15"), ROOT_USER, "bpe", "bpe_template", BPE_CHANGE_LOG_FILE,
+ BPE_CHANGE_LOG_PARAMETERS, true);
@Rule
public final PostgresTemplateRule templateRule = new PostgresTemplateRule(liquibaseRule);
@@ -28,22 +30,22 @@ public class AbstractDaoTest extends AbstractDbTest
@BeforeClass
public static void beforeClass() throws Exception
{
- defaultDataSource = createDefaultDataSource(liquibaseRule.getHost(), liquibaseRule.getMappedPort(5432),
+ defaultDataSource = createBpeDefaultDataSource(liquibaseRule.getHost(), liquibaseRule.getMappedPort(5432),
liquibaseRule.getDatabaseName());
- defaultDataSource.start();
+ defaultDataSource.unwrap(BasicDataSource.class).start();
- camundaDataSource = createCamundaDataSource(liquibaseRule.getHost(), liquibaseRule.getMappedPort(5432),
+ camundaDataSource = createBpeCamundaDataSource(liquibaseRule.getHost(), liquibaseRule.getMappedPort(5432),
liquibaseRule.getDatabaseName());
- camundaDataSource.start();
+ camundaDataSource.unwrap(BasicDataSource.class).start();
}
@AfterClass
public static void afterClass() throws Exception
{
if (defaultDataSource != null)
- defaultDataSource.close();
+ defaultDataSource.unwrap(BasicDataSource.class).close();
if (camundaDataSource != null)
- camundaDataSource.close();
+ camundaDataSource.unwrap(BasicDataSource.class).close();
}
}
diff --git a/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/dao/AbstractDbTest.java b/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/dao/AbstractDbTest.java
index a2f9b8f9e..7909145b2 100644
--- a/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/dao/AbstractDbTest.java
+++ b/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/dao/AbstractDbTest.java
@@ -2,10 +2,14 @@
import java.util.Map;
+import javax.sql.DataSource;
+
import org.apache.commons.dbcp2.BasicDataSource;
import org.postgresql.Driver;
import org.slf4j.bridge.SLF4JBridgeHandler;
+import dev.dsf.common.db.DataSourceWithLogger;
+
public abstract class AbstractDbTest
{
static
@@ -14,50 +18,99 @@ public abstract class AbstractDbTest
SLF4JBridgeHandler.install();
}
- protected static final String CHANGE_LOG_FILE = "db/db.changelog.xml";
+ protected static final boolean LOG_DB_STATEMENTS = true;
+
+ protected static final String BPE_CHANGE_LOG_FILE = "bpe/db/db.changelog.xml";
+
+ protected static final String BPE_DATABASE_USERS_GROUP = "server_users_group";
+ protected static final String BPE_DATABASE_USER = "server_user";
+ protected static final String BPE_DATABASE_USER_PASSWORD = "server_user_password";
- protected static final String DATABASE_USERS_GROUP = "server_users_group";
- protected static final String DATABASE_USER = "server_user";
- protected static final String DATABASE_USER_PASSWORD = "server_user_password";
+ protected static final String BPE_DATABASE_CAMUNDA_USERS_GROUP = "camunda_users_group";
+ protected static final String BPE_DATABASE_CAMUNDA_USER = "camunda_user";
+ protected static final String BPE_DATABASE_CAMUNDA_USER_PASSWORD = "camunda_user_password";
- protected static final String DATABASE_CAMUNDA_USERS_GROUP = "camunda_users_group";
- protected static final String DATABASE_CAMUNDA_USER = "camunda_user";
- protected static final String DATABASE_CAMUNDA_USER_PASSWORD = "camunda_user_password";
+ protected static final String FHIR_CHANGE_LOG_FILE = "fhir/db/db.changelog.xml";
+
+ protected static final String FHIR_DATABASE_USERS_GROUP = "server_users_group";
+ protected static final String FHIR_DATABASE_USER = "server_user";
+ protected static final String FHIR_DATABASE_USER_PASSWORD = "server_user_password";
+
+ protected static final String FHIR_DATABASE_DELETE_USERS_GROUP = "server_permanent_delete_users_group";
+ protected static final String FHIR_DATABASE_DELETE_USER = "server_permanent_delete_user";
+ protected static final String FHIR_DATABASE_DELETE_USER_PASSWORD = "server_permanent_delete_user_password";
protected static final String ROOT_USER = "postgres";
- protected static final Map CHANGE_LOG_PARAMETERS = Map.of("db.liquibase_user", ROOT_USER,
- "db.server_users_group", DATABASE_USERS_GROUP, "db.server_user", DATABASE_USER, "db.server_user_password",
- DATABASE_USER_PASSWORD, "db.camunda_users_group", DATABASE_CAMUNDA_USERS_GROUP, "db.camunda_user",
- DATABASE_CAMUNDA_USER, "db.camunda_user_password", DATABASE_CAMUNDA_USER_PASSWORD);
+ protected static final Map BPE_CHANGE_LOG_PARAMETERS = Map.of("db.liquibase_user", ROOT_USER,
+ "db.server_users_group", BPE_DATABASE_USERS_GROUP, "db.server_user", BPE_DATABASE_USER,
+ "db.server_user_password", BPE_DATABASE_USER_PASSWORD, "db.camunda_users_group",
+ BPE_DATABASE_CAMUNDA_USERS_GROUP, "db.camunda_user", BPE_DATABASE_CAMUNDA_USER, "db.camunda_user_password",
+ BPE_DATABASE_CAMUNDA_USER_PASSWORD);
+
+ protected static final Map FHIR_CHANGE_LOG_PARAMETERS = Map.of("db.liquibase_user", ROOT_USER,
+ "db.server_users_group", FHIR_DATABASE_USERS_GROUP, "db.server_user", FHIR_DATABASE_USER,
+ "db.server_user_password", FHIR_DATABASE_USER_PASSWORD, "db.server_permanent_delete_users_group",
+ FHIR_DATABASE_DELETE_USERS_GROUP, "db.server_permanent_delete_user", FHIR_DATABASE_DELETE_USER,
+ "db.server_permanent_delete_user_password", FHIR_DATABASE_DELETE_USER_PASSWORD);
+
+ public static DataSource createBpeDefaultDataSource(String host, int port, String databaseName)
+ {
+ BasicDataSource dataSource = new BasicDataSource();
+ dataSource.setDriverClassName(Driver.class.getName());
+ dataSource.setUrl("jdbc:postgresql://" + host + ":" + port + "/" + databaseName);
+ dataSource.setUsername(BPE_DATABASE_USER);
+ dataSource.setPassword(BPE_DATABASE_USER_PASSWORD);
+ dataSource.setDefaultReadOnly(true);
+
+ dataSource.setTestOnBorrow(true);
+ dataSource.setValidationQuery("SELECT 1");
+
+ return new DataSourceWithLogger(LOG_DB_STATEMENTS, dataSource);
+ }
+
+ public static DataSource createBpeCamundaDataSource(String host, int port, String databaseName)
+ {
+ BasicDataSource dataSource = new BasicDataSource();
+ dataSource.setDriverClassName(Driver.class.getName());
+ dataSource.setUrl("jdbc:postgresql://" + host + ":" + port + "/" + databaseName);
+ dataSource.setUsername(BPE_DATABASE_CAMUNDA_USER);
+ dataSource.setPassword(BPE_DATABASE_CAMUNDA_USER_PASSWORD);
+ dataSource.setDefaultReadOnly(true);
+
+ dataSource.setTestOnBorrow(true);
+ dataSource.setValidationQuery("SELECT 1");
+
+ return new DataSourceWithLogger(LOG_DB_STATEMENTS, dataSource);
+ }
- public static BasicDataSource createDefaultDataSource(String host, int port, String databaseName)
+ public static DataSource createFhirDefaultDataSource(String host, int port, String databaseName)
{
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(Driver.class.getName());
dataSource.setUrl("jdbc:postgresql://" + host + ":" + port + "/" + databaseName);
- dataSource.setUsername(DATABASE_USER);
- dataSource.setPassword(DATABASE_USER_PASSWORD);
+ dataSource.setUsername(FHIR_DATABASE_USER);
+ dataSource.setPassword(FHIR_DATABASE_USER_PASSWORD);
dataSource.setDefaultReadOnly(true);
dataSource.setTestOnBorrow(true);
dataSource.setValidationQuery("SELECT 1");
- return dataSource;
+ return new DataSourceWithLogger(LOG_DB_STATEMENTS, dataSource);
}
- public static BasicDataSource createCamundaDataSource(String host, int port, String databaseName)
+ public static DataSource createFhirPermanentDeleteDataSource(String host, int port, String databaseName)
{
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(Driver.class.getName());
dataSource.setUrl("jdbc:postgresql://" + host + ":" + port + "/" + databaseName);
- dataSource.setUsername(DATABASE_CAMUNDA_USER);
- dataSource.setPassword(DATABASE_CAMUNDA_USER_PASSWORD);
+ dataSource.setUsername(FHIR_DATABASE_DELETE_USER);
+ dataSource.setPassword(FHIR_DATABASE_DELETE_USER_PASSWORD);
dataSource.setDefaultReadOnly(true);
dataSource.setTestOnBorrow(true);
dataSource.setValidationQuery("SELECT 1");
- return dataSource;
+ return new DataSourceWithLogger(LOG_DB_STATEMENTS, dataSource);
}
}
diff --git a/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractIntegrationTest.java b/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractIntegrationTest.java
new file mode 100644
index 000000000..28fc0ce73
--- /dev/null
+++ b/dsf-bpe/dsf-bpe-server/src/test/java/dev/dsf/bpe/integration/AbstractIntegrationTest.java
@@ -0,0 +1,556 @@
+package dev.dsf.bpe.integration;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.net.URI;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.security.KeyStore;
+import java.security.PrivateKey;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+import javax.sql.DataSource;
+
+import org.apache.commons.dbcp2.BasicDataSource;
+import org.eclipse.jetty.ee10.servlet.SessionHandler;
+import org.eclipse.jetty.ee10.webapp.WebAppContext;
+import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer;
+import org.eclipse.jetty.security.SecurityHandler;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.server.ServerConnector;
+import org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.Endpoint;
+import org.hl7.fhir.r4.model.Extension;
+import org.hl7.fhir.r4.model.Organization;
+import org.hl7.fhir.r4.model.StringType;
+import org.hl7.fhir.r4.model.Subscription;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.SpringServletContainerInitializer;
+import org.testcontainers.utility.DockerImageName;
+
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.parser.IParser;
+import de.hsheilbronn.mi.utils.test.PostgreSqlContainerLiquibaseTemplateClassRule;
+import de.hsheilbronn.mi.utils.test.PostgresTemplateRule;
+import de.rwh.utils.crypto.CertificateHelper;
+import de.rwh.utils.crypto.io.CertificateReader;
+import de.rwh.utils.crypto.io.PemIo;
+import dev.dsf.bpe.dao.AbstractDbTest;
+import dev.dsf.bpe.integration.X509Certificates.ClientCertificate;
+import dev.dsf.common.auth.ClientCertificateAuthenticator;
+import dev.dsf.common.auth.DelegatingAuthenticator;
+import dev.dsf.common.auth.DsfLoginService;
+import dev.dsf.common.auth.DsfSecurityHandler;
+import dev.dsf.common.auth.StatusPortAuthenticator;
+import dev.dsf.common.jetty.JettyServer;
+import dev.dsf.fhir.client.FhirWebserviceClient;
+import dev.dsf.fhir.client.FhirWebserviceClientJersey;
+import dev.dsf.fhir.client.WebsocketClient;
+import dev.dsf.fhir.client.WebsocketClientTyrus;
+import dev.dsf.fhir.service.ReferenceCleaner;
+import dev.dsf.fhir.service.ReferenceCleanerImpl;
+import dev.dsf.fhir.service.ReferenceExtractorImpl;
+import jakarta.servlet.ServletContainerInitializer;
+
+public abstract class AbstractIntegrationTest extends AbstractDbTest
+{
+ @ClassRule
+ public static final X509Certificates certificates = new X509Certificates();
+
+ protected static DataSource fhirDefaultDataSource;
+ protected static DataSource bpeDefaultDataSource;
+
+ @ClassRule
+ public static final PostgreSqlContainerLiquibaseTemplateClassRule bpeLiquibaseRule = new PostgreSqlContainerLiquibaseTemplateClassRule(
+ DockerImageName.parse("postgres:15"), ROOT_USER, "bpe", "bpe_template", BPE_CHANGE_LOG_FILE,
+ BPE_CHANGE_LOG_PARAMETERS, false);
+
+ @Rule
+ public final PostgresTemplateRule bpeTemplateRule = new PostgresTemplateRule(bpeLiquibaseRule);
+
+ @ClassRule
+ public static final PostgreSqlContainerLiquibaseTemplateClassRule fhirLiquibaseRule = new PostgreSqlContainerLiquibaseTemplateClassRule(
+ DockerImageName.parse("postgres:15"), ROOT_USER, "fhir", "fhir_template", FHIR_CHANGE_LOG_FILE,
+ FHIR_CHANGE_LOG_PARAMETERS, false);
+
+ @Rule
+ public final PostgresTemplateRule fhirTemplateRule = new PostgresTemplateRule(fhirLiquibaseRule);
+
+ @Rule
+ public final TestNameLoggerRule testNameLoggerRule = new TestNameLoggerRule();
+
+ private static final Logger logger = LoggerFactory.getLogger(AbstractIntegrationTest.class);
+
+ protected static final String FHIR_CONTEXT_PATH = "/fhir";
+ protected static final String BPE_CONTEXT_PATH = "/bpe";
+
+ private static final Path EMPTY_PROCESS_DIRECTORY = Paths.get("target", UUID.randomUUID().toString());
+ private static final List DIRECTORIES_TO_DELETE = List.of(EMPTY_PROCESS_DIRECTORY);
+
+ private static final Path FHIR_BUNDLE_FILE = Paths.get("target", UUID.randomUUID().toString() + ".xml");
+ private static final Path ALLOWED_BPE_CLASSES_LIST_FILE_V1 = Paths.get("target",
+ UUID.randomUUID().toString() + ".list");
+ private static final Path ALLOWED_BPE_CLASSES_LIST_FILE_V2 = Paths.get("target",
+ UUID.randomUUID().toString() + ".list");
+ private static final List FILES_TO_DELETE = List.of(FHIR_BUNDLE_FILE, ALLOWED_BPE_CLASSES_LIST_FILE_V1,
+ ALLOWED_BPE_CLASSES_LIST_FILE_V2);
+
+ protected static final FhirContext fhirContext = FhirContext.forR4();
+
+ private static final ReferenceCleaner referenceCleaner = new ReferenceCleanerImpl(new ReferenceExtractorImpl());
+
+ private static JettyServer fhirServer;
+ private static FhirWebserviceClient webserviceClient;
+ private static JettyServer bpeServer;
+
+ @BeforeClass
+ public static void beforeClass() throws Exception
+ {
+ fhirDefaultDataSource = createFhirDefaultDataSource(fhirLiquibaseRule.getHost(),
+ fhirLiquibaseRule.getMappedPort(5432), fhirLiquibaseRule.getDatabaseName());
+ fhirDefaultDataSource.unwrap(BasicDataSource.class).start();
+
+ ServerSocketChannel fhirStatusConnectorChannel = JettyServer.serverSocketChannel("127.0.0.1");
+ ServerSocketChannel fhirApiConnectorChannel = JettyServer.serverSocketChannel("127.0.0.1");
+
+ logger.info("Creating FHIR Bundle ...");
+ createTestBundle(certificates.getClientCertificate(), certificates.getExternalClientCertificate(),
+ fhirApiConnectorChannel.socket().getLocalPort());
+
+ String fhirBaseUrl = "https://localhost:" + fhirApiConnectorChannel.socket().getLocalPort() + FHIR_CONTEXT_PATH;
+
+ logger.info("Creating webservice client ...");
+ webserviceClient = createWebserviceClient(fhirBaseUrl, certificates.getClientCertificate().getTrustStore(),
+ certificates.getClientCertificate().getKeyStore(),
+ certificates.getClientCertificate().getKeyStorePassword(), fhirContext, referenceCleaner);
+
+ logger.info("Starting FHIR Server ...");
+ fhirServer = startFhirServer(fhirStatusConnectorChannel, fhirApiConnectorChannel, fhirBaseUrl);
+
+ // --- bpe ---
+
+ // allowed bpe classes override to enable access to classes from dsf-bpe-test-plugin module for v1 test plugins
+ List allowedBpeClassesV1 = readListFile(
+ Paths.get("src/main/resources/bpe/api/v1/allowed-bpe-classes.list"));
+ allowedBpeClassesV1.add("dev.dsf.bpe.test.PluginTest");
+ allowedBpeClassesV1.add("dev.dsf.bpe.test.PluginTestExecutor");
+ writeListFile(ALLOWED_BPE_CLASSES_LIST_FILE_V1, allowedBpeClassesV1);
+
+ // allowed bpe classes override to enable access to classes from dsf-bpe-test-plugin module for v2 test plugins
+ List allowedBpeClassesV2 = readListFile(
+ Paths.get("src/main/resources/bpe/api/v2/allowed-bpe-classes.list"));
+ allowedBpeClassesV2.add("dev.dsf.bpe.test.PluginTest");
+ allowedBpeClassesV2.add("dev.dsf.bpe.test.PluginTestExecutor");
+ writeListFile(ALLOWED_BPE_CLASSES_LIST_FILE_V2, allowedBpeClassesV2);
+
+ bpeDefaultDataSource = createBpeDefaultDataSource(bpeLiquibaseRule.getHost(),
+ bpeLiquibaseRule.getMappedPort(5432), bpeLiquibaseRule.getDatabaseName());
+ bpeDefaultDataSource.unwrap(BasicDataSource.class).start();
+
+ ServerSocketChannel bpeStatusConnectorChannel = JettyServer.serverSocketChannel("127.0.0.1");
+ ServerSocketChannel bpeApiConnectorChannel = JettyServer.serverSocketChannel("127.0.0.1");
+
+ String bpeBaseUrl = "https://localhost:" + bpeApiConnectorChannel.socket().getLocalPort() + BPE_CONTEXT_PATH;
+
+ Files.createDirectories(EMPTY_PROCESS_DIRECTORY);
+
+ logger.info("Starting BPE Server ...");
+ bpeServer = startBpeServer(bpeStatusConnectorChannel, bpeApiConnectorChannel, bpeBaseUrl, fhirBaseUrl);
+
+ logger.info("Creating FHIR template database ...");
+ fhirLiquibaseRule.createTemplateDatabase();
+
+ logger.info("Creating BPE template database ...");
+ bpeLiquibaseRule.createTemplateDatabase();
+
+ // wait for bpe to fhir websocket connections
+ Thread.sleep(Duration.ofSeconds(1));
+ }
+
+ private static FhirWebserviceClient createWebserviceClient(String fhirBaseUrl, KeyStore trustStore,
+ KeyStore keyStore, char[] keyStorePassword, FhirContext fhirContext, ReferenceCleaner referenceCleaner)
+ {
+ return new FhirWebserviceClientJersey(fhirBaseUrl, trustStore, keyStore, keyStorePassword, null, null, null,
+ null, 0, 0, false, "DSF Integration Test Client", fhirContext, referenceCleaner);
+ }
+
+ protected static FhirWebserviceClient getWebserviceClient()
+ {
+ return webserviceClient;
+ }
+
+ protected static WebsocketClient getWebsocketClient()
+ {
+ Bundle bundle = getWebserviceClient().searchWithStrictHandling(Subscription.class,
+ Map.of("criteria:exact", List.of("Task"), "status", List.of("active"), "type", List.of("websocket"),
+ "payload", List.of("application/fhir+json")));
+
+ assertNotNull(bundle);
+ assertEquals(1, bundle.getTotal());
+ assertNotNull(bundle.getEntryFirstRep());
+ assertTrue(bundle.getEntryFirstRep().getResource() instanceof Subscription);
+
+ Subscription subscription = (Subscription) bundle.getEntryFirstRep().getResource();
+ assertNotNull(subscription.getIdElement());
+ assertNotNull(subscription.getIdElement().getIdPart());
+
+ return createWebsocketClient(fhirServer.getApiPort(), certificates.getClientCertificate().getTrustStore(),
+ certificates.getClientCertificate().getKeyStore(),
+ certificates.getClientCertificate().getKeyStorePassword(), subscription.getIdElement().getIdPart());
+ }
+
+ private static WebsocketClient createWebsocketClient(int fhirApiPort, KeyStore trustStore, KeyStore keyStore,
+ char[] keyStorePassword, String subscriptionIdPart)
+ {
+ return new WebsocketClientTyrus(() ->
+ {}, URI.create("wss://localhost:" + fhirApiPort + FHIR_CONTEXT_PATH + "/ws"), trustStore, keyStore,
+ keyStorePassword, null, null, null, "Integration Test Client", subscriptionIdPart);
+ }
+
+ protected static IParser newXmlParser()
+ {
+ return newParser(fhirContext::newXmlParser);
+ }
+
+ protected static IParser newJsonParser()
+ {
+ return newParser(fhirContext::newJsonParser);
+ }
+
+ private static IParser newParser(Supplier supplier)
+ {
+ IParser p = supplier.get();
+ p.setStripVersionsFromReferences(false);
+ p.setOverrideResourceIdWithBundleEntryFullUrl(false);
+ p.setPrettyPrint(true);
+ return p;
+ }
+
+ private static void createTestBundle(ClientCertificate clientCertificate,
+ ClientCertificate externalClientCertificate, int fhirApiPort)
+ {
+ Path testBundleTemplateFile = Paths.get("src/test/resources/integration/test-bundle.xml");
+
+ Bundle testBundle = readBundle(testBundleTemplateFile, newXmlParser());
+
+ Organization organization = (Organization) testBundle.getEntry().get(0).getResource();
+ Extension thumbprintExtension = organization
+ .getExtensionByUrl("http://dsf.dev/fhir/StructureDefinition/extension-certificate-thumbprint");
+ thumbprintExtension.setValue(new StringType(clientCertificate.getCertificateSha512ThumbprintHex()));
+
+ Endpoint endpoint = (Endpoint) testBundle.getEntry().get(1).getResource();
+ endpoint.setAddress("https://localhost:" + fhirApiPort + "/fhir");
+
+ Organization externalOrganization = (Organization) testBundle.getEntry().get(2).getResource();
+ Extension externalThumbprintExtension = externalOrganization
+ .getExtensionByUrl("http://dsf.dev/fhir/StructureDefinition/extension-certificate-thumbprint");
+ externalThumbprintExtension
+ .setValue(new StringType(externalClientCertificate.getCertificateSha512ThumbprintHex()));
+
+ writeBundle(FHIR_BUNDLE_FILE, testBundle);
+ }
+
+ private static Bundle readBundle(Path bundleTemplateFile, IParser parser)
+ {
+ try (InputStream in = Files.newInputStream(bundleTemplateFile))
+ {
+ Bundle bundle = parser.parseResource(Bundle.class, in);
+ return referenceCleaner.cleanReferenceResourcesIfBundle(bundle);
+ }
+ catch (IOException e)
+ {
+ logger.error("Error while reading bundle from {}", bundleTemplateFile.toString(), e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static void writeBundle(Path bundleFile, Bundle bundle)
+ {
+ try (OutputStream out = Files.newOutputStream(bundleFile);
+ OutputStreamWriter writer = new OutputStreamWriter(out))
+ {
+ newXmlParser().encodeResourceToWriter(bundle, writer);
+ }
+ catch (IOException e)
+ {
+ logger.error("Error while writing bundle to {}", bundleFile.toString(), e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static JettyServer startFhirServer(ServerSocketChannel statusConnectorChannel,
+ ServerSocketChannel apiConnectorChannel, String baseUrl) throws Exception
+ {
+ Map