Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit 7c78c7a

Browse files
committed
Merge remote-tracking branch 'origin/issues/79_status_output' into
develop
2 parents 0dfbf2a + e55a71b commit 7c78c7a

15 files changed

Lines changed: 2300 additions & 10 deletions

File tree

codex-process-data-transfer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<artifactId>maven-surefire-plugin</artifactId>
4646
<configuration>
4747
<excludes>
48-
<exclude>**/ValidateDataLearningTest.java</exclude>
48+
<exclude>**/*LearningTest.java</exclude>
4949
</excludes>
5050
</configuration>
5151
</plugin>

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/ConstantsDataTransfer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public interface ConstantsDataTransfer
4343
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_VALUE_EXPORT_TO = "export-to";
4444
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_VALUE_DATA_REFERENCE = "data-reference";
4545
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_VALUE_DRY_RUN = "dry-run";
46+
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_VALUE_ENCRYPTED_BUNDLE_SIZE = "encrypted-bundle-size";
4647

4748
String PROFILE_NUM_CODEX_TASK_DATA_TRIGGER_PROCESS_URI = "http://www.netzwerk-universitaetsmedizin.de/bpe/Process/dataTrigger/";
4849
String PROFILE_NUM_CODEX_TASK_DATA_TRIGGER_PROCESS_URI_AND_LATEST_VERSION = PROFILE_NUM_CODEX_TASK_DATA_TRIGGER_PROCESS_URI

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/receive/LogError.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,15 @@ protected void doExecute(DelegateExecution execution) throws BpmnError, Exceptio
7171
task.addOutput(output);
7272

7373
if (CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_SOURCE_VALUE_CRR.equals(errorSource))
74-
logger.warn("Error while executing local process: code: '{}', message: {}", errorCode, errorMessage);
74+
logger.error("Error while executing local process; code: '{}', message: {}", errorCode, errorMessage);
7575
else
76-
logger.warn("Error while executing process at {}: code: '{}', message: {}", errorSource, errorCode,
76+
logger.error("Error while executing process at {}; code: '{}', message: {}", errorSource, errorCode,
7777
errorMessage);
7878

7979
errorLogger.logDataReceiveFailed(getLeadingTaskFromExecutionVariables().getIdElement()
8080
.withServerBase(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Task.name()));
8181
}
82+
83+
updateLeadingTaskInExecutionVariables(task);
8284
}
8385
}

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/receive/LogValidationError.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,7 @@ protected void doExecute(DelegateExecution execution) throws BpmnError, Exceptio
7373
OperationOutcome outcome = (OperationOutcome) entry.getResponse().getOutcome();
7474
errorOutputParameterGenerator.createCrrValidationError(outcome).forEach(task::addOutput);
7575
});
76+
77+
updateLeadingTaskInExecutionVariables(task);
7678
}
7779
}

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/send/LogError.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,15 @@ protected void doExecute(DelegateExecution execution) throws BpmnError, Exceptio
7272
task.addOutput(output);
7373

7474
if (CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_SOURCE_VALUE_MEDIC.equals(errorSource))
75-
logger.warn("Error while executing local process: code: '{}', message: {}", errorCode, errorMessage);
75+
logger.error("Error while executing local process; code: '{}', message: {}", errorCode, errorMessage);
7676
else
77-
logger.warn("Error while executing process at {}: code: '{}', message: {}", errorSource, errorCode,
77+
logger.error("Error while executing process at {}; code: '{}', message: {}", errorSource, errorCode,
7878
errorMessage);
7979

8080
errorLogger.logDataReceiveFailed(getLeadingTaskFromExecutionVariables().getIdElement()
8181
.withServerBase(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Task.name()));
8282
}
83+
84+
updateLeadingTaskInExecutionVariables(task);
8385
}
8486
}

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/send/LogValidationError.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ private void addErrorsToTask(Bundle bundle, Map<String, String> sourceIdsByBundl
9292

9393
errorOutputParameterGenerator.createCrrValidationError(sourceId, outcome).forEach(task::addOutput);
9494
});
95+
96+
updateLeadingTaskInExecutionVariables(task);
9597
}
9698

9799
private void logValidationDetails(Bundle bundle, Map<String, String> sourceIdsByBundleUuid)

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/DownloadDataFromDic.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.ConstantsDataTransfer.BPMN_EXECUTION_VARIABLE_RETURN_TARGET;
55
import static de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.ConstantsDataTransfer.CODESYSTEM_NUM_CODEX_DATA_TRANSFER;
66
import static de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.ConstantsDataTransfer.CODESYSTEM_NUM_CODEX_DATA_TRANSFER_VALUE_DATA_REFERENCE;
7+
import static de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.ConstantsDataTransfer.CODESYSTEM_NUM_CODEX_DATA_TRANSFER_VALUE_ENCRYPTED_BUNDLE_SIZE;
78
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE;
89
import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC;
910
import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER;
@@ -30,6 +31,7 @@
3031
import org.hl7.fhir.r4.model.Endpoint;
3132
import org.hl7.fhir.r4.model.IdType;
3233
import org.hl7.fhir.r4.model.Identifier;
34+
import org.hl7.fhir.r4.model.IntegerType;
3335
import org.hl7.fhir.r4.model.Reference;
3436
import org.hl7.fhir.r4.model.Task;
3537
import org.hl7.fhir.r4.model.Type;
@@ -61,7 +63,11 @@ public void afterPropertiesSet() throws Exception
6163
@Override
6264
protected void doExecute(DelegateExecution execution) throws BpmnError, Exception
6365
{
64-
Task task = getCurrentTaskFromExecutionVariables();
66+
/*
67+
* need to use leading task not current task, since changes to current task variable will not survive
68+
* intermediate message catch events later in the process flow
69+
*/
70+
Task task = getLeadingTaskFromExecutionVariables();
6571
String dicIdentifierValue = task.getRequester().getIdentifier().getValue();
6672

