From 93e57fc34add8d86641ea8dd12a95f3da1ef7652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20R=C3=BChle?= Date: Thu, 23 Nov 2023 14:58:36 +0100 Subject: [PATCH 1/2] Refactor Request Process Flow Going back to using Camunda multi instance subprocess for sending and receiving single dic tasks. This process flow avoids optimistic lock exceptions. --- .../listener/SetCorrelationKeyListener.java | 33 ++ .../message/SendDicRequest.java | 40 +++ .../service/DownloadMeasureReport.java | 2 +- .../service/LogReceiveTimeout.java | 28 ++ .../service/SendDicRequests.java | 146 -------- .../service/StoreLiveResult.java | 2 +- .../spring/config/FeasibilityConfig.java | 33 +- .../resources/bpe/feasibilityRequest.bpmn | 338 ++++++++++-------- .../service/DownloadMeasureReportTest.java | 2 +- .../service/StoreLiveResultTest.java | 6 +- 10 files changed, 322 insertions(+), 308 deletions(-) create mode 100644 feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/client/listener/SetCorrelationKeyListener.java create mode 100644 feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/message/SendDicRequest.java create mode 100644 feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/LogReceiveTimeout.java delete mode 100644 feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/SendDicRequests.java diff --git a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/client/listener/SetCorrelationKeyListener.java b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/client/listener/SetCorrelationKeyListener.java new file mode 100644 index 0000000..ca63063 --- /dev/null +++ b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/client/listener/SetCorrelationKeyListener.java @@ -0,0 +1,33 @@ +package de.medizininformatik_initiative.feasibility_dsf_process.client.listener; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.constants.BpmnExecutionVariables; +import dev.dsf.bpe.v1.variables.Target; +import dev.dsf.bpe.v1.variables.Variables; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.ExecutionListener; +import org.springframework.beans.factory.InitializingBean; + +import java.util.Objects; + +public class SetCorrelationKeyListener implements ExecutionListener, InitializingBean +{ + private final ProcessPluginApi api; + + public SetCorrelationKeyListener(ProcessPluginApi api) { + this.api = api; + } + + @Override + public void afterPropertiesSet() throws Exception { + Objects.requireNonNull(api, "api"); + } + + @Override + public void notify(DelegateExecution execution) throws Exception { + Variables variables = api.getVariables(execution); + Target target = variables.getTarget(); + + execution.setVariableLocal(BpmnExecutionVariables.CORRELATION_KEY, target.getCorrelationKey()); + } +} diff --git a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/message/SendDicRequest.java b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/message/SendDicRequest.java new file mode 100644 index 0000000..1c8044a --- /dev/null +++ b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/message/SendDicRequest.java @@ -0,0 +1,40 @@ +package de.medizininformatik_initiative.feasibility_dsf_process.message; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractTaskMessageSend; +import dev.dsf.bpe.v1.variables.Variables; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.ParameterComponent; + +import java.util.stream.Stream; + +import static com.google.common.base.Preconditions.checkNotNull; +import static de.medizininformatik_initiative.feasibility_dsf_process.variables.ConstantsFeasibility.CODESYSTEM_FEASIBILITY; +import static de.medizininformatik_initiative.feasibility_dsf_process.variables.ConstantsFeasibility.CODESYSTEM_FEASIBILITY_VALUE_MEASURE_REFERENCE; + +public class SendDicRequest extends AbstractTaskMessageSend { + + public SendDicRequest(ProcessPluginApi api) { + super(api); + } + + @Override + protected Stream getAdditionalInputParameters(DelegateExecution execution, + Variables variables) { + return Stream.of(api.getTaskHelper().createInput( + new Reference(checkNotNull(variables.getString("measure-id"), "variable 'measure-id' not set")), + CODESYSTEM_FEASIBILITY, CODESYSTEM_FEASIBILITY_VALUE_MEASURE_REFERENCE)); + } + + @Override + protected void handleIntermediateThrowEventError(DelegateExecution execution, Variables variables, + Exception exception, String errorMessage) { + execution.setVariableLocal("sendError", true); + } + + @Override + protected void addErrorMessage(Task task, String errorMessage) { + } +} diff --git a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/DownloadMeasureReport.java b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/DownloadMeasureReport.java index 45c6bf2..34b6612 100644 --- a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/DownloadMeasureReport.java +++ b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/DownloadMeasureReport.java @@ -44,7 +44,7 @@ protected void doExecute(DelegateExecution execution, Variables variables) { FhirWebserviceClient client = clientProvider .getWebserviceClientByReference(measureReportId); MeasureReport measureReport = downloadMeasureReport(client, measureReportId); - execution.setVariable(VARIABLE_MEASURE_REPORT, measureReport); + execution.setVariableLocal(VARIABLE_MEASURE_REPORT, measureReport); } private MeasureReport downloadMeasureReport(FhirWebserviceClient client, IdType measureReportId) { diff --git a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/LogReceiveTimeout.java b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/LogReceiveTimeout.java new file mode 100644 index 0000000..c125ae9 --- /dev/null +++ b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/LogReceiveTimeout.java @@ -0,0 +1,28 @@ +package de.medizininformatik_initiative.feasibility_dsf_process.service; + +import dev.dsf.bpe.v1.ProcessPluginApi; +import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; +import dev.dsf.bpe.v1.variables.Target; +import dev.dsf.bpe.v1.variables.Variables; +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LogReceiveTimeout extends AbstractServiceDelegate { + + private static final Logger logger = LoggerFactory.getLogger(LogReceiveTimeout.class); + + public LogReceiveTimeout(ProcessPluginApi api) { + super(api); + } + + @Override + protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { + Target target = variables.getTarget(); + logger.warn("Timeout while waiting for result from {} (endpoint url: {}).", + target.getOrganizationIdentifierValue(), + target.getEndpointUrl()); + } + +} diff --git a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/SendDicRequests.java b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/SendDicRequests.java deleted file mode 100644 index a003739..0000000 --- a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/SendDicRequests.java +++ /dev/null @@ -1,146 +0,0 @@ -package de.medizininformatik_initiative.feasibility_dsf_process.service; - -import dev.dsf.bpe.v1.ProcessPluginApi; -import dev.dsf.bpe.v1.activity.AbstractServiceDelegate; -import dev.dsf.bpe.v1.constants.CodeSystems.BpmnMessage; -import dev.dsf.bpe.v1.constants.NamingSystems; -import dev.dsf.bpe.v1.variables.Target; -import dev.dsf.bpe.v1.variables.Targets; -import dev.dsf.bpe.v1.variables.Variables; -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.impl.el.FixedValue; -import org.hl7.fhir.r4.model.CodeableConcept; -import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.Identifier; -import org.hl7.fhir.r4.model.Meta; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.StringType; -import org.hl7.fhir.r4.model.Task; -import org.hl7.fhir.r4.model.Task.ParameterComponent; -import org.hl7.fhir.r4.model.Task.TaskStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Date; -import java.util.concurrent.ForkJoinPool; -import java.util.stream.Collectors; - -import static com.google.common.base.Preconditions.checkNotNull; -import static de.medizininformatik_initiative.feasibility_dsf_process.variables.ConstantsFeasibility.CODESYSTEM_FEASIBILITY; -import static de.medizininformatik_initiative.feasibility_dsf_process.variables.ConstantsFeasibility.CODESYSTEM_FEASIBILITY_VALUE_MEASURE_REFERENCE; -import static org.hl7.fhir.r4.model.Task.TaskIntent.ORDER; - -public class SendDicRequests extends AbstractServiceDelegate { - - private static final Logger logger = LoggerFactory.getLogger(SendDicRequests.class); - - private final ForkJoinPool forkJoinPool; - - // set via field injection - private FixedValue instantiatesCanonical; - private FixedValue messageName; - private FixedValue profile; - - public SendDicRequests(ProcessPluginApi api, ForkJoinPool forkJoinPool) { - super(api); - this.forkJoinPool = forkJoinPool; - } - - public void setInstantiatesCanonical(FixedValue instantiatesCanonical) { - this.instantiatesCanonical = instantiatesCanonical; - } - - public void setMessageName(FixedValue messageName) { - this.messageName = messageName; - } - - public void setProfile(FixedValue profile) { - this.profile = profile; - } - - @Override - protected void doExecute(DelegateExecution execution, Variables variables) throws BpmnError, Exception { - Targets targets = variables.getTargets(); - Task targetTaskTemplate = createTargetTaskTemplate(execution, variables); - - forkJoinPool.submit( - () -> targets.getEntries() - .parallelStream() - .map((target) -> { - Task targetTask = targetTaskTemplate.copy(); - - targetTask.getRestriction().addRecipient(getRecipient(target)); - - String correlationKey = target.getCorrelationKey(); - if (correlationKey != null) { - ParameterComponent correlationKeyInput = new ParameterComponent( - new CodeableConcept( - new Coding(BpmnMessage.URL, BpmnMessage.Codes.CORRELATION_KEY, null)), - new StringType(correlationKey)); - targetTask.getInput().add(correlationKeyInput); - } - - return sendTask(targetTask, target); - }) - .collect(Collectors.toList())) - .get(); - } - - private Task createTargetTaskTemplate(DelegateExecution execution, Variables variables) { - String instantiatesCanonical = checkNotNull(this.instantiatesCanonical).getExpressionText(); - String messageName = checkNotNull(this.messageName).getExpressionText(); - String profile = checkNotNull(this.profile).getExpressionText(); - Reference measure = new Reference() - .setReference(checkNotNull(variables.getString("measure-id"), "variable 'measure-id' not set")); - String businessKey = execution.getBusinessKey(); - Task targetTask = new Task(); - targetTask.copy(); - targetTask.setMeta(new Meta().addProfile(profile)); - targetTask.setStatus(TaskStatus.REQUESTED); - targetTask.setIntent(ORDER); - targetTask.setAuthoredOn(new Date()); - targetTask.setRequester(getRequester()); - targetTask.setInstantiatesCanonical(instantiatesCanonical); - - ParameterComponent messageNameInput = new ParameterComponent( - new CodeableConcept(new Coding(BpmnMessage.URL, BpmnMessage.Codes.MESSAGE_NAME, null)), - new StringType(messageName)); - targetTask.addInput(messageNameInput); - - ParameterComponent businessKeyInput = new ParameterComponent( - new CodeableConcept(new Coding(BpmnMessage.URL, BpmnMessage.Codes.BUSINESS_KEY, null)), - new StringType(businessKey)); - targetTask.getInput().add(businessKeyInput); - targetTask.getInput().add(api.getTaskHelper().createInput(measure, CODESYSTEM_FEASIBILITY, - CODESYSTEM_FEASIBILITY_VALUE_MEASURE_REFERENCE)); - return targetTask; - } - - private Reference getRequester() { - return new Reference().setType("Organization") - .setIdentifier(new Identifier().setSystem(NamingSystems.OrganizationIdentifier.SID) - .setValue(api.getOrganizationProvider().getLocalOrganizationIdentifierValue().get())); - } - - private Reference getRecipient(Target target) { - return new Reference().setType("Organization") - .setIdentifier(new Identifier().setSystem(NamingSystems.OrganizationIdentifier.SID) - .setValue(target.getOrganizationIdentifierValue())); - } - - private Boolean sendTask(Task task, Target target) { - try { - logger.info("Sending task to target organization {}, endpoint {}", - target.getOrganizationIdentifierValue(), target.getEndpointUrl()); - api.getFhirWebserviceClientProvider() - .getWebserviceClient(target.getEndpointUrl()) - .create(task); - return true; - } catch (Exception e) { - logger.error("Error sending task to target organization {}, endpoint {}: {}", - target.getOrganizationIdentifierValue(), target.getEndpointUrl(), e.getMessage()); - return false; - } - } -} diff --git a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/StoreLiveResult.java b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/StoreLiveResult.java index c430875..218ab0f 100644 --- a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/StoreLiveResult.java +++ b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/service/StoreLiveResult.java @@ -40,7 +40,7 @@ public StoreLiveResult(ProcessPluginApi api) { protected void doExecute(DelegateExecution execution, Variables variables) { Task task = variables.getLatestTask(); - MeasureReport measureReport = variables.getResource(VARIABLE_MEASURE_REPORT); + MeasureReport measureReport = (MeasureReport) execution.getVariableLocal(VARIABLE_MEASURE_REPORT); addReadAccessTag(measureReport); MeasureReport storedMeasureReport = storeMeasureReport(measureReport); diff --git a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/spring/config/FeasibilityConfig.java b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/spring/config/FeasibilityConfig.java index 5312955..fb6040c 100755 --- a/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/spring/config/FeasibilityConfig.java +++ b/feasibility-dsf-process/src/main/java/de/medizininformatik_initiative/feasibility_dsf_process/spring/config/FeasibilityConfig.java @@ -1,5 +1,6 @@ package de.medizininformatik_initiative.feasibility_dsf_process.spring.config; +import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.rest.client.api.IGenericClient; import de.medizininformatik_initiative.feasibility_dsf_process.EnhancedFhirWebserviceClientProvider; import de.medizininformatik_initiative.feasibility_dsf_process.EnhancedFhirWebserviceClientProviderImpl; @@ -10,6 +11,8 @@ import de.medizininformatik_initiative.feasibility_dsf_process.Obfuscator; import de.medizininformatik_initiative.feasibility_dsf_process.RateLimit; import de.medizininformatik_initiative.feasibility_dsf_process.client.flare.FlareWebserviceClient; +import de.medizininformatik_initiative.feasibility_dsf_process.client.listener.SetCorrelationKeyListener; +import de.medizininformatik_initiative.feasibility_dsf_process.message.SendDicRequest; import de.medizininformatik_initiative.feasibility_dsf_process.message.SendDicResponse; import de.medizininformatik_initiative.feasibility_dsf_process.service.DownloadFeasibilityResources; import de.medizininformatik_initiative.feasibility_dsf_process.service.DownloadMeasureReport; @@ -17,11 +20,11 @@ import de.medizininformatik_initiative.feasibility_dsf_process.service.EvaluateRequestRate; import de.medizininformatik_initiative.feasibility_dsf_process.service.EvaluateStructuredQueryMeasure; import de.medizininformatik_initiative.feasibility_dsf_process.service.FeasibilityResourceCleaner; +import de.medizininformatik_initiative.feasibility_dsf_process.service.LogReceiveTimeout; import de.medizininformatik_initiative.feasibility_dsf_process.service.ObfuscateEvaluationResult; import de.medizininformatik_initiative.feasibility_dsf_process.service.RateLimitExceededTaskRejecter; import de.medizininformatik_initiative.feasibility_dsf_process.service.SelectRequestTargets; import de.medizininformatik_initiative.feasibility_dsf_process.service.SelectResponseTarget; -import de.medizininformatik_initiative.feasibility_dsf_process.service.SendDicRequests; import de.medizininformatik_initiative.feasibility_dsf_process.service.SetupEvaluationSettings; import de.medizininformatik_initiative.feasibility_dsf_process.service.StoreFeasibilityResources; import de.medizininformatik_initiative.feasibility_dsf_process.service.StoreLiveResult; @@ -35,22 +38,23 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Scope; -import java.util.concurrent.ForkJoinPool; - @Configuration public class FeasibilityConfig { private final IGenericClient storeClient; + @Autowired private final FhirContext fhirContext; @Autowired private ProcessPluginApi api; private final EvaluationSettingsProvider evaluationSettingsProvider; private final FlareWebserviceClient flareWebserviceClient; public FeasibilityConfig(@Qualifier("store-client") IGenericClient storeClient, + FhirContext fhirContext, EvaluationSettingsProvider evaluationSettingsProvider, FlareWebserviceClient flareWebserviceClient) { this.storeClient = storeClient; + this.fhirContext = fhirContext; this.evaluationSettingsProvider = evaluationSettingsProvider; this.flareWebserviceClient = flareWebserviceClient; } @@ -79,8 +83,8 @@ public SelectRequestTargets selectRequestTargets() { @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public SendDicRequests sendDicRequests(ForkJoinPool threadPool) { - return new SendDicRequests(api, threadPool); + public SendDicRequest sendDicRequests() { + return new SendDicRequest(api); } @Bean @@ -95,6 +99,18 @@ public StoreLiveResult storeLiveResult() { return new StoreLiveResult(api); } + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public LogReceiveTimeout logReceiveTimeout() { + return new LogReceiveTimeout(api); + } + + @Bean + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + public SetCorrelationKeyListener setCorrelationKeyListener() { + return new SetCorrelationKeyListener(api); + } + // // process executeFeasibility implementations // @@ -167,14 +183,9 @@ public SendDicResponse sendDicResponse() { return new SendDicResponse(api); } - @Bean - public ForkJoinPool ioThreadPool() { - return new ForkJoinPool(8); - } - @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public FeasibilityProcessPluginDeploymentStateListener deploymentStateListener () { + public FeasibilityProcessPluginDeploymentStateListener deploymentStateListener() { return new FeasibilityProcessPluginDeploymentStateListener( EvaluationStrategy .fromStrategyRepresentation(evaluationSettingsProvider.evaluationStrategyRepresentation()), diff --git a/feasibility-dsf-process/src/main/resources/bpe/feasibilityRequest.bpmn b/feasibility-dsf-process/src/main/resources/bpe/feasibilityRequest.bpmn index 1ebe489..b8e27e1 100755 --- a/feasibility-dsf-process/src/main/resources/bpe/feasibilityRequest.bpmn +++ b/feasibility-dsf-process/src/main/resources/bpe/feasibilityRequest.bpmn @@ -7,88 +7,107 @@ SequenceFlow_11k77gx - Flow_14amax3 + Flow_0j3kdv8 - Flow_00sw3oh + Flow_08iflnw - - Flow_1qn1bcu - Flow_05o62hi - - - + + Flow_0j3kdv8 + Flow_08iflnw + + + R0/PT5S + + + + Flow_1oq6cy1 Flow_097xx9e - - Flow_14foi4g + + Flow_02h2l8y Flow_1oq6cy1 - - Flow_097xx9e - - - + - - ${target.correlationKey} - + R0/PT5S - Flow_1d7lpns - Flow_14foi4g - - - + Flow_0qr31l0 + + + Flow_1d7lpns - + + + + Flow_1d7lpns + Flow_1whfhqu + + + + http://medizininformatik-initiative.de/fhir/StructureDefinition/feasibility-task-execute|#{version} + + + feasibilityExecuteMessage + + + http://medizininformatik-initiative.de/bpe/Process/feasibilityExecute|#{version} + + + + + + + + Flow_0uyhw70 + Flow_02h2l8y + + + + + + + Flow_02yveoj + Flow_0uyhw70 + Flow_1epm5e3 + + + + Flow_1epm5e3 + Flow_0pq3j9e + + PT5M + + + + + Flow_0pq3j9e + Flow_0gkh900 + + + + + Flow_1whfhqu + Flow_02yveoj + HasSendError + + + + ${execution.hasVariable("sendError")} + + + Flow_097xx9e + Flow_0gkh900 + HasSendError + Flow_0qr31l0 + + - - - - Flow_0sb70bv - - PT45S - - - - - - - http://medizininformatik-initiative.de/fhir/StructureDefinition/feasibility-task-execute|#{version} - - - feasibilityExecuteMessage - - - http://medizininformatik-initiative.de/bpe/Process/feasibilityExecute|#{version} - - - Flow_0faz7g4 - Flow_05069oz - - - - Flow_14amax3 - Flow_1qn1bcu - Flow_0faz7g4 - - - - Flow_0adxuc3 - Flow_05069oz - Flow_00sw3oh - - - Flow_05o62hi - Flow_0sb70bv - Flow_0adxuc3 - - - - + + @@ -108,110 +127,141 @@ - + - + - + - + - + - - + + + - - + + + + + - - + + + + + - - + + + + + - - - + + - - + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + - - + + - - + + - - + + + + + - - + + - - - + + + - - - + + + - - - + + + - - - - + + + - - - - + + + + - - - - + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + - - - - + + + - - - + + + diff --git a/feasibility-dsf-process/src/test/java/de/medizininformatik_initiative/feasibility_dsf_process/service/DownloadMeasureReportTest.java b/feasibility-dsf-process/src/test/java/de/medizininformatik_initiative/feasibility_dsf_process/service/DownloadMeasureReportTest.java index 66eae5b..dd78618 100644 --- a/feasibility-dsf-process/src/test/java/de/medizininformatik_initiative/feasibility_dsf_process/service/DownloadMeasureReportTest.java +++ b/feasibility-dsf-process/src/test/java/de/medizininformatik_initiative/feasibility_dsf_process/service/DownloadMeasureReportTest.java @@ -111,6 +111,6 @@ public void testDoExecute() throws Exception { service.execute(execution); - verify(execution).setVariable(VARIABLE_MEASURE_REPORT, measureReport); + verify(execution).setVariableLocal(VARIABLE_MEASURE_REPORT, measureReport); } } diff --git a/feasibility-dsf-process/src/test/java/de/medizininformatik_initiative/feasibility_dsf_process/service/StoreLiveResultTest.java b/feasibility-dsf-process/src/test/java/de/medizininformatik_initiative/feasibility_dsf_process/service/StoreLiveResultTest.java index 3a9ae1d..19d6530 100644 --- a/feasibility-dsf-process/src/test/java/de/medizininformatik_initiative/feasibility_dsf_process/service/StoreLiveResultTest.java +++ b/feasibility-dsf-process/src/test/java/de/medizininformatik_initiative/feasibility_dsf_process/service/StoreLiveResultTest.java @@ -77,8 +77,7 @@ public void testDoExecute_MeasureReportReferenceIsAddedToTask() throws Exception IdType measureReportId = new IdType("e26daf2d-2d55-4f23-a7c8-4b994e3a319e"); report.setIdElement(measureReportId); TaskOutputComponent taskOutputComponent = new TaskOutputComponent(); - when(variables.getResource(VARIABLE_MEASURE_REPORT)) - .thenReturn(measureReport); + when(execution.getVariableLocal(VARIABLE_MEASURE_REPORT)).thenReturn(measureReport); when(client.create(any(MeasureReport.class))).thenReturn(report); when(taskHelper.createOutput(refCaptor.capture(), eq(CODESYSTEM_FEASIBILITY), eq(CODESYSTEM_FEASIBILITY_VALUE_MEASURE_REPORT_REFERENCE))) .thenReturn(taskOutputComponent); @@ -91,8 +90,7 @@ public void testDoExecute_MeasureReportReferenceIsAddedToTask() throws Exception @Test public void testDoExecute_MeasureReportIsStored() throws Exception { - when(variables.getResource(VARIABLE_MEASURE_REPORT)) - .thenReturn(measureReport); + when(execution.getVariableLocal(VARIABLE_MEASURE_REPORT)).thenReturn(measureReport); when(taskHelper.createOutput(refCaptor.capture(), eq(CODESYSTEM_FEASIBILITY), eq(CODESYSTEM_FEASIBILITY_VALUE_MEASURE_REPORT_REFERENCE))) .thenReturn(new TaskOutputComponent()); when(client.create(measureReportCaptor.capture())).thenReturn(measureReport); From 3a78051ff1c3e90a51e4850623207471afda2901 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20R=C3=BChle?= Date: Thu, 30 Nov 2023 16:57:12 +0100 Subject: [PATCH 2/2] Rename Node IDs in Feasibility Execute Camunda Process Make it more obvious which step in the camunda process caused an error by having the node id's, which are shown in error messages, named equivalent to the display name in camunda modeler. --- .../resources/bpe/feasibilityExecute.bpmn | 86 ++++++++++--------- 1 file changed, 44 insertions(+), 42 deletions(-) diff --git a/feasibility-dsf-process/src/main/resources/bpe/feasibilityExecute.bpmn b/feasibility-dsf-process/src/main/resources/bpe/feasibilityExecute.bpmn index 07897a9..96f46ac 100755 --- a/feasibility-dsf-process/src/main/resources/bpe/feasibilityExecute.bpmn +++ b/feasibility-dsf-process/src/main/resources/bpe/feasibilityExecute.bpmn @@ -9,24 +9,6 @@ Flow_0h1fgqi Flow_11cnoe1 - - - SequenceFlow_0ascyjc - - - - http://medizininformatik-initiative.de/fhir/StructureDefinition/feasibility-task-single-dic-result|#{version} - - - http://medizininformatik-initiative.de/bpe/Process/feasibilityRequest|#{version} - - - feasibilitySingleDicResultMessage - - - - - Flow_11lpcfm SequenceFlow_0ascyjc @@ -55,36 +37,36 @@ ${execution.getVariable('evaluation-strategy')=='cql'} - + ${execution.getVariable('evaluation-strategy')=='structured-query'} - + Flow_0gowl5w Flow_1cs9290 - + Flow_0r37nze Flow_10dmu4o - + Flow_1f6bge9 Flow_07fkz0p - + Flow_1qdam0i Flow_1cs9290 Flow_0r37nze Flow_1lvwaa9 - - - + + + ${execution.getVariable('evaluation-obfuscation')==true} - + ${execution.getVariable('evaluation-obfuscation')==false} - + Flow_07fkz0p Flow_0js57at @@ -97,20 +79,40 @@ ${execution.getVariable('request-rate-below-limit')} - + Flow_0ug5qml Flow_1gqxni9 - + ${execution.getVariable('request-rate-below-limit') == false} - - + + - - + + Flow_1gqxni9 + + + R3/PT5S + + SequenceFlow_0ascyjc + + + + http://medizininformatik-initiative.de/fhir/StructureDefinition/feasibility-task-single-dic-result|#{version} + + + http://medizininformatik-initiative.de/bpe/Process/feasibilityRequest|#{version} + + + feasibilitySingleDicResultMessage + + + + + @@ -125,10 +127,10 @@ - + - + @@ -149,16 +151,16 @@ - + - + - + - + @@ -173,10 +175,10 @@ - + - +