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
Browse files Browse the repository at this point in the history
'origin/issues/384_Parallel_Process_Instances' into develop
  • Loading branch information
hhund committed Oct 13, 2022
2 parents 59cb3d8 + e5ff29b commit 512d177
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,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 +44,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,7 +53,7 @@ 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(
Expand All @@ -74,12 +66,12 @@ public final void execute(DelegateExecution execution) throws Exception
// 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: {}",
logger.error("Process {} has fatal error in step {} for task with id {}, reason: {} - {}",
execution.getProcessDefinitionId(), execution.getActivityInstanceId(), task.getId(),
exception.getMessage());
exception.getClass().getName(), exception.getMessage());

String errorMessage = "Process " + execution.getProcessDefinitionId() + " has fatal error in step "
+ execution.getActivityInstanceId() + ", reason: " + exception.getMessage();
Expand Down Expand Up @@ -109,11 +101,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 +117,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 +161,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 +180,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
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ public class DefaultUserTaskListener implements TaskListener, InitializingBean
private final TaskHelper taskHelper;
private final ReadAccessHelper readAccessHelper;

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

public DefaultUserTaskListener(FhirWebserviceClientProvider clientProvider,
OrganizationProvider organizationProvider, QuestionnaireResponseHelper questionnaireResponseHelper,
TaskHelper taskHelper, ReadAccessHelper readAccessHelper)
Expand All @@ -74,7 +68,7 @@ public void afterPropertiesSet() throws Exception
@Override
public final void notify(DelegateTask userTask)
{
this.execution = userTask.getExecution();
DelegateExecution execution = userTask.getExecution();

try
{
Expand Down Expand Up @@ -102,7 +96,7 @@ public final void notify(DelegateTask userTask)
}
catch (Exception exception)
{
Task task = getTask();
Task task = getTask(execution);

logger.debug("Error while executing user task listener " + getClass().getName(), exception);
logger.error("Process {} has fatal error in step {} for task with id {}, reason: {}",
Expand Down Expand Up @@ -213,11 +207,6 @@ protected void modifyQuestionnaireResponse(DelegateTask userTask, QuestionnaireR
// Nothing to do in default behaviour
}

protected final DelegateExecution getExecution()
{
return execution;
}

protected final TaskHelper getTaskHelper()
{
return taskHelper;
Expand All @@ -234,36 +223,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 @@ -272,13 +267,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 @@ -289,13 +286,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 512d177

Please sign in to comment.