Skip to content

Commit 149774d

Browse files
committed
Merge remote-tracking branch
'origin/issue/296_Optimize_Binary_Resource_Handling' into develop_2
2 parents 9f3c06d + 7e87b3f commit 149774d

File tree

52 files changed

+1562
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1562
-377
lines changed

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/activity/AbstractMessageDelegate.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
package dev.dsf.bpe.v2.activity;
22

3+
import com.fasterxml.jackson.databind.ObjectMapper;
4+
35
import dev.dsf.bpe.v2.ProcessPluginApi;
46
import dev.dsf.bpe.v2.activity.values.SendTaskValues;
57

68
public class AbstractMessageDelegate<D> extends AbstractProcessPluginDelegate<D>
79
{
810
protected final SendTaskValues sendTaskValues;
911

10-
public AbstractMessageDelegate(ProcessPluginApi api, D delegate, SendTaskValues sendTaskValues)
12+
public AbstractMessageDelegate(ProcessPluginApi api, ObjectMapper objectMapper, D delegate,
13+
SendTaskValues sendTaskValues)
1114
{
12-
super(api, delegate);
15+
super(api, objectMapper, delegate);
1316

1417
this.sendTaskValues = sendTaskValues;
1518
}

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/activity/AbstractProcessPluginDelegate.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,29 @@
22

33
import java.util.Objects;
44

5+
import org.camunda.bpm.engine.delegate.DelegateExecution;
6+
7+
import com.fasterxml.jackson.databind.ObjectMapper;
8+
59
import dev.dsf.bpe.v2.ProcessPluginApi;
10+
import dev.dsf.bpe.v2.variables.Variables;
11+
import dev.dsf.bpe.v2.variables.VariablesImpl;
612

713
public abstract class AbstractProcessPluginDelegate<D>
814
{
915
protected final ProcessPluginApi api;
16+
protected final ObjectMapper objectMapper;
1017
protected final D delegate;
1118

12-
public AbstractProcessPluginDelegate(ProcessPluginApi api, D delegate)
19+
public AbstractProcessPluginDelegate(ProcessPluginApi api, ObjectMapper objectMapper, D delegate)
1320
{
1421
this.api = Objects.requireNonNull(api, "api");
22+
this.objectMapper = Objects.requireNonNull(objectMapper, "objectMapper");
1523
this.delegate = Objects.requireNonNull(delegate, "delegate");
1624
}
25+
26+
protected Variables createVariables(DelegateExecution execution)
27+
{
28+
return new VariablesImpl(execution, objectMapper);
29+
}
1730
}

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/activity/ExecutionListenerDelegate.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,24 @@
22

33
import org.camunda.bpm.engine.delegate.DelegateExecution;
44

5+
import com.fasterxml.jackson.databind.ObjectMapper;
6+
57
import dev.dsf.bpe.v2.ProcessPluginApi;
68
import dev.dsf.bpe.v2.error.ExecutionListenerErrorHandler;
7-
import dev.dsf.bpe.v2.variables.VariablesImpl;
9+
import dev.dsf.bpe.v2.variables.Variables;
810

911
public class ExecutionListenerDelegate extends AbstractProcessPluginDelegate<ExecutionListener>
1012
implements org.camunda.bpm.engine.delegate.ExecutionListener
1113
{
12-
public ExecutionListenerDelegate(ProcessPluginApi api, ExecutionListener delegate)
14+
public ExecutionListenerDelegate(ProcessPluginApi api, ObjectMapper objectMapper, ExecutionListener delegate)
1315
{
14-
super(api, delegate);
16+
super(api, objectMapper, delegate);
1517
}
1618

1719
@Override
1820
public void notify(DelegateExecution execution) throws Exception
1921
{
20-
final VariablesImpl variables = new VariablesImpl(execution);
22+
Variables variables = createVariables(execution);
2123

2224
try
2325
{

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/activity/MessageEndEventDelegate.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@
33
import org.camunda.bpm.engine.delegate.DelegateExecution;
44
import org.camunda.bpm.engine.delegate.JavaDelegate;
55

6+
import com.fasterxml.jackson.databind.ObjectMapper;
7+
68
import dev.dsf.bpe.v2.ProcessPluginApi;
79
import dev.dsf.bpe.v2.activity.values.SendTaskValues;
810
import dev.dsf.bpe.v2.error.MessageEndEventErrorHandler;
9-
import dev.dsf.bpe.v2.variables.VariablesImpl;
11+
import dev.dsf.bpe.v2.variables.Variables;
1012

1113
public class MessageEndEventDelegate extends AbstractMessageDelegate<MessageEndEvent> implements JavaDelegate
1214
{
13-
public MessageEndEventDelegate(ProcessPluginApi api, MessageEndEvent delegate, SendTaskValues sendTask)
15+
public MessageEndEventDelegate(ProcessPluginApi api, ObjectMapper objectMapper, MessageEndEvent delegate,
16+
SendTaskValues sendTask)
1417
{
15-
super(api, delegate, sendTask);
18+
super(api, objectMapper, delegate, sendTask);
1619
}
1720

1821
@Override
1922
public void execute(DelegateExecution execution) throws Exception
2023
{
21-
final VariablesImpl variables = new VariablesImpl(execution);
24+
Variables variables = createVariables(execution);
2225

2326
try
2427
{

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/activity/MessageIntermediateThrowEventDelegate.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,26 @@
33
import org.camunda.bpm.engine.delegate.DelegateExecution;
44
import org.camunda.bpm.engine.delegate.JavaDelegate;
55

6+
import com.fasterxml.jackson.databind.ObjectMapper;
7+
68
import dev.dsf.bpe.v2.ProcessPluginApi;
79
import dev.dsf.bpe.v2.activity.values.SendTaskValues;
810
import dev.dsf.bpe.v2.error.MessageIntermediateThrowEventErrorHandler;
9-
import dev.dsf.bpe.v2.variables.VariablesImpl;
11+
import dev.dsf.bpe.v2.variables.Variables;
1012

1113
public class MessageIntermediateThrowEventDelegate extends AbstractMessageDelegate<MessageIntermediateThrowEvent>
1214
implements JavaDelegate
1315
{
14-
public MessageIntermediateThrowEventDelegate(ProcessPluginApi api, MessageIntermediateThrowEvent delegate,
15-
SendTaskValues sendTask)
16+
public MessageIntermediateThrowEventDelegate(ProcessPluginApi api, ObjectMapper objectMapper,
17+
MessageIntermediateThrowEvent delegate, SendTaskValues sendTask)
1618
{
17-
super(api, delegate, sendTask);
19+
super(api, objectMapper, delegate, sendTask);
1820
}
1921

2022
@Override
2123
public void execute(DelegateExecution execution) throws Exception
2224
{
23-
final VariablesImpl variables = new VariablesImpl(execution);
25+
Variables variables = createVariables(execution);
2426

2527
try
2628
{

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/activity/MessageSendTaskDelegate.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,26 @@
44
import org.camunda.bpm.engine.delegate.DelegateExecution;
55
import org.camunda.bpm.engine.delegate.JavaDelegate;
66

7+
import com.fasterxml.jackson.databind.ObjectMapper;
8+
79
import dev.dsf.bpe.v2.ProcessPluginApi;
810
import dev.dsf.bpe.v2.activity.values.SendTaskValues;
911
import dev.dsf.bpe.v2.error.ErrorBoundaryEvent;
1012
import dev.dsf.bpe.v2.error.MessageSendTaskErrorHandler;
11-
import dev.dsf.bpe.v2.variables.VariablesImpl;
13+
import dev.dsf.bpe.v2.variables.Variables;
1214

1315
public class MessageSendTaskDelegate extends AbstractMessageDelegate<MessageSendTask> implements JavaDelegate
1416
{
15-
public MessageSendTaskDelegate(ProcessPluginApi api, MessageSendTask delegate, SendTaskValues sendTask)
17+
public MessageSendTaskDelegate(ProcessPluginApi api, ObjectMapper objectMapper, MessageSendTask delegate,
18+
SendTaskValues sendTask)
1619
{
17-
super(api, delegate, sendTask);
20+
super(api, objectMapper, delegate, sendTask);
1821
}
1922

2023
@Override
2124
public void execute(DelegateExecution execution) throws Exception
2225
{
23-
final VariablesImpl variables = new VariablesImpl(execution);
26+
Variables variables = createVariables(execution);
2427

2528
try
2629
{

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/activity/ServiceTaskDelegate.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,24 @@
44
import org.camunda.bpm.engine.delegate.DelegateExecution;
55
import org.camunda.bpm.engine.delegate.JavaDelegate;
66

7+
import com.fasterxml.jackson.databind.ObjectMapper;
8+
79
import dev.dsf.bpe.v2.ProcessPluginApi;
810
import dev.dsf.bpe.v2.error.ErrorBoundaryEvent;
911
import dev.dsf.bpe.v2.error.ServiceTaskErrorHandler;
10-
import dev.dsf.bpe.v2.variables.VariablesImpl;
12+
import dev.dsf.bpe.v2.variables.Variables;
1113

12-
public class ServiceTaskDelegate implements JavaDelegate
14+
public class ServiceTaskDelegate extends AbstractProcessPluginDelegate<ServiceTask> implements JavaDelegate
1315
{
14-
private final ProcessPluginApi api;
15-
private final ServiceTask delegate;
16-
17-
public ServiceTaskDelegate(ProcessPluginApi api, ServiceTask delegate)
16+
public ServiceTaskDelegate(ProcessPluginApi api, ObjectMapper objectMapper, ServiceTask delegate)
1817
{
19-
this.api = api;
20-
this.delegate = delegate;
18+
super(api, objectMapper, delegate);
2119
}
2220

2321
@Override
2422
public void execute(DelegateExecution execution) throws Exception
2523
{
26-
final VariablesImpl variables = new VariablesImpl(execution);
24+
Variables variables = createVariables(execution);
2725

2826
try
2927
{
@@ -52,7 +50,7 @@ else if (exception != null)
5250
}
5351
}
5452

55-
private void handleErrorBoundaryEvent(final VariablesImpl variables, ErrorBoundaryEvent event)
53+
private void handleErrorBoundaryEvent(Variables variables, ErrorBoundaryEvent event)
5654
{
5755
ServiceTaskErrorHandler handler = delegate.getErrorHandler();
5856
if (handler != null)

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/activity/UserTaskListenerDelegate.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,25 @@
44
import org.camunda.bpm.engine.delegate.DelegateTask;
55
import org.camunda.bpm.engine.delegate.TaskListener;
66

7+
import com.fasterxml.jackson.databind.ObjectMapper;
8+
79
import dev.dsf.bpe.v2.ProcessPluginApi;
810
import dev.dsf.bpe.v2.activity.values.CreateQuestionnaireResponseValues;
911
import dev.dsf.bpe.v2.error.UserTaskListenerErrorHandler;
10-
import dev.dsf.bpe.v2.variables.VariablesImpl;
12+
import dev.dsf.bpe.v2.variables.Variables;
1113

12-
public class UserTaskListenerDelegate implements TaskListener
14+
public class UserTaskListenerDelegate extends AbstractProcessPluginDelegate<UserTaskListener> implements TaskListener
1315
{
14-
private final ProcessPluginApi api;
15-
private final UserTaskListener delegate;
16-
17-
public UserTaskListenerDelegate(ProcessPluginApi api, UserTaskListener delegate)
16+
public UserTaskListenerDelegate(ProcessPluginApi api, ObjectMapper objectMapper, UserTaskListener delegate)
1817
{
19-
this.api = api;
20-
this.delegate = delegate;
18+
super(api, objectMapper, delegate);
2119
}
2220

2321
@Override
2422
public void notify(DelegateTask delegateTask)
2523
{
26-
final VariablesImpl variables = new VariablesImpl(delegateTask.getExecution());
24+
DelegateExecution execution = delegateTask.getExecution();
25+
Variables variables = createVariables(execution);
2726

2827
try
2928
{
@@ -39,9 +38,8 @@ public void notify(DelegateTask delegateTask)
3938

4039
if (exception != null)
4140
{
42-
DelegateExecution execution = delegateTask.getExecution();
43-
delegateTask.getExecution().getProcessEngine().getRuntimeService()
44-
.deleteProcessInstance(execution.getProcessInstanceId(), exception.getMessage());
41+
execution.getProcessEngine().getRuntimeService().deleteProcessInstance(execution.getProcessInstanceId(),
42+
exception.getMessage());
4543
}
4644
// else, do nothing if exception was absorbed by error handler
4745
}

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/ContinueListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public ContinueListener(String serverBaseUrl, Function<DelegateExecution, Listen
2323
@Override
2424
public void doNotify(DelegateExecution execution, ListenerVariables variables) throws Exception
2525
{
26-
Task task = variables.getResource(Constants.TASK_VARIABLE);
26+
Task task = variables.getFhirResource(Constants.TASK_VARIABLE);
2727
execution.removeVariable(Constants.TASK_VARIABLE);
2828

2929
if (task != null)

dsf-bpe/dsf-bpe-process-api-v2-impl/src/main/java/dev/dsf/bpe/v2/listener/StartListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public StartListener(String serverBaseUrl, Function<DelegateExecution, ListenerV
2323
@Override
2424
public void doNotify(DelegateExecution execution, ListenerVariables variables) throws Exception
2525
{
26-
Task task = variables.getResource(Constants.TASK_VARIABLE);
26+
Task task = variables.getFhirResource(Constants.TASK_VARIABLE);
2727
execution.removeVariable(Constants.TASK_VARIABLE);
2828

2929
if (task != null)

0 commit comments

Comments
 (0)