6773
Endpoint targetEndpoint = getEndpoint(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, dicIdentifierValue);
@@ -77,7 +83,14 @@ protected void doExecute(DelegateExecution execution) throws BpmnError, Exceptio
7783
{
7884
byte[] encrypted = binary.readAllBytes();
7985
execution.setVariable(BPMN_EXECUTION_VARIABLE_BUNDLE, Variables.byteArrayValue(encrypted));
86+
87+
task.addOutput().setValue(new IntegerType(encrypted.length)).getType().getCodingFirstRep()
88+
.setSystem(CODESYSTEM_NUM_CODEX_DATA_TRANSFER)
89+
.setCode(CODESYSTEM_NUM_CODEX_DATA_TRANSFER_VALUE_ENCRYPTED_BUNDLE_SIZE);
8090
}
91+
92+
// see comment above on leading vs current task
93+
updateLeadingTaskInExecutionVariables(task);
8194
}
8295

8396
private Optional<String> getDataReference(Task task)

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/LogError.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@ protected void doExecute(DelegateExecution execution) throws BpmnError, Exceptio
5656
logger.debug("Setting Task.status failed, adding error");
5757

5858
Task task = getLeadingTaskFromExecutionVariables();
59-
task.setStatus(TaskStatus.FAILED);
6059

6160
String errorCode = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_ERROR_CODE);
6261
String errorMessage = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_ERROR_MESSAGE);
6362
String errorSource = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_ERROR_SOURCE);
6463

64+
// only fail if local error
65+
if (errorSource == null || CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_SOURCE_VALUE_GTH.equals(errorSource))
66+
task.setStatus(TaskStatus.FAILED);
67+
6568
if (!CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_VALIDATION_FAILED.equals(errorCode))
6669
{
6770
errorSource = errorSource != null ? errorSource : CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_SOURCE_VALUE_GTH;
@@ -71,13 +74,15 @@ protected void doExecute(DelegateExecution execution) throws BpmnError, Exceptio
7174
task.addOutput(output);
7275

7376
if (CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_SOURCE_VALUE_GTH.equals(errorSource))
74-
logger.warn("Error while executing local process: code: '{}', message: {}", errorCode, errorMessage);
75-
else
76-
logger.warn("Error while executing process at {}: code: '{}', message: {}", errorSource, errorCode,
77+
logger.error("Error while executing local process; code: '{}', message: {}", errorCode, errorMessage);
78+
else // not an error if error source remote
79+
logger.warn("Error while executing process at {}; code: '{}', message: {}", errorSource, errorCode,
7780
errorMessage);
7881

7982
errorLogger.logDataReceiveFailed(getLeadingTaskFromExecutionVariables().getIdElement()
8083
.withServerBase(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Task.name()));
8184
}
85+
86+
updateLeadingTaskInExecutionVariables(task);
8287
}
8388
}

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/service/translate/LogValidationError.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ protected void doExecute(DelegateExecution execution) throws BpmnError, Exceptio
5959
CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_VALIDATION_FAILED,
6060
"Validation failed while inserting into CRR");
6161
task.addOutput(output);
62+
updateLeadingTaskInExecutionVariables(task);
6263
}
6364
}

codex-process-data-transfer/src/main/resources/fhir/CodeSystem/num-codex-data-transfer.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,9 @@
5151
<display value="Dry Run" />
5252
<definition value="Boolean parameter to instruct the data-send process to abort after validating the generated transfer bundle but before transferring data to GTH/CRR" />
5353
</concept>
54+
<concept>
55+
<code value="encrypted-bundle-size" />
56+
<display value="Encrypted Bundle Size" />
57+
<definition value="Output parameter describing the encrypted transfer bundle size in byte" />
58+
</concept>
5459
</CodeSystem>

0 commit comments

Comments
 (0)