Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/release/0.9.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hhund committed Oct 17, 2022
2 parents 259490a + 68584d9 commit b7bdb0e
Show file tree
Hide file tree
Showing 86 changed files with 2,007 additions and 690 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ dsf-docker-test-setup-3medic-ttp-docker/**/fhir/log/*.log.gz

dsf-docker-test-setup-3medic-ttp-docker/secrets/*.pem
dsf-docker-test-setup-3medic-ttp-docker/.env
dsf-docker-test-setup-3medic-ttp-docker/docker-compose.override.yml

###
# dsf-tools ignores
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ preferred-citation:
doi: 10.3233/SHTI210060
type: proceedings
title: "HiGHmed Data Sharing Framework (HiGHmed DSF)"
version: 0.8.0
date-released: 2022-10-11
version: 0.9.0
date-released: 2022-10-17
url: https://github.com/highmed/highmed-dsf/wiki
repository-code: https://github.com/highmed/highmed-dsf
repository-artifact: https://github.com/highmed/highmed-dsf/releases
Expand Down
2 changes: 1 addition & 1 deletion dsf-bpe/dsf-bpe-process-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-bpe-pom</artifactId>
<version>0.8.0</version>
<version>0.9.0</version>
</parent>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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.ResourceType;
import org.hl7.fhir.r4.model.Task;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -25,12 +26,6 @@ public abstract class AbstractServiceDelegate implements JavaDelegate, Initializ
private final TaskHelper taskHelper;
private final ReadAccessHelper readAccessHelper;

/**
* @deprecated as of release 0.8.0, use {@link #getExecution()} instead
*/
@Deprecated
protected DelegateExecution execution;

public AbstractServiceDelegate(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
ReadAccessHelper readAccessHelper)
{
Expand All @@ -50,8 +45,6 @@ public void afterPropertiesSet() throws Exception
@Override
public final void execute(DelegateExecution execution) throws Exception
{
this.execution = execution;

try
{
logger.trace("Execution of task with id='{}'", execution.getCurrentActivityId());
Expand All @@ -61,25 +54,25 @@ public final void execute(DelegateExecution execution) throws Exception
// Error boundary event, do not stop process execution
catch (BpmnError error)
{
Task task = getTask();
Task task = getTask(execution);

logger.debug("Error while executing service delegate " + getClass().getName(), error);
logger.error(
"Process {} encountered error boundary event in step {} for task with id {}, error-code: {}, message: {}",
execution.getProcessDefinitionId(), execution.getActivityInstanceId(), task.getId(),
"Process {} encountered error boundary event in step {} for task {}, error-code: {}, message: {}",
execution.getProcessDefinitionId(), execution.getActivityInstanceId(), getTaskAbsoluteUrl(task),
error.getErrorCode(), error.getMessage());

throw error;
}
// Not an error boundary event, stop process execution
catch (Exception exception)
{
Task task = getTask();
Task task = getTask(execution);

logger.debug("Error while executing service delegate " + getClass().getName(), exception);
logger.error("Process {} has fatal error in step {} for task with id {}, reason: {}",
execution.getProcessDefinitionId(), execution.getActivityInstanceId(), task.getId(),
exception.getMessage());
logger.error("Process {} has fatal error in step {} for task {}, reason: {} - {}",
execution.getProcessDefinitionId(), execution.getActivityInstanceId(), getTaskAbsoluteUrl(task),
exception.getClass().getName(), exception.getMessage());

String errorMessage = "Process " + execution.getProcessDefinitionId() + " has fatal error in step "
+ execution.getActivityInstanceId() + ", reason: " + exception.getMessage();
Expand All @@ -96,6 +89,13 @@ public final void execute(DelegateExecution execution) throws Exception
}
}

protected final String getTaskAbsoluteUrl(Task task)
{
return task == null ? "?"
: task.getIdElement().toVersionless()
.withServerBase(clientProvider.getLocalBaseUrl(), ResourceType.Task.name()).getValue();
}

/**
* Method called by a BPMN service task
*
Expand All @@ -109,11 +109,6 @@ public final void execute(DelegateExecution execution) throws Exception
*/
protected abstract void doExecute(DelegateExecution execution) throws BpmnError, Exception;

protected final DelegateExecution getExecution()
{
return execution;
}

protected final TaskHelper getTaskHelper()
{
return taskHelper;
Expand All @@ -130,36 +125,42 @@ protected final ReadAccessHelper getReadAccessHelper()
}

/**
* @param execution
* not <code>null</code>
* @return the active task from execution variables, i.e. the leading task if the main process is running or the
* current task if a subprocess is running.
* @throws IllegalStateException
* if execution of this service delegate has not been started
* @see ConstantsBase#BPMN_EXECUTION_VARIABLE_TASK
*/
protected final Task getTask()
protected final Task getTask(DelegateExecution execution)
{
return taskHelper.getTask(execution);
}

/**
* @param execution
* not <code>null</code>
* @return the current task from execution variables, the task resource that started the current process or
* subprocess
* @throws IllegalStateException
* if execution of this service delegate has not been started
* @see ConstantsBase#BPMN_EXECUTION_VARIABLE_TASK
*/
protected final Task getCurrentTaskFromExecutionVariables()
protected final Task getCurrentTaskFromExecutionVariables(DelegateExecution execution)
{
return taskHelper.getCurrentTaskFromExecutionVariables(execution);
}

/**
* @param execution
* not <code>null</code>
* @return the leading task from execution variables, same as current task if not in a subprocess
* @throws IllegalStateException
* if execution of this service delegate has not been started
* @see ConstantsBase#BPMN_EXECUTION_VARIABLE_LEADING_TASK
*/
protected final Task getLeadingTaskFromExecutionVariables()
protected final Task getLeadingTaskFromExecutionVariables(DelegateExecution execution)
{
return taskHelper.getLeadingTaskFromExecutionVariables(execution);
}
Expand All @@ -168,13 +169,15 @@ protected final Task getLeadingTaskFromExecutionVariables()
* <i>Use this method to update the process engine variable {@link ConstantsBase#BPMN_EXECUTION_VARIABLE_TASK},
* after modifying the {@link Task}.</i>
*
* @param execution
* not <code>null</code>
* @param task
* not <code>null</code>
* @throws IllegalStateException
* if execution of this service delegate has not been started
* @see ConstantsBase#BPMN_EXECUTION_VARIABLE_TASK
*/
protected final void updateCurrentTaskInExecutionVariables(Task task)
protected final void updateCurrentTaskInExecutionVariables(DelegateExecution execution, Task task)
{
taskHelper.updateCurrentTaskInExecutionVariables(execution, task);
}
Expand All @@ -185,13 +188,15 @@ protected final void updateCurrentTaskInExecutionVariables(Task task)
* <p>
* Updates the current task if no leading task is set.
*
* @param execution
* not <code>null</code>
* @param task
* not <code>null</code>
* @throws IllegalStateException
* if execution of this service delegate has not been started
* @see ConstantsBase#BPMN_EXECUTION_VARIABLE_LEADING_TASK
*/
protected final void updateLeadingTaskInExecutionVariables(Task task)
protected final void updateLeadingTaskInExecutionVariables(DelegateExecution execution, Task task)
{
taskHelper.updateLeadingTaskInExecutionVariables(execution, task);
}
Expand Down
Loading

0 comments on commit b7bdb0e

Please sign in to comment.