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 results) + public FinalFeasibilityQueryResults( + @JsonProperty("results") Collection 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 @@ - - + + - - - - - - - - - - - - - - - + + - - - - - - - + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + - - - - - - - + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + - + <subtitle value="Process to compute feasibility result" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> 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 @@ <ActivityDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="executeFeasibilityMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="LOCAL" /> - </valueCoding> - </extension> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility|${version}" /> </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="REMOTE_ROLE" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility" /> + <extension url="recipient"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> </extension> </extension> <url value="http://highmed.org/bpe/Process/executeFeasibility" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="executeFeasibility" /> + <name value="ExecuteFeasibility" /> <title value="Execute a Feasibility" /> <subtitle value="Process to execute a feasibility query" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> 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 @@ <ActivityDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="requestFeasibilityMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="LOCAL" /> - </valueCoding> - </extension> - </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-feasibility|${version}" /> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/highmed-task-request-feasibility" /> + <extension url="recipient"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> </extension> </extension> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="resultMultiMedicFeasibilityMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility|${version}" /> </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="TTP" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="REMOTE_ROLE" /> + </valueCoding> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> - </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility" /> + <extension url="recipient"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> </extension> </extension> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="errorMultiMedicFeasibilityMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </valueCoding> - </extension> - </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility|${version}" /> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="TTP" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="REMOTE_ROLE" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility" /> + <extension url="recipient"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> </extension> </extension> <url value="http://highmed.org/bpe/Process/requestFeasibility" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="requestFeasibility" /> + <name value="RequestFeasibility" /> <title value="Request feasibility" /> <subtitle value="Feasibility Request Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> 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 @@ <CodeSystem xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> </meta> - <url value="http://highmed.org/fhir/CodeSystem/feasibility"/> + <url value="http://highmed.org/fhir/CodeSystem/feasibility" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="HiGHmed_Feasibility"/> - <title value="HiGHmed Feasibility"/> + <name value="HiGHmed_Feasibility" /> + <title value="HiGHmed Feasibility" /> <!-- status managed by bpe --> <status value="unknown" /> - <experimental value="false"/> - <date value="2021-04-20"/> - <publisher value="HiGHmed"/> - <description value="CodeSystem with standard values for feasibility processes"/> - <caseSensitive value="true"/> - <hierarchyMeaning value="grouped-by"/> - <versionNeeded value="false"/> - <content value="complete"/> - <concept> - <code value="research-study-reference"/> - <display value="Research Study Reference"/> - <definition value="HiGHmed Research Study Reference to define what data is requested from which MeDICs and for what purpose"/> + <experimental value="false" /> + <date value="2021-08-24" /> + <publisher value="HiGHmed" /> + <description value="CodeSystem with standard values for feasibility processes" /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> + <concept> + <code value="research-study-reference" /> + <display value="Research Study Reference" /> + <definition value="HiGHmed Research Study Reference to define what data is requested from which MeDICs and for what purpose" /> </concept> <concept> - <code value="needs-record-linkage"/> - <display value="Needs Record Linkage"/> - <definition value="Boolean indicating if a data analysis needs record linkage"/> + <code value="needs-record-linkage" /> + <display value="Needs Record Linkage" /> + <definition value="Boolean indicating if a data analysis needs record linkage" /> </concept> <concept> - <code value="needs-consent-check"/> - <display value="Needs Consent Check"/> - <definition value="Boolean indicating if a data analysis needs consent check"/> + <code value="needs-consent-check" /> + <display value="Needs Consent Check" /> + <definition value="Boolean indicating if a data analysis needs consent check" /> </concept> <concept> - <code value="bloom-filter-configuration"/> - <display value="Bloom Filter Cconfiguration"/> - <definition value="Base64 binary encoded bloom filter configuration"/> + <code value="bloom-filter-configuration" /> + <display value="Bloom Filter Cconfiguration" /> + <definition value="Base64 binary encoded bloom filter configuration" /> </concept> <concept> - <code value="medic-correlation-key"/> - <display value="MeDIC Correlation Key"/> - <definition value="MeDIC Correlation Key transfered to TTP for correlating incoming medic results"/> + <code value="medic-correlation-key" /> + <display value="MeDIC Correlation Key" /> + <definition value="MeDIC Correlation Key transfered to TTP for correlating incoming medic results" /> </concept> <concept> - <code value="single-medic-result"/> - <display value="Single MeDIC Result"/> - <definition value="Result of a single feasibility query execution"/> + <code value="single-medic-result" /> + <display value="Single MeDIC Result" /> + <definition value="Result of a single feasibility query execution" /> </concept> <concept> - <code value="single-medic-result-reference"/> - <display value="Single MeDIC Result Reference"/> - <definition value="Reference to an openEHR ResultSet as a result of a single feasibility query execution"/> + <code value="single-medic-result-reference" /> + <display value="Single MeDIC Result Reference" /> + <definition value="Reference to an openEHR ResultSet as a result of a single feasibility query execution" /> </concept> <concept> - <code value="participating-medics"/> - <display value="Participating MeDICs"/> - <definition value="Count of all MeDICs who participated in a feasibility query"/> + <code value="participating-medics" /> + <display value="Participating MeDICs" /> + <definition value="Count of all MeDICs who participated in a feasibility query" /> </concept> <concept> - <code value="multi-medic-result"/> - <display value="Multi MeDIC Result"/> - <definition value="Aggregated result of all single medic results"/> + <code value="multi-medic-result" /> + <display value="Multi MeDIC Result" /> + <definition value="Aggregated result of all single medic results" /> </concept> </CodeSystem> \ 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-compute-feasibility" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ -<?xml version="1.0" encoding="utf-8"?> <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility" /> @@ -13,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-request-feasibility" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <ValueSet xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> </meta> - <url value="http://highmed.org/fhir/ValueSet/feasibility"/> + <url value="http://highmed.org/fhir/ValueSet/feasibility" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="HiGHmed_Feasibility"/> - <title value="HiGHmed Feasibility"/> + <name value="HiGHmed_Feasibility" /> + <title value="HiGHmed Feasibility" /> <!-- status managed by bpe --> <status value="unknown" /> - <experimental value="false"/> - <date value="2021-04-20"/> - <publisher value="HiGHmed"/> - <description value="ValueSet with standard values for feasibility processes"/> - <immutable value="true"/> + <experimental value="false" /> + <date value="2021-08-24" /> + <publisher value="HiGHmed" /> + <description value="ValueSet with standard values for feasibility processes" /> + <immutable value="true" /> <compose> <include> - <system value="http://highmed.org/fhir/CodeSystem/feasibility"/> + <system value="http://highmed.org/fhir/CodeSystem/feasibility" /> </include> </compose> </ValueSet> \ 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 @@ <parent> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <groupId>org.highmed.dsf</groupId> - <version>0.4.1</version> + <version>0.5.0</version> </parent> + + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + <dsf.location>../../highmed-dsf</dsf.location> + </properties> <dependencies> <dependency> @@ -65,7 +70,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -82,7 +87,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -99,7 +104,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -116,7 +121,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -133,7 +138,79 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic1</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic2</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic3</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/ttp</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process + </outputDirectory> </configuration> </execution> </executions> @@ -144,35 +221,63 @@ <configuration> <filesets> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> 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<String> 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<String, List<AbstractResource>> 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<String> getQueries(Task task) private List<Group> getCohortDefinitions(Stream<String> 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="localServicesIntegration" isExecutable="true" camunda:versionTag="0.4.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> + <bpmn:process id="highmedorg_localServicesIntegration" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> @@ -92,14 +92,6 @@ <bpmn:outgoing>SequenceFlow_1rmqv20</bpmn:outgoing> </bpmn:serviceTask> <bpmn:endEvent id="EndEvent"> - <bpmn:extensionElements> - <camunda:inputOutput> - <camunda:inputParameter name="messageName">resultSingleMedicFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.1</camunda:inputParameter> - <camunda:inputParameter name="processDefinitionKey">computeFeasibility</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility</camunda:inputParameter> - </camunda:inputOutput> - </bpmn:extensionElements> <bpmn:incoming>Flow_0m4rhl9</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="Flow_0m4rhl9" sourceRef="storeResult" targetRef="EndEvent" /> @@ -122,7 +114,11 @@ <bpmn:message id="Message_1yz2a31" name="localServicesIntegrationMessage" /> <bpmn:message id="Message_1dr71re" name="resultSingleMedicFeasibilityMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="localServicesIntegration"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_localServicesIntegration"> + <bpmndi:BPMNEdge id="SequenceFlow_07wtgee_di" bpmnElement="SequenceFlow_07wtgee"> + <di:waypoint x="599" y="272" /> + <di:waypoint x="667" y="272" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_125i149_di" bpmnElement="Flow_125i149"> <di:waypoint x="400" y="272" /> <di:waypoint x="499" y="272" /> @@ -216,10 +212,6 @@ <dc:Bounds x="722" y="254" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_07wtgee_di" bpmnElement="SequenceFlow_07wtgee"> - <di:waypoint x="599" y="272" /> - <di:waypoint x="667" y="272" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> <di:waypoint x="1760" y="272" /> <di:waypoint x="1860" y="272" /> @@ -237,9 +229,6 @@ <dc:Bounds x="180" y="297" width="22" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1pt9xhp_di" bpmnElement="checkQueries"> - <dc:Bounds x="499" y="232" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1dln3in_di" bpmnElement="ExclusiveGateway_1dln3in" isMarkerVisible="true"> <dc:Bounds x="667" y="247" width="50" height="50" /> </bpmndi:BPMNShape> @@ -282,6 +271,9 @@ <bpmndi:BPMNShape id="Activity_1y9z4ut_di" bpmnElement="storeResult"> <dc:Bounds x="1860" y="232" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1pt9xhp_di" bpmnElement="checkQueries"> + <dc:Bounds x="499" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> 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 @@ <ActivityDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> - <valueString value="localServicesIntegrationMessage"/> + <valueString value="localServicesIntegrationMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="LOCAL"/> - </valueCoding> - </extension> - </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type"/> - <code value="MeDIC"/> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-local-services-integration|${version}" /> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type"/> - <code value="MeDIC"/> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical - value="http://highmed.org/fhir/StructureDefinition/task-local-services-integration"/> + <extension url="recipient"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> </extension> </extension> - <url value="http://highmed.org/bpe/Process/localServicesIntegration"/> + <url value="http://highmed.org/bpe/Process/localServicesIntegration" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="localServicesIntegration"/> - <title value="Local services integration"/> - <subtitle value="Service integration process"/> + <name value="LocalServicesIntegration" /> + <title value="Local services integration" /> + <subtitle value="Service integration process" /> <!-- status managed by bpe --> <status value="unknown" /> - <experimental value="false"/> - <date value="2021-04-20"/> - <publisher value="HiGHmed"/> + <experimental value="false" /> + <date value="2021-08-24" /> + <publisher value="HiGHmed" /> <contact> - <name value="HiGHmed"/> + <name value="HiGHmed" /> <telecom> - <system value="email"/> - <value value="pmo@highmed.org"/> + <system value="email" /> + <value value="pmo@highmed.org" /> </telecom> </contact> - <description - value="Process to test the integration of local external services like the MPI, the openEHR repository or the PEP."/> - <kind value="Task"/> + <description value="Process to test the integration of local external services like the MPI, the openEHR repository or the PEP." /> + <kind value="Task" /> </ActivityDefinition> \ 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="LOCAL" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-local-services-integration" /> @@ -13,7 +13,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <parent> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.4.1</version> + <version>0.5.0</version> </parent> + + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + <dsf.location>../../highmed-dsf</dsf.location> + </properties> <dependencies> <dependency> @@ -58,7 +63,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -75,7 +80,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -92,7 +97,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -109,7 +114,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -126,7 +131,79 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic1</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic2</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic3</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/ttp</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process + </outputDirectory> </configuration> </execution> </executions> @@ -137,35 +214,63 @@ <configuration> <filesets> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> 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<Class<?>> 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<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map - .of("ping/" + VERSION, Arrays.asList(aPing, tPong, tStartPing), "pong/" + VERSION, - Arrays.asList(aPong, tPing)); + Map<String, List<AbstractResource>> 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<Target> targets = organizationProvider.getRemoteIdentifiers().stream().map(identifier -> Target - .createBiDirectionalTarget(identifier.getValue(), UUID.randomUUID().toString())) + String localAddress = endpointProvider.getLocalEndpoint().getAddress(); + + List<Target> 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0azvmx1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="ping" isExecutable="true" camunda:versionTag="0.4.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0azvmx1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> + <bpmn:process id="highmedorg_ping" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:sequenceFlow id="SequenceFlow_0k1j79c" sourceRef="StartEvent_1" targetRef="selectTargets" /> <bpmn:sequenceFlow id="SequenceFlow_05ia6lz" sourceRef="selectTargets" targetRef="sendPing" /> <bpmn:serviceTask id="selectTargets" name="selectTargets" camunda:class="org.highmed.dsf.bpe.service.SelectPingTargets"> @@ -10,10 +10,9 @@ <bpmn:sendTask id="sendPing" name="sendPing" camunda:class="org.highmed.dsf.bpe.message.SendPing"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="processDefinitionKey">pong</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.1</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/pong/0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">pingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-ping</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-ping|0.5.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_05ia6lz</bpmn:incoming> @@ -68,7 +67,7 @@ <bpmn:message id="Message_10o3b8y" name="pongMessage" /> <bpmn:message id="Message_1pklz6t" name="startPingProcessMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ping"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_ping"> <bpmndi:BPMNEdge id="SequenceFlow_1vng5zz_di" bpmnElement="SequenceFlow_1vng5zz"> <di:waypoint x="530" y="120" /> <di:waypoint x="606" y="120" /> @@ -83,19 +82,19 @@ <di:waypoint x="1154" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_05ia6lz_di" bpmnElement="SequenceFlow_05ia6lz"> - <di:waypoint x="359" y="120" /> + <di:waypoint x="370" y="120" /> <di:waypoint x="430" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0k1j79c_di" bpmnElement="SequenceFlow_0k1j79c"> <di:waypoint x="209" y="120" /> - <di:waypoint x="259" y="120" /> + <di:waypoint x="270" y="120" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1cxtndb_di" bpmnElement="selectTargets"> - <dc:Bounds x="259" y="80" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SendTask_01t32b2_di" bpmnElement="sendPing"> <dc:Bounds x="430" y="80" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1cxtndb_di" bpmnElement="selectTargets"> + <dc:Bounds x="270" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_0szmntn_di" bpmnElement="SubProcess_0szmntn" isExpanded="true"> <dc:Bounds x="606" y="60" width="458" height="120" /> </bpmndi:BPMNShape> 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_15v05m6" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0"> - <bpmn:process id="pong" isExecutable="true" camunda:versionTag="0.4.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_15v05m6" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> + <bpmn:process id="highmedorg_pong" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_07w11cw</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_0u91abp" /> @@ -9,10 +9,9 @@ <bpmn:endEvent id="EndEvent_1ivxrjg"> <bpmn:extensionElements> <camunda:inputOutput> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/ping/0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">pongMessage</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.1</camunda:inputParameter> - <camunda:inputParameter name="processDefinitionKey">ping</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-pong</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-pong|0.5.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1ism9wt</bpmn:incoming> @@ -32,31 +31,31 @@ <bpmn:message id="Message_0u91abp" name="pingMessage" /> <bpmn:message id="Message_1h0kvyq" name="pong" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="pong"> - <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="StartEvent_1"> - <dc:Bounds x="173" y="102" width="36" height="36" /> - </bpmndi:BPMNShape> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_pong"> + <bpmndi:BPMNEdge id="SequenceFlow_1ism9wt_di" bpmnElement="SequenceFlow_1ism9wt"> + <di:waypoint x="528" y="120" /> + <di:waypoint x="580" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_09i9zb8_di" bpmnElement="SequenceFlow_09i9zb8"> + <di:waypoint x="362" y="120" /> + <di:waypoint x="428" y="120" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07w11cw_di" bpmnElement="SequenceFlow_07w11cw"> <di:waypoint x="209" y="120" /> <di:waypoint x="262" y="120" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="StartEvent_1"> + <dc:Bounds x="173" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_108jj6g_di" bpmnElement="EndEvent_1ivxrjg"> <dc:Bounds x="580" y="102" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_09i9zb8_di" bpmnElement="SequenceFlow_09i9zb8"> - <di:waypoint x="362" y="120" /> - <di:waypoint x="428" y="120" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1uea92o_di" bpmnElement="logPing"> <dc:Bounds x="262" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0ko681m_di" bpmnElement="selectTarget"> <dc:Bounds x="428" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ism9wt_di" bpmnElement="SequenceFlow_1ism9wt"> - <di:waypoint x="528" y="120" /> - <di:waypoint x="580" y="120" /> - </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> 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 @@ <ActivityDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="startPingProcessMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="LOCAL" /> - </valueCoding> - </extension> - </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-start-ping-process|${version}" /> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-start-ping-process" /> + <extension url="recipient"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> </extension> </extension> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="pongMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </valueCoding> - </extension> - </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-pong|${version}" /> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="REMOTE_ALL" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-pong" /> + <extension url="recipient"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> </extension> </extension> <url value="http://highmed.org/bpe/Process/ping" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="ping" /> + <name value="Ping" /> <title value="PING process" /> <subtitle value="Communication Testing Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> @@ -111,6 +63,6 @@ <value value="pmo@highmed.org" /> </telecom> </contact> - <description value="Process to send PING messages to remote Organizations and to receive corresponding PONG message" /> + <description value="Process to send PING messages to remote Organizations and to receive corresponding PONG messages" /> <kind value="Task" /> </ActivityDefinition> \ 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 @@ <ActivityDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="pingMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </valueCoding> - </extension> - </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-ping|${version}" /> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="REMOTE_ALL" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-ping" /> + <extension url="recipient"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> </extension> </extension> <url value="http://highmed.org/bpe/Process/pong" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="pong" /> + <name value="Pong" /> <title value="PONG process" /> <subtitle value="Communication Testing Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> @@ -67,6 +43,6 @@ <value value="pmo@highmed.org" /> </telecom> </contact> - <description value="Process startet by PING messages and to send corresponding PONG messages back remote Organizations" /> + <description value="Process startet by PING messages and to send corresponding PONG messages back to remote Organizations" /> <kind value="Task" /> </ActivityDefinition> \ 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-ping" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-pong" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-start-ping-process" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <parent> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.4.1</version> + <version>0.5.0</version> </parent> + + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + <dsf.location>../../highmed-dsf</dsf.location> + </properties> <dependencies> <dependency> @@ -58,7 +63,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -75,7 +80,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -92,7 +97,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -109,7 +114,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -126,7 +131,79 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic1</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic2</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic3</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/ttp</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process + </outputDirectory> </configuration> </execution> </executions> @@ -137,35 +214,63 @@ <configuration> <filesets> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> 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<Class<?>> 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<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map - .of("downloadAllowList/" + VERSION, Arrays.asList(aDown, c, sDown, v), "updateAllowList/" + VERSION, - Arrays.asList(aUp, c, sUp, v)); + Map<String, List<AbstractResource>> 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<Reference> bundleReferences = getTaskHelper() - .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST, - CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST).collect(Collectors.toList()); + List<Reference> 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<String, String> 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<String, String> 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<BundleEntryComponent> 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<Reference, Optional<Reference>> addAllowListEntryReturnReference(Bundle transaction, - String organizationId, Bundle searchSet) + private Function<Resource, BundleEntryComponent> toAllowListBundleEntry(Map<String, String> identifierByTypeAndId, + Map<String, String> 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<Identifier> getDefaultIdentifier(Organization org) + private BundleEntryComponent toOrganizationEntry(Organization organization, + Map<String, String> identifierByTypeAndId, Map<String, String> 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<Reference> 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<Identifier> getDefaultIdentifier(Endpoint ept) + private BundleEntryComponent toEndpointEntry(Endpoint endpoint, Map<String, String> identifierByTypeAndId, + Map<String, String> 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<Endpoint> getEndpoint(Reference endpoint, Bundle searchSet) + private BundleEntryComponent toOrganizationAffiliationEntry(OrganizationAffiliation affiliation, + Map<String, String> identifierByTypeAndId, Map<String, String> 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<Reference> 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.2.0"> - <bpmn:process id="downloadAllowList" isExecutable="true" camunda:versionTag="0.4.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> + <bpmn:process id="highmedorg_downloadAllowList" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:sequenceFlow id="SequenceFlow_0bbhq2r" sourceRef="StartEvent_1" targetRef="downloadAllowListTask" /> <bpmn:endEvent id="EndEvent_0xd0x8k"> <bpmn:incoming>SequenceFlow_0oyvmcd</bpmn:incoming> @@ -17,7 +17,7 @@ </bpmn:process> <bpmn:message id="Message_1nn2wdw" name="downloadAllowListMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="downloadAllowList"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_downloadAllowList"> <bpmndi:BPMNEdge id="SequenceFlow_0oyvmcd_di" bpmnElement="SequenceFlow_0oyvmcd"> <di:waypoint x="365" y="121" /> <di:waypoint x="415" y="121" /> 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0"> - <bpmn:process id="updateAllowList" isExecutable="true" camunda:versionTag="0.4.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> + <bpmn:process id="highmedorg_updateAllowList" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:sequenceFlow id="SequenceFlow_0bbhq2r" sourceRef="StartEvent_1" targetRef="updateAllowListTask" /> <bpmn:endEvent id="EndEvent_0xd0x8k"> <bpmn:incoming>SequenceFlow_0oyvmcd</bpmn:incoming> @@ -17,7 +17,11 @@ </bpmn:process> <bpmn:message id="Message_1nn2wdw" name="updateAllowListMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="updateAllowList"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_updateAllowList"> + <bpmndi:BPMNEdge id="SequenceFlow_0oyvmcd_di" bpmnElement="SequenceFlow_0oyvmcd"> + <di:waypoint x="365" y="121" /> + <di:waypoint x="415" y="121" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0bbhq2r_di" bpmnElement="SequenceFlow_0bbhq2r"> <di:waypoint x="215" y="121" /> <di:waypoint x="265" y="121" /> @@ -25,10 +29,6 @@ <bpmndi:BPMNShape id="EndEvent_0xd0x8k_di" bpmnElement="EndEvent_0xd0x8k"> <dc:Bounds x="415" y="103" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0oyvmcd_di" bpmnElement="SequenceFlow_0oyvmcd"> - <di:waypoint x="365" y="121" /> - <di:waypoint x="415" y="121" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0um3ad2_di" bpmnElement="updateAllowListTask"> <dc:Bounds x="265" y="81" width="100" height="80" /> </bpmndi:BPMNShape> 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 @@ <ActivityDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="downloadAllowListMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="LOCAL" /> - </valueCoding> - </extension> - </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-download-allow-list|${version}" /> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-download-allow-list" /> + <extension url="recipient"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> </extension> </extension> <url value="http://highmed.org/bpe/Process/downloadAllowList" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="downloadAllowList" /> + <name value="DownloadAllowList" /> <title value="Download Allow List" /> <subtitle value="Download Allow List Bundle Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> 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 @@ <ActivityDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="updateAllowListMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="LOCAL" /> - </valueCoding> - </extension> - </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-update-allow-list|${version}" /> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-organization"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="${org.highmed.dsf.bpe.allow.list.organization:hs-heilbronn.de}" /> + </valueIdentifier> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ORGANIZATION" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-update-allow-list" /> + <extension url="recipient"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-organization"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="${org.highmed.dsf.bpe.allow.list.organization:hs-heilbronn.de}" /> + </valueIdentifier> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ORGANIZATION" /> + </valueCoding> </extension> </extension> <url value="http://highmed.org/bpe/Process/updateAllowList" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="updateAllowList" /> + <name value="UpdateAllowList" /> <title value="Update Allow List" /> <subtitle value="Update Allow List Bundle Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> 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 @@ <CodeSystem xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> </meta> - <url value="http://highmed.org/fhir/CodeSystem/update-allow-list"/> + <url value="http://highmed.org/fhir/CodeSystem/update-allow-list" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="HiGHmed_Update_Allow_List"/> - <title value="HiGHmed Update Allow List"/> + <name value="HiGHmed_Update_Allow_List" /> + <title value="HiGHmed Update Allow List" /> <!-- status managed by bpe --> <status value="unknown" /> - <experimental value="false"/> - <date value="2021-04-20"/> - <publisher value="HiGHmed"/> - <description value="CodeSystem with standard values for the processes update and download allow list"/> - <caseSensitive value="true"/> - <hierarchyMeaning value="grouped-by"/> - <versionNeeded value="false"/> - <content value="complete"/> + <experimental value="false" /> + <date value="2021-08-24" /> + <publisher value="HiGHmed" /> + <description value="CodeSystem with standard values for the processes update and download allow list" /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> <concept> - <code value="highmed_allow_list"/> - <display value="HiGHmed Allow List"/> - <definition value="Allow list identifying organizations as part of HiGHmed"/> + <code value="allow_list" /> + <display value="Allow List" /> + <definition value="Allow list identifying organizations" /> </concept> </CodeSystem> \ 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-download-allow-list" /> @@ -13,7 +13,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -74,7 +74,7 @@ <element id="Task.input:bundle-reference.type.coding.code"> <path value="Task.input.type.coding.code" /> <min value="1" /> - <fixedCode value="highmed_allow_list" /> + <fixedCode value="allow_list" /> </element> <element id="Task.input:bundle-reference.value[x]"> <path value="Task.input.value[x]" /> 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-update-allow-list" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -86,7 +86,7 @@ <element id="Task.output:allowList.type.coding.code"> <path value="Task.output.type.coding.code" /> <min value="1" /> - <fixedCode value="highmed_allow_list" /> + <fixedCode value="allow_list" /> </element> <element id="Task.output:allowList.value[x]"> <path value="Task.output.value[x]" /> 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 @@ <ValueSet xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> </meta> - <url value="http://highmed.org/fhir/ValueSet/update-allow-list"/> + <url value="http://highmed.org/fhir/ValueSet/update-allow-list" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="HiGHmed_Update_Allow_List"/> - <title value="HiGHmed Update Allow List"/> + <name value="HiGHmed_Update_Allow_List" /> + <title value="HiGHmed Update Allow List" /> <!-- status managed by bpe --> <status value="unknown" /> - <experimental value="false"/> - <date value="2021-04-20"/> - <publisher value="HiGHmed"/> - <description - value="ValueSet with standard values for the process update allow list"/> - <immutable value="true"/> + <experimental value="false" /> + <date value="2021-08-24" /> + <publisher value="HiGHmed" /> + <description value="ValueSet with standard values for the process update allow list" /> + <immutable value="true" /> <compose> <include> - <system value="http://highmed.org/fhir/CodeSystem/update-allow-list"/> + <system value="http://highmed.org/fhir/CodeSystem/update-allow-list" /> </include> </compose> </ValueSet> \ 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 @@ <parent> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.4.1</version> + <version>0.5.0</version> </parent> + + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + <dsf.location>../../highmed-dsf</dsf.location> + </properties> <dependencies> <dependency> @@ -17,7 +22,6 @@ <scope>provided</scope> </dependency> - <dependency> <groupId>de.hs-heilbronn.mi</groupId> <artifactId>log4j2-utils</artifactId> @@ -59,7 +63,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -76,7 +80,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -93,7 +97,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -110,7 +114,7 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process</outputDirectory> </configuration> </execution> <execution> @@ -127,7 +131,79 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</outputDirectory> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic1</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic2</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic3</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/ttp</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process + </outputDirectory> </configuration> </execution> </executions> @@ -138,35 +214,63 @@ <configuration> <filesets> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</directory> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process</directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> 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<Class<?>> 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<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map - .of("executeUpdateResources/" + VERSION, Arrays.asList(aExec, c, sExec, v), - "requestUpdateResources/" + VERSION, Arrays.asList(aReq, c, sReq, v)); + Map<String, List<AbstractResource>> 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> 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<Reference> 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<Reference> references = getTaskHelper() - .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_UPDATE_RESOURCE, - CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE).collect(Collectors.toList()); + List<Reference> 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<Target> 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<Reference> bundleReferences = getTaskHelper() - .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_UPDATE_RESOURCE, - CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE).collect(Collectors.toList()); + List<Reference> 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0k0v4i2" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0"> - <bpmn:process id="executeUpdateResources" isExecutable="true" camunda:versionTag="0.4.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0k0v4i2" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> + <bpmn:process id="highmedorg_executeUpdateResources" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_0djh0eg</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_1r6vnvn" /> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_0djh0eg" sourceRef="StartEvent_1" targetRef="checkRequest" /> + <bpmn:sequenceFlow id="SequenceFlow_0djh0eg" sourceRef="StartEvent_1" targetRef="downloadBundle" /> <bpmn:serviceTask id="updateResources" name="updateResources" camunda:class="org.highmed.dsf.bpe.service.UpdateResources"> <bpmn:incoming>SequenceFlow_141lpsf</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0eygcor</bpmn:outgoing> @@ -16,35 +16,47 @@ <bpmn:sequenceFlow id="SequenceFlow_0eygcor" sourceRef="updateResources" targetRef="EndEvent_1i1w8yx" /> <bpmn:sequenceFlow id="SequenceFlow_141lpsf" sourceRef="checkRequest" targetRef="updateResources" /> <bpmn:serviceTask id="checkRequest" name="checkRequest" camunda:class="org.highmed.dsf.bpe.service.CheckRequest"> - <bpmn:incoming>SequenceFlow_0djh0eg</bpmn:incoming> + <bpmn:incoming>Flow_1iamqwv</bpmn:incoming> <bpmn:outgoing>SequenceFlow_141lpsf</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1iamqwv" sourceRef="downloadBundle" targetRef="checkRequest" /> + <bpmn:serviceTask id="downloadBundle" name="downloadBundle" camunda:class="org.highmed.dsf.bpe.service.DownloadBundle"> + <bpmn:incoming>SequenceFlow_0djh0eg</bpmn:incoming> + <bpmn:outgoing>Flow_1iamqwv</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:process> <bpmn:message id="Message_1r6vnvn" name="executeUpdateResourcesMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeUpdateResources"> - <bpmndi:BPMNShape id="StartEvent_1orek60_di" bpmnElement="StartEvent_1"> - <dc:Bounds x="179" y="103" width="36" height="36" /> - </bpmndi:BPMNShape> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_executeUpdateResources"> + <bpmndi:BPMNEdge id="Flow_1iamqwv_di" bpmnElement="Flow_1iamqwv"> + <di:waypoint x="370" y="121" /> + <di:waypoint x="430" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_141lpsf_di" bpmnElement="SequenceFlow_141lpsf"> + <di:waypoint x="530" y="121" /> + <di:waypoint x="593" y="121" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0eygcor_di" bpmnElement="SequenceFlow_0eygcor"> + <di:waypoint x="693" y="121" /> + <di:waypoint x="752" y="121" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0djh0eg_di" bpmnElement="SequenceFlow_0djh0eg"> <di:waypoint x="215" y="121" /> <di:waypoint x="270" y="121" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_1orek60_di" bpmnElement="StartEvent_1"> + <dc:Bounds x="179" y="103" width="36" height="36" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1t3955f_di" bpmnElement="updateResources"> - <dc:Bounds x="433" y="81" width="100" height="80" /> + <dc:Bounds x="593" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1i1w8yx_di" bpmnElement="EndEvent_1i1w8yx"> - <dc:Bounds x="622" y="103" width="36" height="36" /> + <dc:Bounds x="752" y="103" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0eygcor_di" bpmnElement="SequenceFlow_0eygcor"> - <di:waypoint x="533" y="121" /> - <di:waypoint x="622" y="121" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_141lpsf_di" bpmnElement="SequenceFlow_141lpsf"> - <di:waypoint x="370" y="121" /> - <di:waypoint x="433" y="121" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1aaurev_di" bpmnElement="checkRequest"> + <dc:Bounds x="430" y="81" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_059xaj1_di" bpmnElement="downloadBundle"> <dc:Bounds x="270" y="81" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0os0n0z" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="requestUpdateResources" isExecutable="true" camunda:versionTag="0.4.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0os0n0z" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> + <bpmn:process id="highmedorg_requestUpdateResources" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:sequenceFlow id="SequenceFlow_1ryplwc" sourceRef="StartEvent_1" targetRef="selectResourceAndTargets" /> <bpmn:sequenceFlow id="SequenceFlow_1u4zxix" sourceRef="selectResourceAndTargets" targetRef="sendRequest" /> <bpmn:endEvent id="EndEvent_1f9cjs7"> @@ -10,10 +10,9 @@ <bpmn:sendTask id="sendRequest" name="sendRequest" camunda:class="org.highmed.dsf.bpe.message.SendRequest"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="processDefinitionKey">executeUpdateResources</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.1</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeUpdateResources/0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">executeUpdateResourcesMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-update-resources</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-update-resources|0.5.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1u4zxix</bpmn:incoming> @@ -31,7 +30,7 @@ </bpmn:process> <bpmn:message id="Message_1buqzgq" name="requestUpdateResourcesMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="requestUpdateResources"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_requestUpdateResources"> <bpmndi:BPMNEdge id="SequenceFlow_1xwki6k_di" bpmnElement="SequenceFlow_1xwki6k"> <di:waypoint x="515" y="121" /> <di:waypoint x="565" y="121" /> 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 @@ <ActivityDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="executeUpdateResourcesMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </valueCoding> - </extension> - </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-update-resources|${version}" /> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="MeDIC" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-organization"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="${org.highmed.dsf.bpe.allow.list.organization:hs-heilbronn.de}" /> + </valueIdentifier> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="REMOTE_ORGANIZATION" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-update-resources" /> + <extension url="recipient"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> </extension> </extension> <url value="http://highmed.org/bpe/Process/executeUpdateResources" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="executeUpdateResources" /> + <name value="ExecuteUpdateResources" /> <title value="Execute Update of Resources" /> <subtitle value="Process to Download and Execute FHIR Bundle" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> 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 @@ <ActivityDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> <valueString value="requestUpdateResourcesMessage" /> </extension> - <extension url="authorization-roles"> - <extension url="authorization-role"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="LOCAL" /> - </valueCoding> - </extension> - </extension> - <extension url="requester-organization-types"> - <extension url="requester-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-update-resources|${version}" /> </extension> - <extension url="recipient-organization-types"> - <extension url="recipient-organization-type"> - <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> - <code value="TTP" /> - </valueCoding> - </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-organization"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="${org.highmed.dsf.bpe.allow.list.organization:hs-heilbronn.de}" /> + </valueIdentifier> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ORGANIZATION" /> + </valueCoding> </extension> - <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-update-resources" /> + <extension url="recipient"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-organization"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="${org.highmed.dsf.bpe.allow.list.organization:hs-heilbronn.de}" /> + </valueIdentifier> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ORGANIZATION" /> + </valueCoding> </extension> </extension> <url value="http://highmed.org/bpe/Process/requestUpdateResources" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="requestUpdateResources" /> + <name value="RequestUpdateResources" /> <title value="Request Update of Resources" /> <subtitle value="Process to Request a Bundle Download" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> 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 @@ <CodeSystem xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> </meta> - <url value="http://highmed.org/fhir/CodeSystem/update-resources"/> + <url value="http://highmed.org/fhir/CodeSystem/update-resources" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="HiGHmed_Update_Resources"/> - <title value="HiGHmed Update Resources"/> + <name value="HiGHmed_Update_Resources" /> + <title value="HiGHmed Update Resources" /> <!-- status managed by bpe --> <status value="unknown" /> - <experimental value="false"/> - <date value="2021-04-20"/> - <publisher value="HiGHmed"/> - <description value="CodeSystem with standard values for the process update resources"/> - <caseSensitive value="true"/> - <hierarchyMeaning value="grouped-by"/> - <versionNeeded value="false"/> - <content value="complete"/> + <experimental value="false" /> + <date value="2021-08-24" /> + <publisher value="HiGHmed" /> + <description value="CodeSystem with standard values for the process update resources" /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> <concept> - <code value="bundle-reference"/> - <display value="Bundle Reference"/> - <definition value="Bundle reference to be downloaded to update local resources"/> + <code value="bundle-reference" /> + <display value="Bundle Reference" /> + <definition value="Bundle reference to be downloaded to update local resources" /> </concept> <concept> - <code value="organization-identifier-search-parameter"/> - <display value="Organization Identifier Search Parameter"/> - <definition value="Organization system identifier as search parameter to define which organization are targets"/> + <code value="organization-identifier-search-parameter" /> + <display value="Organization Identifier Search Parameter" /> + <definition value="Organization system identifier as search parameter to define which organization are targets" /> </concept> </CodeSystem> \ 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-execute-update-resources" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <StructureDefinition xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-request-update-resources" /> @@ -12,7 +12,7 @@ <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-04-20" /> + <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> 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 @@ <ValueSet xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> </meta> - <url value="http://highmed.org/fhir/ValueSet/update-resources"/> + <url value="http://highmed.org/fhir/ValueSet/update-resources" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="HiGHmed_Update_Resources"/> - <title value="HiGHmed Update Resources"/> + <name value="HiGHmed_Update_Resources" /> + <title value="HiGHmed Update Resources" /> <!-- status managed by bpe --> <status value="unknown" /> - <experimental value="false"/> - <date value="2021-04-20"/> - <publisher value="HiGHmed"/> - <description - value="ValueSet with standard values for the process update resources"/> - <immutable value="true"/> + <experimental value="false" /> + <date value="2021-08-24" /> + <publisher value="HiGHmed" /> + <description value="ValueSet with standard values for the process update resources" /> + <immutable value="true" /> <compose> <include> - <system value="http://highmed.org/fhir/CodeSystem/update-resources"/> + <system value="http://highmed.org/fhir/CodeSystem/update-resources" /> </include> </compose> </ValueSet> \ 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 @@ <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.4.1</version> + <version>0.5.0</version> <packaging>pom</packaging> <modules> @@ -21,6 +21,8 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <compileSource>11</compileSource> <compileTarget>11</compileTarget> + + <main.basedir>${project.basedir}</main.basedir> </properties> <name>highmed-processes</name> @@ -62,12 +64,12 @@ <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-process-base</artifactId> - <version>0.4.0</version> + <version>0.5.0</version> </dependency> <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-fhir-validation</artifactId> - <version>0.4.0</version> + <version>0.5.0</version> </dependency> <dependency> @@ -100,7 +102,7 @@ <dependency> <groupId>de.hs-heilbronn.mi</groupId> <artifactId>log4j2-utils</artifactId> - <version>0.7.0</version> + <version>0.10.0</version> </dependency> <!-- logging --> @@ -113,19 +115,19 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> - <version>2.12.0</version> + <version>2.12.4</version> </dependency> <!-- testing --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>4.13.1</version> + <version>4.13.2</version> </dependency> <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-process-base</artifactId> - <version>0.4.0</version> + <version>0.5.0</version> <scope>test</scope> <type>test-jar</type> </dependency> @@ -176,13 +178,23 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.2</version> + <version>3.2.0</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> + <plugin> + <groupId>net.revelc.code.formatter</groupId> + <artifactId>formatter-maven-plugin</artifactId> + <version>2.16.0</version> + </plugin> + <plugin> + <groupId>net.revelc.code</groupId> + <artifactId>impsort-maven-plugin</artifactId> + <version>1.6.2</version> + </plugin> </plugins> </pluginManagement> @@ -204,6 +216,22 @@ <useLastCommittedRevision>true</useLastCommittedRevision> </configuration> </plugin> + <plugin> + <groupId>net.revelc.code.formatter</groupId> + <artifactId>formatter-maven-plugin</artifactId> + <configuration> + <configFile>${main.basedir}/src/main/resources/eclipse-formatter-config.xml</configFile> + </configuration> + </plugin> + <plugin> + <groupId>net.revelc.code</groupId> + <artifactId>impsort-maven-plugin</artifactId> + <configuration> + <compliance>11</compliance> + <groups>java.,javax.,org.,com.</groups> + <staticGroups>java,*</staticGroups> + </configuration> + </plugin> </plugins> </build> @@ -231,4 +259,70 @@ </snapshots> </repository> </repositories> + + <profiles> + <profile> + <id>format-and-sort</id> + + <build> + <plugins> + <plugin> + <groupId>net.revelc.code.formatter</groupId> + <artifactId>formatter-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>format</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>net.revelc.code</groupId> + <artifactId>impsort-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>sort</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>validate-and-check</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + + <build> + <plugins> + <plugin> + <groupId>net.revelc.code.formatter</groupId> + <artifactId>formatter-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>validate</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>net.revelc.code</groupId> + <artifactId>impsort-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> </project> 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 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<profiles version="20"> + <profile kind="CodeFormatterProfile" name="highmed_dsf" version="20"> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/> + <setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/> + <setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="2"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/> + <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/> + <setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_if_empty"/> + <setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> + </profile> +</profiles>