From c5e87621aea85063021df9ee08acd196dfaac220 Mon Sep 17 00:00:00 2001 From: Reto Wettstein Date: Wed, 13 Sep 2023 09:28:00 +0200 Subject: [PATCH] email message in the same format as in other tasks --- .../service/HandleErrorReceive.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/medizininformatik_initiative/process/data_transfer/service/HandleErrorReceive.java b/src/main/java/de/medizininformatik_initiative/process/data_transfer/service/HandleErrorReceive.java index e4e50f4..f9f8e6c 100644 --- a/src/main/java/de/medizininformatik_initiative/process/data_transfer/service/HandleErrorReceive.java +++ b/src/main/java/de/medizininformatik_initiative/process/data_transfer/service/HandleErrorReceive.java @@ -20,25 +20,23 @@ public HandleErrorReceive(ProcessPluginApi api) protected void doExecute(DelegateExecution delegateExecution, Variables variables) { Task task = variables.getStartTask(); + String projectIdentifier = variables + .getString(ConstantsDataTransfer.BPMN_EXECUTION_VARIABLE_PROJECT_IDENTIFIER); + String error = variables.getString(ConstantsDataTransfer.BPMN_EXECUTION_VARIABLE_DATA_RECEIVE_ERROR_MESSAGE); - if (Task.TaskStatus.FAILED.equals(task.getStatus())) - { - sendMail(task, variables); - api.getFhirWebserviceClientProvider().getLocalWebserviceClient() - .withRetry(ConstantsBase.DSF_CLIENT_RETRY_6_TIMES, ConstantsBase.DSF_CLIENT_RETRY_INTERVAL_5MIN) - .update(task); - } + sendMail(task, projectIdentifier, error); + api.getFhirWebserviceClientProvider().getLocalWebserviceClient() + .withRetry(ConstantsBase.DSF_CLIENT_RETRY_6_TIMES, ConstantsBase.DSF_CLIENT_RETRY_INTERVAL_5MIN) + .update(task); } - private void sendMail(Task task, Variables variables) + private void sendMail(Task task, String projectIdentifier, String error) { - String error = variables.getString(ConstantsDataTransfer.BPMN_EXECUTION_VARIABLE_DATA_RECEIVE_ERROR_MESSAGE); - String subject = "Error in process '" + ConstantsDataTransfer.PROCESS_NAME_FULL_DATA_RECEIVE + "'"; String message = "Could not download and insert new data-set in process '" + ConstantsDataTransfer.PROCESS_NAME_FULL_DATA_RECEIVE + "' for Task with id '" + task.getId() - + "' from organization '" + task.getRequester().getIdentifier().getValue() + "' in Task with id '" - + task.getId() + "':\n" + "- status code: " + + "' from organization '" + task.getRequester().getIdentifier().getValue() + + "' for project-identifier '" + projectIdentifier + "':\n" + "- status code: " + ConstantsBase.CODESYSTEM_DATA_SET_STATUS_VALUE_RECEIVE_ERROR + "\n" + "- error: " + (error == null ? "none" : error);