Skip to content

Commit

Permalink
email message in the same format as in other tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
wetret committed Sep 13, 2023
1 parent d0a5a6e commit c5e8762
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c5e8762

Please sign in to comment.