diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml
index 8d513d6a..d1cdb9f9 100644
--- a/.github/workflows/maven-build.yml
+++ b/.github/workflows/maven-build.yml
@@ -19,4 +19,4 @@ jobs:
- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: mvn -B verify --file pom.xml
+ run: mvn -B verify -fae --file pom.xml
diff --git a/dsf-bpe-process-feasibility/pom.xml b/dsf-bpe-process-feasibility/pom.xml
index 65588dbb..7c54622c 100644
--- a/dsf-bpe-process-feasibility/pom.xml
+++ b/dsf-bpe-process-feasibility/pom.xml
@@ -8,8 +8,13 @@
dsf-bpe-highmed-processes-pom
org.highmed.dsf
- 0.4.1
+ 0.5.0
+
+
+ ${project.basedir}/..
+ ../../highmed-dsf
+
@@ -64,7 +69,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup/bpe/process
@@ -81,7 +86,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process
@@ -98,7 +103,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process
@@ -115,7 +120,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process
@@ -132,7 +137,79 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic1
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic2
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic3
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/ttp
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process
+
@@ -143,35 +220,63 @@
- ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process
${project.artifactId}-${project.version}.jar
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java
index d3cb1f28..ebf11c54 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java
@@ -36,22 +36,22 @@ public interface ConstantsFeasibility
String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-request-feasibility";
String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestFeasibility/";
- String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION =
- PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI + VERSION;
+ String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI
+ + VERSION;
String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME = "requestFeasibilityMessage";
String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "localServicesIntegration/";
String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-execute-feasibility";
String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "executeFeasibility/";
- String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION =
- PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI + VERSION;
+ String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI
+ + VERSION;
String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MESSAGE_NAME = "executeFeasibilityMessage";
String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-compute-feasibility";
String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "computeFeasibility/";
- String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION =
- PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI + VERSION;
+ String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI
+ + VERSION;
String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_MESSAGE_NAME = "computeFeasibilityMessage";
String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility";
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java
index e13f7745..8bd27bbe 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java
@@ -13,12 +13,13 @@
import org.highmed.dsf.fhir.resources.ResourceProvider;
import org.highmed.dsf.fhir.resources.StructureDefinitionResource;
import org.highmed.dsf.fhir.resources.ValueSetResource;
+import org.springframework.core.env.PropertyResolver;
import ca.uhn.fhir.context.FhirContext;
public class FeasibilityProcessPluginDefinition implements ProcessPluginDefinition
{
- public static final String VERSION = "0.4.1";
+ public static final String VERSION = "0.5.0";
@Override
public String getName()
@@ -45,7 +46,8 @@ public Stream> getSpringConfigClasses()
}
@Override
- public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader)
+ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader,
+ PropertyResolver resolver)
{
var aCom = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-computeFeasibility.xml");
var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeFeasibility.xml");
@@ -65,12 +67,11 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader
var vF = ValueSetResource.file("fhir/ValueSet/highmed-feasibility.xml");
Map> resourcesByProcessKeyAndVersion = Map.of(
- "computeFeasibility/" + VERSION, Arrays.asList(aCom, cF, sTCom, sTResS, vF),
- "executeFeasibility/" + VERSION, Arrays.asList(aExe, cF, sTExe, vF),
- "requestFeasibility/" + VERSION, Arrays.asList(aReq, cF, sTReq, sTResM, sTErr, vF));
+ "highmedorg_computeFeasibility/" + VERSION, Arrays.asList(aCom, cF, sTCom, sTResS, vF),
+ "highmedorg_executeFeasibility/" + VERSION, Arrays.asList(aExe, cF, sTExe, vF),
+ "highmedorg_requestFeasibility/" + VERSION, Arrays.asList(aReq, cF, sTReq, sTResM, sTErr, vF));
- return ResourceProvider
- .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader,
- resourcesByProcessKeyAndVersion);
+ return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false),
+ classLoader, resolver, resourcesByProcessKeyAndVersion);
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java
index efd4d718..83c00837 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java
@@ -14,6 +14,7 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.variables.BloomFilterConfig;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.AbstractTaskMessageSend;
@@ -28,9 +29,9 @@
public class SendMedicRequest extends AbstractTaskMessageSend
{
public SendMedicRequest(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider, FhirContext fhirContext)
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext)
{
- super(clientProvider, taskHelper, organizationProvider, fhirContext);
+ super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
@Override
@@ -45,14 +46,12 @@ protected Stream getAdditionalInputParameters(DelegateExecut
new Reference().setReference(researchStudyId.toVersionless().getValueAsString()));
boolean needsConsentCheck = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK);
- ParameterComponent inputNeedsConsentCheck = getTaskHelper()
- .createInput(CODESYSTEM_HIGHMED_FEASIBILITY, CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK,
- needsConsentCheck);
+ ParameterComponent inputNeedsConsentCheck = getTaskHelper().createInput(CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck);
boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE);
- ParameterComponent inputNeedsRecordLinkage = getTaskHelper()
- .createInput(CODESYSTEM_HIGHMED_FEASIBILITY, CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE,
- needsRecordLinkage);
+ ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage);
if (needsRecordLinkage)
{
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java
index 999e44dc..dc996bf4 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java
@@ -6,6 +6,7 @@
import java.util.stream.Stream;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.AbstractTaskMessageSend;
@@ -20,9 +21,9 @@
public class SendMultiMedicErrors extends AbstractTaskMessageSend
{
public SendMultiMedicErrors(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider, FhirContext fhirContext)
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext)
{
- super(clientProvider, taskHelper, organizationProvider, fhirContext);
+ super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
@Override
@@ -30,13 +31,13 @@ protected Stream getAdditionalInputParameters(DelegateExecut
{
Task task = getLeadingTaskFromExecutionVariables();
- String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task" , task.getIdElement().getIdPart()))
- .getReference();
+ String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task",
+ task.getIdElement().getIdPart())).getReference();
- Task.ParameterComponent input = getTaskHelper()
- .createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
- "An error occurred while calculating the multi medic feasibility result for "
- + "all defined cohorts, see task with url='" + taskUrl + "'");
+ Task.ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_BPMN,
+ CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
+ "An error occurred while calculating the multi medic feasibility result for "
+ + "all defined cohorts, see task with url='" + taskUrl + "'");
return Stream.of(input);
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java
index 8597de85..ecba92d7 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java
@@ -14,6 +14,7 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResults;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.AbstractTaskMessageSend;
@@ -29,9 +30,9 @@
public class SendMultiMedicResults extends AbstractTaskMessageSend
{
public SendMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider, FhirContext fhirContext)
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext)
{
- super(clientProvider, taskHelper, organizationProvider, fhirContext);
+ super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
@Override
@@ -48,16 +49,12 @@ protected Stream getAdditionalInputParameters(DelegateExecut
private Stream toInputs(FinalFeasibilityQueryResult result)
{
- ParameterComponent input1 = getTaskHelper()
- .createInputUnsignedInt(CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT,
- result.getCohortSize());
+ ParameterComponent input1 = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT, result.getCohortSize());
input1.addExtension(createCohortIdExtension(result.getCohortId()));
- ParameterComponent input2 = getTaskHelper()
- .createInputUnsignedInt(CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT,
- result.getParticipatingMedics());
+ ParameterComponent input2 = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT, result.getParticipatingMedics());
input2.addExtension(createCohortIdExtension(result.getCohortId()));
return Stream.of(input1, input2);
@@ -79,10 +76,10 @@ private Stream getErrorInput(DelegateExecution execution)
String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task",
task.getIdElement().getIdPart())).getReference();
- Task.ParameterComponent input = getTaskHelper()
- .createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
- "Errors occurred for missing cohorts while calculating their multi medic feasibility "
- + "result, see task with url='" + taskUrl + "'");
+ Task.ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_BPMN,
+ CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
+ "Errors occurred for missing cohorts while calculating their multi medic feasibility "
+ + "result, see task with url='" + taskUrl + "'");
return Stream.of(input);
}
@@ -91,8 +88,9 @@ private Stream getErrorInput(DelegateExecution execution)
private boolean hasErrorOutput(List outputs)
{
- return outputs.stream().anyMatch(output -> output.getType().getCoding().stream().anyMatch(
- coding -> coding.getSystem().equals(CODESYSTEM_HIGHMED_BPMN) && coding.getCode()
- .equals(CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR)));
+ return outputs.stream()
+ .anyMatch(output -> output.getType().getCoding().stream()
+ .anyMatch(coding -> coding.getSystem().equals(CODESYSTEM_HIGHMED_BPMN)
+ && coding.getCode().equals(CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR)));
}
}
\ No newline at end of file
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java
index e28c582d..ba5fb173 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java
@@ -11,6 +11,7 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.AbstractTaskMessageSend;
@@ -29,9 +30,9 @@ public class SendSingleMedicResults extends AbstractTaskMessageSend
private static final Logger logger = LoggerFactory.getLogger(SendSingleMedicResults.class);
public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider, FhirContext fhirContext)
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext)
{
- super(clientProvider, taskHelper, organizationProvider, fhirContext);
+ super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
@Override
@@ -62,11 +63,11 @@ else if (result.isIdResultSetUrlResult())
}
else
{
- logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + result
- .getCohortId());
+ logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID "
+ + result.getCohortId());
throw new RuntimeException(
- "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + result
- .getCohortId());
+ "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID "
+ + result.getCohortId());
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java
index 385d5bfb..1992ec01 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java
@@ -9,6 +9,7 @@
import java.util.stream.Stream;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.AbstractTaskMessageSend;
@@ -21,9 +22,9 @@
public class SendTtpRequest extends AbstractTaskMessageSend
{
public SendTtpRequest(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider, FhirContext fhirContext)
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext)
{
- super(clientProvider, taskHelper, organizationProvider, fhirContext);
+ super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
@Override
@@ -37,9 +38,8 @@ protected Stream getAdditionalInputParameters(DelegateE
target.getCorrelationKey()));
boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE);
- Task.ParameterComponent inputNeedsRecordLinkage = getTaskHelper()
- .createInput(CODESYSTEM_HIGHMED_FEASIBILITY, CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE,
- needsRecordLinkage);
+ Task.ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage);
return Stream.concat(inputTargets, Stream.of(inputNeedsRecordLinkage));
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java
index 4508c07e..f5ae3c9a 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java
@@ -14,14 +14,16 @@
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
public class CalculateMultiMedicResults extends AbstractServiceDelegate
{
- public CalculateMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public CalculateMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
@@ -41,9 +43,10 @@ private List calculateResults(List> byCohortId = results.stream()
.collect(Collectors.groupingBy(FeasibilityQueryResult::getCohortId));
- return byCohortId.entrySet().stream().map(e -> new FinalFeasibilityQueryResult(e.getKey(),
- toInt(e.getValue().stream().filter(r -> r.getCohortSize() > 0).count()),
- toInt(e.getValue().stream().mapToLong(FeasibilityQueryResult::getCohortSize).sum())))
+ return byCohortId.entrySet().stream()
+ .map(e -> new FinalFeasibilityQueryResult(e.getKey(),
+ toInt(e.getValue().stream().filter(r -> r.getCohortSize() > 0).count()),
+ toInt(e.getValue().stream().mapToLong(FeasibilityQueryResult::getCohortSize).sum())))
.collect(Collectors.toList());
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java
index edbca48c..1fe346a9 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java
@@ -11,6 +11,7 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.dsf.fhir.variables.FhirResourcesList;
@@ -20,9 +21,10 @@
public class CheckFeasibilityResources extends AbstractServiceDelegate
{
- public CheckFeasibilityResources(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public CheckFeasibilityResources(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java
index 96a62cc1..d8f9f83e 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java
@@ -14,6 +14,7 @@
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResults;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.hl7.fhir.r4.model.Extension;
@@ -25,9 +26,10 @@
public class CheckMultiMedicResults extends AbstractServiceDelegate
{
- public CheckMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public CheckMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
@@ -51,21 +53,22 @@ protected void doExecute(DelegateExecution execution) throws Exception
private void addFinalFeasibilityQueryErrorsToLeadingTask(Task toRead, Task toWrite)
{
- toRead.getInput().stream().filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_BPMN
- .equals(in.getType().getCodingFirstRep().getSystem()) && CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR
- .equals(in.getType().getCodingFirstRep().getCode())).forEach(in -> toWrite.getOutput()
- .add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
- in.getValue().primitiveValue())));
+ toRead.getInput().stream()
+ .filter(in -> in.hasType() && in.getType().hasCoding()
+ && CODESYSTEM_HIGHMED_BPMN.equals(in.getType().getCodingFirstRep().getSystem())
+ && CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR.equals(in.getType().getCodingFirstRep().getCode()))
+ .forEach(in -> toWrite.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN,
+ CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, in.getValue().primitiveValue())));
}
private FinalFeasibilityQueryResults readFinalFeasibilityQueryResultsFromCurrentTask(Task task)
{
List results = task.getInput().stream()
- .filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_FEASIBILITY
- .equals(in.getType().getCodingFirstRep().getSystem())
+ .filter(in -> in.hasType() && in.getType().hasCoding()
+ && CODESYSTEM_HIGHMED_FEASIBILITY.equals(in.getType().getCodingFirstRep().getSystem())
&& CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT
- .equals(in.getType().getCodingFirstRep().getCode())).map(in -> toResult(task, in))
- .collect(Collectors.toList());
+ .equals(in.getType().getCodingFirstRep().getCode()))
+ .map(in -> toResult(task, in)).collect(Collectors.toList());
return new FinalFeasibilityQueryResults(results);
}
@@ -79,14 +82,13 @@ private FinalFeasibilityQueryResult toResult(Task task, ParameterComponent in)
private int getParticipatingMedicsCountByCohortId(Task task, String cohortId)
{
- return task.getInput().stream()
- .filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_FEASIBILITY
- .equals(in.getType().getCodingFirstRep().getSystem())
- && CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT
- .equals(in.getType().getCodingFirstRep().getCode()) && cohortId
- .equals(((Reference) in.getExtensionByUrl(EXTENSION_HIGHMED_GROUP_ID).getValue())
- .getReference())).mapToInt(in -> ((UnsignedIntType) in.getValue()).getValue())
- .findFirst().getAsInt();
+ return task.getInput().stream().filter(in -> in.hasType() && in.getType().hasCoding()
+ && CODESYSTEM_HIGHMED_FEASIBILITY.equals(in.getType().getCodingFirstRep().getSystem())
+ && CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT
+ .equals(in.getType().getCodingFirstRep().getCode())
+ && cohortId.equals(
+ ((Reference) in.getExtensionByUrl(EXTENSION_HIGHMED_GROUP_ID).getValue()).getReference()))
+ .mapToInt(in -> ((UnsignedIntType) in.getValue()).getValue()).findFirst().getAsInt();
}
protected FinalFeasibilityQueryResults checkResults(FinalFeasibilityQueryResults results)
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java
index 8504cb15..e2ca8358 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java
@@ -1,5 +1,11 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_COHORTS;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERIES;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.FEASIBILITY_QUERY_PREFIX;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -7,9 +13,8 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.highmed.dsf.bpe.ConstantsBase;
-import org.highmed.dsf.bpe.ConstantsFeasibility;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.group.GroupHelper;
import org.highmed.dsf.fhir.task.TaskHelper;
@@ -26,9 +31,11 @@ public class CheckQueries extends AbstractServiceDelegate implements Initializin
private final GroupHelper groupHelper;
- public CheckQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, GroupHelper groupHelper)
+ public CheckQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper, GroupHelper groupHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
+
this.groupHelper = groupHelper;
}
@@ -36,14 +43,15 @@ public CheckQueries(FhirWebserviceClientProvider clientProvider, TaskHelper task
public void afterPropertiesSet() throws Exception
{
super.afterPropertiesSet();
+
Objects.requireNonNull(groupHelper, "groupHelper");
}
@Override
protected void doExecute(DelegateExecution execution) throws Exception
{
- List cohorts = ((FhirResourcesList) execution
- .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_COHORTS)).getResourcesAndCast();
+ List cohorts = ((FhirResourcesList) execution.getVariable(BPMN_EXECUTION_VARIABLE_COHORTS))
+ .getResourcesAndCast();
Map queries = new HashMap<>();
@@ -53,16 +61,15 @@ protected void doExecute(DelegateExecution execution) throws Exception
String aqlQuery = groupHelper.extractAqlQuery(group);
String groupId = group.getId();
- if (!aqlQuery.startsWith(ConstantsFeasibility.FEASIBILITY_QUERY_PREFIX))
+ if (!aqlQuery.startsWith(FEASIBILITY_QUERY_PREFIX))
{
- String errorMessage =
- "Initial single medic feasibility query check failed, wrong format for query of group with id '"
- + groupId + "', expected query to start with '"
- + ConstantsFeasibility.FEASIBILITY_QUERY_PREFIX + "' but got '" + aqlQuery + "'";
+ String errorMessage = "Initial single medic feasibility query check failed, wrong format for query of group with id '"
+ + groupId + "', expected query to start with '" + FEASIBILITY_QUERY_PREFIX + "' but got '"
+ + aqlQuery + "'";
logger.info(errorMessage);
- leadingTask.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN,
- ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage));
+ leadingTask.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN,
+ CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage));
}
else
{
@@ -70,6 +77,6 @@ protected void doExecute(DelegateExecution execution) throws Exception
}
});
- execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERIES, queries);
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, queries);
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java
index 6dd391ae..019f2ea8 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java
@@ -1,16 +1,19 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.highmed.dsf.bpe.ConstantsBase;
-import org.highmed.dsf.bpe.ConstantsFeasibility;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.hl7.fhir.r4.model.Task;
@@ -21,16 +24,17 @@ public class CheckSingleMedicResults extends AbstractServiceDelegate
{
private static final Logger logger = LoggerFactory.getLogger(CheckSingleMedicResults.class);
- public CheckSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public CheckSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
protected void doExecute(DelegateExecution execution) throws Exception
{
FeasibilityQueryResults results = (FeasibilityQueryResults) execution
- .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS);
+ .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS);
Task currentTask = getCurrentTaskFromExecutionVariables();
List filteredResults = filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(results,
@@ -38,7 +42,7 @@ protected void doExecute(DelegateExecution execution) throws Exception
// TODO: add percentage filter over results
- execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS,
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS,
FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(filteredResults)));
}
@@ -71,8 +75,7 @@ private void addError(Task task, String cohortId, String error)
String errorMessage = "Feasibility query result check failed for group with id '" + cohortId + "': " + error;
logger.info(errorMessage);
- task.getOutput().add(getTaskHelper()
- .createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN, ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
- errorMessage));
+ task.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
+ errorMessage));
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java
index 77bbd244..fc7f1501 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java
@@ -17,6 +17,7 @@
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.hl7.fhir.r4.model.Task;
@@ -27,9 +28,10 @@ public class CheckTtpComputedMultiMedicResults extends AbstractServiceDelegate
{
private static final Logger logger = LoggerFactory.getLogger(CheckTtpComputedMultiMedicResults.class);
- public CheckTtpComputedMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public CheckTtpComputedMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
@@ -61,15 +63,16 @@ private List filterResultsByParticipatingMedics(Tas
String correlationKey = getTaskHelper().getFirstInputParameterStringValue(leadingTask, CODESYSTEM_HIGHMED_BPMN,
CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).orElse(null);
- return results.getResults().stream().filter(result -> {
+ return results.getResults().stream().filter(result ->
+ {
if (result.getParticipatingMedics() < MIN_PARTICIPATING_MEDICS)
{
logger.warn("Removed result with cohort id='{}' from feasibility request with task-id='{}', "
- + "business-key='{}' and correlation-key='{}' because of not enough participating MeDICs",
+ + "business-key='{}' and correlation-key='{}' because of not enough participating MeDICs",
result.getCohortId(), taskId, businessKey, correlationKey);
- leadingTask.getOutput().add(getTaskHelper()
- .createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
+ leadingTask.getOutput()
+ .add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR,
"Removed result with cohort id='" + result.getCohortId()
+ "' from feasibility request because of not enough participating MeDICs"));
@@ -90,12 +93,13 @@ private boolean checkIfAtLeastOneResultExists(Task leadingTask, List c.hasResource() && c.getRes
private List getCohortDefinitions(Bundle bundle, String baseUrl)
{
- return bundle.getEntry().stream().skip(1).map(e -> {
+ return bundle.getEntry().stream().skip(1).map(e ->
+ {
Group group = (Group) e.getResource();
IdType oldId = group.getIdElement();
group.setIdElement(
@@ -167,29 +171,29 @@ private String getTtpIdentifier(ResearchStudy researchStudy, FhirWebserviceClien
private boolean getNeedsConsentCheck(Task task)
{
- return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK).orElseThrow(
- () -> new IllegalArgumentException(
- "NeedsConsentCheck boolean is not set in task with id='" + task.getId()
- + "', this error should " + "have been caught by resource validation"));
+ return getTaskHelper()
+ .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK)
+ .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='"
+ + task.getId() + "', this error should " + "have been caught by resource validation"));
}
private boolean getNeedsRecordLinkageCheck(Task task)
{
- return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow(
- () -> new IllegalArgumentException(
- "NeedsRecordLinkage boolean is not set in task with id='" + task.getId()
- + "', this error should " + "have been caught by resource validation"));
+ return getTaskHelper()
+ .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE)
+ .orElseThrow(
+ () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='"
+ + task.getId() + "', this error should " + "have been caught by resource validation"));
}
private BloomFilterConfig getBloomFilterConfig(Task task)
{
return BloomFilterConfig.fromBytes(getTaskHelper()
.getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG).orElseThrow(
- () -> new IllegalArgumentException(
- "BloomFilterConfig byte[] is not set in task with id='" + task.getId()
- + "', this error should " + "have been caught by resource validation")));
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG)
+ .orElseThrow(() -> new IllegalArgumentException("BloomFilterConfig byte[] is not set in task with id='"
+ + task.getId() + "', this error should " + "have been caught by resource validation")));
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java
index 90b18e53..f18ba427 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java
@@ -17,6 +17,7 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
@@ -37,10 +38,10 @@ public class DownloadResearchStudyResource extends AbstractServiceDelegate imple
private final OrganizationProvider organizationProvider;
- public DownloadResearchStudyResource(OrganizationProvider organizationProvider,
- FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public DownloadResearchStudyResource(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
this.organizationProvider = organizationProvider;
}
@@ -75,10 +76,10 @@ private IdType getResearchStudyId(Task task)
{
Reference researchStudyReference = getTaskHelper()
.getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().orElseThrow(
- () -> new IllegalArgumentException(
- "ResearchStudy reference is not set in task with id='" + task.getId()
- + "', this error should " + "have been caught by resource validation"));
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE)
+ .findFirst()
+ .orElseThrow(() -> new IllegalArgumentException("ResearchStudy reference is not set in task with id='"
+ + task.getId() + "', this error should " + "have been caught by resource validation"));
return new IdType(researchStudyReference.getReference());
}
@@ -113,15 +114,15 @@ private ResearchStudy addMissingOrganizations(ResearchStudy researchStudy, FhirW
if (!identifiers.isEmpty())
{
- identifiers.forEach(identifier -> {
+ identifiers.forEach(identifier ->
+ {
logger.warn(
"Adding missing organization with identifier='{}' to feasibility research study with id='{}'",
identifier, researchStudy.getId());
researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue(
- new Reference().setType(ResourceType.Organization.name()).setIdentifier(
- new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(identifier)));
+ new Reference().setType(ResourceType.Organization.name()).setIdentifier(new Identifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(identifier)));
});
@@ -146,19 +147,20 @@ private ResearchStudy update(ResearchStudy researchStudy, FhirWebserviceClient c
private boolean getNeedsConsentCheck(Task task)
{
- return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK).orElseThrow(
- () -> new IllegalArgumentException(
- "NeedsConsentCheck boolean is not set in task with id='" + task.getId()
- + "', this error should " + "have been caught by resource validation"));
+ return getTaskHelper()
+ .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK)
+ .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='"
+ + task.getId() + "', this error should " + "have been caught by resource validation"));
}
private boolean getNeedsRecordLinkageCheck(Task task)
{
- return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow(
- () -> new IllegalArgumentException(
- "NeedsRecordLinkage boolean is not set in task with id='" + task.getId()
- + "', this error should " + "have been caught by resource validation"));
+ return getTaskHelper()
+ .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE)
+ .orElseThrow(
+ () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='"
+ + task.getId() + "', this error should " + "have been caught by resource validation"));
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java
index 5df78880..6f49b179 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java
@@ -16,6 +16,7 @@
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.fhir.client.FhirWebserviceClient;
@@ -33,9 +34,9 @@ public class DownloadResultSets extends AbstractServiceDelegate
private final ObjectMapper openEhrObjectMapper;
public DownloadResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- ObjectMapper openEhrObjectMapper)
+ ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
this.openEhrObjectMapper = openEhrObjectMapper;
}
@@ -68,7 +69,7 @@ private List download(FeasibilityQueryResults results)
private FeasibilityQueryResult download(FeasibilityQueryResult result)
{
IdType id = new IdType(result.getResultSetUrl());
- FhirWebserviceClient client = getFhirWebserviceClientProvider().getRemoteWebserviceClient(id.getBaseUrl());
+ FhirWebserviceClient client = getFhirWebserviceClientProvider().getWebserviceClient(id.getBaseUrl());
InputStream binary = readBinaryResource(client, id.getIdPart());
ResultSet resultSet = deserializeResultSet(binary);
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java
index c4fb0365..7c814ecd 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java
@@ -1,16 +1,21 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERIES;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS;
+
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.highmed.dsf.bpe.ConstantsFeasibility;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
@@ -24,9 +29,9 @@ public class ExecuteQueries extends AbstractServiceDelegate implements Initializ
private final OrganizationProvider organizationProvider;
public ExecuteQueries(FhirWebserviceClientProvider clientProvider, OpenEhrClient openehrClient,
- TaskHelper taskHelper, OrganizationProvider organizationProvider)
+ TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
this.openehrClient = openehrClient;
this.organizationProvider = organizationProvider;
@@ -46,26 +51,23 @@ protected void doExecute(DelegateExecution execution) throws Exception
{
//
@SuppressWarnings("unchecked")
- Map queries = (Map) execution
- .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERIES);
+ Map queries = (Map) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES);
- Boolean needsConsentCheck = (Boolean) execution
- .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK);
- Boolean needsRecordLinkage = (Boolean) execution
- .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE);
+ Boolean needsConsentCheck = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK);
+ Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE);
boolean idQuery = Boolean.TRUE.equals(needsConsentCheck) || Boolean.TRUE.equals(needsRecordLinkage);
List results = queries.entrySet().stream()
.map(entry -> executeQuery(entry.getKey(), entry.getValue(), idQuery)).collect(Collectors.toList());
- execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS,
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS,
FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(results)));
}
private FeasibilityQueryResult executeQuery(String cohortId, String cohortQuery, boolean idQuery)
{
// TODO We might want to introduce a more complex result type to represent a count,
- // errors and possible meta-data.
+ // errors and possible meta-data.
ResultSet resultSet = openehrClient.query(cohortQuery, null);
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java
index da6d2119..34159b7d 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java
@@ -1,5 +1,8 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS;
+
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -7,13 +10,13 @@
import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.highmed.dsf.bpe.ConstantsFeasibility;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.pseudonymization.domain.PersonWithMdat;
@@ -31,9 +34,9 @@ public class ExecuteRecordLink extends AbstractServiceDelegate
private final ResultSetTranslatorFromMedicRbfOnly translator;
public ExecuteRecordLink(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- ResultSetTranslatorFromMedicRbfOnly translator)
+ ReadAccessHelper readAccessHelper, ResultSetTranslatorFromMedicRbfOnly translator)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
this.translator = translator;
}
@@ -50,7 +53,7 @@ public void afterPropertiesSet() throws Exception
protected void doExecute(DelegateExecution execution) throws Exception
{
FeasibilityQueryResults results = (FeasibilityQueryResults) execution
- .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS);
+ .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS);
Map> byCohortId = results.getResults().stream()
.collect(Collectors.groupingBy(FeasibilityQueryResult::getCohortId));
@@ -60,7 +63,7 @@ protected void doExecute(DelegateExecution execution) throws Exception
List matchedResults = byCohortId.entrySet().stream()
.map(e -> match(matcher, e.getKey(), e.getValue())).collect(Collectors.toList());
- execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS,
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS,
FinalFeasibilityQueryResultsValues.create(new FinalFeasibilityQueryResults(matchedResults)));
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java
index ebdb9f02..7a16b970 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java
@@ -1,34 +1,37 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS;
+
import java.util.List;
import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.highmed.dsf.bpe.ConstantsFeasibility;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.openehr.model.structure.ResultSet;
public class FilterQueryResultsByConsent extends AbstractServiceDelegate
{
- public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
protected void doExecute(DelegateExecution execution) throws Exception
{
FeasibilityQueryResults results = (FeasibilityQueryResults) execution
- .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS);
+ .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS);
List filteredResults = filterResults(results.getResults());
- execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS,
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS,
FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(filteredResults)));
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java
index 6a10c6b1..faa94230 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java
@@ -1,11 +1,11 @@
package org.highmed.dsf.bpe.service;
import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER;
-import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON;
import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG;
import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS;
import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI;
+import static org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnlyImpl.FILTER_ON_IDAT_NOT_FOUND_EXCEPTION;
import java.security.Key;
import java.util.List;
@@ -19,6 +19,7 @@
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.mpi.client.MasterPatientIndexClient;
@@ -32,7 +33,6 @@
import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnlyImpl;
import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.IdType;
-import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.ResourceType;
import org.hl7.fhir.r4.model.Task;
import org.slf4j.Logger;
@@ -58,10 +58,11 @@ public class GenerateBloomFilters extends AbstractServiceDelegate
private final BouncyCastleProvider bouncyCastleProvider;
public GenerateBloomFilters(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, ObjectMapper openEhrObjectMapper,
+ ReadAccessHelper readAccessHelper, String ehrIdColumnPath,
+ MasterPatientIndexClient masterPatientIndexClient, ObjectMapper openEhrObjectMapper,
BouncyCastleProvider bouncyCastleProvider)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
this.ehrIdColumnPath = ehrIdColumnPath;
this.masterPatientIndexClient = masterPatientIndexClient;
@@ -116,7 +117,7 @@ protected ResultSetTranslatorToTtpRbfOnly createResultSetTranslator(BloomFilterC
return new ResultSetTranslatorToTtpRbfOnlyImpl(ehrIdColumnPath,
createRecordBloomFilterGenerator(bloomFilterConfig.getPermutationSeed(),
bloomFilterConfig.getHmacSha2Key(), bloomFilterConfig.getHmacSha3Key()),
- masterPatientIndexClient, ResultSetTranslatorToTtpRbfOnlyImpl.FILTER_ON_IDAT_NOT_FOUND_EXCEPTION);
+ masterPatientIndexClient, FILTER_ON_IDAT_NOT_FOUND_EXCEPTION);
}
protected RecordBloomFilterGenerator createRecordBloomFilterGenerator(long permutationSeed, Key hmacSha2Key,
@@ -149,14 +150,11 @@ private ResultSet translate(ResultSetTranslatorToTtpRbfOnly resultSetTranslator,
}
}
- protected String saveResultSetAsBinaryForTtp(ResultSet resultSet, String securityIdentifier)
+ protected String saveResultSetAsBinaryForTtp(ResultSet resultSet, String ttpIdentifier)
{
byte[] content = serializeResultSet(resultSet);
- Reference securityContext = new Reference();
- securityContext.setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(securityIdentifier);
- Binary binary = new Binary().setContentType(OPENEHR_MIMETYPE_JSON).setSecurityContext(securityContext)
- .setData(content);
+ Binary binary = new Binary().setContentType(OPENEHR_MIMETYPE_JSON).setData(content);
+ getReadAccessHelper().addOrganization(binary, ttpIdentifier);
IdType created = createBinaryResource(binary);
return new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Binary.name(),
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java
index ef41cf4e..ccc83771 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java
@@ -1,33 +1,36 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS;
+
import java.util.List;
import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.highmed.dsf.bpe.ConstantsFeasibility;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
public class GenerateCountFromIds extends AbstractServiceDelegate
{
- public GenerateCountFromIds(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public GenerateCountFromIds(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
protected void doExecute(DelegateExecution execution) throws Exception
{
FeasibilityQueryResults results = (FeasibilityQueryResults) execution
- .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS);
+ .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS);
List filteredResults = count(results.getResults());
- execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS,
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS,
FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(filteredResults)));
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java
index c00384c4..79161ffd 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java
@@ -1,17 +1,21 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR;
+
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.highmed.dsf.bpe.ConstantsBase;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.hl7.fhir.r4.model.Task;
public class HandleErrorMultiMedicResults extends AbstractServiceDelegate
{
- public HandleErrorMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public HandleErrorMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
@@ -20,15 +24,16 @@ protected void doExecute(DelegateExecution execution) throws Exception
Task currentTask = getCurrentTaskFromExecutionVariables();
Task leadingTask = getLeadingTaskFromExecutionVariables();
- currentTask.getInput().forEach(input -> {
- boolean isErrorInput = input.getType().getCoding().stream().anyMatch(
- code -> code.getSystem().equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN) && code.getCode()
- .equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR));
+ currentTask.getInput().forEach(input ->
+ {
+ boolean isErrorInput = input.getType().getCoding().stream()
+ .anyMatch(code -> code.getSystem().equals(CODESYSTEM_HIGHMED_BPMN)
+ && code.getCode().equals(CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR));
if (isErrorInput)
{
- leadingTask.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN,
- ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, input.getValue().primitiveValue()));
+ leadingTask.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN,
+ CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, input.getValue().primitiveValue()));
}
});
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java
index 83cc1bb9..1df227ae 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java
@@ -11,6 +11,7 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.springframework.beans.factory.InitializingBean;
@@ -19,9 +20,11 @@ public class ModifyQueries extends AbstractServiceDelegate implements Initializi
{
private final String ehrIdColumnPath;
- public ModifyQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, String ehrIdColumnPath)
+ public ModifyQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper, String ehrIdColumnPath)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
+
this.ehrIdColumnPath = ehrIdColumnPath;
}
@@ -29,6 +32,7 @@ public ModifyQueries(FhirWebserviceClientProvider clientProvider, TaskHelper tas
public void afterPropertiesSet() throws Exception
{
super.afterPropertiesSet();
+
Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath");
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java
index 016da37b..08795a72 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java
@@ -1,7 +1,13 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET;
+import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP;
import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC;
import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM;
import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG;
import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE;
import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY;
@@ -17,17 +23,19 @@
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.highmed.dsf.bpe.ConstantsBase;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.bpe.variables.BloomFilterConfig;
import org.highmed.dsf.bpe.variables.BloomFilterConfigValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
-import org.highmed.dsf.fhir.organization.OrganizationProvider;
+import org.highmed.dsf.fhir.organization.EndpointProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.dsf.fhir.variables.Target;
import org.highmed.dsf.fhir.variables.TargetValues;
import org.highmed.dsf.fhir.variables.Targets;
import org.highmed.dsf.fhir.variables.TargetsValues;
+import org.hl7.fhir.r4.model.Extension;
+import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.ResearchStudy;
@@ -35,16 +43,17 @@ public class SelectRequestTargets extends AbstractServiceDelegate
{
private static final Random random = new Random();
- private final OrganizationProvider organizationProvider;
+ private final EndpointProvider endpointProvider;
private final KeyGenerator hmacSha2Generator;
private final KeyGenerator hmacSha3Generator;
public SelectRequestTargets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider, BouncyCastleProvider bouncyCastleProvider)
+ ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider,
+ BouncyCastleProvider bouncyCastleProvider)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
- this.organizationProvider = organizationProvider;
+ this.endpointProvider = endpointProvider;
try
{
@@ -63,7 +72,8 @@ public SelectRequestTargets(FhirWebserviceClientProvider clientProvider, TaskHel
public void afterPropertiesSet() throws Exception
{
super.afterPropertiesSet();
- Objects.requireNonNull(organizationProvider, "organizationProvider");
+
+ Objects.requireNonNull(endpointProvider, "endpointProvider");
}
@Override
@@ -71,11 +81,8 @@ protected void doExecute(DelegateExecution execution) throws Exception
{
ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY);
- execution.setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS,
- TargetsValues.create(getMedicTargets(researchStudy)));
-
- execution.setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET,
- TargetValues.create(getTtpTarget(researchStudy)));
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(getMedicTargets(researchStudy)));
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(getTtpTarget(researchStudy)));
Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE);
if (Boolean.TRUE.equals(needsRecordLinkage))
@@ -94,8 +101,12 @@ private BloomFilterConfig createBloomFilterConfig()
private Targets getMedicTargets(ResearchStudy researchStudy)
{
List targets = researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).stream()
- .filter(e -> e.getValue() instanceof Reference).map(e -> (Reference) e.getValue())
- .map(r -> Target.createBiDirectionalTarget(r.getIdentifier().getValue(), UUID.randomUUID().toString()))
+ .filter(Extension::hasValue).map(Extension::getValue).filter(v -> v instanceof Reference)
+ .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier)
+ .filter(Identifier::hasValue).map(Identifier::getValue)
+ .map(medicIdentifier -> Target.createBiDirectionalTarget(medicIdentifier,
+ getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC, medicIdentifier),
+ UUID.randomUUID().toString()))
.collect(Collectors.toList());
return new Targets(targets);
@@ -104,7 +115,19 @@ private Targets getMedicTargets(ResearchStudy researchStudy)
private Target getTtpTarget(ResearchStudy researchStudy)
{
return researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP).stream()
- .filter(e -> e.getValue() instanceof Reference).map(e -> (Reference) e.getValue())
- .map(r -> Target.createUniDirectionalTarget(r.getIdentifier().getValue())).findFirst().get();
+ .filter(Extension::hasValue).map(Extension::getValue).filter(v -> v instanceof Reference)
+ .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier)
+ .filter(Identifier::hasValue).map(Identifier::getValue)
+ .map(ttpIdentifier -> Target.createUniDirectionalTarget(ttpIdentifier,
+ getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP, ttpIdentifier)))
+ .findFirst().get();
+ }
+
+ private String getAddress(String role, String identifier)
+ {
+ return endpointProvider
+ .getFirstConsortiumEndpointAdress(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM,
+ CODESYSTEM_HIGHMED_ORGANIZATION_TYPE, role, identifier)
+ .get();
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java
index 5e078184..c087f26c 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java
@@ -1,28 +1,32 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM;
+
import java.util.Objects;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.highmed.dsf.bpe.ConstantsBase;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
-import org.highmed.dsf.fhir.organization.OrganizationProvider;
+import org.highmed.dsf.fhir.organization.EndpointProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.dsf.fhir.variables.Target;
import org.highmed.dsf.fhir.variables.TargetValues;
-import org.hl7.fhir.r4.model.Task;
import org.springframework.beans.factory.InitializingBean;
public class SelectResponseTargetMedic extends AbstractServiceDelegate implements InitializingBean
{
- private final OrganizationProvider organizationProvider;
+ private final EndpointProvider endpointProvider;
public SelectResponseTargetMedic(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider)
+ ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
- this.organizationProvider = organizationProvider;
+ this.endpointProvider = endpointProvider;
}
@Override
@@ -30,15 +34,19 @@ public void afterPropertiesSet() throws Exception
{
super.afterPropertiesSet();
- Objects.requireNonNull(organizationProvider, "organizationProvider");
+ Objects.requireNonNull(endpointProvider, "endpointProvider");
}
@Override
protected void doExecute(DelegateExecution execution) throws Exception
{
- Task task = getLeadingTaskFromExecutionVariables();
-
- Target medicTarget = Target.createUniDirectionalTarget(task.getRequester().getIdentifier().getValue());
- execution.setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget));
+ String medicIndentifier = getLeadingTaskFromExecutionVariables().getRequester().getIdentifier().getValue();
+
+ Target medicTarget = Target.createUniDirectionalTarget(medicIndentifier,
+ endpointProvider.getFirstConsortiumEndpointAdress(
+ NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM,
+ CODESYSTEM_HIGHMED_ORGANIZATION_TYPE, CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC,
+ medicIndentifier).get());
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget));
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java
index 2677e6be..328701e1 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java
@@ -1,12 +1,20 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET;
+import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM;
+
import java.util.Objects;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.highmed.dsf.bpe.ConstantsBase;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
-import org.highmed.dsf.fhir.organization.OrganizationProvider;
+import org.highmed.dsf.fhir.organization.EndpointProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.dsf.fhir.variables.Target;
import org.highmed.dsf.fhir.variables.TargetValues;
@@ -15,39 +23,47 @@
public class SelectResponseTargetTtp extends AbstractServiceDelegate implements InitializingBean
{
- private final OrganizationProvider organizationProvider;
+ private final EndpointProvider endpointProvider;
public SelectResponseTargetTtp(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider)
+ ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider)
{
- super(clientProvider, taskHelper);
- this.organizationProvider = organizationProvider;
+ super(clientProvider, taskHelper, readAccessHelper);
+
+ this.endpointProvider = endpointProvider;
}
@Override
public void afterPropertiesSet() throws Exception
{
super.afterPropertiesSet();
- Objects.requireNonNull(organizationProvider, "organizationProvider");
+
+ Objects.requireNonNull(endpointProvider, "endpointProvider");
}
@Override
protected void doExecute(DelegateExecution execution) throws Exception
{
- String ttpIdentifier = (String) execution.getVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER);
+ String ttpIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER);
String correlationKey = getCorrelationKey(execution);
- Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, correlationKey);
- execution.setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget));
+ Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier,
+ endpointProvider.getFirstConsortiumEndpointAdress(
+ NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM,
+ CODESYSTEM_HIGHMED_ORGANIZATION_TYPE, CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP,
+ ttpIdentifier).get(),
+ correlationKey);
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget));
}
private String getCorrelationKey(DelegateExecution execution)
{
Task task = getCurrentTaskFromExecutionVariables();
- return getTaskHelper().getFirstInputParameterStringValue(task, ConstantsBase.CODESYSTEM_HIGHMED_BPMN,
- ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).orElseThrow(
- () -> new IllegalStateException(
+ return getTaskHelper()
+ .getFirstInputParameterStringValue(task, CODESYSTEM_HIGHMED_BPMN,
+ CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY)
+ .orElseThrow(() -> new IllegalStateException(
"No correlation key found, this error should have been caught by resource validation"));
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java
index d4f3962f..ab70cc74 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java
@@ -1,5 +1,6 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS;
import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE;
import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS;
import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY;
@@ -10,10 +11,10 @@
import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.highmed.dsf.bpe.ConstantsBase;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.dsf.fhir.variables.Target;
@@ -23,9 +24,10 @@
public class StoreCorrelationKeys extends AbstractServiceDelegate
{
- public StoreCorrelationKeys(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public StoreCorrelationKeys(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
@@ -33,13 +35,13 @@ protected void doExecute(DelegateExecution execution) throws Exception
{
Task task = getCurrentTaskFromExecutionVariables();
- List targets = getTaskHelper().getInputParameterStringValues(task, CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY)
- .map(correlationKey -> Target.createBiDirectionalTarget("", correlationKey))
+ List targets = getTaskHelper()
+ .getInputParameterStringValues(task, CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY)
+ .map(correlationKey -> Target.createBiDirectionalTarget("", "", correlationKey))
.collect(Collectors.toList());
- execution
- .setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets)));
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets)));
boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task);
execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage);
@@ -50,10 +52,11 @@ protected void doExecute(DelegateExecution execution) throws Exception
private boolean getNeedsRecordLinkageCheck(Task task)
{
- return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow(
- () -> new IllegalArgumentException(
- "NeedsRecordLinkage boolean is not set in task with id='" + task.getId()
- + "', this error should " + "have been caught by resource validation"));
+ return getTaskHelper()
+ .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE)
+ .orElseThrow(
+ () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='"
+ + task.getId() + "', this error should " + "have been caught by resource validation"));
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java
index 322a8f9e..9ebdab5d 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java
@@ -17,6 +17,7 @@
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
@@ -30,9 +31,9 @@ public class StoreResults extends AbstractServiceDelegate implements Initializin
private final OrganizationProvider organizationProvider;
public StoreResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider)
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
this.organizationProvider = organizationProvider;
}
@@ -73,24 +74,28 @@ private List getResults(Task task, boolean needsRecordLi
{
return taskHelper.getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_FEASIBILITY,
CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, EXTENSION_HIGHMED_GROUP_ID)
- .map(input -> {
+ .map(input ->
+ {
String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference();
String resultSetUrl = ((Reference) input.getValue()).getReference();
- return FeasibilityQueryResult
- .idResult(requester.getIdentifier().getValue(), cohortId, resultSetUrl);
+ return FeasibilityQueryResult.idResult(requester.getIdentifier().getValue(), cohortId,
+ resultSetUrl);
}).collect(Collectors.toList());
}
else
{
- return taskHelper.getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_FEASIBILITY,
- CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT, EXTENSION_HIGHMED_GROUP_ID).map(input -> {
- String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference();
- int cohortSize = ((UnsignedIntType) input.getValue()).getValue();
+ return taskHelper
+ .getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_FEASIBILITY,
+ CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT, EXTENSION_HIGHMED_GROUP_ID)
+ .map(input ->
+ {
+ String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference();
+ int cohortSize = ((UnsignedIntType) input.getValue()).getValue();
- return FeasibilityQueryResult.countResult(requester.getIdentifier().getValue(), cohortId, cohortSize);
- }).collect(Collectors.toList());
+ return FeasibilityQueryResult.countResult(requester.getIdentifier().getValue(), cohortId,
+ cohortSize);
+ }).collect(Collectors.toList());
}
}
-
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java
index 1abc6a6a..b674a878 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java
@@ -27,8 +27,10 @@
import org.highmed.dsf.bpe.service.SelectResponseTargetTtp;
import org.highmed.dsf.bpe.service.StoreCorrelationKeys;
import org.highmed.dsf.bpe.service.StoreResults;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.group.GroupHelper;
+import org.highmed.dsf.fhir.organization.EndpointProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.mpi.client.MasterPatientIndexClient;
@@ -62,9 +64,15 @@ public class FeasibilityConfig
@Autowired
private OrganizationProvider organizationProvider;
+ @Autowired
+ private EndpointProvider endpointProvider;
+
@Autowired
private TaskHelper taskHelper;
+ @Autowired
+ private ReadAccessHelper readAccessHelper;
+
@Autowired
private GroupHelper groupHelper;
@@ -87,37 +95,40 @@ public class FeasibilityConfig
@Bean
public DownloadResearchStudyResource downloadResearchStudyResource()
{
- return new DownloadResearchStudyResource(organizationProvider, fhirClientProvider, taskHelper);
+ return new DownloadResearchStudyResource(fhirClientProvider, taskHelper, readAccessHelper,
+ organizationProvider);
}
@Bean
public SelectRequestTargets selectRequestTargets()
{
- return new SelectRequestTargets(fhirClientProvider, taskHelper, organizationProvider, bouncyCastleProvider());
+ return new SelectRequestTargets(fhirClientProvider, taskHelper, readAccessHelper, endpointProvider,
+ bouncyCastleProvider());
}
@Bean
public SendTtpRequest sendTtpRequest()
{
- return new SendTtpRequest(fhirClientProvider, taskHelper, organizationProvider, fhirContext);
+ return new SendTtpRequest(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
@Bean
public SendMedicRequest sendMedicRequest()
{
- return new SendMedicRequest(fhirClientProvider, taskHelper, organizationProvider, fhirContext);
+ return new SendMedicRequest(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider,
+ fhirContext);
}
@Bean
public CheckMultiMedicResults checkMultiMedicResults()
{
- return new CheckMultiMedicResults(fhirClientProvider, taskHelper);
+ return new CheckMultiMedicResults(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public HandleErrorMultiMedicResults handleErrorMultiMedicResults()
{
- return new HandleErrorMultiMedicResults(fhirClientProvider, taskHelper);
+ return new HandleErrorMultiMedicResults(fhirClientProvider, taskHelper, readAccessHelper);
}
//
@@ -127,43 +138,44 @@ public HandleErrorMultiMedicResults handleErrorMultiMedicResults()
@Bean
public DownloadFeasibilityResources downloadFeasibilityResources()
{
- return new DownloadFeasibilityResources(organizationProvider, fhirClientProvider, taskHelper);
+ return new DownloadFeasibilityResources(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider);
}
@Bean
public CheckFeasibilityResources checkFeasibilityResources()
{
- return new CheckFeasibilityResources(fhirClientProvider, taskHelper);
+ return new CheckFeasibilityResources(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public CheckQueries checkQueries()
{
- return new CheckQueries(fhirClientProvider, taskHelper, groupHelper);
+ return new CheckQueries(fhirClientProvider, taskHelper, readAccessHelper, groupHelper);
}
@Bean
public ModifyQueries modifyQueries()
{
- return new ModifyQueries(fhirClientProvider, taskHelper, ehrIdColumnPath);
+ return new ModifyQueries(fhirClientProvider, taskHelper, readAccessHelper, ehrIdColumnPath);
}
@Bean
public ExecuteQueries executeQueries()
{
- return new ExecuteQueries(fhirClientProvider, openEhrClient(), taskHelper, organizationProvider);
+ return new ExecuteQueries(fhirClientProvider, openEhrClient(), taskHelper, readAccessHelper,
+ organizationProvider);
}
@Bean
public FilterQueryResultsByConsent filterQueryResultsByConsent()
{
- return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper);
+ return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public GenerateCountFromIds generateCountFromIds()
{
- return new GenerateCountFromIds(fhirClientProvider, taskHelper);
+ return new GenerateCountFromIds(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
@@ -181,8 +193,8 @@ public OpenEhrClient openEhrClient()
@Bean
public GenerateBloomFilters generateBloomFilters()
{
- return new GenerateBloomFilters(fhirClientProvider, taskHelper, ehrIdColumnPath, masterPatientIndexClient(),
- objectMapper, bouncyCastleProvider());
+ return new GenerateBloomFilters(fhirClientProvider, taskHelper, readAccessHelper, ehrIdColumnPath,
+ masterPatientIndexClient(), objectMapper, bouncyCastleProvider());
}
@Bean
@@ -194,19 +206,20 @@ public BouncyCastleProvider bouncyCastleProvider()
@Bean
public CheckSingleMedicResults checkSingleMedicResults()
{
- return new CheckSingleMedicResults(fhirClientProvider, taskHelper);
+ return new CheckSingleMedicResults(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public SelectResponseTargetTtp selectResponseTargetTtp()
{
- return new SelectResponseTargetTtp(fhirClientProvider, taskHelper, organizationProvider);
+ return new SelectResponseTargetTtp(fhirClientProvider, taskHelper, readAccessHelper, endpointProvider);
}
@Bean
public SendSingleMedicResults sendSingleMedicResults()
{
- return new SendSingleMedicResults(fhirClientProvider, taskHelper, organizationProvider, fhirContext);
+ return new SendSingleMedicResults(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider,
+ fhirContext);
}
//
@@ -216,19 +229,19 @@ public SendSingleMedicResults sendSingleMedicResults()
@Bean
public StoreCorrelationKeys storeCorrelationKeys()
{
- return new StoreCorrelationKeys(fhirClientProvider, taskHelper);
+ return new StoreCorrelationKeys(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public StoreResults storeResults()
{
- return new StoreResults(fhirClientProvider, taskHelper, organizationProvider);
+ return new StoreResults(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider);
}
@Bean
public DownloadResultSets downloadResultSets()
{
- return new DownloadResultSets(fhirClientProvider, taskHelper, objectMapper);
+ return new DownloadResultSets(fhirClientProvider, taskHelper, readAccessHelper, objectMapper);
}
@Bean
@@ -240,36 +253,39 @@ public ResultSetTranslatorFromMedicRbfOnly resultSetTranslatorFromMedicRbfOnly()
@Bean
public ExecuteRecordLink executeRecordLink()
{
- return new ExecuteRecordLink(fhirClientProvider, taskHelper, resultSetTranslatorFromMedicRbfOnly());
+ return new ExecuteRecordLink(fhirClientProvider, taskHelper, readAccessHelper,
+ resultSetTranslatorFromMedicRbfOnly());
}
@Bean
public CalculateMultiMedicResults calculateMultiMedicResults()
{
- return new CalculateMultiMedicResults(fhirClientProvider, taskHelper);
+ return new CalculateMultiMedicResults(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public CheckTtpComputedMultiMedicResults checkTtpComputedMultiMedicResults()
{
- return new CheckTtpComputedMultiMedicResults(fhirClientProvider, taskHelper);
+ return new CheckTtpComputedMultiMedicResults(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public SelectResponseTargetMedic selectResponseTargetMedic()
{
- return new SelectResponseTargetMedic(fhirClientProvider, taskHelper, organizationProvider);
+ return new SelectResponseTargetMedic(fhirClientProvider, taskHelper, readAccessHelper, endpointProvider);
}
@Bean
public SendMultiMedicResults sendMultiMedicResults()
{
- return new SendMultiMedicResults(fhirClientProvider, taskHelper, organizationProvider, fhirContext);
+ return new SendMultiMedicResults(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider,
+ fhirContext);
}
@Bean
public SendMultiMedicErrors sendMultiMedicErrors()
{
- return new SendMultiMedicErrors(fhirClientProvider, taskHelper, organizationProvider, fhirContext);
+ return new SendMultiMedicErrors(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider,
+ fhirContext);
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultValues.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultValues.java
index 5f5c2fe9..d2eea04a 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultValues.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultValues.java
@@ -37,7 +37,8 @@ private FeasibilityQueryResultValueTypeImpl()
@Override
public TypedValue createValue(Object value, Map valueInfo)
{
- return new FeasibilityQueryResultValues.FeasibilityQueryResultValueImpl((FeasibilityQueryResult) value, VALUE_TYPE);
+ return new FeasibilityQueryResultValues.FeasibilityQueryResultValueImpl((FeasibilityQueryResult) value,
+ VALUE_TYPE);
}
}
diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java
index a5905759..65f413db 100644
--- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java
+++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java
@@ -13,7 +13,8 @@ public class FinalFeasibilityQueryResults
private final List results = new ArrayList<>();
@JsonCreator
- public FinalFeasibilityQueryResults(@JsonProperty("results") Collection extends FinalFeasibilityQueryResult> results)
+ public FinalFeasibilityQueryResults(
+ @JsonProperty("results") Collection extends FinalFeasibilityQueryResult> results)
{
if (results != null)
this.results.addAll(results);
diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn
index 497bf7bd..ee7d301d 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn
+++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn
@@ -1,6 +1,6 @@
-
-
+
+
SequenceFlow_1lfe4wr
SequenceFlow_0xxpamp
@@ -45,10 +45,9 @@
- requestFeasibility
- http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility
- 0.4.1
+ http://highmed.org/bpe/Process/requestFeasibility/0.5.0
resultMultiMedicFeasibilityMessage
+ http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility|0.5.0
Flow_1r6dq8y
@@ -97,10 +96,9 @@
- requestFeasibility
- http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility
- 0.4.1
+ http://highmed.org/bpe/Process/requestFeasibility/0.5.0
errorMultiMedicFeasibilityMessage
+ http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility|0.5.0
Flow_1tmnvhl
@@ -125,7 +123,7 @@
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn
index 0ef9190b..230c52c7 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn
+++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn
@@ -1,6 +1,6 @@
-
-
+
+
SequenceFlow_0q803rh
SequenceFlow_04ouilq
@@ -24,10 +24,9 @@
+ http://highmed.org/bpe/Process/computeFeasibility/0.5.0
resultSingleMedicFeasibilityMessage
- 0.4.1
- computeFeasibility
- http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility
+ http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility|0.5.0
SequenceFlow_0ascyjc
@@ -132,7 +131,7 @@
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn
index 0c76e993..597e131c 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn
+++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn
@@ -1,6 +1,6 @@
-
-
+
+
SequenceFlow_11k77gx
@@ -12,10 +12,9 @@
- executeFeasibility
- 0.4.1
+ http://highmed.org/bpe/Process/executeFeasibility/0.5.0
executeFeasibilityMessage
- http://highmed.org/fhir/StructureDefinition/task-execute-feasibility
+ http://highmed.org/fhir/StructureDefinition/task-execute-feasibility|0.5.0
SequenceFlow_035oihl
@@ -33,10 +32,9 @@
- computeFeasibility
- 0.4.1
+ http://highmed.org/bpe/Process/computeFeasibility/0.5.0
computeFeasibilityMessage
- http://highmed.org/fhir/StructureDefinition/task-compute-feasibility
+ http://highmed.org/fhir/StructureDefinition/task-compute-feasibility|0.5.0
SequenceFlow_0b5s4ef
@@ -97,7 +95,7 @@
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml
index 678a6a9e..2149ad7e 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml
@@ -1,84 +1,116 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml
index 35b609f9..ceb27b2c 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml
@@ -1,58 +1,88 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml
index ccc933f0..44c96360 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml
@@ -1,116 +1,164 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/CodeSystem/highmed-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/CodeSystem/highmed-feasibility.xml
index 605b17d5..12c62aa2 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/CodeSystem/highmed-feasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/CodeSystem/highmed-feasibility.xml
@@ -1,68 +1,68 @@
-
-
-
+
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml
index 96b60bb6..d550ac41 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-error-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-error-feasibility.xml
index 3e2ad541..a225592d 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-error-feasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-error-feasibility.xml
@@ -1,9 +1,8 @@
-
-
-
+
+
@@ -13,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml
index 667b0cfa..f0c63dff 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml
index 0f630c30..fbdd3578 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml
index 6a141c20..185e164c 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml
index 7e2b6c77..54aa89e8 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ValueSet/highmed-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ValueSet/highmed-feasibility.xml
index 98d2172d..6c7289ba 100644
--- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ValueSet/highmed-feasibility.xml
+++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/ValueSet/highmed-feasibility.xml
@@ -1,25 +1,25 @@
-
-
-
+
+
+
-
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java
new file mode 100644
index 00000000..1cc918ac
--- /dev/null
+++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java
@@ -0,0 +1,165 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY;
+import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC;
+import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP;
+import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_QUERY;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER;
+import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY;
+import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION;
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1;
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2;
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3;
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.UUID;
+
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelperImpl;
+import org.hl7.fhir.r4.model.BooleanType;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.Bundle.BundleType;
+import org.hl7.fhir.r4.model.Bundle.HTTPVerb;
+import org.hl7.fhir.r4.model.Expression;
+import org.hl7.fhir.r4.model.Group;
+import org.hl7.fhir.r4.model.Group.GroupType;
+import org.hl7.fhir.r4.model.IdType;
+import org.hl7.fhir.r4.model.Identifier;
+import org.hl7.fhir.r4.model.Narrative;
+import org.hl7.fhir.r4.model.Reference;
+import org.hl7.fhir.r4.model.ResearchStudy;
+import org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus;
+import org.hl7.fhir.r4.model.ResourceType;
+import org.hl7.fhir.r4.model.StringType;
+import org.hl7.fhir.r4.model.Task;
+import org.hl7.fhir.r4.model.Task.TaskIntent;
+import org.hl7.fhir.r4.model.Task.TaskStatus;
+
+public abstract class AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter
+{
+ private final String[] medicIdentifier = new String[] { NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1,
+ NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2,
+ NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3 };
+ private final String ttpIdentifier = NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP;
+
+ private final ReadAccessHelper readAccessHelper = new ReadAccessHelperImpl();
+
+ protected void main(String[] args, String baseUrl) throws Exception
+ {
+ Bundle bundle = createStartResource();
+ ExampleStarter.forServer(args, baseUrl).startWith(bundle);
+ }
+
+ private Bundle createStartResource()
+ {
+ Group group1 = createGroup("Group 1");
+ Group group2 = createGroup("Group 2");
+ ResearchStudy researchStudy = createResearchStudy(group1, group2);
+ Task task = createTask(researchStudy);
+
+ Bundle bundle = new Bundle();
+ bundle.setType(BundleType.TRANSACTION);
+ bundle.addEntry().setResource(group1).setFullUrl(group1.getIdElement().getIdPart()).getRequest()
+ .setMethod(HTTPVerb.POST).setUrl(ResourceType.Group.name());
+ bundle.addEntry().setResource(group2).setFullUrl(group2.getIdElement().getIdPart()).getRequest()
+ .setMethod(HTTPVerb.POST).setUrl(ResourceType.Group.name());
+ bundle.addEntry().setResource(researchStudy).setFullUrl(researchStudy.getIdElement().getIdPart()).getRequest()
+ .setMethod(HTTPVerb.POST).setUrl(ResourceType.ResearchStudy.name());
+ bundle.addEntry().setResource(task).setFullUrl(task.getIdElement().getIdPart()).getRequest()
+ .setMethod(HTTPVerb.POST).setUrl(ResourceType.Task.name());
+
+ return bundle;
+ }
+
+ private Group createGroup(String name)
+ {
+ Group group = new Group();
+ group.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
+
+ group.getMeta().addProfile(PROFILE_HIGHMED_GROUP);
+ group.getText().getDiv().addText("This is the description");
+ group.getText().setStatus(Narrative.NarrativeStatus.ADDITIONAL);
+ group.setType(GroupType.PERSON);
+ group.setActual(false);
+ group.setActive(true);
+ group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY).setValue(
+ new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression("SELECT COUNT(e) FROM EHR e"));
+ group.setName(name);
+
+ Arrays.stream(medicIdentifier).forEach(i -> readAccessHelper.addOrganization(group, i));
+ readAccessHelper.addOrganization(group, ttpIdentifier);
+
+ return group;
+ }
+
+ private ResearchStudy createResearchStudy(Group group1, Group group2)
+ {
+ ResearchStudy researchStudy = new ResearchStudy();
+ researchStudy.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
+
+ researchStudy.getMeta().addProfile(PROFILE_HIGHEMD_RESEARCH_STUDY);
+ researchStudy.addIdentifier().setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)
+ .setValue(UUID.randomUUID().toString());
+ researchStudy.setStatus(ResearchStudyStatus.ACTIVE);
+ researchStudy.addEnrollment().setReference(group1.getIdElement().getIdPart());
+ researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart());
+
+ Arrays.stream(medicIdentifier)
+ .forEach(i -> researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC)
+ .setValue(new Reference().setType(ResourceType.Organization.name()).setIdentifier(
+ new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(i))));
+
+ researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP)
+ .setValue(new Reference().setType(ResourceType.Organization.name()).setIdentifier(new Identifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(ttpIdentifier)));
+
+ Arrays.stream(medicIdentifier).forEach(i -> readAccessHelper.addOrganization(researchStudy, i));
+ readAccessHelper.addOrganization(researchStudy, ttpIdentifier);
+
+ return researchStudy;
+ }
+
+ private Task createTask(ResearchStudy researchStudy)
+ {
+ Task task = new Task();
+ task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
+
+ task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY);
+ task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION);
+ task.setStatus(TaskStatus.REQUESTED);
+ task.setIntent(TaskIntent.ORDER);
+ task.setAuthoredOn(new Date());
+ task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
+ task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
+
+ task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME)).getType()
+ .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
+ task.addInput()
+ .setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart())
+ .setType(ResourceType.ResearchStudy.name()))
+ .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
+ .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE);
+ task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
+ .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE);
+ task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
+ .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK);
+
+ return task;
+ }
+}
diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1DockerExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1DockerExampleStarter.java
new file mode 100644
index 00000000..5010341f
--- /dev/null
+++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1DockerExampleStarter.java
@@ -0,0 +1,16 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_DOCKER_FHIR_BASE_URL;
+
+public class RequestFeasibilityFromMedicsViaMedic1DockerExampleStarter
+ extends AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter
+{
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
+ // password
+ public static void main(String[] args) throws Exception
+ {
+ new RequestFeasibilityFromMedicsViaMedic1DockerExampleStarter().main(args, MEDIC_1_DOCKER_FHIR_BASE_URL);
+ }
+}
diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java
index f400ae3e..4cb5ab05 100644
--- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java
+++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java
@@ -1,161 +1,16 @@
package org.highmed.dsf.bpe.start;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY;
-import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_QUERY;
-import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE;
-import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC;
-import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP;
-import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER;
-import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY;
-import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION;
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_FHIR_BASE_URL;
-import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1;
-import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2;
-import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3;
-import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP;
-
-import java.util.Date;
-import java.util.UUID;
-
-import org.hl7.fhir.r4.model.BooleanType;
-import org.hl7.fhir.r4.model.Bundle;
-import org.hl7.fhir.r4.model.Bundle.BundleType;
-import org.hl7.fhir.r4.model.Bundle.HTTPVerb;
-import org.hl7.fhir.r4.model.Expression;
-import org.hl7.fhir.r4.model.Group;
-import org.hl7.fhir.r4.model.Group.GroupType;
-import org.hl7.fhir.r4.model.IdType;
-import org.hl7.fhir.r4.model.Identifier;
-import org.hl7.fhir.r4.model.Narrative;
-import org.hl7.fhir.r4.model.Reference;
-import org.hl7.fhir.r4.model.ResearchStudy;
-import org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus;
-import org.hl7.fhir.r4.model.ResourceType;
-import org.hl7.fhir.r4.model.StringType;
-import org.hl7.fhir.r4.model.Task;
-import org.hl7.fhir.r4.model.Task.TaskIntent;
-import org.hl7.fhir.r4.model.Task.TaskStatus;
public class RequestFeasibilityFromMedicsViaMedic1ExampleStarter
+ extends AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter
{
// Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
- // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
// Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
- // password
+ // password
public static void main(String[] args) throws Exception
{
- Bundle bundle = createStartResource();
- ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL).startWith(bundle);
- }
-
- private static Bundle createStartResource()
- {
- Group group1 = createGroup("Group 1");
- Group group2 = createGroup("Group 2");
- ResearchStudy researchStudy = createResearchStudy(group1, group2);
- Task task = createTask(researchStudy);
-
- Bundle bundle = new Bundle();
- bundle.setType(BundleType.TRANSACTION);
- bundle.addEntry().setResource(group1).setFullUrl(group1.getIdElement().getIdPart()).getRequest()
- .setMethod(HTTPVerb.POST).setUrl(ResourceType.Group.name());
- bundle.addEntry().setResource(group2).setFullUrl(group2.getIdElement().getIdPart()).getRequest()
- .setMethod(HTTPVerb.POST).setUrl(ResourceType.Group.name());
- bundle.addEntry().setResource(researchStudy).setFullUrl(researchStudy.getIdElement().getIdPart()).getRequest()
- .setMethod(HTTPVerb.POST).setUrl(ResourceType.ResearchStudy.name());
- bundle.addEntry().setResource(task).setFullUrl(task.getIdElement().getIdPart()).getRequest()
- .setMethod(HTTPVerb.POST).setUrl(ResourceType.Task.name());
-
- return bundle;
- }
-
- private static Group createGroup(String name)
- {
- Group group = new Group();
- group.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
-
- group.getMeta().addProfile(PROFILE_HIGHMED_GROUP);
- group.getText().getDiv().addText("This is the description");
- group.getText().setStatus(Narrative.NarrativeStatus.ADDITIONAL);
- group.setType(GroupType.PERSON);
- group.setActual(false);
- group.setActive(true);
- group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY).setValue(
- new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression("SELECT COUNT(e) FROM EHR e"));
- group.setName(name);
-
- return group;
- }
-
- private static ResearchStudy createResearchStudy(Group group1, Group group2)
- {
- ResearchStudy researchStudy = new ResearchStudy();
- researchStudy.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
-
- researchStudy.getMeta().addProfile(PROFILE_HIGHEMD_RESEARCH_STUDY);
- researchStudy.addIdentifier().setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)
- .setValue(UUID.randomUUID().toString());
- researchStudy.setStatus(ResearchStudyStatus.ACTIVE);
- researchStudy.addEnrollment().setReference(group1.getIdElement().getIdPart());
- researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart());
-
- researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue(
- new Reference().setType(ResourceType.Organization.name()).setIdentifier(
- new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1)));
- researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue(
- new Reference().setType(ResourceType.Organization.name()).setIdentifier(
- new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2)));
- researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue(
- new Reference().setType(ResourceType.Organization.name()).setIdentifier(
- new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3)));
- researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP).setValue(
- new Reference().setType(ResourceType.Organization.name()).setIdentifier(
- new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP)));
-
- return researchStudy;
- }
-
- private static Task createTask(ResearchStudy researchStudy)
- {
- Task task = new Task();
- task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString()));
-
- task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY);
- task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION);
- task.setStatus(TaskStatus.REQUESTED);
- task.setIntent(TaskIntent.ORDER);
- task.setAuthoredOn(new Date());
- task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
- task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
-
- task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME)).getType()
- .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
- task.addInput().setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart())
- .setType(ResourceType.ResearchStudy.name())).getType().addCoding()
- .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
- .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE);
- task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
- .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE);
- task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
- .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK);
-
- return task;
+ new RequestFeasibilityFromMedicsViaMedic1ExampleStarter().main(args, MEDIC_1_FHIR_BASE_URL);
}
}
diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java
new file mode 100644
index 00000000..e12cd5bc
--- /dev/null
+++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java
@@ -0,0 +1,116 @@
+package org.highmed.dsf.fhir.profile;
+
+import static org.highmed.dsf.bpe.FeasibilityProcessPluginDefinition.VERSION;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+
+import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelper;
+import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelperImpl;
+import org.highmed.dsf.fhir.validation.ResourceValidator;
+import org.highmed.dsf.fhir.validation.ResourceValidatorImpl;
+import org.highmed.dsf.fhir.validation.ValidationSupportRule;
+import org.hl7.fhir.r4.model.ActivityDefinition;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ca.uhn.fhir.validation.ResultSeverityEnum;
+import ca.uhn.fhir.validation.ValidationResult;
+
+public class ActivityDefinitionProfileTest
+{
+ private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class);
+
+ @ClassRule
+ public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION,
+ Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml",
+ "highmed-extension-process-authorization-consortium-role-0.5.0.xml",
+ "highmed-extension-process-authorization-organization-0.5.0.xml",
+ "highmed-coding-process-authorization-local-all-0.5.0.xml",
+ "highmed-coding-process-authorization-local-consortium-role-0.5.0.xml",
+ "highmed-coding-process-authorization-local-organization-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-all-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-consortium-role-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-organization-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-recipient-0.5.0.xml",
+ "highmed-process-authorization-requester-0.5.0.xml"));
+
+ private final ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(),
+ validationRule.getValidationSupport());
+
+ private final ProcessAuthorizationHelper processAuthorizationHelper = new ProcessAuthorizationHelperImpl();
+
+ @Test
+ public void testComputeFeasibilityValid() throws Exception
+ {
+ try (InputStream in = Files
+ .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml")))
+ {
+ ActivityDefinition ad = validationRule.getFhirContext().newXmlParser()
+ .parseResource(ActivityDefinition.class, in);
+
+ ValidationResult result = resourceValidator.validate(ad);
+ ValidationSupportRule.logValidationMessages(logger, result);
+
+ assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity())
+ || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count());
+
+ assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier ->
+ {
+ System.err.println("Org: " + orgIdentifier);
+ return true;
+ }, role ->
+ {
+ System.err.println("Role:" + role);
+ return true;
+ }));
+ }
+ }
+
+ @Test
+ public void testExecuteFeasibilityValid() throws Exception
+ {
+ try (InputStream in = Files
+ .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml")))
+ {
+ ActivityDefinition ad = validationRule.getFhirContext().newXmlParser()
+ .parseResource(ActivityDefinition.class, in);
+
+ ValidationResult result = resourceValidator.validate(ad);
+ ValidationSupportRule.logValidationMessages(logger, result);
+
+ assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity())
+ || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count());
+
+ assertTrue(
+ processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true));
+ }
+ }
+
+ @Test
+ public void testRequestFeasibilityValid() throws Exception
+ {
+ try (InputStream in = Files
+ .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml")))
+ {
+ ActivityDefinition ad = validationRule.getFhirContext().newXmlParser()
+ .parseResource(ActivityDefinition.class, in);
+
+ ValidationResult result = resourceValidator.validate(ad);
+ ValidationSupportRule.logValidationMessages(logger, result);
+
+ assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity())
+ || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count());
+
+ assertTrue(
+ processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true));
+ }
+ }
+}
\ No newline at end of file
diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
index eb808a9e..b3cea862 100644
--- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
+++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
@@ -68,14 +68,14 @@ public class TaskProfileTest
@ClassRule
public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION,
- Arrays.asList("highmed-task-base-0.4.0.xml", "highmed-group-0.4.0.xml",
- "highmed-extension-group-id-0.4.0.xml", "highmed-research-study-0.4.0.xml",
+ Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-group-0.5.0.xml",
+ "highmed-extension-group-id-0.5.0.xml", "highmed-research-study-0.5.0.xml",
"highmed-task-request-feasibility.xml", "highmed-task-execute-feasibility.xml",
"highmed-task-single-medic-result-feasibility.xml", "highmed-task-compute-feasibility.xml",
"highmed-task-multi-medic-result-feasibility.xml", "highmed-task-error-feasibility.xml"),
- Arrays.asList("highmed-authorization-role-0.4.0.xml", "highmed-bpmn-message-0.4.0.xml",
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml",
"highmed-feasibility.xml"),
- Arrays.asList("highmed-authorization-role-0.4.0.xml", "highmed-bpmn-message-0.4.0.xml",
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml",
"highmed-feasibility.xml"));
private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(),
diff --git a/dsf-bpe-process-local-services/pom.xml b/dsf-bpe-process-local-services/pom.xml
index 676c52a3..710ff991 100644
--- a/dsf-bpe-process-local-services/pom.xml
+++ b/dsf-bpe-process-local-services/pom.xml
@@ -9,8 +9,13 @@
dsf-bpe-highmed-processes-pom
org.highmed.dsf
- 0.4.1
+ 0.5.0
+
+
+ ${project.basedir}/..
+ ../../highmed-dsf
+
@@ -65,7 +70,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup/bpe/process
@@ -82,7 +87,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process
@@ -99,7 +104,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process
@@ -116,7 +121,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process
@@ -133,7 +138,79 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic1
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic2
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic3
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/ttp
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process
+
@@ -144,35 +221,63 @@
- ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process
${project.artifactId}-${project.version}.jar
diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java
index 7dba0856..70562d56 100644
--- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java
+++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java
@@ -6,7 +6,7 @@
public interface ConstantsLocalServices
{
String PROFILE_HIGHMED_TASK_LOCAL_SERVICES = "http://highmed.org/fhir/StructureDefinition/task-local-services-integration";
- String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION =
- PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI + VERSION;
+ String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI
+ + VERSION;
String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME = "localServicesIntegrationMessage";
}
diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java
index 8c682370..c9e431f4 100644
--- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java
+++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java
@@ -13,15 +13,16 @@
import org.highmed.dsf.fhir.resources.ResourceProvider;
import org.highmed.dsf.fhir.resources.StructureDefinitionResource;
import org.highmed.dsf.fhir.resources.ValueSetResource;
+import org.springframework.core.env.PropertyResolver;
import ca.uhn.fhir.context.FhirContext;
public class LocalServicesProcessPluginDefinition implements ProcessPluginDefinition
{
- public static final String VERSION = "0.4.1";
+ public static final String VERSION = "0.5.0";
- private static final String DEPENDENCY_FEASIBILITY_VERSION = "0.4.1";
- private static final String DEPENDENCY_FEASIBILITY_NAME_AND_VERSION = "dsf-bpe-process-feasibility-0.4.1";
+ private static final String DEPENDENCY_FEASIBILITY_VERSION = "0.5.0";
+ private static final String DEPENDENCY_FEASIBILITY_NAME_AND_VERSION = "dsf-bpe-process-feasibility-0.5.0";
@Override
public String getName()
@@ -54,24 +55,22 @@ public List getDependencyNamesAndVersions()
}
@Override
- public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader)
+ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader,
+ PropertyResolver resolver)
{
var aL = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-localServicesIntegration.xml");
var sTL = StructureDefinitionResource
.file("fhir/StructureDefinition/highmed-task-local-services-integration.xml");
- var vF = ValueSetResource
- .dependency(DEPENDENCY_FEASIBILITY_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/feasibility",
- DEPENDENCY_FEASIBILITY_VERSION);
- var cF = CodeSystemResource
- .dependency(DEPENDENCY_FEASIBILITY_NAME_AND_VERSION, "http://highmed.org/fhir/CodeSystem/feasibility",
- DEPENDENCY_FEASIBILITY_VERSION);
+ var vF = ValueSetResource.dependency(DEPENDENCY_FEASIBILITY_NAME_AND_VERSION,
+ "http://highmed.org/fhir/ValueSet/feasibility", DEPENDENCY_FEASIBILITY_VERSION);
+ var cF = CodeSystemResource.dependency(DEPENDENCY_FEASIBILITY_NAME_AND_VERSION,
+ "http://highmed.org/fhir/CodeSystem/feasibility", DEPENDENCY_FEASIBILITY_VERSION);
Map> resourcesByProcessKeyAndVersion = Map
- .of("localServicesIntegration/" + VERSION, Arrays.asList(aL, sTL, vF, cF));
+ .of("highmedorg_localServicesIntegration/" + VERSION, Arrays.asList(aL, sTL, vF, cF));
- return ResourceProvider
- .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader,
- resourcesByProcessKeyAndVersion);
+ return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false),
+ classLoader, resolver, resourcesByProcessKeyAndVersion);
}
}
diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java
index 6a020529..e80f59cb 100644
--- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java
+++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java
@@ -8,7 +8,6 @@
import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK;
import java.util.List;
-import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -17,20 +16,22 @@
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.bpe.variables.BloomFilterConfig;
import org.highmed.dsf.bpe.variables.BloomFilterConfigValues;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.dsf.fhir.variables.FhirResourcesListValues;
import org.hl7.fhir.r4.model.Expression;
import org.hl7.fhir.r4.model.Group;
-import org.hl7.fhir.r4.model.IdType;
+import org.hl7.fhir.r4.model.Group.GroupType;
import org.hl7.fhir.r4.model.Task;
import org.springframework.beans.factory.InitializingBean;
public class ExtractInputValues extends AbstractServiceDelegate implements InitializingBean
{
- public ExtractInputValues(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public ExtractInputValues(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
@@ -64,12 +65,16 @@ private Stream getQueries(Task task)
private List getCohortDefinitions(Stream queries)
{
- return queries.map(q -> {
+ return queries.map(q ->
+ {
Group group = new Group();
- group.setIdElement(new IdType(UUID.randomUUID().toString()));
+ group.setType(GroupType.PERSON);
+ group.setActual(false);
group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY)
.setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(q));
- return group;
+ getReadAccessHelper().addLocal(group);
+
+ return getFhirWebserviceClientProvider().getLocalWebserviceClient().create(group);
}).collect(Collectors.toList());
}
@@ -77,29 +82,27 @@ private boolean getNeedsConsentCheck(Task task)
{
return getTaskHelper()
.getFirstInputParameterBooleanValue(task, ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY,
- ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK).orElseThrow(
- () -> new IllegalArgumentException(
- "NeedsConsentCheck boolean is not set in task with id='" + task.getId()
- + "', this error should " + "have been caught by resource validation"));
+ ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK)
+ .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='"
+ + task.getId() + "', this error should " + "have been caught by resource validation"));
}
private boolean getNeedsRecordLinkageCheck(Task task)
{
return getTaskHelper()
.getFirstInputParameterBooleanValue(task, ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY,
- ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow(
- () -> new IllegalArgumentException(
- "NeedsRecordLinkage boolean is not set in task with id='" + task.getId()
- + "', this error should " + "have been caught by resource validation"));
+ ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE)
+ .orElseThrow(
+ () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='"
+ + task.getId() + "', this error should " + "have been caught by resource validation"));
}
private BloomFilterConfig getBloomFilterConfig(Task task)
{
return BloomFilterConfig.fromBytes(getTaskHelper()
.getFirstInputParameterByteValue(task, ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY,
- ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG).orElseThrow(
- () -> new IllegalArgumentException(
- "BloomFilterConfig byte[] is not set in task with id='" + task.getId()
- + "', this error should " + "have been caught by resource validation")));
+ ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG)
+ .orElseThrow(() -> new IllegalArgumentException("BloomFilterConfig byte[] is not set in task with id='"
+ + task.getId() + "', this error should " + "have been caught by resource validation")));
}
}
diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java
index da4623b0..0d1b19dd 100644
--- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java
+++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java
@@ -7,6 +7,7 @@
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResult;
import org.highmed.dsf.bpe.variables.FeasibilityQueryResults;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.hl7.fhir.r4.model.Extension;
@@ -20,9 +21,10 @@ public class StoreResult extends AbstractServiceDelegate implements Initializing
{
private static final Logger logger = LoggerFactory.getLogger(StoreResult.class);
- public StoreResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public StoreResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
@@ -44,29 +46,29 @@ private void addOutput(Task task, FeasibilityQueryResult result)
{
if (result.isCohortSizeResult())
{
- Task.TaskOutputComponent output = getTaskHelper()
- .createOutputUnsignedInt(ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY,
- ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT,
- result.getCohortSize());
+ Task.TaskOutputComponent output = getTaskHelper().createOutputUnsignedInt(
+ ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY,
+ ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT,
+ result.getCohortSize());
output.addExtension(createCohortIdExtension(result.getCohortId()));
task.addOutput(output);
}
else if (result.isIdResultSetUrlResult())
{
- Task.TaskOutputComponent output = getTaskHelper()
- .createOutput(ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY,
- ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE,
- new Reference(result.getResultSetUrl()));
+ Task.TaskOutputComponent output = getTaskHelper().createOutput(
+ ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY,
+ ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE,
+ new Reference(result.getResultSetUrl()));
output.addExtension(createCohortIdExtension(result.getCohortId()));
task.addOutput(output);
}
else
{
- logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + result
- .getCohortId());
+ logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID "
+ + result.getCohortId());
throw new RuntimeException(
- "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + result
- .getCohortId());
+ "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID "
+ + result.getCohortId());
}
}
diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java
index c351806a..12681ab6 100644
--- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java
+++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java
@@ -10,6 +10,7 @@
import org.highmed.dsf.bpe.service.GenerateCountFromIds;
import org.highmed.dsf.bpe.service.ModifyQueries;
import org.highmed.dsf.bpe.service.StoreResult;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.group.GroupHelper;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
@@ -40,13 +41,16 @@ public class LocalServicesConfig
@Autowired
private OrganizationProvider organizationProvider;
-
+
@Autowired
private TaskHelper taskHelper;
+ @Autowired
+ private ReadAccessHelper readAccessHelper;
+
@Autowired
private GroupHelper groupHelper;
-
+
@Autowired
private ObjectMapper objectMapper;
@@ -59,38 +63,38 @@ public class LocalServicesConfig
@Bean
public ExtractInputValues extractInputValues()
{
- return new ExtractInputValues(fhirClientProvider, taskHelper);
+ return new ExtractInputValues(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public StoreResult storeResult()
{
- return new StoreResult(fhirClientProvider, taskHelper);
+ return new StoreResult(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public CheckSingleMedicResults checkSingleMedicResults()
{
- return new CheckSingleMedicResults(fhirClientProvider, taskHelper);
+ return new CheckSingleMedicResults(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public ModifyQueries modifyQueries()
{
- return new ModifyQueries(fhirClientProvider, taskHelper, ehrIdColumnPath);
+ return new ModifyQueries(fhirClientProvider, taskHelper, readAccessHelper, ehrIdColumnPath);
}
@Bean
public FilterQueryResultsByConsent filterQueryResultsByConsent()
{
- return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper);
+ return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper);
}
@Bean
public GenerateBloomFilters generateBloomFilters()
{
- return new GenerateBloomFilters(fhirClientProvider, taskHelper, ehrIdColumnPath, masterPatientIndexClient(),
- objectMapper, bouncyCastleProvider());
+ return new GenerateBloomFilters(fhirClientProvider, taskHelper, readAccessHelper, ehrIdColumnPath,
+ masterPatientIndexClient(), objectMapper, bouncyCastleProvider());
}
@Bean
@@ -104,28 +108,29 @@ public BouncyCastleProvider bouncyCastleProvider()
{
return new BouncyCastleProvider();
}
-
+
@Bean
public GenerateCountFromIds generateCountFromIds()
{
- return new GenerateCountFromIds(fhirClientProvider, taskHelper);
+ return new GenerateCountFromIds(fhirClientProvider, taskHelper, readAccessHelper);
}
-
+
@Bean
public ExecuteQueries executeQueries()
{
- return new ExecuteQueries(fhirClientProvider, openEhrClient(), taskHelper, organizationProvider);
+ return new ExecuteQueries(fhirClientProvider, openEhrClient(), taskHelper, readAccessHelper,
+ organizationProvider);
}
-
+
@Bean
public OpenEhrClient openEhrClient()
{
return openEhrClientFactory.createClient(environment::getProperty);
}
-
+
@Bean
public CheckQueries checkQueries()
{
- return new CheckQueries(fhirClientProvider, taskHelper, groupHelper);
+ return new CheckQueries(fhirClientProvider, taskHelper, readAccessHelper, groupHelper);
}
}
diff --git a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn
index 863dadc4..bac4e414 100644
--- a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn
+++ b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn
@@ -1,6 +1,6 @@
-
-
+
+
SequenceFlow_0q803rh
SequenceFlow_04ouilq
@@ -92,14 +92,6 @@
SequenceFlow_1rmqv20
-
-
- resultSingleMedicFeasibilityMessage
- 0.4.1
- computeFeasibility
- http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility
-
-
Flow_0m4rhl9
@@ -122,7 +114,11 @@
-
+
+
+
+
+
@@ -216,10 +212,6 @@
-
-
-
-
@@ -237,9 +229,6 @@
-
-
-
@@ -282,6 +271,9 @@
+
+
+
diff --git a/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml b/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml
index e86fc545..510b6a7d 100644
--- a/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml
+++ b/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml
@@ -1,62 +1,76 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
-
-
+
+
+
-
+
-
-
+
+
-
-
+
+
\ No newline at end of file
diff --git a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml
index 0a14027d..b56866de 100644
--- a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml
+++ b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml
@@ -2,8 +2,8 @@
-
-
+
+
@@ -13,7 +13,7 @@
-
+
diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/AbstractLocalServicesMedic1ExampleStarter.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/AbstractLocalServicesMedic1ExampleStarter.java
new file mode 100644
index 00000000..853f315e
--- /dev/null
+++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/AbstractLocalServicesMedic1ExampleStarter.java
@@ -0,0 +1,91 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_QUERY_TYPE;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK;
+import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE;
+import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES;
+import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION;
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1;
+
+import java.util.Date;
+import java.util.Random;
+
+import javax.crypto.KeyGenerator;
+
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.highmed.dsf.bpe.variables.BloomFilterConfig;
+import org.hl7.fhir.r4.model.Base64BinaryType;
+import org.hl7.fhir.r4.model.BooleanType;
+import org.hl7.fhir.r4.model.ResourceType;
+import org.hl7.fhir.r4.model.StringType;
+import org.hl7.fhir.r4.model.Task;
+
+public abstract class AbstractLocalServicesMedic1ExampleStarter
+{
+ private static boolean NEEDS_CONSENT_CHECK = true;
+ private static boolean NEEDS_RECORD_LINKAGE = true;
+
+ protected void main(String[] args, String baseUrl) throws Exception
+ {
+ Task task = createStartResource();
+ ExampleStarter.forServer(args, baseUrl).startWith(task);
+ }
+
+ private Task createStartResource()
+ {
+ Task task = new Task();
+
+ task.getMeta().addProfile(PROFILE_HIGHMED_TASK_LOCAL_SERVICES);
+ task.setInstantiatesUri(PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION);
+ task.setStatus(Task.TaskStatus.REQUESTED);
+ task.setIntent(Task.TaskIntent.ORDER);
+ task.setAuthoredOn(new Date());
+
+ task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
+ task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
+
+ task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME)).getType().addCoding()
+ .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
+
+ task.addInput().setValue(new StringType("SELECT COUNT(e) FROM EHR e;")).getType().addCoding()
+ .setSystem(CODESYSTEM_HIGHMED_QUERY_TYPE).setCode(CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL);
+ task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding()
+ .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
+ .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK);
+ task.addInput().setValue(new BooleanType(NEEDS_RECORD_LINKAGE)).getType().addCoding()
+ .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
+ .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE);
+
+ if (NEEDS_RECORD_LINKAGE)
+ {
+ try
+ {
+ BouncyCastleProvider bouncyCastleProvider = new BouncyCastleProvider();
+ BloomFilterConfig bloomFilterConfig = new BloomFilterConfig(new Random().nextLong(),
+ KeyGenerator.getInstance("HmacSHA256", bouncyCastleProvider).generateKey(),
+ KeyGenerator.getInstance("HmacSHA3-256", bouncyCastleProvider).generateKey());
+
+ task.addInput().setValue(new Base64BinaryType(bloomFilterConfig.toBytes())).getType().addCoding()
+ .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
+ .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG);
+ }
+ catch (Exception exception)
+ {
+ throw new RuntimeException("Could not create BloomFilterConfig", exception);
+ }
+ }
+
+ return task;
+ }
+}
diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1DockerExampleStarter.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1DockerExampleStarter.java
new file mode 100644
index 00000000..bc56c526
--- /dev/null
+++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1DockerExampleStarter.java
@@ -0,0 +1,15 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_DOCKER_FHIR_BASE_URL;
+
+public class LocalServicesMedic1DockerExampleStarter extends AbstractLocalServicesMedic1ExampleStarter
+{
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
+ // password
+ public static void main(String[] args) throws Exception
+ {
+ new LocalServicesMedic1ExampleStarter().main(args, MEDIC_1_DOCKER_FHIR_BASE_URL);
+ }
+}
\ No newline at end of file
diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java
index c7cee546..50625119 100644
--- a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java
+++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java
@@ -1,96 +1,15 @@
package org.highmed.dsf.bpe.start;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_QUERY_TYPE;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL;
-import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK;
-import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE;
-import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES;
-import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION;
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_FHIR_BASE_URL;
-import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1;
-import java.util.Date;
-import java.util.Random;
-
-import javax.crypto.KeyGenerator;
-
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.highmed.dsf.bpe.variables.BloomFilterConfig;
-import org.hl7.fhir.r4.model.Base64BinaryType;
-import org.hl7.fhir.r4.model.BooleanType;
-import org.hl7.fhir.r4.model.ResourceType;
-import org.hl7.fhir.r4.model.StringType;
-import org.hl7.fhir.r4.model.Task;
-
-public class LocalServicesMedic1ExampleStarter
+public class LocalServicesMedic1ExampleStarter extends AbstractLocalServicesMedic1ExampleStarter
{
- private static boolean NEEDS_CONSENT_CHECK = true;
- private static boolean NEEDS_RECORD_LINKAGE = true;
-
// Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
- // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
// Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
- // password
+ // password
public static void main(String[] args) throws Exception
{
- Task task = createStartResource();
- ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL).startWith(task);
- }
-
- private static Task createStartResource()
- {
- Task task = new Task();
-
- task.getMeta().addProfile(PROFILE_HIGHMED_TASK_LOCAL_SERVICES);
- task.setInstantiatesUri(PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION);
- task.setStatus(Task.TaskStatus.REQUESTED);
- task.setIntent(Task.TaskIntent.ORDER);
- task.setAuthoredOn(new Date());
-
- task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
- task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
-
- task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME)).getType().addCoding()
- .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
-
- task.addInput().setValue(new StringType("SELECT COUNT(e) FROM EHR e;")).getType().addCoding()
- .setSystem(CODESYSTEM_HIGHMED_QUERY_TYPE).setCode(CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL);
- task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding()
- .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
- .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK);
- task.addInput().setValue(new BooleanType(NEEDS_RECORD_LINKAGE)).getType().addCoding()
- .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
- .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE);
-
- if (NEEDS_RECORD_LINKAGE)
- {
- try
- {
- BouncyCastleProvider bouncyCastleProvider = new BouncyCastleProvider();
- BloomFilterConfig bloomFilterConfig = new BloomFilterConfig(new Random().nextLong(),
- KeyGenerator.getInstance("HmacSHA256", bouncyCastleProvider).generateKey(),
- KeyGenerator.getInstance("HmacSHA3-256", bouncyCastleProvider).generateKey());
-
- task.addInput().setValue(new Base64BinaryType(bloomFilterConfig.toBytes())).getType().addCoding()
- .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY)
- .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG);
- }
- catch (Exception exception)
- {
- throw new RuntimeException("Could not create BloomFilterConfig", exception);
- }
- }
-
- return task;
+ new LocalServicesMedic1ExampleStarter().main(args, MEDIC_1_FHIR_BASE_URL);
}
}
diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java
new file mode 100644
index 00000000..c804f720
--- /dev/null
+++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java
@@ -0,0 +1,69 @@
+package org.highmed.dsf.fhir.profile;
+
+import static org.highmed.dsf.bpe.LocalServicesProcessPluginDefinition.VERSION;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+
+import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelper;
+import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelperImpl;
+import org.highmed.dsf.fhir.validation.ResourceValidator;
+import org.highmed.dsf.fhir.validation.ResourceValidatorImpl;
+import org.highmed.dsf.fhir.validation.ValidationSupportRule;
+import org.hl7.fhir.r4.model.ActivityDefinition;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ca.uhn.fhir.validation.ResultSeverityEnum;
+import ca.uhn.fhir.validation.ValidationResult;
+
+public class ActivityDefinitionProfileTest
+{
+ private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class);
+
+ @ClassRule
+ public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION,
+ Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml",
+ "highmed-extension-process-authorization-consortium-role-0.5.0.xml",
+ "highmed-extension-process-authorization-organization-0.5.0.xml",
+ "highmed-coding-process-authorization-local-all-0.5.0.xml",
+ "highmed-coding-process-authorization-local-consortium-role-0.5.0.xml",
+ "highmed-coding-process-authorization-local-organization-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-all-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-consortium-role-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-organization-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-recipient-0.5.0.xml",
+ "highmed-process-authorization-requester-0.5.0.xml"));
+
+ private final ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(),
+ validationRule.getValidationSupport());
+
+ private final ProcessAuthorizationHelper processAuthorizationHelper = new ProcessAuthorizationHelperImpl();
+
+ @Test
+ public void testLocalServicesIntegrationValid() throws Exception
+ {
+ try (InputStream in = Files.newInputStream(
+ Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml")))
+ {
+ ActivityDefinition ad = validationRule.getFhirContext().newXmlParser()
+ .parseResource(ActivityDefinition.class, in);
+
+ ValidationResult result = resourceValidator.validate(ad);
+ ValidationSupportRule.logValidationMessages(logger, result);
+
+ assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity())
+ || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count());
+
+ assertTrue(
+ processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true));
+ }
+ }
+}
\ No newline at end of file
diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
index 364a3b7c..fa64f641 100644
--- a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
+++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
@@ -41,13 +41,13 @@ public class TaskProfileTest
@ClassRule
public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION,
- Arrays.asList("highmed-task-base-0.4.0.xml", "highmed-group-0.4.0.xml",
- "highmed-extension-group-id-0.4.0.xml", "highmed-extension-query-0.4.0.xml",
+ Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-group-0.5.0.xml",
+ "highmed-extension-group-id-0.5.0.xml", "highmed-extension-query-0.5.0.xml",
"highmed-task-local-services-integration.xml"),
- Arrays.asList("highmed-authorization-role-0.4.0.xml", "highmed-bpmn-message-0.4.0.xml",
- "highmed-feasibility.xml", "highmed-query-type-0.4.0.xml"),
- Arrays.asList("highmed-authorization-role-0.4.0.xml", "highmed-bpmn-message-0.4.0.xml",
- "highmed-feasibility.xml", "highmed-query-type-0.4.0.xml"));
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml",
+ "highmed-feasibility.xml", "highmed-query-type-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml",
+ "highmed-feasibility.xml", "highmed-query-type-0.5.0.xml"));
private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(),
validationRule.getValidationSupport());
diff --git a/dsf-bpe-process-ping/pom.xml b/dsf-bpe-process-ping/pom.xml
index db0e33cd..50af9679 100644
--- a/dsf-bpe-process-ping/pom.xml
+++ b/dsf-bpe-process-ping/pom.xml
@@ -7,8 +7,13 @@
org.highmed.dsf
dsf-bpe-highmed-processes-pom
- 0.4.1
+ 0.5.0
+
+
+ ${project.basedir}/..
+ ../../highmed-dsf
+
@@ -58,7 +63,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup/bpe/process
@@ -75,7 +80,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process
@@ -92,7 +97,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process
@@ -109,7 +114,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process
@@ -126,7 +131,79 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic1
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic2
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic3
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/ttp
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process
+
@@ -137,35 +214,63 @@
- ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process
${project.artifactId}-${project.version}.jar
diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java
index 52dec26a..180a53a7 100644
--- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java
+++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java
@@ -10,12 +10,13 @@
import org.highmed.dsf.fhir.resources.ActivityDefinitionResource;
import org.highmed.dsf.fhir.resources.ResourceProvider;
import org.highmed.dsf.fhir.resources.StructureDefinitionResource;
+import org.springframework.core.env.PropertyResolver;
import ca.uhn.fhir.context.FhirContext;
public class PingProcessPluginDefinition implements ProcessPluginDefinition
{
- public static final String VERSION = "0.4.1";
+ public static final String VERSION = "0.5.0";
@Override
public String getName()
@@ -42,7 +43,8 @@ public Stream> getSpringConfigClasses()
}
@Override
- public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader)
+ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader,
+ PropertyResolver resolver)
{
var aPing = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-ping.xml");
var aPong = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-pong.xml");
@@ -51,12 +53,10 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader
.file("fhir/StructureDefinition/highmed-task-start-ping-process.xml");
var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml");
- Map> resourcesByProcessKeyAndVersion = Map
- .of("ping/" + VERSION, Arrays.asList(aPing, tPong, tStartPing), "pong/" + VERSION,
- Arrays.asList(aPong, tPing));
+ Map> resourcesByProcessKeyAndVersion = Map.of("highmedorg_ping/" + VERSION,
+ Arrays.asList(aPing, tPong, tStartPing), "highmedorg_pong/" + VERSION, Arrays.asList(aPong, tPing));
- return ResourceProvider
- .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader,
- resourcesByProcessKeyAndVersion);
+ return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false),
+ classLoader, resolver, resourcesByProcessKeyAndVersion);
}
}
diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java
index 13205a49..8a64cc1e 100644
--- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java
+++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java
@@ -1,5 +1,6 @@
package org.highmed.dsf.bpe.message;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.AbstractTaskMessageSend;
@@ -10,8 +11,8 @@
public class SendPing extends AbstractTaskMessageSend
{
public SendPing(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider, FhirContext fhirContext)
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext)
{
- super(clientProvider, taskHelper, organizationProvider, fhirContext);
+ super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
}
diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPong.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPong.java
index 1d98a3c5..3ba8659c 100644
--- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPong.java
+++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPong.java
@@ -1,5 +1,6 @@
package org.highmed.dsf.bpe.message;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.AbstractTaskMessageSend;
@@ -10,8 +11,8 @@
public class SendPong extends AbstractTaskMessageSend
{
public SendPong(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider, FhirContext fhirContext)
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext)
{
- super(clientProvider, taskHelper, organizationProvider, fhirContext);
+ super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
}
diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPing.java
index 41de1434..e436c9f6 100644
--- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPing.java
+++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPing.java
@@ -2,6 +2,7 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.hl7.fhir.r4.model.Task;
@@ -12,9 +13,10 @@ public class LogPing extends AbstractServiceDelegate
{
private static final Logger logger = LoggerFactory.getLogger(LogPing.class);
- public LogPing(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public LogPing(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java
index 97a79692..400ee43d 100644
--- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java
+++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java
@@ -2,6 +2,7 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.hl7.fhir.r4.model.Task;
@@ -12,9 +13,10 @@ public class LogPong extends AbstractServiceDelegate
{
private static final Logger logger = LoggerFactory.getLogger(LogPong.class);
- public LogPong(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ public LogPong(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java
index bb91420f..9066782e 100644
--- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java
+++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java
@@ -9,8 +9,9 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
-import org.highmed.dsf.fhir.organization.OrganizationProvider;
+import org.highmed.dsf.fhir.organization.EndpointProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.dsf.fhir.variables.Target;
import org.highmed.dsf.fhir.variables.Targets;
@@ -19,13 +20,14 @@
public class SelectPingTargets extends AbstractServiceDelegate implements InitializingBean
{
- private final OrganizationProvider organizationProvider;
+ private final EndpointProvider endpointProvider;
public SelectPingTargets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider)
+ ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider)
{
- super(clientProvider, taskHelper);
- this.organizationProvider = organizationProvider;
+ super(clientProvider, taskHelper, readAccessHelper);
+
+ this.endpointProvider = endpointProvider;
}
@Override
@@ -33,14 +35,17 @@ public void afterPropertiesSet() throws Exception
{
super.afterPropertiesSet();
- Objects.requireNonNull(organizationProvider, "organizationProvider");
+ Objects.requireNonNull(endpointProvider, "endpointProvider");
}
@Override
public void doExecute(DelegateExecution execution) throws Exception
{
- List targets = organizationProvider.getRemoteIdentifiers().stream().map(identifier -> Target
- .createBiDirectionalTarget(identifier.getValue(), UUID.randomUUID().toString()))
+ String localAddress = endpointProvider.getLocalEndpoint().getAddress();
+
+ List targets = endpointProvider.getDefaultEndpointAdressesByOrganizationIdentifier().entrySet().stream()
+ .filter(a -> !localAddress.equals(a.getValue()))
+ .map(e -> Target.createBiDirectionalTarget(e.getKey(), e.getValue(), UUID.randomUUID().toString()))
.collect(Collectors.toList());
execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets)));
diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPongTarget.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPongTarget.java
index f0d0cb0a..b064d657 100644
--- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPongTarget.java
+++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPongTarget.java
@@ -4,9 +4,13 @@
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY;
+import java.util.Objects;
+
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
+import org.highmed.dsf.fhir.organization.EndpointProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.dsf.fhir.variables.Target;
import org.highmed.dsf.fhir.variables.TargetValues;
@@ -16,9 +20,22 @@
public class SelectPongTarget extends AbstractServiceDelegate implements InitializingBean
{
- public SelectPongTarget(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper)
+ private final EndpointProvider endpointProvider;
+
+ public SelectPongTarget(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider)
+ {
+ super(clientProvider, taskHelper, readAccessHelper);
+
+ this.endpointProvider = endpointProvider;
+ }
+
+ @Override
+ public void afterPropertiesSet() throws Exception
{
- super(clientProvider, taskHelper);
+ super.afterPropertiesSet();
+
+ Objects.requireNonNull(endpointProvider, "endpointProvider");
}
@Override
@@ -30,7 +47,9 @@ public void doExecute(DelegateExecution execution) throws Exception
CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).get();
Identifier targetOrganizationIdentifier = task.getRequester().getIdentifier();
- execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues
- .create(Target.createBiDirectionalTarget(targetOrganizationIdentifier.getValue(), correlationKey)));
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET,
+ TargetValues.create(Target.createBiDirectionalTarget(targetOrganizationIdentifier.getValue(),
+ endpointProvider.getFirstDefaultEndpointAddress(targetOrganizationIdentifier.getValue()).get(),
+ correlationKey)));
}
}
diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java
index b1dd4a66..a67497cf 100644
--- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java
+++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java
@@ -6,7 +6,9 @@
import org.highmed.dsf.bpe.service.LogPong;
import org.highmed.dsf.bpe.service.SelectPingTargets;
import org.highmed.dsf.bpe.service.SelectPongTarget;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
+import org.highmed.dsf.fhir.organization.EndpointProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,11 +23,17 @@ public class PingConfig
@Autowired
private FhirWebserviceClientProvider clientProvider;
+ @Autowired
+ private TaskHelper taskHelper;
+
+ @Autowired
+ private ReadAccessHelper readAccessHelper;
+
@Autowired
private OrganizationProvider organizationProvider;
@Autowired
- private TaskHelper taskHelper;
+ private EndpointProvider endpointProvider;
@Autowired
private FhirContext fhirContext;
@@ -33,36 +41,36 @@ public class PingConfig
@Bean
public SendPing sendPing()
{
- return new SendPing(clientProvider, taskHelper, organizationProvider, fhirContext);
+ return new SendPing(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
@Bean
public SendPong sendPong()
{
- return new SendPong(clientProvider, taskHelper, organizationProvider, fhirContext);
+ return new SendPong(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
@Bean
public LogPing logPing()
{
- return new LogPing(clientProvider, taskHelper);
+ return new LogPing(clientProvider, taskHelper, readAccessHelper);
}
@Bean
public LogPong logPong()
{
- return new LogPong(clientProvider, taskHelper);
+ return new LogPong(clientProvider, taskHelper, readAccessHelper);
}
@Bean
public SelectPingTargets selectPingTargets()
{
- return new SelectPingTargets(clientProvider, taskHelper, organizationProvider);
+ return new SelectPingTargets(clientProvider, taskHelper, readAccessHelper, endpointProvider);
}
@Bean
public SelectPongTarget selectPongTarget()
{
- return new SelectPongTarget(clientProvider, taskHelper);
+ return new SelectPongTarget(clientProvider, taskHelper, readAccessHelper, endpointProvider);
}
}
diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn
index bc0a294c..1b87ce4b 100644
--- a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn
+++ b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn
@@ -1,6 +1,6 @@
-
-
+
+
@@ -10,10 +10,9 @@
- pong
- 0.4.1
+ http://highmed.org/bpe/Process/pong/0.5.0
pingMessage
- http://highmed.org/fhir/StructureDefinition/task-ping
+ http://highmed.org/fhir/StructureDefinition/task-ping|0.5.0
SequenceFlow_05ia6lz
@@ -68,7 +67,7 @@
-
+
@@ -83,19 +82,19 @@
-
+
-
+
-
-
-
+
+
+
diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn
index db73ab00..94580681 100644
--- a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn
+++ b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn
@@ -1,6 +1,6 @@
-
-
+
+
SequenceFlow_07w11cw
@@ -9,10 +9,9 @@
+ http://highmed.org/bpe/Process/ping/0.5.0
pongMessage
- 0.4.1
- ping
- http://highmed.org/fhir/StructureDefinition/task-pong
+ http://highmed.org/fhir/StructureDefinition/task-pong|0.5.0
SequenceFlow_1ism9wt
@@ -32,31 +31,31 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml
index ea907764..fb074ac7 100644
--- a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml
+++ b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml
@@ -1,108 +1,60 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
-
+
-
+
@@ -111,6 +63,6 @@
-
+
\ No newline at end of file
diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml
index a3236b97..fb6d1ce4 100644
--- a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml
+++ b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml
@@ -1,64 +1,40 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
-
+
-
+
@@ -67,6 +43,6 @@
-
+
\ No newline at end of file
diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml
index 941071c3..f388c627 100644
--- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml
+++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml
index 05c9d350..d4084cf4 100644
--- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml
+++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml
index 59b8881c..aebc6cde 100644
--- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml
+++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPing3MedicFromTtpExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPing3MedicFromTtpExampleStarter.java
new file mode 100644
index 00000000..ee760643
--- /dev/null
+++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPing3MedicFromTtpExampleStarter.java
@@ -0,0 +1,47 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
+import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION;
+import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING;
+import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP;
+
+import java.util.Date;
+
+import org.hl7.fhir.r4.model.ResourceType;
+import org.hl7.fhir.r4.model.StringType;
+import org.hl7.fhir.r4.model.Task;
+import org.hl7.fhir.r4.model.Task.TaskIntent;
+import org.hl7.fhir.r4.model.Task.TaskStatus;
+
+public abstract class AbstractPing3MedicFromTtpExampleStarter
+{
+ protected void main(String[] args, String baseUrl) throws Exception
+ {
+ Task task = createStartResource();
+ ExampleStarter.forServer(args, baseUrl).startWith(task);
+ }
+
+ private Task createStartResource()
+ {
+ Task task = new Task();
+ task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_PING);
+ task.setInstantiatesUri(PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION);
+ task.setStatus(TaskStatus.REQUESTED);
+ task.setIntent(TaskIntent.ORDER);
+ task.setAuthoredOn(new Date());
+ task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
+ task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
+
+ task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME)).getType().addCoding()
+ .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
+
+ return task;
+ }
+}
diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpDockerExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpDockerExampleStarter.java
new file mode 100644
index 00000000..815e80ef
--- /dev/null
+++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpDockerExampleStarter.java
@@ -0,0 +1,15 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_DOCKER_FHIR_BASE_URL;
+
+public class Ping3MedicFromTtpDockerExampleStarter extends AbstractPing3MedicFromTtpExampleStarter
+{
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
+ // password
+ public static void main(String[] args) throws Exception
+ {
+ new Ping3MedicFromTtpDockerExampleStarter().main(args, TTP_DOCKER_FHIR_BASE_URL);
+ }
+}
diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpExampleStarter.java
index a782ab52..6a3041a3 100644
--- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpExampleStarter.java
+++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpExampleStarter.java
@@ -1,52 +1,15 @@
package org.highmed.dsf.bpe.start;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
-import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION;
-import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING;
-import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP;
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_FHIR_BASE_URL;
-import java.util.Date;
-
-import org.hl7.fhir.r4.model.ResourceType;
-import org.hl7.fhir.r4.model.StringType;
-import org.hl7.fhir.r4.model.Task;
-import org.hl7.fhir.r4.model.Task.TaskIntent;
-import org.hl7.fhir.r4.model.Task.TaskStatus;
-
-public class Ping3MedicFromTtpExampleStarter
+public class Ping3MedicFromTtpExampleStarter extends AbstractPing3MedicFromTtpExampleStarter
{
// Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
- // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
// Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
- // password
+ // password
public static void main(String[] args) throws Exception
{
- Task task = createStartResource();
- ExampleStarter.forServer(args, TTP_FHIR_BASE_URL).startWith(task);
- }
-
- private static Task createStartResource()
- {
- Task task = new Task();
- task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_PING);
- task.setInstantiatesUri(PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION);
- task.setStatus(TaskStatus.REQUESTED);
- task.setIntent(TaskIntent.ORDER);
- task.setAuthoredOn(new Date());
- task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
- task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
-
- task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME)).getType().addCoding()
- .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
-
- return task;
+ new Ping3MedicFromTtpExampleStarter().main(args, TTP_FHIR_BASE_URL);
}
}
diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java
new file mode 100644
index 00000000..36e45fae
--- /dev/null
+++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java
@@ -0,0 +1,89 @@
+package org.highmed.dsf.fhir.profiles;
+
+import static org.highmed.dsf.bpe.PingProcessPluginDefinition.VERSION;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+
+import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelper;
+import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelperImpl;
+import org.highmed.dsf.fhir.validation.ResourceValidator;
+import org.highmed.dsf.fhir.validation.ResourceValidatorImpl;
+import org.highmed.dsf.fhir.validation.ValidationSupportRule;
+import org.hl7.fhir.r4.model.ActivityDefinition;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ca.uhn.fhir.validation.ResultSeverityEnum;
+import ca.uhn.fhir.validation.ValidationResult;
+
+public class ActivityDefinitionProfileTest
+{
+ private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class);
+
+ @ClassRule
+ public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION,
+ Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml",
+ "highmed-extension-process-authorization-consortium-role-0.5.0.xml",
+ "highmed-extension-process-authorization-organization-0.5.0.xml",
+ "highmed-coding-process-authorization-local-all-0.5.0.xml",
+ "highmed-coding-process-authorization-local-consortium-role-0.5.0.xml",
+ "highmed-coding-process-authorization-local-organization-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-all-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-consortium-role-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-organization-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-recipient-0.5.0.xml",
+ "highmed-process-authorization-requester-0.5.0.xml"));
+
+ private final ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(),
+ validationRule.getValidationSupport());
+
+ private final ProcessAuthorizationHelper processAuthorizationHelper = new ProcessAuthorizationHelperImpl();
+
+ @Test
+ public void testPingValid() throws Exception
+ {
+ try (InputStream in = Files
+ .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-ping.xml")))
+ {
+ ActivityDefinition ad = validationRule.getFhirContext().newXmlParser()
+ .parseResource(ActivityDefinition.class, in);
+
+ ValidationResult result = resourceValidator.validate(ad);
+ ValidationSupportRule.logValidationMessages(logger, result);
+
+ assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity())
+ || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count());
+
+ assertTrue(
+ processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true));
+ }
+ }
+
+ @Test
+ public void testPongValid() throws Exception
+ {
+ try (InputStream in = Files
+ .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-pong.xml")))
+ {
+ ActivityDefinition ad = validationRule.getFhirContext().newXmlParser()
+ .parseResource(ActivityDefinition.class, in);
+
+ ValidationResult result = resourceValidator.validate(ad);
+ ValidationSupportRule.logValidationMessages(logger, result);
+
+ assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity())
+ || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count());
+
+ assertTrue(
+ processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true));
+ }
+ }
+}
\ No newline at end of file
diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java
index 04b3a75b..a89d86dd 100644
--- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java
+++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java
@@ -42,10 +42,10 @@ public class TaskProfileTest
@ClassRule
public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION,
- Arrays.asList("highmed-task-base-0.4.0.xml", "highmed-task-start-ping-process.xml", "highmed-task-ping.xml",
+ Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-start-ping-process.xml", "highmed-task-ping.xml",
"highmed-task-pong.xml"),
- Arrays.asList("highmed-authorization-role-0.4.0.xml", "highmed-bpmn-message-0.4.0.xml"),
- Arrays.asList("highmed-authorization-role-0.4.0.xml", "highmed-bpmn-message-0.4.0.xml"));
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml"));
private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(),
validationRule.getValidationSupport());
diff --git a/dsf-bpe-process-update-allow-list/pom.xml b/dsf-bpe-process-update-allow-list/pom.xml
index c71aa0f4..5c39fb5f 100644
--- a/dsf-bpe-process-update-allow-list/pom.xml
+++ b/dsf-bpe-process-update-allow-list/pom.xml
@@ -7,8 +7,13 @@
org.highmed.dsf
dsf-bpe-highmed-processes-pom
- 0.4.1
+ 0.5.0
+
+
+ ${project.basedir}/..
+ ../../highmed-dsf
+
@@ -58,7 +63,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup/bpe/process
@@ -75,7 +80,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process
@@ -92,7 +97,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process
@@ -109,7 +114,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process
@@ -126,7 +131,79 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic1
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic2
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic3
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/ttp
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process
+
@@ -137,35 +214,63 @@
- ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process
${project.artifactId}-${project.version}.jar
diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java
index 920befdd..2e0c3e33 100644
--- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java
+++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java
@@ -6,17 +6,17 @@
public interface ConstantsUpdateAllowList
{
String CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST = "http://highmed.org/fhir/CodeSystem/update-allow-list";
- String CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST = "highmed_allow_list";
+ String CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST = "allow_list";
String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST = "http://highmed.org/fhir/StructureDefinition/task-download-allow-list";
String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "downloadAllowList/";
- String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION =
- PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI + VERSION;
+ String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI
+ + VERSION;
String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME = "downloadAllowListMessage";
String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST = "http://highmed.org/fhir/StructureDefinition/task-update-allow-list";
String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "updateAllowList/";
- String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION =
- PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI + VERSION;
+ String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI
+ + VERSION;
String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_MESSAGE_NAME = "updateAllowListMessage";
}
diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java
index 0df90299..0f330987 100644
--- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java
+++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java
@@ -12,12 +12,13 @@
import org.highmed.dsf.fhir.resources.ResourceProvider;
import org.highmed.dsf.fhir.resources.StructureDefinitionResource;
import org.highmed.dsf.fhir.resources.ValueSetResource;
+import org.springframework.core.env.PropertyResolver;
import ca.uhn.fhir.context.FhirContext;
public class UpdateAllowListProcessPluginDefinition implements ProcessPluginDefinition
{
- public static final String VERSION = "0.4.1";
+ public static final String VERSION = "0.5.0";
@Override
public String getName()
@@ -44,7 +45,8 @@ public Stream> getSpringConfigClasses()
}
@Override
- public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader)
+ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader,
+ PropertyResolver resolver)
{
var aDown = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-downloadAllowList.xml");
var aUp = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-updateAllowList.xml");
@@ -53,12 +55,11 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader
var sUp = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-update-allow-list.xml");
var v = ValueSetResource.file("fhir/ValueSet/highmed-update-allow-list.xml");
- Map> resourcesByProcessKeyAndVersion = Map
- .of("downloadAllowList/" + VERSION, Arrays.asList(aDown, c, sDown, v), "updateAllowList/" + VERSION,
- Arrays.asList(aUp, c, sUp, v));
+ Map> resourcesByProcessKeyAndVersion = Map.of(
+ "highmedorg_downloadAllowList/" + VERSION, Arrays.asList(aDown, c, sDown, v),
+ "highmedorg_updateAllowList/" + VERSION, Arrays.asList(aUp, c, sUp, v));
- return ResourceProvider
- .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader,
- resourcesByProcessKeyAndVersion);
+ return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false),
+ classLoader, resolver, resourcesByProcessKeyAndVersion);
}
}
diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/DownloadAllowList.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/DownloadAllowList.java
index dda7f7a4..7945405e 100644
--- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/DownloadAllowList.java
+++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/DownloadAllowList.java
@@ -12,6 +12,7 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.fhir.client.FhirWebserviceClient;
@@ -31,9 +32,11 @@ public class DownloadAllowList extends AbstractServiceDelegate
private final FhirContext context;
- public DownloadAllowList(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, FhirContext context)
+ public DownloadAllowList(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper, FhirContext context)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
+
this.context = context;
}
@@ -50,7 +53,7 @@ protected void doExecute(DelegateExecution execution) throws Exception
Task task = getCurrentTaskFromExecutionVariables();
IdType bundleId = getBundleId(task);
FhirWebserviceClient requesterClient = getFhirWebserviceClientProvider()
- .getRemoteWebserviceClient(bundleId.getBaseUrl());
+ .getWebserviceClient(bundleId.getBaseUrl());
Bundle bundle;
try
@@ -64,9 +67,8 @@ protected void doExecute(DelegateExecution execution) throws Exception
{
logger.error("Error while reading Bundle with id {} from organization {}: {}", bundleId.getValue(),
task.getRequester().getReference(), e.getMessage());
- throw new RuntimeException(
- "Error while reading Bundle with id " + bundleId.getValue() + " from organization " + task
- .getRequester().getReference() + ", " + e.getMessage(), e);
+ throw new RuntimeException("Error while reading Bundle with id " + bundleId.getValue()
+ + " from organization " + task.getRequester().getReference() + ", " + e.getMessage(), e);
}
if (!EnumSet.of(BundleType.TRANSACTION, BundleType.BATCH).contains(bundle.getType()))
@@ -84,17 +86,16 @@ protected void doExecute(DelegateExecution execution) throws Exception
{
logger.error("Error while executing Bundle with id {} from organization {} locally: {}",
bundleId.getValue(), task.getRequester().getReference(), e.getMessage());
- throw new RuntimeException(
- "Error while executing Bundle with id " + bundleId.getValue() + " from organization " + task
- .getRequester().getReference() + " locally, " + e.getMessage(), e);
+ throw new RuntimeException("Error while executing Bundle with id " + bundleId.getValue()
+ + " from organization " + task.getRequester().getReference() + " locally, " + e.getMessage(), e);
}
}
private IdType getBundleId(Task task)
{
- List bundleReferences = getTaskHelper()
- .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST,
- CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST).collect(Collectors.toList());
+ List bundleReferences = getTaskHelper().getInputParameterReferenceValues(task,
+ CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST, CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST)
+ .collect(Collectors.toList());
if (bundleReferences.size() != 1)
{
@@ -103,8 +104,8 @@ private IdType getBundleId(Task task)
throw new RuntimeException("Task input parameter " + CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST
+ " contains unexpected number of Bundle IDs, expected 1, got " + bundleReferences.size());
}
- else if (!bundleReferences.get(0).hasReference() || !bundleReferences.get(0).getReference()
- .contains("/Bundle/"))
+ else if (!bundleReferences.get(0).hasReference()
+ || !bundleReferences.get(0).getReference().contains("/Bundle/"))
{
logger.error("Task input parameter {} has no Bundle reference",
CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST);
diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/UpdateAllowList.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/UpdateAllowList.java
index 68f38815..cc72a034 100644
--- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/UpdateAllowList.java
+++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/UpdateAllowList.java
@@ -1,34 +1,34 @@
package org.highmed.dsf.bpe.service;
import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST;
import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
import java.util.UUID;
-import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
-import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.fhir.client.FhirWebserviceClient;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.Bundle.BundleType;
import org.hl7.fhir.r4.model.Bundle.HTTPVerb;
-import org.hl7.fhir.r4.model.Bundle.SearchEntryMode;
import org.hl7.fhir.r4.model.Endpoint;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Organization;
+import org.hl7.fhir.r4.model.OrganizationAffiliation;
import org.hl7.fhir.r4.model.Reference;
+import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.Task;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,22 +40,10 @@ public class UpdateAllowList extends AbstractServiceDelegate implements Initiali
{
private static final Logger logger = LoggerFactory.getLogger(UpdateAllowList.class);
- private final OrganizationProvider organizationProvider;
-
- public UpdateAllowList(OrganizationProvider organizationProvider, FhirWebserviceClientProvider clientProvider,
- TaskHelper taskHelper)
+ public UpdateAllowList(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
-
- this.organizationProvider = organizationProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(organizationProvider, "organizationProvider");
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
@@ -65,24 +53,41 @@ public void doExecute(DelegateExecution execution) throws Exception
Bundle searchSet = client.searchWithStrictHandling(Organization.class,
Map.of("active", Collections.singletonList("true"), "identifier",
- Collections.singletonList(organizationProvider.getDefaultIdentifierSystem() + "|"), "_include",
- Collections.singletonList("Organization:endpoint")));
+ Collections.singletonList(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER + "|"), "_include",
+ Collections.singletonList("Organization:endpoint"), "_revinclude",
+ Collections.singletonList("OrganizationAffiliation:participating-organization")));
+
+ Map identifierByTypeAndId = searchSet.getEntry().stream()
+ .filter(BundleEntryComponent::hasResource).map(BundleEntryComponent::getResource)
+ .filter(r -> r instanceof Organization || r instanceof Endpoint).filter(Resource::hasIdElement)
+ .collect(Collectors.toMap(r -> r.getIdElement().toUnqualifiedVersionless().getValue(),
+ this::getIdentifierValue));
+ Map tempIdsByTypeAndId = searchSet.getEntry().stream().filter(BundleEntryComponent::hasResource)
+ .map(BundleEntryComponent::getResource)
+ .filter(r -> r instanceof Organization || r instanceof Endpoint || r instanceof OrganizationAffiliation)
+ .filter(Resource::hasIdElement)
+ .collect(Collectors.toMap(r -> r.getIdElement().toUnqualifiedVersionless().getValue(),
+ r -> "urn:uuid:" + UUID.randomUUID().toString()));
Bundle transaction = new Bundle().setType(BundleType.TRANSACTION);
- transaction.getMeta().addTag().setSystem("http://highmed.org/fhir/CodeSystem/authorization-role")
- .setCode("REMOTE");
+
+ getReadAccessHelper().addAll(transaction);
+
transaction.getIdentifier().setSystem(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST)
.setValue(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST);
- searchSet.getEntry().stream()
- .filter(e -> e.hasSearch() && SearchEntryMode.MATCH.equals(e.getSearch().getMode()) && e.hasResource()
- && e.getResource() instanceof Organization).map(e -> (Organization) e.getResource())
- .forEach(addAllowListEntry(transaction, searchSet));
+
+ List entries = searchSet.getEntry().stream().filter(BundleEntryComponent::hasResource)
+ .map(BundleEntryComponent::getResource)
+ .filter(r -> r instanceof Organization || r instanceof Endpoint || r instanceof OrganizationAffiliation)
+ .map(toAllowListBundleEntry(identifierByTypeAndId, tempIdsByTypeAndId)).collect(Collectors.toList());
+
+ transaction.setEntry(entries);
logger.debug("Uploading new allow list transaction bundle: {}",
FhirContext.forR4().newJsonParser().encodeResourceToString(transaction));
- IdType result = client.withMinimalReturn().updateConditionaly(transaction, Map.of("identifier", Collections
- .singletonList(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST + "|"
+ IdType result = client.withMinimalReturn().updateConditionaly(transaction,
+ Map.of("identifier", Collections.singletonList(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST + "|"
+ CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST)));
Task task = getLeadingTaskFromExecutionVariables();
@@ -91,64 +96,143 @@ public void doExecute(DelegateExecution execution) throws Exception
.setCode(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST);
}
- private Consumer super Organization> addAllowListEntry(Bundle transaction, Bundle searchSet)
+ private String getIdentifierValue(Resource resource)
{
- return organization -> {
- Identifier identifier = getDefaultIdentifier(organization).get();
-
- BundleEntryComponent organizationEntry = transaction.addEntry();
- String organizationId = "urn:uuid:" + UUID.randomUUID();
- organizationEntry.setFullUrl(organizationId);
- organizationEntry.getRequest().setMethod(HTTPVerb.PUT)
- .setUrl("Organization?identifier=" + identifier.getSystem() + "|" + identifier.getValue());
-
- organization.setIdElement(new IdType(organizationId));
- organization.getMeta().setVersionIdElement(null).setLastUpdatedElement(null);
- organizationEntry.setResource(organization);
-
- organization.setEndpoint(organization.getEndpoint().stream()
- .map(addAllowListEntryReturnReference(transaction, organizationId, searchSet))
- .filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList()));
- };
+ if (resource instanceof Organization)
+ return ((Organization) resource).getIdentifier().stream().filter(Identifier::hasSystem)
+ .filter(i -> NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER.equals(i.getSystem())).findFirst()
+ .filter(Identifier::hasValue).map(Identifier::getValue)
+ .orElseThrow(() -> new RuntimeException("Organization is missing identifier value with system "
+ + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER));
+ else if (resource instanceof Endpoint)
+ return ((Endpoint) resource).getIdentifier().stream().filter(Identifier::hasSystem)
+ .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst()
+ .filter(Identifier::hasValue).map(Identifier::getValue)
+ .orElseThrow(() -> new RuntimeException("Endpoint is missing identifier value with system "
+ + NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER));
+ else
+ throw new IllegalStateException("Organization or Endpoint expected");
}
- private Function> addAllowListEntryReturnReference(Bundle transaction,
- String organizationId, Bundle searchSet)
+ private Function toAllowListBundleEntry(Map identifierByTypeAndId,
+ Map tempIdsByTypeAndId)
{
- return endpointRef -> getEndpoint(endpointRef, searchSet).map(endpoint -> {
- Identifier identifier = getDefaultIdentifier(endpoint).get();
-
- BundleEntryComponent endpointEntry = transaction.addEntry();
- String endpointId = "urn:uuid:" + UUID.randomUUID();
- endpointEntry.setFullUrl(endpointId);
- endpointEntry.getRequest().setMethod(HTTPVerb.PUT)
- .setUrl("Endpoint?identifier=" + identifier.getSystem() + "|" + identifier.getValue());
-
- endpoint.setIdElement(new IdType(endpointId));
- endpoint.getMeta().setVersionIdElement(null).setLastUpdatedElement(null);
- endpoint.setManagingOrganization(new Reference().setReference(organizationId).setType("Organization"));
- endpointEntry.setResource(endpoint);
-
- return new Reference().setReference(endpointId).setType("Endpoint");
- });
+ return resource ->
+ {
+ if (resource instanceof Organization)
+ return toOrganizationEntry((Organization) resource, identifierByTypeAndId, tempIdsByTypeAndId);
+ else if (resource instanceof Endpoint)
+ return toEndpointEntry((Endpoint) resource, identifierByTypeAndId, tempIdsByTypeAndId);
+ else if (resource instanceof OrganizationAffiliation)
+ return toOrganizationAffiliationEntry((OrganizationAffiliation) resource, identifierByTypeAndId,
+ tempIdsByTypeAndId);
+ else
+ throw new IllegalStateException("Organization, Endpoint or OrganizationAffiliation expected");
+ };
}
- private Optional getDefaultIdentifier(Organization org)
+ private BundleEntryComponent toOrganizationEntry(Organization organization,
+ Map identifierByTypeAndId, Map tempIdsByTypeAndId)
{
- return org.getIdentifier().stream()
- .filter(i -> organizationProvider.getDefaultIdentifierSystem().equals(i.getSystem())).findFirst();
+ String typeAndId = organization.getIdElement().toUnqualifiedVersionless().getValue();
+ String uuid = tempIdsByTypeAndId.get(typeAndId);
+ String organizationIdentifier = identifierByTypeAndId.get(typeAndId);
+
+ organization.setIdElement(new IdType(uuid));
+ organization.getMeta().setVersionIdElement(null).setLastUpdatedElement(null);
+
+ if (organization.hasEndpoint())
+ {
+ List endpoints = organization.getEndpoint().stream()
+ .map(e -> tempIdsByTypeAndId.get(e.getReference()))
+ .map(tempId -> new Reference().setType("Endpoint").setReference(tempId))
+ .collect(Collectors.toList());
+ organization.setEndpoint(endpoints);
+ }
+
+ BundleEntryComponent entry = new BundleEntryComponent();
+ entry.setFullUrl(uuid);
+ entry.setResource(organization);
+ entry.getRequest().setMethod(HTTPVerb.PUT).setUrl("Organization?identifier="
+ + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER + "|" + organizationIdentifier);
+ return entry;
}
- private Optional getDefaultIdentifier(Endpoint ept)
+ private BundleEntryComponent toEndpointEntry(Endpoint endpoint, Map identifierByTypeAndId,
+ Map tempIdsByTypeAndId)
{
- return ept.getIdentifier().stream().filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem()))
- .findFirst();
+ String typeAndId = endpoint.getIdElement().toUnqualifiedVersionless().getValue();
+ String uuid = tempIdsByTypeAndId.get(typeAndId);
+ String endpointIdentifier = identifierByTypeAndId.get(typeAndId);
+
+ endpoint.setIdElement(new IdType(uuid));
+ endpoint.getMeta().setVersionIdElement(null).setLastUpdatedElement(null);
+
+ if (endpoint.hasManagingOrganization())
+ {
+ String organizationTempId = tempIdsByTypeAndId.get(endpoint.getManagingOrganization().getReference());
+ endpoint.setManagingOrganization(new Reference().setType("Organization").setReference(organizationTempId));
+ }
+
+ BundleEntryComponent entry = new BundleEntryComponent();
+ entry.setFullUrl(uuid);
+ entry.setResource(endpoint);
+ entry.getRequest().setMethod(HTTPVerb.PUT)
+ .setUrl("Endpoint?identifier=" + NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER + "|" + endpointIdentifier);
+ return entry;
}
- private Optional getEndpoint(Reference endpoint, Bundle searchSet)
+ private BundleEntryComponent toOrganizationAffiliationEntry(OrganizationAffiliation affiliation,
+ Map identifierByTypeAndId, Map tempIdsByTypeAndId)
{
- return searchSet.getEntry().stream()
- .filter(e -> e.hasResource() && e.getResource() instanceof Endpoint && e.getFullUrl()
- .endsWith(endpoint.getReference())).map(e -> (Endpoint) e.getResource()).findFirst();
+ String uuid = tempIdsByTypeAndId.get(affiliation.getIdElement().toUnqualifiedVersionless().getValue());
+
+ affiliation.setIdElement(new IdType(uuid));
+ affiliation.getMeta().setVersionIdElement(null).setLastUpdatedElement(null);
+
+ String primaryOrganizatioIdentifier;
+ if (affiliation.hasOrganization())
+ {
+ String ref = affiliation.getOrganization().getReference();
+ primaryOrganizatioIdentifier = identifierByTypeAndId.get(ref);
+ String primaryOrganizationTempId = tempIdsByTypeAndId.get(ref);
+
+ affiliation
+ .setOrganization(new Reference().setType("Organization").setReference(primaryOrganizationTempId));
+ }
+ else
+ throw new IllegalStateException("OrganizationAffiliation with primary organization expected");
+
+ String participatingOrganizationIdentifier;
+ if (affiliation.hasParticipatingOrganization())
+ {
+ String ref = affiliation.getParticipatingOrganization().getReference();
+ participatingOrganizationIdentifier = identifierByTypeAndId.get(ref);
+ String participatingOrganizationTempId = tempIdsByTypeAndId.get(ref);
+
+ affiliation.setParticipatingOrganization(
+ new Reference().setType("Organization").setReference(participatingOrganizationTempId));
+ }
+ else
+ throw new IllegalStateException("OrganizationAffiliation with participating organization expected");
+
+ if (affiliation.hasEndpoint())
+ {
+ List endpoints = affiliation.getEndpoint().stream()
+ .map(e -> tempIdsByTypeAndId.get(e.getReference()))
+ .map(tempId -> new Reference().setType("Endpoint").setReference(tempId))
+ .collect(Collectors.toList());
+ affiliation.setEndpoint(endpoints);
+ }
+
+ BundleEntryComponent entry = new BundleEntryComponent();
+ entry.setFullUrl(uuid);
+ entry.setResource(affiliation);
+ entry.getRequest().setMethod(HTTPVerb.PUT)
+ .setUrl("OrganizationAffiliation?primary-organization:identifier="
+ + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER + "|" + primaryOrganizatioIdentifier
+ + "&participating-organization:identifier=" + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER + "|"
+ + participatingOrganizationIdentifier);
+ return entry;
}
}
diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/spring/config/UpdateAllowListConfig.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/spring/config/UpdateAllowListConfig.java
index 55702ba9..92a894ff 100644
--- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/spring/config/UpdateAllowListConfig.java
+++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/spring/config/UpdateAllowListConfig.java
@@ -2,8 +2,8 @@
import org.highmed.dsf.bpe.service.DownloadAllowList;
import org.highmed.dsf.bpe.service.UpdateAllowList;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
-import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
@@ -18,10 +18,10 @@ public class UpdateAllowListConfig
private FhirWebserviceClientProvider clientProvider;
@Autowired
- private OrganizationProvider organizationProvider;
+ private TaskHelper taskHelper;
@Autowired
- private TaskHelper taskHelper;
+ private ReadAccessHelper readAccessHelper;
@Autowired
private FhirContext fhirContext;
@@ -29,12 +29,12 @@ public class UpdateAllowListConfig
@Bean
public UpdateAllowList updateAllowList()
{
- return new UpdateAllowList(organizationProvider, clientProvider, taskHelper);
+ return new UpdateAllowList(clientProvider, taskHelper, readAccessHelper);
}
@Bean
public DownloadAllowList downloadAllowList()
{
- return new DownloadAllowList(clientProvider, taskHelper, fhirContext);
+ return new DownloadAllowList(clientProvider, taskHelper, readAccessHelper, fhirContext);
}
}
diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn
index 6297f593..2ac200dd 100644
--- a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn
+++ b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn
@@ -1,6 +1,6 @@
-
-
+
+
SequenceFlow_0oyvmcd
@@ -17,7 +17,7 @@
-
+
diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn
index 133f21ad..58003231 100644
--- a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn
+++ b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn
@@ -1,6 +1,6 @@
-
-
+
+
SequenceFlow_0oyvmcd
@@ -17,7 +17,11 @@
-
+
+
+
+
+
@@ -25,10 +29,6 @@
-
-
-
-
diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml
index 02cf66c3..639af2d6 100644
--- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml
+++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml
@@ -1,64 +1,40 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
-
+
-
+
diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml
index 4727e5fb..d1c7cf33 100644
--- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml
+++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml
@@ -1,52 +1,52 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/CodeSystem/highmed-update-allow-list.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/CodeSystem/highmed-update-allow-list.xml
index f4f4f497..fbce2f2b 100644
--- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/CodeSystem/highmed-update-allow-list.xml
+++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/CodeSystem/highmed-update-allow-list.xml
@@ -1,28 +1,28 @@
-
-
-
+
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-download-allow-list.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-download-allow-list.xml
index 622bfbe4..afcb991c 100644
--- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-download-allow-list.xml
+++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-download-allow-list.xml
@@ -2,8 +2,8 @@
-
-
+
+
@@ -13,7 +13,7 @@
-
+
@@ -74,7 +74,7 @@
-
+
diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-update-allow-list.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-update-allow-list.xml
index 7dcd263d..83f474ba 100644
--- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-update-allow-list.xml
+++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-update-allow-list.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
@@ -86,7 +86,7 @@
-
+
diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ValueSet/highmed-update-allow-list.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ValueSet/highmed-update-allow-list.xml
index f8d6cc37..44450c21 100644
--- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ValueSet/highmed-update-allow-list.xml
+++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ValueSet/highmed-update-allow-list.xml
@@ -1,26 +1,25 @@
-
-
-
+
+
+
-
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractDownloadAllowListFromTtpViaMedic1ExampleStarter.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractDownloadAllowListFromTtpViaMedic1ExampleStarter.java
new file mode 100644
index 00000000..1410f258
--- /dev/null
+++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractDownloadAllowListFromTtpViaMedic1ExampleStarter.java
@@ -0,0 +1,75 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
+import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST;
+import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST;
+import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST;
+import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION;
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.Map;
+
+import org.highmed.fhir.client.FhirWebserviceClient;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.IdType;
+import org.hl7.fhir.r4.model.Reference;
+import org.hl7.fhir.r4.model.ResourceType;
+import org.hl7.fhir.r4.model.StringType;
+import org.hl7.fhir.r4.model.Task;
+import org.hl7.fhir.r4.model.Task.TaskIntent;
+import org.hl7.fhir.r4.model.Task.TaskStatus;
+
+public abstract class AbstractDownloadAllowListFromTtpViaMedic1ExampleStarter
+{
+ protected void main(String[] args, String baseUrl, String ttpUrl) throws Exception
+ {
+ ExampleStarter starter = ExampleStarter.forServer(args, baseUrl);
+ Task task = createStartResource(starter, ttpUrl);
+ starter.startWith(task);
+ }
+
+ private Task createStartResource(ExampleStarter starter, String ttpUrl) throws Exception
+ {
+ Bundle allowList = getAllowList(starter, ttpUrl);
+
+ Task task = new Task();
+ task.getMeta().addProfile(PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST);
+ task.setInstantiatesUri(PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION);
+ task.setStatus(TaskStatus.REQUESTED);
+ task.setIntent(TaskIntent.ORDER);
+ task.setAuthoredOn(new Date());
+ task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
+ task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
+
+ task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME)).getType()
+ .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
+ task.addInput()
+ .setValue(new Reference(new IdType(ttpUrl, ResourceType.Bundle.name(),
+ allowList.getIdElement().getIdPart(), allowList.getIdElement().getVersionIdPart())))
+ .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST)
+ .setCode(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST);
+
+ return task;
+ }
+
+ private Bundle getAllowList(ExampleStarter starter, String ttpUrl) throws Exception
+ {
+ FhirWebserviceClient client = starter.createClient(ttpUrl);
+ Bundle searchResult = client.searchWithStrictHandling(Bundle.class, Map.of("identifier",
+ Collections.singletonList("http://highmed.org/fhir/CodeSystem/update-allow-list|allow_list")));
+
+ if (searchResult.getTotal() != 1 && searchResult.getEntryFirstRep().getResource() instanceof Bundle)
+ throw new IllegalStateException("Expected a single allow list Bundle");
+
+ return (Bundle) searchResult.getEntryFirstRep().getResource();
+ }
+}
diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateAllowList3MedicTtpExampleStarter.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateAllowList3MedicTtpExampleStarter.java
new file mode 100644
index 00000000..89920cf7
--- /dev/null
+++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateAllowList3MedicTtpExampleStarter.java
@@ -0,0 +1,47 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
+import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST;
+import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION;
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP;
+
+import java.util.Date;
+
+import org.hl7.fhir.r4.model.ResourceType;
+import org.hl7.fhir.r4.model.StringType;
+import org.hl7.fhir.r4.model.Task;
+import org.hl7.fhir.r4.model.Task.TaskIntent;
+import org.hl7.fhir.r4.model.Task.TaskStatus;
+
+public abstract class AbstractUpdateAllowList3MedicTtpExampleStarter
+{
+ protected void main(String[] args, String baseUrl) throws Exception
+ {
+ Task task = createStartResource();
+ ExampleStarter.forServer(args, baseUrl).startWith(task);
+ }
+
+ private Task createStartResource()
+ {
+ Task task = new Task();
+ task.getMeta().addProfile(PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST);
+ task.setInstantiatesUri(PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION);
+ task.setStatus(TaskStatus.REQUESTED);
+ task.setIntent(TaskIntent.ORDER);
+ task.setAuthoredOn(new Date());
+ task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
+ task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
+
+ task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_MESSAGE_NAME)).getType()
+ .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
+
+ return task;
+ }
+}
diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1DockerExampleStarter.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1DockerExampleStarter.java
new file mode 100644
index 00000000..85677fc5
--- /dev/null
+++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1DockerExampleStarter.java
@@ -0,0 +1,18 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_DOCKER_FHIR_BASE_URL;
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_DOCKER_FHIR_BASE_URL;
+
+public class DownloadAllowListFromTtpViaMedic1DockerExampleStarter
+ extends AbstractDownloadAllowListFromTtpViaMedic1ExampleStarter
+{
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
+ // password
+ public static void main(String[] args) throws Exception
+ {
+ new DownloadAllowListFromTtpViaMedic1DockerExampleStarter().main(args, MEDIC_1_DOCKER_FHIR_BASE_URL,
+ TTP_DOCKER_FHIR_BASE_URL);
+ }
+}
diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1ExampleStarter.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1ExampleStarter.java
index 5e729dba..e7cd3d46 100644
--- a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1ExampleStarter.java
+++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1ExampleStarter.java
@@ -1,81 +1,17 @@
package org.highmed.dsf.bpe.start;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
-import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST;
-import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST;
-import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST;
-import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION;
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_FHIR_BASE_URL;
-import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1;
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_FHIR_BASE_URL;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Map;
-
-import org.highmed.fhir.client.FhirWebserviceClient;
-import org.hl7.fhir.r4.model.Bundle;
-import org.hl7.fhir.r4.model.IdType;
-import org.hl7.fhir.r4.model.Reference;
-import org.hl7.fhir.r4.model.ResourceType;
-import org.hl7.fhir.r4.model.StringType;
-import org.hl7.fhir.r4.model.Task;
-import org.hl7.fhir.r4.model.Task.TaskIntent;
-import org.hl7.fhir.r4.model.Task.TaskStatus;
-
public class DownloadAllowListFromTtpViaMedic1ExampleStarter
+ extends AbstractDownloadAllowListFromTtpViaMedic1ExampleStarter
{
// Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
- // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
// Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
- // password
+ // password
public static void main(String[] args) throws Exception
{
- ExampleStarter starter = ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL);
- Task task = createStartResource(starter);
- starter.startWith(task);
- }
-
- private static Task createStartResource(ExampleStarter starter) throws Exception
- {
- Bundle allowList = getAllowList(starter);
-
- Task task = new Task();
- task.getMeta().addProfile(PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST);
- task.setInstantiatesUri(PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION);
- task.setStatus(TaskStatus.REQUESTED);
- task.setIntent(TaskIntent.ORDER);
- task.setAuthoredOn(new Date());
- task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
- task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1);
-
- task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME)).getType()
- .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
- task.addInput().setValue(new Reference(
- new IdType(TTP_FHIR_BASE_URL, ResourceType.Bundle.name(), allowList.getIdElement().getIdPart(),
- allowList.getIdElement().getVersionIdPart()))).getType().addCoding()
- .setSystem(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST)
- .setCode(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST);
-
- return task;
- }
-
- private static Bundle getAllowList(ExampleStarter starter) throws Exception
- {
- FhirWebserviceClient client = starter.createClient(TTP_FHIR_BASE_URL);
- Bundle searchResult = client.searchWithStrictHandling(Bundle.class, Map.of("identifier",
- Collections.singletonList("http://highmed.org/fhir/CodeSystem/update-allow-list|highmed_allow_list")));
-
- if (searchResult.getTotal() != 1 && searchResult.getEntryFirstRep().getResource() instanceof Bundle)
- throw new IllegalStateException("Expected a single allow list Bundle");
-
- return (Bundle) searchResult.getEntryFirstRep().getResource();
+ new DownloadAllowListFromTtpViaMedic1ExampleStarter().main(args, MEDIC_1_FHIR_BASE_URL, TTP_FHIR_BASE_URL);
}
}
diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpDockerExampleStarter.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpDockerExampleStarter.java
new file mode 100644
index 00000000..35346e12
--- /dev/null
+++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpDockerExampleStarter.java
@@ -0,0 +1,15 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_DOCKER_FHIR_BASE_URL;
+
+public class UpdateAllowList3MedicTtpDockerExampleStarter extends AbstractUpdateAllowList3MedicTtpExampleStarter
+{
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
+ // password
+ public static void main(String[] args) throws Exception
+ {
+ new UpdateAllowList3MedicTtpDockerExampleStarter().main(args, TTP_DOCKER_FHIR_BASE_URL);
+ }
+}
diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpExampleStarter.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpExampleStarter.java
index 6d08e8ba..090fa361 100644
--- a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpExampleStarter.java
+++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpExampleStarter.java
@@ -1,52 +1,15 @@
package org.highmed.dsf.bpe.start;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
-import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST;
-import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION;
-import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP;
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_FHIR_BASE_URL;
-import java.util.Date;
-
-import org.hl7.fhir.r4.model.ResourceType;
-import org.hl7.fhir.r4.model.StringType;
-import org.hl7.fhir.r4.model.Task;
-import org.hl7.fhir.r4.model.Task.TaskIntent;
-import org.hl7.fhir.r4.model.Task.TaskStatus;
-
-public class UpdateAllowList3MedicTtpExampleStarter
+public class UpdateAllowList3MedicTtpExampleStarter extends AbstractUpdateAllowList3MedicTtpExampleStarter
{
// Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
- // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
// Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
- // password
+ // password
public static void main(String[] args) throws Exception
{
- Task task = createStartResource();
- ExampleStarter.forServer(args, TTP_FHIR_BASE_URL).startWith(task);
- }
-
- private static Task createStartResource()
- {
- Task task = new Task();
- task.getMeta().addProfile(PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST);
- task.setInstantiatesUri(PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION);
- task.setStatus(TaskStatus.REQUESTED);
- task.setIntent(TaskIntent.ORDER);
- task.setAuthoredOn(new Date());
- task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
- task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
-
- task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_MESSAGE_NAME)).getType()
- .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
-
- return task;
+ new UpdateAllowList3MedicTtpExampleStarter().main(args, TTP_FHIR_BASE_URL);
}
}
diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java
new file mode 100644
index 00000000..1d1797f1
--- /dev/null
+++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java
@@ -0,0 +1,89 @@
+package org.highmed.dsf.fhir.profile;
+
+import static org.highmed.dsf.bpe.UpdateAllowListProcessPluginDefinition.VERSION;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+
+import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelper;
+import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelperImpl;
+import org.highmed.dsf.fhir.validation.ResourceValidator;
+import org.highmed.dsf.fhir.validation.ResourceValidatorImpl;
+import org.highmed.dsf.fhir.validation.ValidationSupportRule;
+import org.hl7.fhir.r4.model.ActivityDefinition;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ca.uhn.fhir.validation.ResultSeverityEnum;
+import ca.uhn.fhir.validation.ValidationResult;
+
+public class ActivityDefinitionProfileTest
+{
+ private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class);
+
+ @ClassRule
+ public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION,
+ Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml",
+ "highmed-extension-process-authorization-consortium-role-0.5.0.xml",
+ "highmed-extension-process-authorization-organization-0.5.0.xml",
+ "highmed-coding-process-authorization-local-all-0.5.0.xml",
+ "highmed-coding-process-authorization-local-consortium-role-0.5.0.xml",
+ "highmed-coding-process-authorization-local-organization-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-all-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-consortium-role-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-organization-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-recipient-0.5.0.xml",
+ "highmed-process-authorization-requester-0.5.0.xml"));
+
+ private final ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(),
+ validationRule.getValidationSupport());
+
+ private final ProcessAuthorizationHelper processAuthorizationHelper = new ProcessAuthorizationHelperImpl();
+
+ @Test
+ public void testDownloadAllowListValid() throws Exception
+ {
+ try (InputStream in = Files
+ .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml")))
+ {
+ ActivityDefinition ad = validationRule.getFhirContext().newXmlParser()
+ .parseResource(ActivityDefinition.class, in);
+
+ ValidationResult result = resourceValidator.validate(ad);
+ ValidationSupportRule.logValidationMessages(logger, result);
+
+ assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity())
+ || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count());
+
+ assertTrue(
+ processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true));
+ }
+ }
+
+ @Test
+ public void testUpdateAllowListValid() throws Exception
+ {
+ try (InputStream in = Files
+ .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml")))
+ {
+ ActivityDefinition ad = validationRule.getFhirContext().newXmlParser()
+ .parseResource(ActivityDefinition.class, in);
+
+ ValidationResult result = resourceValidator.validate(ad);
+ ValidationSupportRule.logValidationMessages(logger, result);
+
+ assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity())
+ || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count());
+
+ assertTrue(
+ processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true));
+ }
+ }
+}
\ No newline at end of file
diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
index a2e17f81..fef1465d 100644
--- a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
+++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
@@ -42,11 +42,11 @@ public class TaskProfileTest
@ClassRule
public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION,
- Arrays.asList("highmed-task-base-0.4.0.xml", "highmed-task-update-allow-list.xml",
+ Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-update-allow-list.xml",
"highmed-task-download-allow-list.xml"),
- Arrays.asList("highmed-authorization-role-0.4.0.xml", "highmed-bpmn-message-0.4.0.xml",
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml",
"highmed-update-allow-list.xml"),
- Arrays.asList("highmed-authorization-role-0.4.0.xml", "highmed-bpmn-message-0.4.0.xml",
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml",
"highmed-update-allow-list.xml"));
private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(),
diff --git a/dsf-bpe-process-update-resources/pom.xml b/dsf-bpe-process-update-resources/pom.xml
index 66e1a63d..856c7a6f 100644
--- a/dsf-bpe-process-update-resources/pom.xml
+++ b/dsf-bpe-process-update-resources/pom.xml
@@ -7,8 +7,13 @@
org.highmed.dsf
dsf-bpe-highmed-processes-pom
- 0.4.1
+ 0.5.0
+
+
+ ${project.basedir}/..
+ ../../highmed-dsf
+
@@ -17,7 +22,6 @@
provided
-
de.hs-heilbronn.mi
log4j2-utils
@@ -59,7 +63,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup/bpe/process
@@ -76,7 +80,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process
@@ -93,7 +97,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process
@@ -110,7 +114,7 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process
@@ -127,7 +131,79 @@
${project.version}
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic1
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic2
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/medic3
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process
+
+
+
+
+ copy-process-to-docker-test-setup-3medic-ttp-docker/ttp
+ package
+
+ copy
+
+
+
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process
+
@@ -138,35 +214,63 @@
- ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process
+
+ ${project.artifactId}-${project.version}.jar
+
+ false
+
+
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process
${project.artifactId}-${project.version}.jar
false
- ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process
+ ${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process
${project.artifactId}-${project.version}.jar
diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java
index d9ab66f3..a4a56881 100644
--- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java
+++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java
@@ -5,21 +5,23 @@
public interface ConstantsUpdateResources
{
+ String BPMN_EXECUTION_VARIABLE_BUNDLE = "bundle";
+
String CODESYSTEM_HIGHMED_UPDATE_RESOURCE = "http://highmed.org/fhir/CodeSystem/update-resources";
String CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE = "bundle-reference";
String CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER = "organization-identifier-search-parameter";
String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES = "http://highmed.org/fhir/StructureDefinition/task-request-update-resources";
- String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI =
- PROCESS_HIGHMED_URI_BASE + "requestUpdateResources/";
- String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION =
- PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI + VERSION;
+ String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE
+ + "requestUpdateResources/";
+ String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI
+ + VERSION;
String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME = "requestUpdateResourcesMessage";
String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES = "http://highmed.org/fhir/StructureDefinition/task-execute-update-resources";
- String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI =
- PROCESS_HIGHMED_URI_BASE + "executeUpdateResources/";
- String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION =
- PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI + VERSION;
+ String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE
+ + "executeUpdateResources/";
+ String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI
+ + VERSION;
String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_MESSAGE_NAME = "executeUpdateResourcesMessage";
}
diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java
index 5f0c635a..8bde102e 100644
--- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java
+++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java
@@ -12,12 +12,13 @@
import org.highmed.dsf.fhir.resources.ResourceProvider;
import org.highmed.dsf.fhir.resources.StructureDefinitionResource;
import org.highmed.dsf.fhir.resources.ValueSetResource;
+import org.springframework.core.env.PropertyResolver;
import ca.uhn.fhir.context.FhirContext;
public class UpdateResourcesProcessPluginDefinition implements ProcessPluginDefinition
{
- public static final String VERSION = "0.4.1";
+ public static final String VERSION = "0.5.0";
@Override
public String getName()
@@ -44,7 +45,8 @@ public Stream> getSpringConfigClasses()
}
@Override
- public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader)
+ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader,
+ PropertyResolver resolver)
{
var aExec = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeUpdateResources.xml");
var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestUpdateResources.xml");
@@ -55,12 +57,11 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader
.file("fhir/StructureDefinition/highmed-task-request-update-resources.xml");
var v = ValueSetResource.file("fhir/ValueSet/highmed-update-resources.xml");
- Map> resourcesByProcessKeyAndVersion = Map
- .of("executeUpdateResources/" + VERSION, Arrays.asList(aExec, c, sExec, v),
- "requestUpdateResources/" + VERSION, Arrays.asList(aReq, c, sReq, v));
+ Map> resourcesByProcessKeyAndVersion = Map.of(
+ "highmedorg_executeUpdateResources/" + VERSION, Arrays.asList(aExec, c, sExec, v),
+ "highmedorg_requestUpdateResources/" + VERSION, Arrays.asList(aReq, c, sReq, v));
- return ResourceProvider
- .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader,
- resourcesByProcessKeyAndVersion);
+ return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false),
+ classLoader, resolver, resourcesByProcessKeyAndVersion);
}
}
diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/message/SendRequest.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/message/SendRequest.java
index 9ff3a6a7..96f24b9f 100644
--- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/message/SendRequest.java
+++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/message/SendRequest.java
@@ -7,6 +7,7 @@
import java.util.stream.Stream;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.AbstractTaskMessageSend;
@@ -21,9 +22,9 @@
public class SendRequest extends AbstractTaskMessageSend
{
public SendRequest(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider, FhirContext fhirContext)
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext)
{
- super(clientProvider, taskHelper, organizationProvider, fhirContext);
+ super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
@Override
@@ -39,8 +40,9 @@ private ParameterComponent toInputParameterBundleReference(String localBaseUrl,
if (bundleId == null || bundleId.isEmpty())
throw new IllegalArgumentException("bundleId null or empty");
- return new ParameterComponent(new CodeableConcept(new Coding(CODESYSTEM_HIGHMED_UPDATE_RESOURCE,
- CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE, null)),
+ return new ParameterComponent(
+ new CodeableConcept(new Coding(CODESYSTEM_HIGHMED_UPDATE_RESOURCE,
+ CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE, null)),
new Reference().setReference(localBaseUrl + (localBaseUrl.endsWith("/") ? "" : "/") + bundleId));
}
}
diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/CheckRequest.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/CheckRequest.java
index dd45cb07..4e0a8d2d 100644
--- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/CheckRequest.java
+++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/CheckRequest.java
@@ -1,61 +1,24 @@
package org.highmed.dsf.bpe.service;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP;
-
-import java.util.Objects;
-import java.util.Optional;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
-import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
-import org.hl7.fhir.r4.model.Identifier;
-import org.hl7.fhir.r4.model.Organization;
-import org.hl7.fhir.r4.model.Task;
-import org.springframework.beans.factory.InitializingBean;
-public class CheckRequest extends AbstractServiceDelegate implements InitializingBean
+public class CheckRequest extends AbstractServiceDelegate
{
- private final OrganizationProvider organizationProvider;
-
public CheckRequest(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider)
+ ReadAccessHelper readAccessHelper)
{
- super(clientProvider, taskHelper);
-
- this.organizationProvider = organizationProvider;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception
- {
- super.afterPropertiesSet();
-
- Objects.requireNonNull(organizationProvider, "organizationProvider");
+ super(clientProvider, taskHelper, readAccessHelper);
}
@Override
protected void doExecute(DelegateExecution execution) throws Exception
{
- Task task = getCurrentTaskFromExecutionVariables();
-
- if (requesterIsNotOfTypeTtp(task.getRequester().getIdentifier()))
- {
- throw new RuntimeException(
- "Request check failed: process can only be started by requesting organization of type='"
- + CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP + "'");
- }
- }
-
- private boolean requesterIsNotOfTypeTtp(Identifier requester)
- {
- Optional organization = organizationProvider
- .getOrganization(requester.getSystem(), requester.getValue());
+ // TODO check digital signature of bundle
- return !organization.map(value -> value.getType().stream().anyMatch(type -> type.getCoding().stream().anyMatch(
- coding -> coding.getSystem().equals(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE) && coding.getCode()
- .equals(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP)))).orElse(false);
+ // Bundle bundle = (Bundle) execution.getVariable(BPMN_EXECUTION_VARIABLE_BUNDLE);
}
}
diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/DownloadBundle.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/DownloadBundle.java
new file mode 100644
index 00000000..30e52801
--- /dev/null
+++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/DownloadBundle.java
@@ -0,0 +1,96 @@
+package org.highmed.dsf.bpe.service;
+
+import static org.highmed.dsf.bpe.ConstantsUpdateResources.BPMN_EXECUTION_VARIABLE_BUNDLE;
+import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE;
+import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE;
+
+import java.util.EnumSet;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.ws.rs.WebApplicationException;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
+import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
+import org.highmed.dsf.fhir.task.TaskHelper;
+import org.highmed.dsf.fhir.variables.FhirResourceValues;
+import org.highmed.fhir.client.FhirWebserviceClient;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.Bundle.BundleType;
+import org.hl7.fhir.r4.model.IdType;
+import org.hl7.fhir.r4.model.Reference;
+import org.hl7.fhir.r4.model.Task;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DownloadBundle extends AbstractServiceDelegate
+{
+ private static final Logger logger = LoggerFactory.getLogger(DownloadBundle.class);
+
+ public DownloadBundle(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper)
+ {
+ super(clientProvider, taskHelper, readAccessHelper);
+ }
+
+ @Override
+ protected void doExecute(DelegateExecution execution) throws Exception
+ {
+ Task task = getCurrentTaskFromExecutionVariables();
+ IdType bundleId = getBundleId(task);
+ FhirWebserviceClient requesterClient = getFhirWebserviceClientProvider()
+ .getWebserviceClient(bundleId.getBaseUrl());
+
+ Bundle bundle;
+ try
+ {
+ if (bundleId.hasVersionIdPart())
+ bundle = requesterClient.read(Bundle.class, bundleId.getIdPart(), bundleId.getVersionIdPart());
+ else
+ bundle = requesterClient.read(Bundle.class, bundleId.getIdPart());
+ }
+ catch (WebApplicationException e)
+ {
+ logger.error("Error while reading Bundle with id {} from organization {}: {}", bundleId.getValue(),
+ task.getRequester().getReference(), e.getMessage());
+ throw new RuntimeException("Error while reading Bundle with id " + bundleId.getValue()
+ + " from organization " + task.getRequester().getReference() + ", " + e.getMessage(), e);
+ }
+
+ if (!EnumSet.of(BundleType.TRANSACTION, BundleType.BATCH).contains(bundle.getType()))
+ {
+ logger.error("Bundle type TRANSACTION or BATCH expected, but got {}", bundle.getType());
+ throw new RuntimeException("Bundle type TRANSACTION or BATCH expected, but got " + bundle.getType());
+ }
+
+ execution.setVariable(BPMN_EXECUTION_VARIABLE_BUNDLE, FhirResourceValues.create(bundle));
+ }
+
+ private IdType getBundleId(Task task)
+ {
+ List bundleReferences = getTaskHelper().getInputParameterReferenceValues(task,
+ CODESYSTEM_HIGHMED_UPDATE_RESOURCE, CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE)
+ .collect(Collectors.toList());
+
+ if (bundleReferences.size() != 1)
+ {
+ logger.error("Task input parameter {} contains unexpected number of Bundle IDs, expected 1, got {}",
+ CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE, bundleReferences.size());
+ throw new RuntimeException(
+ "Task input parameter " + CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE
+ + " contains unexpected number of Bundle IDs, expected 1, got " + bundleReferences.size());
+ }
+ else if (!bundleReferences.get(0).hasReference()
+ || !bundleReferences.get(0).getReference().contains("/Bundle/"))
+ {
+ logger.error("Task input parameter {} has no Bundle reference",
+ CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE);
+ throw new RuntimeException("Task input parameter "
+ + CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE + " has no Bundle reference");
+ }
+
+ return new IdType(bundleReferences.get(0).getReference());
+ }
+}
diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java
index a0f13f77..17410614 100644
--- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java
+++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java
@@ -13,12 +13,15 @@
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
+import org.highmed.dsf.fhir.organization.EndpointProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.highmed.dsf.fhir.variables.Target;
import org.highmed.dsf.fhir.variables.Targets;
import org.highmed.dsf.fhir.variables.TargetsValues;
+import org.hl7.fhir.r4.model.Endpoint;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.Task;
import org.slf4j.Logger;
@@ -33,13 +36,16 @@ public class SelectResourceAndTargets extends AbstractServiceDelegate implements
private static final Pattern BUNDLE_ID_PATTERN = Pattern.compile(BUNDLE_ID_PATTERN_STRING);
private final OrganizationProvider organizationProvider;
+ private final EndpointProvider endpointProvider;
public SelectResourceAndTargets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
- OrganizationProvider organizationProvider)
+ ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider,
+ EndpointProvider endpointProvider)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
this.organizationProvider = organizationProvider;
+ this.endpointProvider = endpointProvider;
}
@Override
@@ -54,9 +60,9 @@ public void afterPropertiesSet() throws Exception
public void doExecute(DelegateExecution execution) throws Exception
{
Task task = getCurrentTaskFromExecutionVariables();
- List references = getTaskHelper()
- .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_UPDATE_RESOURCE,
- CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE).collect(Collectors.toList());
+ List references = getTaskHelper().getInputParameterReferenceValues(task,
+ CODESYSTEM_HIGHMED_UPDATE_RESOURCE, CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE)
+ .collect(Collectors.toList());
if (references.size() != 1)
{
@@ -80,8 +86,10 @@ else if (!BUNDLE_ID_PATTERN.matcher(references.get(0).getReference()).matches())
List targets = targetIdentifierSearchParameters.stream()
.flatMap(organizationProvider::searchRemoteOrganizationsIdentifiers)
- .map(identifier -> Target.createUniDirectionalTarget(identifier.getValue()))
- .collect(Collectors.toList());
+ .map(identifier -> Target.createUniDirectionalTarget(identifier.getValue(),
+ endpointProvider.getFirstDefaultEndpoint(identifier.getValue()).filter(Endpoint::hasAddress)
+ .map(Endpoint::getAddress).orElse(null)))
+ .filter(t -> t.getTargetEndpointUrl() != null).collect(Collectors.toList());
execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets)));
}
}
diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/UpdateResources.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/UpdateResources.java
index 1f984efc..a23df160 100644
--- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/UpdateResources.java
+++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/UpdateResources.java
@@ -1,22 +1,19 @@
package org.highmed.dsf.bpe.service;
+import static org.highmed.dsf.bpe.ConstantsUpdateResources.BPMN_EXECUTION_VARIABLE_BUNDLE;
import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE;
import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE;
-import java.util.EnumSet;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
-import javax.ws.rs.WebApplicationException;
-
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
-import org.highmed.fhir.client.FhirWebserviceClient;
import org.hl7.fhir.r4.model.Bundle;
-import org.hl7.fhir.r4.model.Bundle.BundleType;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.Task;
@@ -32,9 +29,11 @@ public class UpdateResources extends AbstractServiceDelegate implements Initiali
private final FhirContext context;
- public UpdateResources(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, FhirContext context)
+ public UpdateResources(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
+ ReadAccessHelper readAccessHelper, FhirContext context)
{
- super(clientProvider, taskHelper);
+ super(clientProvider, taskHelper, readAccessHelper);
+
this.context = context;
}
@@ -42,6 +41,7 @@ public UpdateResources(FhirWebserviceClientProvider clientProvider, TaskHelper t
public void afterPropertiesSet() throws Exception
{
super.afterPropertiesSet();
+
Objects.requireNonNull(context, "fhirContext");
}
@@ -50,31 +50,8 @@ public void doExecute(DelegateExecution execution) throws Exception
{
Task task = getCurrentTaskFromExecutionVariables();
IdType bundleId = getBundleId(task);
- FhirWebserviceClient requesterClient = getFhirWebserviceClientProvider()
- .getRemoteWebserviceClient(bundleId.getBaseUrl());
- Bundle bundle;
- try
- {
- if (bundleId.hasVersionIdPart())
- bundle = requesterClient.read(Bundle.class, bundleId.getIdPart(), bundleId.getVersionIdPart());
- else
- bundle = requesterClient.read(Bundle.class, bundleId.getIdPart());
- }
- catch (WebApplicationException e)
- {
- logger.error("Error while reading Bundle with id {} from organization {}: {}", bundleId.getValue(),
- task.getRequester().getReference(), e.getMessage());
- throw new RuntimeException(
- "Error while reading Bundle with id " + bundleId.getValue() + " from organization " + task
- .getRequester().getReference() + ", " + e.getMessage(), e);
- }
-
- if (!EnumSet.of(BundleType.TRANSACTION, BundleType.BATCH).contains(bundle.getType()))
- {
- logger.error("Bundle type TRANSACTION or BATCH expected, but got {}", bundle.getType());
- throw new RuntimeException("Bundle type TRANSACTION or BATCH expected, but got " + bundle.getType());
- }
+ Bundle bundle = (Bundle) execution.getVariable(BPMN_EXECUTION_VARIABLE_BUNDLE);
try
{
@@ -85,17 +62,16 @@ public void doExecute(DelegateExecution execution) throws Exception
{
logger.error("Error while executing Bundle with id {} from organization {} locally: {}",
bundleId.getValue(), task.getRequester().getReference(), e.getMessage());
- throw new RuntimeException(
- "Error while executing Bundle with id " + bundleId.getValue() + " from organization " + task
- .getRequester().getReference() + " locally, " + e.getMessage(), e);
+ throw new RuntimeException("Error while executing Bundle with id " + bundleId.getValue()
+ + " from organization " + task.getRequester().getReference() + " locally, " + e.getMessage(), e);
}
}
private IdType getBundleId(Task task)
{
- List bundleReferences = getTaskHelper()
- .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_UPDATE_RESOURCE,
- CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE).collect(Collectors.toList());
+ List bundleReferences = getTaskHelper().getInputParameterReferenceValues(task,
+ CODESYSTEM_HIGHMED_UPDATE_RESOURCE, CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE)
+ .collect(Collectors.toList());
if (bundleReferences.size() != 1)
{
@@ -105,14 +81,13 @@ private IdType getBundleId(Task task)
"Task input parameter " + CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE
+ " contains unexpected number of Bundle IDs, expected 1, got " + bundleReferences.size());
}
- else if (!bundleReferences.get(0).hasReference() || !bundleReferences.get(0).getReference()
- .contains("/Bundle/"))
+ else if (!bundleReferences.get(0).hasReference()
+ || !bundleReferences.get(0).getReference().contains("/Bundle/"))
{
logger.error("Task input parameter {} has no Bundle reference",
CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE);
- throw new RuntimeException(
- "Task input parameter " + CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE
- + " has no Bundle reference");
+ throw new RuntimeException("Task input parameter "
+ + CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE + " has no Bundle reference");
}
return new IdType(bundleReferences.get(0).getReference());
diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/spring/config/UpdateResourcesConfig.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/spring/config/UpdateResourcesConfig.java
index 8625f6f6..e5ff7d51 100644
--- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/spring/config/UpdateResourcesConfig.java
+++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/spring/config/UpdateResourcesConfig.java
@@ -2,9 +2,12 @@
import org.highmed.dsf.bpe.message.SendRequest;
import org.highmed.dsf.bpe.service.CheckRequest;
+import org.highmed.dsf.bpe.service.DownloadBundle;
import org.highmed.dsf.bpe.service.SelectResourceAndTargets;
import org.highmed.dsf.bpe.service.UpdateResources;
+import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper;
import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider;
+import org.highmed.dsf.fhir.organization.EndpointProvider;
import org.highmed.dsf.fhir.organization.OrganizationProvider;
import org.highmed.dsf.fhir.task.TaskHelper;
import org.springframework.beans.factory.annotation.Autowired;
@@ -19,11 +22,17 @@ public class UpdateResourcesConfig
@Autowired
private FhirWebserviceClientProvider clientProvider;
+ @Autowired
+ private TaskHelper taskHelper;
+
+ @Autowired
+ private ReadAccessHelper readAccessHelper;
+
@Autowired
private OrganizationProvider organizationProvider;
@Autowired
- private TaskHelper taskHelper;
+ private EndpointProvider endpointProvider;
@Autowired
private FhirContext fhirContext;
@@ -31,24 +40,31 @@ public class UpdateResourcesConfig
@Bean
public SendRequest sendRequest()
{
- return new SendRequest(clientProvider, taskHelper, organizationProvider, fhirContext);
+ return new SendRequest(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext);
}
@Bean
public SelectResourceAndTargets selectUpdateResourcesTargets()
{
- return new SelectResourceAndTargets(clientProvider, taskHelper, organizationProvider);
+ return new SelectResourceAndTargets(clientProvider, taskHelper, readAccessHelper, organizationProvider,
+ endpointProvider);
}
@Bean
- public UpdateResources updateResources()
+ public DownloadBundle downloadBundle()
{
- return new UpdateResources(clientProvider, taskHelper, fhirContext);
+ return new DownloadBundle(clientProvider, taskHelper, readAccessHelper);
}
@Bean
public CheckRequest checkRequest()
{
- return new CheckRequest(clientProvider, taskHelper, organizationProvider);
+ return new CheckRequest(clientProvider, taskHelper, readAccessHelper);
+ }
+
+ @Bean
+ public UpdateResources updateResources()
+ {
+ return new UpdateResources(clientProvider, taskHelper, readAccessHelper, fhirContext);
}
}
diff --git a/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn b/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn
index 7b07f9cf..b19a714c 100644
--- a/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn
+++ b/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn
@@ -1,11 +1,11 @@
-
-
+
+
SequenceFlow_0djh0eg
-
+
SequenceFlow_141lpsf
SequenceFlow_0eygcor
@@ -16,35 +16,47 @@
- SequenceFlow_0djh0eg
+ Flow_1iamqwv
SequenceFlow_141lpsf
+
+
+ SequenceFlow_0djh0eg
+ Flow_1iamqwv
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
+
+
+
diff --git a/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn b/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn
index 7f1089d8..595694e7 100644
--- a/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn
+++ b/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn
@@ -1,6 +1,6 @@
-
-
+
+
@@ -10,10 +10,9 @@
- executeUpdateResources
- 0.4.1
+ http://highmed.org/bpe/Process/executeUpdateResources/0.5.0
executeUpdateResourcesMessage
- http://highmed.org/fhir/StructureDefinition/task-execute-update-resources
+ http://highmed.org/fhir/StructureDefinition/task-execute-update-resources|0.5.0
SequenceFlow_1u4zxix
@@ -31,7 +30,7 @@
-
+
diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml
index b1c3c31c..bdaa2b5f 100644
--- a/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml
+++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml
@@ -1,58 +1,46 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
+
-
+
diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml
index 0a29b04c..d71a67b2 100644
--- a/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml
+++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml
@@ -1,52 +1,52 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/CodeSystem/highmed-update-resources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/CodeSystem/highmed-update-resources.xml
index 040418e0..6589ed88 100644
--- a/dsf-bpe-process-update-resources/src/main/resources/fhir/CodeSystem/highmed-update-resources.xml
+++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/CodeSystem/highmed-update-resources.xml
@@ -1,33 +1,33 @@
-
-
-
+
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-execute-update-resources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-execute-update-resources.xml
index 22f1ac06..276e9aad 100644
--- a/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-execute-update-resources.xml
+++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-execute-update-resources.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-request-update-resources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-request-update-resources.xml
index 9fe30716..50b69c78 100644
--- a/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-request-update-resources.xml
+++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-request-update-resources.xml
@@ -1,8 +1,8 @@
-
-
+
+
@@ -12,7 +12,7 @@
-
+
diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/ValueSet/highmed-update-resources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/ValueSet/highmed-update-resources.xml
index 4b4ff43f..6ab0bb9d 100644
--- a/dsf-bpe-process-update-resources/src/main/resources/fhir/ValueSet/highmed-update-resources.xml
+++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/ValueSet/highmed-update-resources.xml
@@ -1,26 +1,25 @@
-
-
-
+
+
+
-
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
+
\ No newline at end of file
diff --git a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateResource3MedicTtpExampleStarter.java b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateResource3MedicTtpExampleStarter.java
new file mode 100644
index 00000000..9fa0731b
--- /dev/null
+++ b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateResource3MedicTtpExampleStarter.java
@@ -0,0 +1,81 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
+import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
+import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE;
+import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE;
+import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER;
+import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES;
+import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME;
+import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION;
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.Map;
+
+import org.highmed.fhir.client.FhirWebserviceClient;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.IdType;
+import org.hl7.fhir.r4.model.Reference;
+import org.hl7.fhir.r4.model.ResourceType;
+import org.hl7.fhir.r4.model.StringType;
+import org.hl7.fhir.r4.model.Task;
+import org.hl7.fhir.r4.model.Task.TaskIntent;
+import org.hl7.fhir.r4.model.Task.TaskStatus;
+
+public abstract class AbstractUpdateResource3MedicTtpExampleStarter
+{
+ protected void main(String[] args, String baseUrl) throws Exception
+ {
+ ExampleStarter starter = ExampleStarter.forServer(args, baseUrl);
+ Task task = createStartResource(starter, baseUrl);
+ starter.startWith(task);
+ }
+
+ private Task createStartResource(ExampleStarter starter, String ttpUrl) throws Exception
+ {
+ Bundle allowList = getAllowList(starter, ttpUrl);
+
+ Task task = new Task();
+ task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES);
+ task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION);
+ task.setStatus(TaskStatus.REQUESTED);
+ task.setIntent(TaskIntent.ORDER);
+ task.setAuthoredOn(new Date());
+ task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
+ task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
+ .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
+ .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
+
+ task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME)).getType()
+ .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
+
+ task.addInput()
+ .setValue(new Reference(new IdType(ResourceType.Bundle.name(), allowList.getIdElement().getIdPart(),
+ allowList.getIdElement().getVersionIdPart())))
+ .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_UPDATE_RESOURCE)
+ .setCode(CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE);
+
+ task.addInput().setValue(new StringType(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER + "|")).getType()
+ .addCoding().setSystem(CODESYSTEM_HIGHMED_UPDATE_RESOURCE)
+ .setCode(CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER);
+
+ return task;
+ }
+
+ private Bundle getAllowList(ExampleStarter starter, String ttpUrl) throws Exception
+ {
+ FhirWebserviceClient client = starter.createClient(ttpUrl);
+ Bundle searchResult = client.searchWithStrictHandling(Bundle.class, Map.of("identifier",
+ Collections.singletonList("http://highmed.org/fhir/CodeSystem/update-allow-list|allow_list")));
+
+ if (searchResult.getTotal() != 1 && searchResult.getEntryFirstRep().getResource() instanceof Bundle)
+ throw new IllegalStateException("Expected a single allow list Bundle");
+
+ return (Bundle) searchResult.getEntryFirstRep().getResource();
+ }
+}
diff --git a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpDockerExampleStarter.java b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpDockerExampleStarter.java
new file mode 100644
index 00000000..da80cea3
--- /dev/null
+++ b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpDockerExampleStarter.java
@@ -0,0 +1,15 @@
+package org.highmed.dsf.bpe.start;
+
+import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_DOCKER_FHIR_BASE_URL;
+
+public class UpdateResource3MedicTtpDockerExampleStarter extends AbstractUpdateResource3MedicTtpExampleStarter
+{
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
+ // password
+ public static void main(String[] args) throws Exception
+ {
+ new UpdateResource3MedicTtpDockerExampleStarter().main(args, TTP_DOCKER_FHIR_BASE_URL);
+ }
+}
diff --git a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpExampleStarter.java b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpExampleStarter.java
index 3cc79c9d..afd39d7d 100644
--- a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpExampleStarter.java
+++ b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpExampleStarter.java
@@ -1,86 +1,15 @@
package org.highmed.dsf.bpe.start;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN;
-import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER;
-import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE;
-import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE;
-import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER;
-import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES;
-import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME;
-import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION;
-import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP;
import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_FHIR_BASE_URL;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Map;
-
-import org.highmed.fhir.client.FhirWebserviceClient;
-import org.hl7.fhir.r4.model.Bundle;
-import org.hl7.fhir.r4.model.IdType;
-import org.hl7.fhir.r4.model.Reference;
-import org.hl7.fhir.r4.model.ResourceType;
-import org.hl7.fhir.r4.model.StringType;
-import org.hl7.fhir.r4.model.Task;
-import org.hl7.fhir.r4.model.Task.TaskIntent;
-import org.hl7.fhir.r4.model.Task.TaskStatus;
-
-public class UpdateResource3MedicTtpExampleStarter
+public class UpdateResource3MedicTtpExampleStarter extends AbstractUpdateResource3MedicTtpExampleStarter
{
// Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate
- // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
+ // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12
// Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate
- // password
+ // password
public static void main(String[] args) throws Exception
{
- ExampleStarter starter = ExampleStarter.forServer(args, TTP_FHIR_BASE_URL);
- Task task = createStartResource(starter);
- starter.startWith(task);
- }
-
- private static Task createStartResource(ExampleStarter starter) throws Exception
- {
- Bundle allowList = getAllowList(starter);
-
- Task task = new Task();
- task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES);
- task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION);
- task.setStatus(TaskStatus.REQUESTED);
- task.setIntent(TaskIntent.ORDER);
- task.setAuthoredOn(new Date());
- task.getRequester().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
- task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier()
- .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER)
- .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP);
-
- task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME)).getType()
- .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME);
-
- task.addInput().setValue(new Reference(
- new IdType(ResourceType.Bundle.name(), allowList.getIdElement().getIdPart(),
- allowList.getIdElement().getVersionIdPart()))).getType().addCoding()
- .setSystem(CODESYSTEM_HIGHMED_UPDATE_RESOURCE)
- .setCode(CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE);
-
- task.addInput().setValue(new StringType("http://highmed.org/fhir/NamingSystem/organization-identifier|"))
- .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_UPDATE_RESOURCE)
- .setCode(CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER);
-
- return task;
- }
-
- private static Bundle getAllowList(ExampleStarter starter) throws Exception
- {
- FhirWebserviceClient client = starter.createClient(TTP_FHIR_BASE_URL);
- Bundle searchResult = client.searchWithStrictHandling(Bundle.class, Map.of("identifier",
- Collections.singletonList("http://highmed.org/fhir/CodeSystem/update-allow-list|highmed_allow_list")));
-
- if (searchResult.getTotal() != 1 && searchResult.getEntryFirstRep().getResource() instanceof Bundle)
- throw new IllegalStateException("Expected a single allow list Bundle");
-
- return (Bundle) searchResult.getEntryFirstRep().getResource();
+ new UpdateResource3MedicTtpExampleStarter().main(args, TTP_FHIR_BASE_URL);
}
}
diff --git a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java
new file mode 100644
index 00000000..8c763dfa
--- /dev/null
+++ b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java
@@ -0,0 +1,89 @@
+package org.highmed.dsf.fhir.profile;
+
+import static org.highmed.dsf.bpe.UpdateResourcesProcessPluginDefinition.VERSION;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Arrays;
+
+import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelper;
+import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelperImpl;
+import org.highmed.dsf.fhir.validation.ResourceValidator;
+import org.highmed.dsf.fhir.validation.ResourceValidatorImpl;
+import org.highmed.dsf.fhir.validation.ValidationSupportRule;
+import org.hl7.fhir.r4.model.ActivityDefinition;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import ca.uhn.fhir.validation.ResultSeverityEnum;
+import ca.uhn.fhir.validation.ValidationResult;
+
+public class ActivityDefinitionProfileTest
+{
+ private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class);
+
+ @ClassRule
+ public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION,
+ Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml",
+ "highmed-extension-process-authorization-consortium-role-0.5.0.xml",
+ "highmed-extension-process-authorization-organization-0.5.0.xml",
+ "highmed-coding-process-authorization-local-all-0.5.0.xml",
+ "highmed-coding-process-authorization-local-consortium-role-0.5.0.xml",
+ "highmed-coding-process-authorization-local-organization-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-all-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-consortium-role-0.5.0.xml",
+ "highmed-coding-process-authorization-remote-organization-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-0.5.0.xml"),
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-recipient-0.5.0.xml",
+ "highmed-process-authorization-requester-0.5.0.xml"));
+
+ private final ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(),
+ validationRule.getValidationSupport());
+
+ private final ProcessAuthorizationHelper processAuthorizationHelper = new ProcessAuthorizationHelperImpl();
+
+ @Test
+ public void testExecuteUpdateResourcesValid() throws Exception
+ {
+ try (InputStream in = Files.newInputStream(
+ Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml")))
+ {
+ ActivityDefinition ad = validationRule.getFhirContext().newXmlParser()
+ .parseResource(ActivityDefinition.class, in);
+
+ ValidationResult result = resourceValidator.validate(ad);
+ ValidationSupportRule.logValidationMessages(logger, result);
+
+ assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity())
+ || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count());
+
+ assertTrue(
+ processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true));
+ }
+ }
+
+ @Test
+ public void testRequestUpdateResourcesValid() throws Exception
+ {
+ try (InputStream in = Files.newInputStream(
+ Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml")))
+ {
+ ActivityDefinition ad = validationRule.getFhirContext().newXmlParser()
+ .parseResource(ActivityDefinition.class, in);
+
+ ValidationResult result = resourceValidator.validate(ad);
+ ValidationSupportRule.logValidationMessages(logger, result);
+
+ assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity())
+ || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count());
+
+ assertTrue(
+ processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true));
+ }
+ }
+}
\ No newline at end of file
diff --git a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
index addcc80f..b90a947f 100644
--- a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
+++ b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java
@@ -53,11 +53,11 @@ public class TaskProfileTest
@ClassRule
public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION,
- Arrays.asList("highmed-task-base-0.4.0.xml", "highmed-task-request-update-resources.xml",
+ Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-request-update-resources.xml",
"highmed-task-execute-update-resources.xml"),
- Arrays.asList("highmed-authorization-role-0.4.0.xml", "highmed-bpmn-message-0.4.0.xml",
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml",
"highmed-update-resources.xml"),
- Arrays.asList("highmed-authorization-role-0.4.0.xml", "highmed-bpmn-message-0.4.0.xml",
+ Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml",
"highmed-update-resources.xml"));
private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(),
@@ -68,7 +68,7 @@ public void testGenerateSnapshotNotWorkingWithoutBaseSnapshot() throws Exception
{
var reader = new StructureDefinitionReader(validationRule.getFhirContext());
- StructureDefinition base = reader.readXml("/fhir/StructureDefinition/highmed-task-base-0.4.0.xml");
+ StructureDefinition base = reader.readXml("/fhir/StructureDefinition/highmed-task-base-0.5.0.xml");
StructureDefinition differential = reader
.readXml("/fhir/StructureDefinition/highmed-task-execute-update-resources.xml");
diff --git a/pom.xml b/pom.xml
index 27c30be4..24452a06 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
org.highmed.dsf
dsf-bpe-highmed-processes-pom
- 0.4.1
+ 0.5.0
pom
@@ -21,6 +21,8 @@
UTF-8
11
11
+
+ ${project.basedir}
highmed-processes
@@ -62,12 +64,12 @@
org.highmed.dsf
dsf-bpe-process-base
- 0.4.0
+ 0.5.0
org.highmed.dsf
dsf-fhir-validation
- 0.4.0
+ 0.5.0
@@ -100,7 +102,7 @@
de.hs-heilbronn.mi
log4j2-utils
- 0.7.0
+ 0.10.0
@@ -113,19 +115,19 @@
com.fasterxml.jackson.core
jackson-annotations
- 2.12.0
+ 2.12.4
junit
junit
- 4.13.1
+ 4.13.2
org.highmed.dsf
dsf-bpe-process-base
- 0.4.0
+ 0.5.0
test
test-jar
@@ -176,13 +178,23 @@
org.apache.maven.plugins
maven-dependency-plugin
- 3.1.2
+ 3.2.0
org.apache.maven.plugins
maven-clean-plugin
3.1.0
+
+ net.revelc.code.formatter
+ formatter-maven-plugin
+ 2.16.0
+
+
+ net.revelc.code
+ impsort-maven-plugin
+ 1.6.2
+
@@ -204,6 +216,22 @@
true
+
+ net.revelc.code.formatter
+ formatter-maven-plugin
+
+ ${main.basedir}/src/main/resources/eclipse-formatter-config.xml
+
+
+
+ net.revelc.code
+ impsort-maven-plugin
+
+ 11
+ java.,javax.,org.,com.
+ java,*
+
+
@@ -231,4 +259,70 @@
+
+
+
+ format-and-sort
+
+
+
+
+ net.revelc.code.formatter
+ formatter-maven-plugin
+
+
+
+ format
+
+
+
+
+
+ net.revelc.code
+ impsort-maven-plugin
+
+
+
+ sort
+
+
+
+
+
+
+
+
+ validate-and-check
+
+ true
+
+
+
+
+
+ net.revelc.code.formatter
+ formatter-maven-plugin
+
+
+
+ validate
+
+
+
+
+
+ net.revelc.code
+ impsort-maven-plugin
+
+
+
+ check
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/eclipse-formatter-config.xml b/src/main/resources/eclipse-formatter-config.xml
new file mode 100644
index 00000000..fa149094
--- /dev/null
+++ b/src/main/resources/eclipse-formatter-config.xml
@@ -0,0 +1,382 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+