From 2067b522b1cea7b4314b08688e7a530892281ff3 Mon Sep 17 00:00:00 2001
From: Julian Haupt
Date: Mon, 4 Nov 2024 22:55:17 +0100
Subject: [PATCH 01/37] feat(api): add filter on incidentIdIn for
HistoricProcessInstanceQuery
related to: #4587
---------
Co-authored-by: Tassilo Weidner <3015690+tasso94@users.noreply.github.com>
Backported commit 5d02cd39bc from the camunda-bpm-platform repository.
Original author: Gergely Juhasz
---
.../lib/commons/history-process-instance.ftl | 6 ++
.../HistoricProcessInstanceQueryDto.java | 9 ++
...icProcessInstanceRestServiceQueryTest.java | 28 ++++++
.../history/HistoricProcessInstanceQuery.java | 5 +
.../HistoricProcessInstanceQueryImpl.java | 11 +++
.../entity/HistoricProcessInstance.xml | 10 +-
.../history/HistoricProcessInstanceTest.java | 96 +++++++++++++++++++
...sAfterUserTaskCreateOneIncident.bpmn20.xml | 20 ++++
8 files changed, 184 insertions(+), 1 deletion(-)
create mode 100644 engine/src/test/resources/org/operaton/bpm/engine/test/api/runtime/failingProcessAfterUserTaskCreateOneIncident.bpmn20.xml
diff --git a/engine-rest/engine-rest-openapi/src/main/templates/lib/commons/history-process-instance.ftl b/engine-rest/engine-rest-openapi/src/main/templates/lib/commons/history-process-instance.ftl
index d24f16bb978..086b3aacceb 100644
--- a/engine-rest/engine-rest-openapi/src/main/templates/lib/commons/history-process-instance.ftl
+++ b/engine-rest/engine-rest-openapi/src/main/templates/lib/commons/history-process-instance.ftl
@@ -123,6 +123,12 @@
"desc": "Only include process instances which have a root incident. Value may only be `true`, as `false` is the default behavior."
},
+ "incidentIdIn": {
+ "type": "array",
+ "itemType": "string",
+ "desc": "Restrict to instances that have an incident with one of the given ids. ${listTypeDescription}"
+ },
+
"incidentType": {
"type": "string",
"desc": "Filter by the incident type. See the [User Guide](${docsUrl}/user-guide/process-engine/incidents/#incident-types) for a list of incident types."
diff --git a/engine-rest/engine-rest/src/main/java/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceQueryDto.java b/engine-rest/engine-rest/src/main/java/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceQueryDto.java
index a121c67dacb..31543c1b535 100644
--- a/engine-rest/engine-rest/src/main/java/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceQueryDto.java
+++ b/engine-rest/engine-rest/src/main/java/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceQueryDto.java
@@ -114,6 +114,7 @@ public class HistoricProcessInstanceQueryDto extends AbstractQueryDto incidentIds;
private List variables;
@@ -306,6 +307,11 @@ public void setIncidentType(String incidentType) {
this.incidentType = incidentType;
}
+ @OperatonQueryParam(value = "incidentIdIn", converter = StringListConverter.class)
+ public void setIncidentIdIn(List incidentIds) {
+ this.incidentIds = incidentIds;
+ }
+
@OperatonQueryParam(value = "tenantIdIn", converter = StringListConverter.class)
public void setTenantIdIn(List tenantIds) {
this.tenantIds = tenantIds;
@@ -443,6 +449,9 @@ protected void applyFilters(HistoricProcessInstanceQuery query) {
if (withRootIncidents != null && withRootIncidents) {
query.withRootIncidents();
}
+ if (incidentIds != null && !incidentIds.isEmpty()) {
+ query.incidentIdIn(incidentIds.toArray(new String[0]));
+ }
if (incidentStatus != null) {
query.incidentStatus(incidentStatus);
}
diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceQueryTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceQueryTest.java
index e63bf12bbb9..8c32e87df52 100644
--- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceQueryTest.java
+++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceQueryTest.java
@@ -73,6 +73,7 @@ public class HistoricProcessInstanceRestServiceQueryTest extends AbstractRestSer
protected static final String QUERY_PARAM_EXECUTED_ACTIVITY_AFTER = "executedActivityAfter";
protected static final String QUERY_PARAM_EXECUTED_ACTIVITY_IDS = "executedActivityIdIn";
protected static final String QUERY_PARAM_ACTIVE_ACTIVITY_IDS = "activeActivityIdIn";
+ protected static final String QUERY_PARAM_INCIDENT_IDS = "incidentIdIn";
@ClassRule
public static TestContainerRule rule = new TestContainerRule();
@@ -2315,5 +2316,32 @@ public void testQueryByRootProcessInstancesAsPost() {
verify(mockedQuery).rootProcessInstances();
}
+ @Test
+ public void testQueryByIncidentIdIn() {
+ given()
+ .queryParam(QUERY_PARAM_INCIDENT_IDS, "1,2")
+ .then().expect()
+ .statusCode(Status.OK.getStatusCode())
+ .when()
+ .get(HISTORIC_PROCESS_INSTANCE_RESOURCE_URL);
+
+ verify(mockedQuery).incidentIdIn("1", "2");
+ }
+
+ @Test
+ public void testQueryByIncidentIdInAsPost() {
+ Map> parameters = new HashMap>();
+ parameters.put(QUERY_PARAM_INCIDENT_IDS, Arrays.asList("1", "2"));
+
+ given()
+ .contentType(POST_JSON_CONTENT_TYPE)
+ .body(parameters)
+ .then().expect()
+ .statusCode(Status.OK.getStatusCode())
+ .when()
+ .post(HISTORIC_PROCESS_INSTANCE_RESOURCE_URL);
+
+ verify(mockedQuery).incidentIdIn("1", "2");
+ }
}
diff --git a/engine/src/main/java/org/operaton/bpm/engine/history/HistoricProcessInstanceQuery.java b/engine/src/main/java/org/operaton/bpm/engine/history/HistoricProcessInstanceQuery.java
index 62fe37891ce..9e0f25cc66e 100644
--- a/engine/src/main/java/org/operaton/bpm/engine/history/HistoricProcessInstanceQuery.java
+++ b/engine/src/main/java/org/operaton/bpm/engine/history/HistoricProcessInstanceQuery.java
@@ -127,6 +127,11 @@ public interface HistoricProcessInstanceQuery extends Query
-
+
@@ -550,6 +550,14 @@
${queryType} INC.INCIDENT_TYPE_ = #{query.incidentType}
+
+
+ ${queryType} INC.ID_ IN
+
+ #{incidentId}
+
+
+
${queryType} INC.INCIDENT_MSG_ = #{query.incidentMessage}
diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceTest.java
index 954e395d77f..5503e655285 100644
--- a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceTest.java
+++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceTest.java
@@ -39,6 +39,7 @@
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import org.apache.commons.lang3.time.DateUtils;
import org.operaton.bpm.engine.BadUserRequestException;
import org.operaton.bpm.engine.CaseService;
@@ -59,6 +60,7 @@
import org.operaton.bpm.engine.impl.history.event.HistoricProcessInstanceEventEntity;
import org.operaton.bpm.engine.impl.util.ClockUtil;
import org.operaton.bpm.engine.repository.ProcessDefinition;
+import org.operaton.bpm.engine.runtime.Incident;
import org.operaton.bpm.engine.runtime.Job;
import org.operaton.bpm.engine.runtime.ProcessInstance;
import org.operaton.bpm.engine.task.Task;
@@ -1693,6 +1695,100 @@ public void testQueryByMultipleInvalidProcessDefinitionKeyIn() {
}
}
+ @Test
+ @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
+ @Deployment(resources={"org/operaton/bpm/engine/test/api/runtime/failingProcessCreateOneIncident.bpmn20.xml"})
+ public void shouldQueryProcessInstancesWithIncidentIdIn() {
+ // GIVEN
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcess");
+ ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("failingProcess");
+ runtimeService.startProcessInstanceByKey("failingProcess");
+ List queriedProcessInstances = Arrays.asList(processInstance.getId(), processInstance2.getId());
+
+ testHelper.executeAvailableJobs();
+ Incident incident = runtimeService.createIncidentQuery().processInstanceId(queriedProcessInstances.get(0)).singleResult();
+ Incident incident2 = runtimeService.createIncidentQuery().processInstanceId(queriedProcessInstances.get(1)).singleResult();
+
+ // WHEN
+ List processInstanceList =
+ historyService.createHistoricProcessInstanceQuery().incidentIdIn(incident.getId(), incident2.getId()).list();
+
+ // THEN
+ assertEquals(2, processInstanceList.size());
+ assertThat(queriedProcessInstances)
+ .containsExactlyInAnyOrderElementsOf(
+ processInstanceList.stream()
+ .map(HistoricProcessInstance::getId)
+ .collect(Collectors.toList()));
+ }
+
+ @Test
+ @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
+ @Deployment(resources={"org/operaton/bpm/engine/test/api/runtime/failingProcessAfterUserTaskCreateOneIncident.bpmn20.xml"})
+ public void shouldOnlyQueryProcessInstancesWithIncidentIdIn() {
+ // GIVEN
+ ProcessInstance processWithIncident1 = runtimeService.startProcessInstanceByKey("failingProcess");
+ ProcessInstance processWithIncident2 = runtimeService.startProcessInstanceByKey("failingProcess");
+
+ List tasks = taskService.createTaskQuery().list();
+ assertEquals(2, tasks.size());
+ taskService.complete(tasks.get(0).getId());
+ taskService.complete(tasks.get(1).getId());
+
+ ProcessInstance processWithoutIncident = runtimeService.startProcessInstanceByKey("failingProcess");
+
+ List queriedProcessInstances = Arrays.asList(processWithIncident1.getId(), processWithIncident2.getId());
+
+ testHelper.executeAvailableJobs();
+ Incident incident = runtimeService.createIncidentQuery().processInstanceId(queriedProcessInstances.get(0)).singleResult();
+ Incident incident2 = runtimeService.createIncidentQuery().processInstanceId(queriedProcessInstances.get(1)).singleResult();
+
+ // WHEN
+ List processInstanceList =
+ historyService.createHistoricProcessInstanceQuery().incidentIdIn(incident.getId(), incident2.getId()).list();
+
+ // THEN
+ assertEquals(2, processInstanceList.size());
+ assertThat(queriedProcessInstances)
+ .containsExactlyInAnyOrderElementsOf(
+ processInstanceList.stream()
+ .map(HistoricProcessInstance::getId)
+ .collect(Collectors.toList()));
+ }
+
+ @Test
+ public void shouldFailWhenQueryWithNullIncidentIdIn() {
+ try {
+ historyService.createHistoricProcessInstanceQuery().incidentIdIn(null).list();
+ fail("incidentMessage with null value is not allowed");
+ } catch( NullValueException nex ) {
+ // expected
+ }
+ }
+
+ @Test
+ @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL)
+ @Deployment(resources={"org/operaton/bpm/engine/test/api/runtime/failingSubProcessCreateOneIncident.bpmn20.xml"})
+ public void shouldQueryByIncidentIdInSubProcess() {
+ // given
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingSubProcess");
+
+ testHelper.executeAvailableJobs();
+
+ List incidentList = runtimeService.createIncidentQuery().list();
+ assertEquals(1, incidentList.size());
+
+ Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
+
+ // when
+ HistoricProcessInstance historicPI =
+ historyService.createHistoricProcessInstanceQuery().incidentIdIn(incident.getId()).singleResult();
+
+ // then
+ assertThat(historicPI).isNotNull();
+ assertThat(historicPI.getId()).isEqualTo(processInstance.getId());
+ }
+
@Test
@Deployment(resources = {"org/operaton/bpm/engine/test/history/oneAsyncTaskProcess.bpmn20.xml"})
public void testShouldStoreHistoricProcessInstanceVariableOnAsyncBefore() {
diff --git a/engine/src/test/resources/org/operaton/bpm/engine/test/api/runtime/failingProcessAfterUserTaskCreateOneIncident.bpmn20.xml b/engine/src/test/resources/org/operaton/bpm/engine/test/api/runtime/failingProcessAfterUserTaskCreateOneIncident.bpmn20.xml
new file mode 100644
index 00000000000..e7fb8eef394
--- /dev/null
+++ b/engine/src/test/resources/org/operaton/bpm/engine/test/api/runtime/failingProcessAfterUserTaskCreateOneIncident.bpmn20.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 143c59032cedf96bb8ed6cb3472ccc20cf1cf774 Mon Sep 17 00:00:00 2001
From: Karsten Thoms
Date: Mon, 4 Nov 2024 23:25:18 +0100
Subject: [PATCH 02/37] Remove installAtEnd
---
.mvn/maven.config | 1 -
1 file changed, 1 deletion(-)
diff --git a/.mvn/maven.config b/.mvn/maven.config
index b102b0e7b83..0a656548c59 100644
--- a/.mvn/maven.config
+++ b/.mvn/maven.config
@@ -2,6 +2,5 @@
--errors
--show-version
--no-transfer-progress
--DinstallAtEnd=true
-DdeployAtEnd=true
-Duser.timezone=Europe/Berlin
From fc8aac880404e61298d4e9f26549a3e1fc0e9af2 Mon Sep 17 00:00:00 2001
From: Karsten Thoms
Date: Tue, 5 Nov 2024 00:01:39 +0100
Subject: [PATCH 03/37] [#27] JUnit 5 migration: submodule examples
---
.../engine/impl/test/ProcessEngineAssert.java | 4 +-
.../bpm/example/invoice/InvoiceTestCase.java | 62 ++++++++++++-------
examples/pom.xml | 12 ++--
3 files changed, 47 insertions(+), 31 deletions(-)
diff --git a/engine/src/main/java/org/operaton/bpm/engine/impl/test/ProcessEngineAssert.java b/engine/src/main/java/org/operaton/bpm/engine/impl/test/ProcessEngineAssert.java
index 0d13878bcfa..3d1586d03c7 100644
--- a/engine/src/main/java/org/operaton/bpm/engine/impl/test/ProcessEngineAssert.java
+++ b/engine/src/main/java/org/operaton/bpm/engine/impl/test/ProcessEngineAssert.java
@@ -16,8 +16,6 @@
*/
package org.operaton.bpm.engine.impl.test;
-import junit.framework.AssertionFailedError;
-
import org.operaton.bpm.engine.ProcessEngine;
import org.operaton.bpm.engine.runtime.ProcessInstance;
@@ -31,7 +29,7 @@ public static void assertProcessEnded(ProcessEngine processEngine, String proces
.singleResult();
if (processInstance!=null) {
- throw new AssertionFailedError("expected finished process instance '"+processInstanceId+"' but it was still in the db");
+ throw new AssertionError("expected finished process instance '"+processInstanceId+"' but it was still in the db");
}
}
}
diff --git a/examples/invoice/src/test/java/org/operaton/bpm/example/invoice/InvoiceTestCase.java b/examples/invoice/src/test/java/org/operaton/bpm/example/invoice/InvoiceTestCase.java
index a89adbeea14..208226105a3 100644
--- a/examples/invoice/src/test/java/org/operaton/bpm/example/invoice/InvoiceTestCase.java
+++ b/examples/invoice/src/test/java/org/operaton/bpm/example/invoice/InvoiceTestCase.java
@@ -16,27 +16,40 @@
*/
package org.operaton.bpm.example.invoice;
-import static org.operaton.bpm.engine.variable.Variables.fileValue;
-
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.operaton.bpm.engine.ManagementService;
+import org.operaton.bpm.engine.ProcessEngine;
+import org.operaton.bpm.engine.RuntimeService;
+import org.operaton.bpm.engine.TaskService;
import org.operaton.bpm.engine.runtime.Job;
import org.operaton.bpm.engine.runtime.ProcessInstance;
import org.operaton.bpm.engine.task.IdentityLink;
import org.operaton.bpm.engine.task.Task;
import org.operaton.bpm.engine.test.Deployment;
-import org.operaton.bpm.engine.test.ProcessEngineTestCase;
+import org.operaton.bpm.engine.test.junit5.ProcessEngineExtension;
import org.operaton.bpm.engine.variable.VariableMap;
import org.operaton.bpm.engine.variable.Variables;
-public class InvoiceTestCase extends ProcessEngineTestCase {
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
- @Deployment(resources= {"invoice.v1.bpmn", "invoiceBusinessDecisions.dmn"})
- public void testHappyPathV1() {
+import static org.junit.jupiter.api.Assertions.*;
+import static org.operaton.bpm.engine.impl.test.ProcessEngineAssert.assertProcessEnded;
+import static org.operaton.bpm.engine.variable.Variables.fileValue;
+
+@ExtendWith(ProcessEngineExtension.class)
+public class InvoiceTestCase {
+ ProcessEngine processEngine;
+ RuntimeService runtimeService;
+ TaskService taskService;
+ ManagementService managementService;
+ @Deployment(resources = {"invoice.v1.bpmn", "invoiceBusinessDecisions.dmn"})
+ @Test
+ public void testHappyPathV1() {
InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf");
VariableMap variables = Variables.createVariables()
.putValue("creditor", "Great Pizza for Everyone Inc.")
@@ -75,11 +88,12 @@ public void testHappyPathV1() {
assertNotNull(archiveInvoiceJob);
managementService.executeJob(archiveInvoiceJob.getId());
- assertProcessEnded(pi.getId());
+ assertProcessEnded(processEngine, pi.getId());
}
- @Deployment(resources= {"invoice.v2.bpmn", "invoiceBusinessDecisions.dmn"})
- public void testHappyPathV2() {
+ @Deployment(resources = {"invoice.v2.bpmn", "invoiceBusinessDecisions.dmn"})
+ @Test
+ public void testHappyPathV2() {
InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf");
VariableMap variables = Variables.createVariables()
.putValue("creditor", "Great Pizza for Everyone Inc.")
@@ -118,11 +132,12 @@ public void testHappyPathV2() {
assertNotNull(archiveInvoiceJob);
managementService.executeJob(archiveInvoiceJob.getId());
- assertProcessEnded(pi.getId());
+ assertProcessEnded(processEngine, pi.getId());
}
- @Deployment(resources= {"invoice.v2.bpmn", "invoiceBusinessDecisions.dmn"})
- public void testApproveInvoiceAssignment() {
+ @Deployment(resources = {"invoice.v2.bpmn", "invoiceBusinessDecisions.dmn"})
+ @Test
+ public void testApproveInvoiceAssignment() {
InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf");
VariableMap variables = Variables.createVariables()
@@ -165,8 +180,9 @@ public void testApproveInvoiceAssignment() {
assertEquals("mary", taskService.getVariable(task.getId(), "approver"));
}
- @Deployment(resources= {"invoice.v2.bpmn", "reviewInvoice.bpmn", "invoiceBusinessDecisions.dmn"})
- public void testNonSuccessfulPath() {
+ @Deployment(resources = {"invoice.v2.bpmn", "reviewInvoice.bpmn", "invoiceBusinessDecisions.dmn"})
+ @Test
+ public void testNonSuccessfulPath() {
InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf");
VariableMap variables = Variables.createVariables()
.putValue("creditor", "Great Pizza for Everyone Inc.")
@@ -210,9 +226,11 @@ public void testNonSuccessfulPath() {
variables.put("clarified", Boolean.FALSE);
taskService.complete(task.getId(), variables);
- assertProcessEnded(task.getProcessInstanceId());
- assertProcessEnded(pi.getId());
+ assertProcessEnded(processEngine, task.getProcessInstanceId());
+ assertProcessEnded(processEngine, pi.getId());
}
}
+
+
diff --git a/examples/pom.xml b/examples/pom.xml
index 01ac4583376..bf4675fcadd 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -33,12 +33,6 @@
provided
-
- junit
- junit
- test
-
-
com.h2database
h2
@@ -57,6 +51,12 @@
test
+
+ org.operaton.bpm
+ operaton-bpm-junit5
+ test
+
+
From b8b43e12c21400cae4aea8e69fb727e26b62911d Mon Sep 17 00:00:00 2001
From: Julian Haupt
Date: Mon, 4 Nov 2024 16:04:23 +0100
Subject: [PATCH 04/37] feat(cockpit): add rootInstanceId filter to humanTask
search (#4509)
related to #4315
Backported commit e0b2c191e6 from the camunda-bpm-platform repository.
Original author: Gergely Juhasz
---
webapps/frontend/public/app/cockpit/locales/de.json | 1 +
webapps/frontend/public/app/cockpit/locales/en.json | 1 +
2 files changed, 2 insertions(+)
diff --git a/webapps/frontend/public/app/cockpit/locales/de.json b/webapps/frontend/public/app/cockpit/locales/de.json
index 1eb3b4e6ce3..ed179e7f02b 100644
--- a/webapps/frontend/public/app/cockpit/locales/de.json
+++ b/webapps/frontend/public/app/cockpit/locales/de.json
@@ -1757,6 +1757,7 @@
"PLGN_SETA_CONF_PROCESS_DEFINITION_NAME": "Prozessdefinitions-Name",
"PLGN_SETA_CONF_PROCESS_INSTANCE_ID": "Prozessinstanz-ID",
"PLGN_SETA_CONF_PROCESS_VARIABLE": "Prozess-Variable",
+ "PLGN_SETA_CONF_ROOT_PROCESS_INSTANCE_ID": "Root Process Instance ID",
"PLGN_SETA_CONF_TASK_ASSIGNEE": "Task-Assignee",
"PLGN_SETA_CONF_TASK_DEFINITION_KEY": "Task-Definitions-Schlüssel",
"PLGN_SETA_CONF_TASK_DELETE_REASON": "Löschgrund des Tasks",
diff --git a/webapps/frontend/public/app/cockpit/locales/en.json b/webapps/frontend/public/app/cockpit/locales/en.json
index 61c651cce78..ca5f5dda729 100644
--- a/webapps/frontend/public/app/cockpit/locales/en.json
+++ b/webapps/frontend/public/app/cockpit/locales/en.json
@@ -1757,6 +1757,7 @@
"PLGN_SETA_CONF_PROCESS_DEFINITION_NAME": "Process Definition Name",
"PLGN_SETA_CONF_PROCESS_INSTANCE_ID": "Process Instance ID",
"PLGN_SETA_CONF_PROCESS_VARIABLE": "Process Variable",
+ "PLGN_SETA_CONF_ROOT_PROCESS_INSTANCE_ID": "Root Process Instance ID",
"PLGN_SETA_CONF_TASK_ASSIGNEE": "Task Assignee",
"PLGN_SETA_CONF_TASK_DEFINITION_KEY": "Task Definition Key",
"PLGN_SETA_CONF_TASK_DELETE_REASON": "Task Delete Reason",
From 1bd2107dada211f021f1b33105d5f042850caa00 Mon Sep 17 00:00:00 2001
From: Julian Haupt
Date: Mon, 4 Nov 2024 22:38:36 +0100
Subject: [PATCH 05/37] fix(openapi): make description for POST
/deployment/create more clear
Related to https://github.com/camunda/camunda-bpm-platform/issues/4312
Backported commit 8789a9b748 from the camunda-bpm-platform repository.
Original author: Miklas Boskamp
---
.../org/operaton/bpm/engine/rest/dto/MultiFormDeploymentDto.ftl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/engine-rest/engine-rest-openapi/src/main/templates/models/org/operaton/bpm/engine/rest/dto/MultiFormDeploymentDto.ftl b/engine-rest/engine-rest-openapi/src/main/templates/models/org/operaton/bpm/engine/rest/dto/MultiFormDeploymentDto.ftl
index 10e40a77388..4e3f8e26eb3 100644
--- a/engine-rest/engine-rest-openapi/src/main/templates/models/org/operaton/bpm/engine/rest/dto/MultiFormDeploymentDto.ftl
+++ b/engine-rest/engine-rest-openapi/src/main/templates/models/org/operaton/bpm/engine/rest/dto/MultiFormDeploymentDto.ftl
@@ -17,7 +17,7 @@
defaultValue = 'false'
desc = "A flag indicating whether the process engine should perform duplicate checking on a per-resource basis.
If set to true, only those resources that have actually changed are deployed.
- Checks are made against resources included previous deployments of the same name and only against the latest versions of those resources.
+ Checks are made against resources included previous deployments of the same name and source and only against the latest versions of those resources.
If set to true, the option enable-duplicate-filtering is overridden and set to true." />
<@lib.property
From 5832855edcce58a15e5fbd2768f2f1b60f8eb7fd Mon Sep 17 00:00:00 2001
From: Dirk Olmes
Date: Tue, 5 Nov 2024 09:26:46 +0100
Subject: [PATCH 06/37] chore(sonar): Fix instanceof check and cast with
pattern matching in engine-dmn/engine. (#85)
---
.../impl/DefaultDmnEngineConfiguration.java | 4 ++--
.../impl/el/VariableContextScriptBindings.java | 8 ++++----
.../evaluation/ExpressionEvaluationHandler.java | 5 ++---
.../AbstractCollectNumberHitPolicyHandler.java | 12 ++++++------
.../metrics/DmnEngineMetricCollectorWrapper.java | 4 ++--
.../impl/type/BooleanDataTypeTransformer.java | 8 ++++----
.../impl/type/DateDataTypeTransformer.java | 16 ++++++++--------
.../impl/type/DoubleDataTypeTransformer.java | 8 ++++----
.../impl/type/IntegerDataTypeTransformer.java | 8 ++++----
.../impl/type/LongDataTypeTransformer.java | 8 ++++----
10 files changed, 40 insertions(+), 41 deletions(-)
diff --git a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/DefaultDmnEngineConfiguration.java b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/DefaultDmnEngineConfiguration.java
index 8ea7c208e03..a6eb7f45f3e 100644
--- a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/DefaultDmnEngineConfiguration.java
+++ b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/DefaultDmnEngineConfiguration.java
@@ -168,8 +168,8 @@ protected void initDecisionEvaluationListener() {
protected Collection extends DmnDecisionEvaluationListener> getDefaultDmnDecisionEvaluationListeners() {
List defaultListeners = new ArrayList<>();
- if (engineMetricCollector instanceof DmnDecisionEvaluationListener) {
- defaultListeners.add((DmnDecisionEvaluationListener) engineMetricCollector);
+ if (engineMetricCollector instanceof DmnDecisionEvaluationListener listener) {
+ defaultListeners.add(listener);
} else {
defaultListeners.add(new DmnEngineMetricCollectorWrapper(engineMetricCollector));
}
diff --git a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/el/VariableContextScriptBindings.java b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/el/VariableContextScriptBindings.java
index 925ee916d46..bf999f1a73f 100644
--- a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/el/VariableContextScriptBindings.java
+++ b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/el/VariableContextScriptBindings.java
@@ -54,8 +54,8 @@ public boolean containsKey(Object key) {
if(wrappedBindings.containsKey(key)) {
return true;
}
- if (key instanceof String) {
- return variableContext.containsVariable((String) key);
+ if (key instanceof String keyString) {
+ return variableContext.containsVariable(keyString);
}
else {
return false;
@@ -72,8 +72,8 @@ public Object get(Object key) {
result = wrappedBindings.get(key);
}
else {
- if (key instanceof String) {
- TypedValue resolvedValue = variableContext.resolve((String) key);
+ if (key instanceof String keyString) {
+ TypedValue resolvedValue = variableContext.resolve(keyString);
result = unpack(resolvedValue);
}
}
diff --git a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/evaluation/ExpressionEvaluationHandler.java b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/evaluation/ExpressionEvaluationHandler.java
index 5e3cc0ee57a..f143feb42c5 100644
--- a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/evaluation/ExpressionEvaluationHandler.java
+++ b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/evaluation/ExpressionEvaluationHandler.java
@@ -77,15 +77,14 @@ protected Object evaluateScriptExpression(String expressionLanguage, VariableCon
bindings.put("variableContext", variableContext);
try {
- if (scriptEngine instanceof Compilable) {
+ if (scriptEngine instanceof Compilable compilableScriptEngine) {
CompiledScript compiledScript = cachedCompiledScriptSupport.getCachedCompiledScript();
if (compiledScript == null) {
synchronized (cachedCompiledScriptSupport) {
compiledScript = cachedCompiledScriptSupport.getCachedCompiledScript();
- if(compiledScript == null) {
- Compilable compilableScriptEngine = (Compilable) scriptEngine;
+ if (compiledScript == null) {
compiledScript = compilableScriptEngine.compile(expressionText);
cachedCompiledScriptSupport.cacheCompiledScript(compiledScript);
diff --git a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/hitpolicy/AbstractCollectNumberHitPolicyHandler.java b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/hitpolicy/AbstractCollectNumberHitPolicyHandler.java
index 049b2a75f5e..71d762a9ef7 100644
--- a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/hitpolicy/AbstractCollectNumberHitPolicyHandler.java
+++ b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/hitpolicy/AbstractCollectNumberHitPolicyHandler.java
@@ -135,8 +135,8 @@ protected List convertValuesToInteger(List typedValues) thr
// check if it is an integer
Object value = typedValue.getValue();
- if (value instanceof Integer) {
- intValues.add((Integer) value);
+ if (value instanceof Integer integerValue) {
+ intValues.add(integerValue);
} else {
throw new IllegalArgumentException();
@@ -162,8 +162,8 @@ protected List convertValuesToLong(List typedValues) throws Il
// check if it is a long or a string of a number
Object value = typedValue.getValue();
- if (value instanceof Long) {
- longValues.add((Long) value);
+ if (value instanceof Long longValue) {
+ longValues.add(longValue);
} else {
Long longValue = Long.valueOf(value.toString());
@@ -191,8 +191,8 @@ protected List convertValuesToDouble(List typedValues) throw
// check if it is a double or a string of a decimal number
Object value = typedValue.getValue();
- if (value instanceof Double) {
- doubleValues.add((Double) value);
+ if (value instanceof Double doubleValue) {
+ doubleValues.add(doubleValue);
} else {
Double doubleValue = Double.valueOf(value.toString());
diff --git a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/metrics/DmnEngineMetricCollectorWrapper.java b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/metrics/DmnEngineMetricCollectorWrapper.java
index cb26c19ccb3..40b0b30b963 100644
--- a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/metrics/DmnEngineMetricCollectorWrapper.java
+++ b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/metrics/DmnEngineMetricCollectorWrapper.java
@@ -45,8 +45,8 @@ public void notify(DmnDecisionEvaluationEvent evaluationEvent) {
}
protected void notifyCollector(DmnDecisionLogicEvaluationEvent evaluationEvent) {
- if (evaluationEvent instanceof DmnDecisionTableEvaluationEvent) {
- collector.notify((DmnDecisionTableEvaluationEvent) evaluationEvent);
+ if (evaluationEvent instanceof DmnDecisionTableEvaluationEvent dmnEvent) {
+ collector.notify(dmnEvent);
}
// ignore other evaluation events since the collector is implemented as decision table evaluation listener
}
diff --git a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/BooleanDataTypeTransformer.java b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/BooleanDataTypeTransformer.java
index e47b5cc17f3..73130f79103 100644
--- a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/BooleanDataTypeTransformer.java
+++ b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/BooleanDataTypeTransformer.java
@@ -30,11 +30,11 @@ public class BooleanDataTypeTransformer implements DmnDataTypeTransformer {
@Override
public TypedValue transform(Object value) throws IllegalArgumentException {
- if (value instanceof Boolean) {
- return Variables.booleanValue((Boolean) value);
+ if (value instanceof Boolean booleanValue) {
+ return Variables.booleanValue(booleanValue);
- } else if (value instanceof String) {
- boolean booleanValue = transformString((String) value);
+ } else if (value instanceof String stringValue) {
+ boolean booleanValue = transformString(stringValue);
return Variables.booleanValue(booleanValue);
} else {
diff --git a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/DateDataTypeTransformer.java b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/DateDataTypeTransformer.java
index 7c11fa90cdf..a0cc8208ea0 100644
--- a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/DateDataTypeTransformer.java
+++ b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/DateDataTypeTransformer.java
@@ -49,22 +49,22 @@ public class DateDataTypeTransformer implements DmnDataTypeTransformer {
@Override
public TypedValue transform(Object value) throws IllegalArgumentException {
- if (value instanceof Date) {
- return Variables.dateValue((Date) value);
+ if (value instanceof Date dateValue) {
+ return Variables.dateValue(dateValue);
- } else if (value instanceof String) {
- Date date = transformString((String) value);
+ } else if (value instanceof String stringValue) {
+ Date date = transformString(stringValue);
return Variables.dateValue(date);
- } if (value instanceof ZonedDateTime) {
- Instant instant = ((ZonedDateTime) value).toInstant();
+ } if (value instanceof ZonedDateTime zonedDateTimeValue) {
+ Instant instant = (zonedDateTimeValue).toInstant();
Date date = Date.from(instant);
return Variables.dateValue(date);
- } else if (value instanceof LocalDateTime) {
+ } else if (value instanceof LocalDateTime localDateTimeValue) {
ZoneId defaultTimeZone = ZoneId.systemDefault();
- Instant instant = ((LocalDateTime) value)
+ Instant instant = localDateTimeValue
.atZone(defaultTimeZone)
.toInstant();
diff --git a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/DoubleDataTypeTransformer.java b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/DoubleDataTypeTransformer.java
index c02d88101ee..61e9d34345b 100644
--- a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/DoubleDataTypeTransformer.java
+++ b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/DoubleDataTypeTransformer.java
@@ -30,12 +30,12 @@ public class DoubleDataTypeTransformer implements DmnDataTypeTransformer {
@Override
public TypedValue transform(Object value) throws IllegalArgumentException {
- if (value instanceof Number) {
- double doubleValue = transformNumber((Number) value);
+ if (value instanceof Number numberValue) {
+ double doubleValue = transformNumber(numberValue);
return Variables.doubleValue(doubleValue);
- } else if (value instanceof String) {
- double doubleValue = transformString((String) value);
+ } else if (value instanceof String stringValue) {
+ double doubleValue = transformString(stringValue);
return Variables.doubleValue(doubleValue);
} else {
diff --git a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/IntegerDataTypeTransformer.java b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/IntegerDataTypeTransformer.java
index 300ae45bcf3..e93e3f605e4 100644
--- a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/IntegerDataTypeTransformer.java
+++ b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/IntegerDataTypeTransformer.java
@@ -30,12 +30,12 @@ public class IntegerDataTypeTransformer implements DmnDataTypeTransformer {
@Override
public TypedValue transform(Object value) throws IllegalArgumentException {
- if (value instanceof Number) {
- int intValue = transformNumber((Number) value);
+ if (value instanceof Number numberValue) {
+ int intValue = transformNumber(numberValue);
return Variables.integerValue(intValue);
- } else if (value instanceof String) {
- int intValue = transformString((String) value);
+ } else if (value instanceof String stringValue) {
+ int intValue = transformString(stringValue);
return Variables.integerValue(intValue);
} else {
diff --git a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/LongDataTypeTransformer.java b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/LongDataTypeTransformer.java
index a9e7d196f52..9c13ce931a0 100644
--- a/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/LongDataTypeTransformer.java
+++ b/engine-dmn/engine/src/main/java/org/operaton/bpm/dmn/engine/impl/type/LongDataTypeTransformer.java
@@ -31,12 +31,12 @@ public class LongDataTypeTransformer implements DmnDataTypeTransformer {
@Override
public TypedValue transform(Object value) throws IllegalArgumentException {
- if (value instanceof Number) {
- long longValue = transformNumber((Number) value);
+ if (value instanceof Number numberValue) {
+ long longValue = transformNumber(numberValue);
return Variables.longValue(longValue);
- } else if (value instanceof String) {
- long longValue = transformString((String) value);
+ } else if (value instanceof String stringValue) {
+ long longValue = transformString(stringValue);
return Variables.longValue(longValue);
} else {
From ceceba6dc8905cc1b4bf953278d2aaab46c0def0 Mon Sep 17 00:00:00 2001
From: Julian Haupt
Date: Mon, 4 Nov 2024 22:39:44 +0100
Subject: [PATCH 07/37] fix(client): load local file variable (#4594)
related to: #4523
Backported commit f06cb967dd from the camunda-bpm-platform repository.
Original author: Gergely Juhasz
---
.../operaton/bpm/client/impl/EngineClient.java | 15 +++++++--------
.../bpm/client/task/impl/ExternalTaskImpl.java | 9 +++++++++
.../impl/value/DeferredFileValueImpl.java | 16 ++++++++++++++--
.../client/variable/value/DeferredFileValue.java | 16 ++++++++++++++++
4 files changed, 46 insertions(+), 10 deletions(-)
diff --git a/clients/java/client/src/main/java/org/operaton/bpm/client/impl/EngineClient.java b/clients/java/client/src/main/java/org/operaton/bpm/client/impl/EngineClient.java
index 43e4b3a49bb..927aed3cb5c 100644
--- a/clients/java/client/src/main/java/org/operaton/bpm/client/impl/EngineClient.java
+++ b/clients/java/client/src/main/java/org/operaton/bpm/client/impl/EngineClient.java
@@ -52,11 +52,10 @@ public class EngineClient {
public static final String FAILURE_RESOURCE_PATH = ID_RESOURCE_PATH + "/failure";
public static final String BPMN_ERROR_RESOURCE_PATH = ID_RESOURCE_PATH + "/bpmnError";
public static final String NAME_PATH_PARAM = "{name}";
- public static final String EXECUTION_RESOURCE_PATH = "/execution";
- public static final String EXECUTION_ID_RESOURCE_PATH = EXECUTION_RESOURCE_PATH + "/" + ID_PATH_PARAM;
- public static final String GET_LOCAL_VARIABLE = EXECUTION_ID_RESOURCE_PATH + "/localVariables/" + NAME_PATH_PARAM;
- public static final String GET_LOCAL_BINARY_VARIABLE = GET_LOCAL_VARIABLE + "/data";
-
+ public static final String PROCESS_INSTANCE_RESOURCE_PATH = "/process-instance";
+ public static final String PROCESS_INSTANCE_ID_RESOURCE_PATH = PROCESS_INSTANCE_RESOURCE_PATH + "/" + ID_PATH_PARAM;
+ public static final String GET_BINARY_VARIABLE =
+ PROCESS_INSTANCE_ID_RESOURCE_PATH + "/variables/" + NAME_PATH_PARAM + "/data";
protected String baseUrl;
protected String workerId;
protected int maxTasks;
@@ -147,9 +146,9 @@ public void extendLock(String taskId, long newDuration) {
engineInteraction.postRequest(resourceUrl, payload, Void.class);
}
- public byte[] getLocalBinaryVariable(String variableName, String processInstanceId) {
- String resourcePath = baseUrl + GET_LOCAL_BINARY_VARIABLE
- .replace(ID_PATH_PARAM, processInstanceId)
+ public byte[] getLocalBinaryVariable(String variableName, String executionId) {
+ String resourcePath = baseUrl + GET_BINARY_VARIABLE
+ .replace(ID_PATH_PARAM, executionId)
.replace(NAME_PATH_PARAM, variableName);
return engineInteraction.getRequest(resourcePath);
diff --git a/clients/java/client/src/main/java/org/operaton/bpm/client/task/impl/ExternalTaskImpl.java b/clients/java/client/src/main/java/org/operaton/bpm/client/task/impl/ExternalTaskImpl.java
index efa9ea7d64f..171debec1fa 100644
--- a/clients/java/client/src/main/java/org/operaton/bpm/client/task/impl/ExternalTaskImpl.java
+++ b/clients/java/client/src/main/java/org/operaton/bpm/client/task/impl/ExternalTaskImpl.java
@@ -25,6 +25,7 @@
import org.operaton.bpm.client.task.ExternalTask;
import org.operaton.bpm.client.variable.impl.TypedValueField;
import org.operaton.bpm.client.variable.impl.VariableValue;
+import org.operaton.bpm.client.variable.value.DeferredFileValue;
import org.operaton.bpm.engine.variable.VariableMap;
import org.operaton.bpm.engine.variable.Variables;
import org.operaton.bpm.engine.variable.value.TypedValue;
@@ -257,6 +258,10 @@ public T getVariable(String variableName) {
VariableValue variableValue = receivedVariableMap.get(variableName);
if (variableValue != null) {
+ if(variableValue.getTypedValue() instanceof DeferredFileValue) {
+ DeferredFileValue deferredFileValue = (DeferredFileValue) variableValue.getTypedValue();
+ deferredFileValue.setExecutionId(this.executionId);
+ }
value = (T) variableValue.getValue();
}
@@ -295,6 +300,10 @@ public T getVariableTyped(String variableName, boolean de
VariableValue variableValue = receivedVariableMap.get(variableName);
if (variableValue != null) {
typedValue = variableValue.getTypedValue(deserializeObjectValues);
+ if(typedValue instanceof DeferredFileValue) {
+ DeferredFileValue deferredFileValue = (DeferredFileValue) typedValue;
+ deferredFileValue.setExecutionId(this.executionId);
+ }
}
return (T) typedValue;
diff --git a/clients/java/client/src/main/java/org/operaton/bpm/client/variable/impl/value/DeferredFileValueImpl.java b/clients/java/client/src/main/java/org/operaton/bpm/client/variable/impl/value/DeferredFileValueImpl.java
index ba83d17c056..80510842f79 100644
--- a/clients/java/client/src/main/java/org/operaton/bpm/client/variable/impl/value/DeferredFileValueImpl.java
+++ b/clients/java/client/src/main/java/org/operaton/bpm/client/variable/impl/value/DeferredFileValueImpl.java
@@ -39,6 +39,7 @@ public class DeferredFileValueImpl extends FileValueImpl implements DeferredFile
protected String variableName;
protected String processInstanceId;
protected EngineClient engineClient;
+ protected String executionId = null;
public DeferredFileValueImpl(String filename, EngineClient engineClient) {
super(PrimitiveValueType.FILE, filename);
@@ -47,7 +48,7 @@ public DeferredFileValueImpl(String filename, EngineClient engineClient) {
protected void load() {
try {
- byte[] bytes = engineClient.getLocalBinaryVariable(variableName, processInstanceId);
+ byte[] bytes = engineClient.getLocalBinaryVariable(variableName, executionId);
setValue(bytes);
this.isLoaded = true;
@@ -79,9 +80,20 @@ public void setVariableName(String variableName) {
this.variableName = variableName;
}
+ @Override
+ public void setExecutionId(String executionId){
+ this.executionId = executionId;
+ };
+
+ @Override
+ public String getExecutionId() {
+ return executionId;
+ }
+
@Override
public String toString() {
- return "DeferredFileValueImpl [mimeType=" + mimeType + ", filename=" + filename + ", type=" + type + ", isTransient=" + isTransient + ", isLoaded=" + isLoaded + "]";
+ return "DeferredFileValueImpl [mimeType=" + mimeType + ", filename=" + filename + ", type=" + type + ", "
+ + "isTransient=" + isTransient + ", isLoaded=" + isLoaded + ", processInstanceId" + processInstanceId + ", executionId" + executionId + "]";
}
}
diff --git a/clients/java/client/src/main/java/org/operaton/bpm/client/variable/value/DeferredFileValue.java b/clients/java/client/src/main/java/org/operaton/bpm/client/variable/value/DeferredFileValue.java
index fdc1a924b6e..a7bfc82e9dc 100644
--- a/clients/java/client/src/main/java/org/operaton/bpm/client/variable/value/DeferredFileValue.java
+++ b/clients/java/client/src/main/java/org/operaton/bpm/client/variable/value/DeferredFileValue.java
@@ -39,4 +39,20 @@ public interface DeferredFileValue extends FileValue {
*/
boolean isLoaded();
+ /**
+ * Sets the executionId, which defines the scope of the DeferredFileValue.
+ * This identifier ensures that the correct scope is applied when loading the file value.
+ *
+ * @param executionId defines the scope of the DeferredFileValue
+ */
+ void setExecutionId(String executionId);
+
+ /**
+ * Returns the executionId, which specifies the scope of the DeferredFileValue.
+ * This identifier ensures that the correct scope is applied when loading the file value.
+ *
+ * @return the executionId which defines the scope of the DeferredFileValue
+ */
+ String getExecutionId();
+
}
From d3912cac3d920d3d3018d592d17f150516fb6d90 Mon Sep 17 00:00:00 2001
From: Julian Haupt
Date: Mon, 4 Nov 2024 22:41:14 +0100
Subject: [PATCH 08/37] chore(docs): Fix sortOrder case in fetch and lock rest
api example
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Related to https://github.com/camunda/camunda-bpm-platform/issues/4608
Backported commit 16f5002bdf from the camunda-bpm-platform repository.
Original author: Joaquín
---
.../main/templates/paths/external-task/fetchAndLock/post.ftl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/external-task/fetchAndLock/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/external-task/fetchAndLock/post.ftl
index 379a5d12964..9c236360571 100644
--- a/engine-rest/engine-rest-openapi/src/main/templates/paths/external-task/fetchAndLock/post.ftl
+++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/external-task/fetchAndLock/post.ftl
@@ -70,7 +70,7 @@
"sorting": [
{
"sortBy":"createTime",
- "sortOrder":"ASC"
+ "sortOrder":"asc"
}
]
}
From 230ee7d7ee2ca2f2cc7b8c710a9a6f8c8c1f81ad Mon Sep 17 00:00:00 2001
From: Julian Haupt
Date: Mon, 4 Nov 2024 15:56:39 +0100
Subject: [PATCH 09/37] chore(distro/tomcat/assembly): Add Juel to distro/lib
Folder
Context: This fix adds juel to distro/lib folder.
Fixes: NoClassDefFound errors that users who copy distro/lib dependencies experience when starting with a Manual Installation of Tomcat 10
Related-to: https://github.com/camunda/camunda-bpm-platform/issues/4573
Backported commit 2fa8c6324c from the camunda-bpm-platform repository.
Original author: psavidis <69160690+psavidis@users.noreply.github.com>
---
distro/tomcat/assembly/assembly.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/distro/tomcat/assembly/assembly.xml b/distro/tomcat/assembly/assembly.xml
index a896496ae50..7d8e8bbb04c 100644
--- a/distro/tomcat/assembly/assembly.xml
+++ b/distro/tomcat/assembly/assembly.xml
@@ -111,6 +111,7 @@
org.operaton.bpm.model:*:jar
org.operaton.bpm.dmn:*:jar
+ org.operaton.bpm.juel:*:jar
org.camunda.feel:*:jar
From db0f12dec7053afe3ea313d1fca7d303a4e5d716 Mon Sep 17 00:00:00 2001
From: Julian Haupt
Date: Mon, 4 Nov 2024 16:07:42 +0100
Subject: [PATCH 10/37] feat(engine, engine-rest): Expose
restartedProcessInstanceId
Context: This commit introduces restartedProcessInstanceId for historic process instances.
Why: To be able to track the originating process instances in restart - batch operations.
Db-Migration: The commit introduces
- RESTARTED_PROC_INST_ID_ column in ACT_HI_PROCINST table
- ACT_IDX_HI_PRO_RST_PRO_INST_ID index on the above
Unit-tests: Adds a unit test for verified the population of the column for completed and restarted process instances
Related-to
- https://github.com/camunda/camunda-bpm-platform/issues/4214
- https://github.com/camunda/camunda-bpm-platform/issues/4201
Backported commit 0509c7b114 from the camunda-bpm-platform repository.
Original author: punitdarira
---
.../history/HistoricProcessInstanceDto.ftl | 7 +++-
.../paths/history/process-instance/get.ftl | 3 +-
.../paths/history/process-instance/post.ftl | 3 +-
.../history/process-instance/{id}/get.ftl | 3 +-
.../history/HistoricProcessInstanceDto.java | 11 +++++
.../bpm/engine/rest/helper/MockProvider.java | 1 +
...essInstanceRestServiceInteractionTest.java | 2 +
...icProcessInstanceRestServiceQueryTest.java | 2 +
.../history/HistoricProcessInstance.java | 5 +++
.../impl/ProcessInstantiationBuilderImpl.java | 10 +++++
.../impl/cmd/RestartProcessInstancesCmd.java | 3 +-
.../StartProcessInstanceAtActivitiesCmd.java | 2 +
.../HistoricProcessInstanceEventEntity.java | 12 ++++++
.../producer/DefaultHistoryEventProducer.java | 1 +
.../persistence/entity/ExecutionEntity.java | 13 ++++++
.../db/create/activiti.db2.create.history.sql | 2 +
.../db/create/activiti.h2.create.history.sql | 2 +
.../activiti.mariadb.create.history.sql | 2 +
.../create/activiti.mssql.create.history.sql | 2 +
.../create/activiti.mysql.create.history.sql | 2 +
.../create/activiti.oracle.create.history.sql | 2 +
.../activiti.postgres.create.history.sql | 2 +
.../db/drop/activiti.db2.drop.history.sql | 1 +
.../db/drop/activiti.h2.drop.history.sql | 1 +
.../db/drop/activiti.mariadb.drop.history.sql | 1 +
.../db/drop/activiti.mssql.drop.history.sql | 1 +
.../db/drop/activiti.mysql.drop.history.sql | 1 +
.../db/drop/activiti.oracle.drop.history.sql | 1 +
.../drop/activiti.postgres.drop.history.sql | 1 +
.../db/upgrade/db2_engine_7.21_to_7.22.sql | 4 ++
.../db/upgrade/h2_engine_7.21_to_7.22.sql | 3 ++
.../upgrade/mariadb_engine_7.21_to_7.22.sql | 3 ++
.../db/upgrade/mssql_engine_7.21_to_7.22.sql | 3 ++
.../db/upgrade/mysql_engine_7.21_to_7.22.sql | 3 ++
.../db/upgrade/oracle_engine_7.21_to_7.22.sql | 3 ++
.../upgrade/postgres_engine_7.21_to_7.22.sql | 3 ++
.../entity/HistoricProcessInstance.xml | 7 +++-
.../RestartProcessInstanceAsyncTest.java | 41 +++++++++++++++++++
.../RestartProcessInstanceSyncTest.java | 5 +++
.../HistoricProcessInstanceStateTest.java | 2 +
40 files changed, 169 insertions(+), 7 deletions(-)
diff --git a/engine-rest/engine-rest-openapi/src/main/templates/models/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceDto.ftl b/engine-rest/engine-rest-openapi/src/main/templates/models/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceDto.ftl
index 6a47adab83e..3ff9134d65f 100644
--- a/engine-rest/engine-rest-openapi/src/main/templates/models/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceDto.ftl
+++ b/engine-rest/engine-rest-openapi/src/main/templates/models/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceDto.ftl
@@ -101,7 +101,6 @@
name = "state"
type = "string"
enumValues = ["ACTIVE", "SUSPENDED", "COMPLETED", "EXTERNALLY_TERMINATED", "INTERNALLY_TERMINATED"]
- last = true
desc = "Last state of the process instance, possible values are:
`ACTIVE` - running process instance
@@ -114,5 +113,11 @@
`INTERNALLY_TERMINATED` - terminated internally, for instance by terminating boundary event"/>
+ <@lib.property
+ name = "restartedProcessInstanceId"
+ type = "string"
+ desc = "The id of the original process instance which was restarted."
+ last = true />
+
@lib.dto>
#macro>
\ No newline at end of file
diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/get.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/get.ftl
index c3ba6c8843e..e315a9842e8 100644
--- a/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/get.ftl
+++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/get.ftl
@@ -53,7 +53,8 @@
"superCaseInstanceId":null,
"caseInstanceId":null,
"tenantId":null,
- "state":"ACTIVE"
+ "state":"ACTIVE",
+ "restartedProcessInstanceId":"2bef365d-3406-11ef-bd73-0a0027000003"
}
]
}'] />
diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/post.ftl
index ecbfa354206..4a1ff6e53cc 100644
--- a/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/post.ftl
+++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/post.ftl
@@ -78,7 +78,8 @@
"superCaseInstanceId":null,
"caseInstanceId":null,
"tenantId":null,
- "state":"ACTIVE"
+ "state":"ACTIVE",
+ "restartedProcessInstanceId":"2bef365d-3406-11ef-bd73-0a0027000003"
}
]
}'] />
diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/{id}/get.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/{id}/get.ftl
index 8cb0e8f502a..e26e84a4490 100644
--- a/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/{id}/get.ftl
+++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/history/process-instance/{id}/get.ftl
@@ -46,7 +46,8 @@
"superCaseInstanceId":null,
"caseInstanceId":null,
"tenantId":null,
- "state":"ACTIVE"
+ "state":"ACTIVE",
+ "restartedProcessInstanceId":"2bef365d-3406-11ef-bd73-0a0027000003"
}
}'] />
diff --git a/engine-rest/engine-rest/src/main/java/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceDto.java b/engine-rest/engine-rest/src/main/java/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceDto.java
index fbc470d2a3a..cfdb502a9d2 100644
--- a/engine-rest/engine-rest/src/main/java/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceDto.java
+++ b/engine-rest/engine-rest/src/main/java/org/operaton/bpm/engine/rest/dto/history/HistoricProcessInstanceDto.java
@@ -40,6 +40,7 @@ public class HistoricProcessInstanceDto {
private String caseInstanceId;
private String tenantId;
private String state;
+ private String restartedProcessInstanceId;
public String getId() {
return id;
@@ -129,6 +130,15 @@ public void setRootProcessInstanceId(String rootProcessInstanceId) {
this.rootProcessInstanceId = rootProcessInstanceId;
}
+ public String getRestartedProcessInstanceId() {
+ return restartedProcessInstanceId;
+ }
+
+ public void setRestartedProcessInstanceId(String restartedProcessInstanceId) {
+ this.restartedProcessInstanceId = restartedProcessInstanceId;
+ }
+
+
public static HistoricProcessInstanceDto fromHistoricProcessInstance(HistoricProcessInstance historicProcessInstance) {
HistoricProcessInstanceDto dto = new HistoricProcessInstanceDto();
@@ -152,6 +162,7 @@ public static HistoricProcessInstanceDto fromHistoricProcessInstance(HistoricPro
dto.caseInstanceId = historicProcessInstance.getCaseInstanceId();
dto.tenantId = historicProcessInstance.getTenantId();
dto.state = historicProcessInstance.getState();
+ dto.restartedProcessInstanceId = historicProcessInstance.getRestartedProcessInstanceId();
return dto;
}
diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/helper/MockProvider.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/helper/MockProvider.java
index 2f054bd8feb..7d925969c0e 100644
--- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/helper/MockProvider.java
+++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/helper/MockProvider.java
@@ -2183,6 +2183,7 @@ public static HistoricProcessInstance createMockHistoricProcessInstance(String t
when(mock.getCaseInstanceId()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_CASE_INSTANCE_ID);
when(mock.getTenantId()).thenReturn(tenantId);
when(mock.getState()).thenReturn(EXAMPLE_HISTORIC_PROCESS_INSTANCE_STATE);
+ when(mock.getRestartedProcessInstanceId()).thenReturn(EXAMPLE_PROCESS_INSTANCE_ID);
return mock;
}
diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceInteractionTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceInteractionTest.java
index 5a853c12e63..748b78af686 100644
--- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceInteractionTest.java
+++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceInteractionTest.java
@@ -123,6 +123,7 @@ public void testGetSingleInstance() {
String returnedCaseInstanceId = from(content).getString("caseInstanceId");
String returnedTenantId = from(content).getString("tenantId");
String returnedState = from(content).getString("state");
+ String restartedProcessInstanceId = from(content).getString("restartedProcessInstanceId");
Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID, returnedProcessInstanceId);
Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY, returnedProcessInstanceBusinessKey);
@@ -139,6 +140,7 @@ public void testGetSingleInstance() {
Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_CASE_INSTANCE_ID, returnedCaseInstanceId);
Assert.assertEquals(MockProvider.EXAMPLE_TENANT_ID, returnedTenantId);
Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_STATE, returnedState);
+ Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID, restartedProcessInstanceId);
}
diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceQueryTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceQueryTest.java
index e63bf12bbb9..218aef19822 100644
--- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceQueryTest.java
+++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/history/HistoricProcessInstanceRestServiceQueryTest.java
@@ -429,6 +429,7 @@ public void testSimpleHistoricProcessQuery() {
String returnedCaseInstanceId = from(content).getString("[0].caseInstanceId");
String returnedTenantId = from(content).getString("[0].tenantId");
String returnedState = from(content).getString("[0].state");
+ String restartedProcessInstanceId = from(content).getString("[0].restartedProcessInstanceId");
Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID, returnedProcessInstanceId);
Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY, returnedProcessInstanceBusinessKey);
@@ -449,6 +450,7 @@ public void testSimpleHistoricProcessQuery() {
Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_CASE_INSTANCE_ID, returnedCaseInstanceId);
Assert.assertEquals(MockProvider.EXAMPLE_TENANT_ID, returnedTenantId);
Assert.assertEquals(MockProvider.EXAMPLE_HISTORIC_PROCESS_INSTANCE_STATE, returnedState);
+ Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID, restartedProcessInstanceId);
}
@Test
diff --git a/engine/src/main/java/org/operaton/bpm/engine/history/HistoricProcessInstance.java b/engine/src/main/java/org/operaton/bpm/engine/history/HistoricProcessInstance.java
index 8eb1422c0de..0b827cd69d6 100644
--- a/engine/src/main/java/org/operaton/bpm/engine/history/HistoricProcessInstance.java
+++ b/engine/src/main/java/org/operaton/bpm/engine/history/HistoricProcessInstance.java
@@ -118,4 +118,9 @@ public interface HistoricProcessInstance {
* STATE_INTERNALLY_TERMINATED - terminated internally, for instance by terminating boundary event
*/
String getState();
+
+ /**
+ * The id of the original process instance which was restarted.
+ */
+ String getRestartedProcessInstanceId();
}
diff --git a/engine/src/main/java/org/operaton/bpm/engine/impl/ProcessInstantiationBuilderImpl.java b/engine/src/main/java/org/operaton/bpm/engine/impl/ProcessInstantiationBuilderImpl.java
index 9e226ecdae2..d48ff2e1e39 100644
--- a/engine/src/main/java/org/operaton/bpm/engine/impl/ProcessInstantiationBuilderImpl.java
+++ b/engine/src/main/java/org/operaton/bpm/engine/impl/ProcessInstantiationBuilderImpl.java
@@ -50,6 +50,8 @@ public class ProcessInstantiationBuilderImpl implements ProcessInstantiationBuil
protected String processDefinitionTenantId;
protected boolean isProcessDefinitionTenantIdSet = false;
+ protected String restartedProcessInstanceId;
+
protected ProcessInstanceModificationBuilderImpl modificationBuilder;
protected ProcessInstantiationBuilderImpl(CommandExecutor commandExecutor) {
@@ -206,6 +208,14 @@ public void setModificationBuilder(ProcessInstanceModificationBuilderImpl modifi
this.modificationBuilder = modificationBuilder;
}
+ public void setRestartedProcessInstanceId(String restartedProcessInstanceId){
+ this.restartedProcessInstanceId = restartedProcessInstanceId;
+ }
+
+ public String getRestartedProcessInstanceId(){
+ return restartedProcessInstanceId;
+ }
+
public static ProcessInstantiationBuilder createProcessInstanceById(CommandExecutor commandExecutor, String processDefinitionId) {
ProcessInstantiationBuilderImpl builder = new ProcessInstantiationBuilderImpl(commandExecutor);
builder.processDefinitionId = processDefinitionId;
diff --git a/engine/src/main/java/org/operaton/bpm/engine/impl/cmd/RestartProcessInstancesCmd.java b/engine/src/main/java/org/operaton/bpm/engine/impl/cmd/RestartProcessInstancesCmd.java
index a97c7335941..2f56f656ed8 100644
--- a/engine/src/main/java/org/operaton/bpm/engine/impl/cmd/RestartProcessInstancesCmd.java
+++ b/engine/src/main/java/org/operaton/bpm/engine/impl/cmd/RestartProcessInstancesCmd.java
@@ -103,6 +103,8 @@ public Void execute(final CommandContext commandContext) {
getProcessInstantiationBuilder(commandExecutor, processDefinitionId);
applyProperties(instantiationBuilder, processDefinition, historicProcessInstance);
+ instantiationBuilder.setRestartedProcessInstanceId(processInstanceId);
+
ProcessInstanceModificationBuilderImpl modificationBuilder =
instantiationBuilder.getModificationBuilder();
@@ -167,7 +169,6 @@ protected void applyProperties(ProcessInstantiationBuilderImpl instantiationBuil
if (!builder.isWithoutBusinessKey()) {
instantiationBuilder.businessKey(processInstance.getBusinessKey());
}
-
}
protected VariableMap collectVariables(CommandContext commandContext,
diff --git a/engine/src/main/java/org/operaton/bpm/engine/impl/cmd/StartProcessInstanceAtActivitiesCmd.java b/engine/src/main/java/org/operaton/bpm/engine/impl/cmd/StartProcessInstanceAtActivitiesCmd.java
index e083f276b05..abb57e0a6ef 100644
--- a/engine/src/main/java/org/operaton/bpm/engine/impl/cmd/StartProcessInstanceAtActivitiesCmd.java
+++ b/engine/src/main/java/org/operaton/bpm/engine/impl/cmd/StartProcessInstanceAtActivitiesCmd.java
@@ -79,6 +79,8 @@ public ProcessInstanceWithVariables execute(CommandContext commandContext) {
processInstance.setTenantId(instantiationBuilder.getTenantId());
}
+ processInstance.setRestartedProcessInstanceId(instantiationBuilder.getRestartedProcessInstanceId());
+
processInstance.setSkipCustomListeners(modificationBuilder.isSkipCustomListeners());
VariableMap variables = modificationBuilder.getProcessVariables();
diff --git a/engine/src/main/java/org/operaton/bpm/engine/impl/history/event/HistoricProcessInstanceEventEntity.java b/engine/src/main/java/org/operaton/bpm/engine/impl/history/event/HistoricProcessInstanceEventEntity.java
index 35492493ae4..bcba6c0df41 100644
--- a/engine/src/main/java/org/operaton/bpm/engine/impl/history/event/HistoricProcessInstanceEventEntity.java
+++ b/engine/src/main/java/org/operaton/bpm/engine/impl/history/event/HistoricProcessInstanceEventEntity.java
@@ -54,6 +54,9 @@ public class HistoricProcessInstanceEventEntity extends HistoricScopeInstanceEve
protected String state;
+ /** completed HPI that has been restarted */
+ protected String restartedProcessInstanceId;
+
// getters / setters ////////////////////////////////////////
public String getEndActivityId() {
@@ -128,6 +131,14 @@ public void setState(String state) {
this.state = state;
}
+ public String getRestartedProcessInstanceId() {
+ return restartedProcessInstanceId;
+ }
+
+ public void setRestartedProcessInstanceId(String restartedProcessInstanceId) {
+ this.restartedProcessInstanceId = restartedProcessInstanceId;
+ }
+
@Override
public String toString() {
return this.getClass().getSimpleName()
@@ -149,6 +160,7 @@ public String toString() {
+ ", processDefinitionId=" + processDefinitionId
+ ", processInstanceId=" + processInstanceId
+ ", tenantId=" + tenantId
+ + ", restartedProcessInstanceId=" + restartedProcessInstanceId
+ "]";
}
diff --git a/engine/src/main/java/org/operaton/bpm/engine/impl/history/producer/DefaultHistoryEventProducer.java b/engine/src/main/java/org/operaton/bpm/engine/impl/history/producer/DefaultHistoryEventProducer.java
index d864a020b5e..38e3128262d 100644
--- a/engine/src/main/java/org/operaton/bpm/engine/impl/history/producer/DefaultHistoryEventProducer.java
+++ b/engine/src/main/java/org/operaton/bpm/engine/impl/history/producer/DefaultHistoryEventProducer.java
@@ -204,6 +204,7 @@ protected void initProcessInstanceEvent(HistoricProcessInstanceEventEntity evt,
evt.setCaseInstanceId(caseInstanceId);
evt.setTenantId(tenantId);
evt.setRootProcessInstanceId(execution.getRootProcessInstanceId());
+ evt.setRestartedProcessInstanceId(execution.getRestartedProcessInstanceId());
if (execution.getSuperCaseExecution() != null) {
evt.setSuperCaseInstanceId(execution.getSuperCaseExecution().getCaseInstanceId());
diff --git a/engine/src/main/java/org/operaton/bpm/engine/impl/persistence/entity/ExecutionEntity.java b/engine/src/main/java/org/operaton/bpm/engine/impl/persistence/entity/ExecutionEntity.java
index 3c8c757ac23..66dae261461 100644
--- a/engine/src/main/java/org/operaton/bpm/engine/impl/persistence/entity/ExecutionEntity.java
+++ b/engine/src/main/java/org/operaton/bpm/engine/impl/persistence/entity/ExecutionEntity.java
@@ -234,6 +234,11 @@ public class ExecutionEntity extends PvmExecutionImpl implements Execution, Proc
*/
protected String superCaseExecutionId;
+ /**
+ * Completed HPI that is being restarted through this ExecutionEntity
+ */
+ protected String restartedProcessInstanceId;
+
/**
* Contains observers which are observe the execution.
* @since 7.6
@@ -970,6 +975,14 @@ public void setSuperCaseExecutionId(String superCaseExecutionId) {
this.superCaseExecutionId = superCaseExecutionId;
}
+ public String getRestartedProcessInstanceId(){
+ return restartedProcessInstanceId;
+ }
+
+ public void setRestartedProcessInstanceId(String restartedProcessInstanceId){
+ this.restartedProcessInstanceId = restartedProcessInstanceId;
+ }
+
@Override
public CaseExecutionEntity getSuperCaseExecution() {
ensureSuperCaseExecutionInitialized();
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.history.sql
index f4008b1d6ef..e4090b67ed8 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.db2.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ varchar(4000),
TENANT_ID_ varchar(64),
STATE_ varchar(255),
+ RESTARTED_PROC_INST_ID_ varchar(64),
primary key (ID_)
);
@@ -340,6 +341,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.history.sql
index 52a04fde94c..ad8c4dd42e6 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.h2.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ varchar(4000),
TENANT_ID_ varchar(64),
STATE_ varchar(255),
+ RESTARTED_PROC_INST_ID_ varchar(64),
primary key (ID_),
unique (PROC_INST_ID_)
);
@@ -339,6 +340,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.history.sql
index 01a1cc72d12..e9c95f12f81 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mariadb.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ varchar(4000),
TENANT_ID_ varchar(64),
STATE_ varchar(255),
+ RESTARTED_PROC_INST_ID_ varchar(64),
primary key (ID_),
unique (PROC_INST_ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
@@ -339,6 +340,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.history.sql
index d6b3f9a6d06..27a26b37212 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mssql.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ nvarchar(4000),
TENANT_ID_ nvarchar(64),
STATE_ nvarchar(255),
+ RESTARTED_PROC_INST_ID_ nvarchar(64),
primary key (ID_),
unique (PROC_INST_ID_)
);
@@ -338,6 +339,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.history.sql
index 478f30ea48a..4c8d0720f44 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.mysql.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ varchar(4000),
TENANT_ID_ varchar(64),
STATE_ varchar(255),
+ RESTARTED_PROC_INST_ID_ varchar(64),
primary key (ID_),
unique (PROC_INST_ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
@@ -340,6 +341,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.history.sql
index 430ed1ee56d..ffe27b569ff 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.oracle.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ NVARCHAR2(2000),
TENANT_ID_ NVARCHAR2(64),
STATE_ NVARCHAR2(255),
+ RESTARTED_PROC_INST_ID_ NVARCHAR2(64),
primary key (ID_),
unique (PROC_INST_ID_)
);
@@ -339,6 +340,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.history.sql
index 2126975e74a..aa111103f25 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/create/activiti.postgres.create.history.sql
@@ -35,6 +35,7 @@ create table ACT_HI_PROCINST (
DELETE_REASON_ varchar(4000),
TENANT_ID_ varchar(64),
STATE_ varchar(255),
+ RESTARTED_PROC_INST_ID_ varchar(64),
primary key (ID_),
unique (PROC_INST_ID_)
);
@@ -339,6 +340,7 @@ create index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST(START_TIME_, END_T
create index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST(PROC_DEF_ID_, END_TIME_);
create index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST(REMOVAL_TIME_);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
create index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST(ROOT_PROC_INST_ID_);
create index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST(START_TIME_, END_TIME_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.db2.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.db2.drop.history.sql
index bdd56029478..9d8be4d3f31 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.db2.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.db2.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI;
drop index ACT_IDX_HI_PRO_INST_RM_TIME;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID;
drop index ACT_IDX_HI_ACTINST_ROOT_PI;
drop index ACT_IDX_HI_ACT_INST_START_END;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.h2.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.h2.drop.history.sql
index 8bf4e2a4655..bc856ed8645 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.h2.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.h2.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI;
drop index ACT_IDX_HI_PRO_INST_RM_TIME;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID;
drop index ACT_IDX_HI_ACTINST_ROOT_PI;
drop index ACT_IDX_HI_ACT_INST_START_END;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mariadb.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mariadb.drop.history.sql
index 2fff71cc558..0cebb8ea81f 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mariadb.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mariadb.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST;
drop index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST;
drop index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mssql.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mssql.drop.history.sql
index 3cbce879033..de4b0ab35b7 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mssql.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mssql.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_HI_PROCINST.ACT_IDX_HI_PRO_INST_PROC_TIME;
drop index ACT_HI_PROCINST.ACT_IDX_HI_PI_PDEFID_END_TIME;
drop index ACT_HI_PROCINST.ACT_IDX_HI_PRO_INST_ROOT_PI;
drop index ACT_HI_PROCINST.ACT_IDX_HI_PRO_INST_RM_TIME;
+drop index ACT_HI_PROCINST.ACT_IDX_HI_PRO_RST_PRO_INST_ID;
drop index ACT_HI_ACTINST.ACT_IDX_HI_ACTINST_ROOT_PI;
drop index ACT_HI_ACTINST.ACT_IDX_HI_ACT_INST_START_END;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mysql.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mysql.drop.history.sql
index cc7fae60ffd..e63914408cb 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mysql.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.mysql.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI on ACT_HI_PROCINST;
drop index ACT_IDX_HI_PRO_INST_RM_TIME on ACT_HI_PROCINST;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST;
drop index ACT_IDX_HI_ACTINST_ROOT_PI on ACT_HI_ACTINST;
drop index ACT_IDX_HI_ACT_INST_START_END on ACT_HI_ACTINST;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.oracle.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.oracle.drop.history.sql
index b7318b2807f..e6acb942fd6 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.oracle.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.oracle.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI;
drop index ACT_IDX_HI_PRO_INST_RM_TIME;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID;
drop index ACT_IDX_HI_ACTINST_ROOT_PI;
drop index ACT_IDX_HI_ACT_INST_START_END;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.postgres.drop.history.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.postgres.drop.history.sql
index 5f9c798074d..bb0e521ff91 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.postgres.drop.history.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/drop/activiti.postgres.drop.history.sql
@@ -23,6 +23,7 @@ drop index ACT_IDX_HI_PRO_INST_PROC_TIME;
drop index ACT_IDX_HI_PI_PDEFID_END_TIME;
drop index ACT_IDX_HI_PRO_INST_ROOT_PI;
drop index ACT_IDX_HI_PRO_INST_RM_TIME;
+drop index ACT_IDX_HI_PRO_RST_PRO_INST_ID;
drop index ACT_IDX_HI_ACTINST_ROOT_PI;
drop index ACT_IDX_HI_ACT_INST_START_END;
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/db2_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/db2_engine_7.21_to_7.22.sql
index 7a8ada55ac2..566033c3f1a 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/db2_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/db2_engine_7.21_to_7.22.sql
@@ -21,3 +21,7 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add column TASK_STATE_ varchar(64);
alter table ACT_HI_TASKINST add column TASK_STATE_ varchar(64);
+
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ varchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
\ No newline at end of file
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/h2_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/h2_engine_7.21_to_7.22.sql
index 7a8ada55ac2..8918a9bdc81 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/h2_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/h2_engine_7.21_to_7.22.sql
@@ -21,3 +21,6 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add column TASK_STATE_ varchar(64);
alter table ACT_HI_TASKINST add column TASK_STATE_ varchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ varchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mariadb_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mariadb_engine_7.21_to_7.22.sql
index 7a8ada55ac2..8918a9bdc81 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mariadb_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mariadb_engine_7.21_to_7.22.sql
@@ -21,3 +21,6 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add column TASK_STATE_ varchar(64);
alter table ACT_HI_TASKINST add column TASK_STATE_ varchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ varchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mssql_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mssql_engine_7.21_to_7.22.sql
index 5c49433ff26..4e884d3918e 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mssql_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mssql_engine_7.21_to_7.22.sql
@@ -21,3 +21,6 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add TASK_STATE_ nvarchar(64);
alter table ACT_HI_TASKINST add TASK_STATE_ nvarchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ nvarchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mysql_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mysql_engine_7.21_to_7.22.sql
index 7a8ada55ac2..8918a9bdc81 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mysql_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/mysql_engine_7.21_to_7.22.sql
@@ -21,3 +21,6 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add column TASK_STATE_ varchar(64);
alter table ACT_HI_TASKINST add column TASK_STATE_ varchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ varchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/oracle_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/oracle_engine_7.21_to_7.22.sql
index 1136a2087ef..235e7284d10 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/oracle_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/oracle_engine_7.21_to_7.22.sql
@@ -21,3 +21,6 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add TASK_STATE_ NVARCHAR2(64);
alter table ACT_HI_TASKINST add TASK_STATE_ NVARCHAR2(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ NVARCHAR2(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/postgres_engine_7.21_to_7.22.sql b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/postgres_engine_7.21_to_7.22.sql
index 7a8ada55ac2..8918a9bdc81 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/postgres_engine_7.21_to_7.22.sql
+++ b/engine/src/main/resources/org/operaton/bpm/engine/db/upgrade/postgres_engine_7.21_to_7.22.sql
@@ -21,3 +21,6 @@ values ('1100', CURRENT_TIMESTAMP, '7.22.0');
alter table ACT_RU_TASK add column TASK_STATE_ varchar(64);
alter table ACT_HI_TASKINST add column TASK_STATE_ varchar(64);
+
+alter table ACT_HI_PROCINST add RESTARTED_PROC_INST_ID_ varchar(64);
+create index ACT_IDX_HI_PRO_RST_PRO_INST_ID on ACT_HI_PROCINST(RESTARTED_PROC_INST_ID_);
diff --git a/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/HistoricProcessInstance.xml b/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/HistoricProcessInstance.xml
index 8b21d26ad67..23b0bcdd71c 100644
--- a/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/HistoricProcessInstance.xml
+++ b/engine/src/main/resources/org/operaton/bpm/engine/impl/mapping/entity/HistoricProcessInstance.xml
@@ -55,7 +55,8 @@
CASE_INST_ID_,
DELETE_REASON_,
TENANT_ID_,
- STATE_
+ STATE_,
+ RESTARTED_PROC_INST_ID_
) values (
#{id ,jdbcType=VARCHAR},
#{processInstanceId, jdbcType=VARCHAR},
@@ -75,7 +76,8 @@
#{caseInstanceId, jdbcType=VARCHAR},
#{deleteReason, jdbcType=VARCHAR},
#{tenantId, jdbcType=VARCHAR},
- #{state, jdbcType=VARCHAR}
+ #{state, jdbcType=VARCHAR},
+ #{restartedProcessInstanceId, jdbcType=VARCHAR}
)
@@ -313,6 +315,7 @@
+
diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RestartProcessInstanceAsyncTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RestartProcessInstanceAsyncTest.java
index d119c317319..18351ad5360 100644
--- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RestartProcessInstanceAsyncTest.java
+++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RestartProcessInstanceAsyncTest.java
@@ -48,6 +48,7 @@
import org.operaton.bpm.engine.impl.cfg.multitenancy.TenantIdProviderCaseInstanceContext;
import org.operaton.bpm.engine.impl.cfg.multitenancy.TenantIdProviderHistoricDecisionInstanceContext;
import org.operaton.bpm.engine.impl.cfg.multitenancy.TenantIdProviderProcessInstanceContext;
+import org.operaton.bpm.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
import org.operaton.bpm.engine.impl.util.ClockUtil;
import org.operaton.bpm.engine.repository.ProcessDefinition;
import org.operaton.bpm.engine.runtime.ActivityInstance;
@@ -248,6 +249,46 @@ public void shouldRestartProcessInstance() {
Assert.assertEquals(task2.getTaskDefinitionKey(), restartedTask.getTaskDefinitionKey());
}
+ @Test
+ public void shouldAssignRestartProcessInstanceIdOnlyToRestartedProcessInstances() {
+ // given process instances 1 and 2
+ ProcessDefinition processDefinition = testRule.deployAndGetDefinition(ProcessModels.TWO_TASKS_PROCESS);
+
+ var processInstance1 = runtimeService.startProcessInstanceByKey("Process");
+ var processInstance2 = runtimeService.startProcessInstanceByKey("Process");
+
+ runtimeService.deleteProcessInstance(processInstance1.getId(), "test");
+ runtimeService.deleteProcessInstance(processInstance2.getId(), "test");
+
+ // when process instance 1 is restarted
+ Batch batch = runtimeService.restartProcessInstances(processDefinition.getId())
+ .startBeforeActivity("userTask1")
+ .processInstanceIds(processInstance1.getId())
+ .executeAsync();
+
+ helper.completeSeedJobs(batch);
+
+ helper.getExecutionJobs(batch).forEach(j -> assertEquals(processDefinition.getDeploymentId(), j.getDeploymentId()));
+ helper.completeExecutionJobs(batch);
+ helper.completeMonitorJobs(batch);
+
+ // then the restartedProcessInstanceId should be populated only for the restarted process instance 1
+ var restartedProcessInstance = runtimeService.createProcessInstanceQuery()
+ .active()
+ .singleResult();
+
+ var historicProcessInstance1 = (HistoricProcessInstanceEntity) historyService.createHistoricProcessInstanceQuery()
+ .processInstanceId(restartedProcessInstance.getId())
+ .singleResult();
+
+ var historicProcessInstance2 = (HistoricProcessInstanceEntity) historyService.createHistoricProcessInstanceQuery()
+ .processInstanceId(processInstance2.getId())
+ .singleResult();
+
+ assertThat(historicProcessInstance1.getRestartedProcessInstanceId()).isEqualTo(processInstance1.getId());
+ assertThat(historicProcessInstance2.getRestartedProcessInstanceId()).isNull();
+ }
+
@Test
public void shouldRestartProcessInstanceWithParallelGateway() {
// given
diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RestartProcessInstanceSyncTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RestartProcessInstanceSyncTest.java
index d79c8abca82..5ee3d46f066 100644
--- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RestartProcessInstanceSyncTest.java
+++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RestartProcessInstanceSyncTest.java
@@ -44,6 +44,7 @@
import org.operaton.bpm.engine.impl.cfg.multitenancy.TenantIdProviderHistoricDecisionInstanceContext;
import org.operaton.bpm.engine.impl.cfg.multitenancy.TenantIdProviderProcessInstanceContext;
import org.operaton.bpm.engine.impl.history.event.HistoricVariableUpdateEventEntity;
+import org.operaton.bpm.engine.impl.persistence.entity.HistoricProcessInstanceEntity;
import org.operaton.bpm.engine.repository.ProcessDefinition;
import org.operaton.bpm.engine.runtime.ActivityInstance;
import org.operaton.bpm.engine.runtime.Execution;
@@ -122,6 +123,10 @@ public void shouldRestartSimpleProcessInstance() {
ProcessInstance restartedProcessInstance = runtimeService.createProcessInstanceQuery().active().singleResult();
Task restartedTask = engineRule.getTaskService().createTaskQuery().processInstanceId(restartedProcessInstance.getId()).active().singleResult();
Assert.assertEquals(task.getTaskDefinitionKey(), restartedTask.getTaskDefinitionKey());
+
+ HistoricProcessInstanceEntity historicProcessInstanceEntity = (HistoricProcessInstanceEntity) historyService.createHistoricProcessInstanceQuery().processInstanceId(restartedProcessInstance.getId()).singleResult();
+ Assert.assertEquals(processInstance.getId(), historicProcessInstanceEntity.getRestartedProcessInstanceId());
+
}
@Test
diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceStateTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceStateTest.java
index a9c066c5bc0..e0e42c61990 100644
--- a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceStateTest.java
+++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceStateTest.java
@@ -83,6 +83,8 @@ public void testCompletedOnEndEvent() {
ProcessDefinition processDefinition = processEngineTestRule.deployAndGetDefinition(instance);
processEngineRule.getRuntimeService().startProcessInstanceById(processDefinition.getId());
HistoricProcessInstance entity = getHistoricProcessInstanceWithAssertion(processDefinition);
+
+ assertThat(entity.getRestartedProcessInstanceId()).isNull();
assertThat(entity.getState()).isEqualTo(HistoricProcessInstance.STATE_COMPLETED);
}
From 4eda0948dbe8bdd83b833d0a774e02fe533cb24c Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 4 Nov 2024 09:06:54 +0000
Subject: [PATCH 11/37] chore(deps): bump com.ibm.db2:jcc from 11.5.0.0 to
11.5.9.0
Bumps com.ibm.db2:jcc from 11.5.0.0 to 11.5.9.0.
---
updated-dependencies:
- dependency-name: com.ibm.db2:jcc
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
database/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/database/pom.xml b/database/pom.xml
index 082192f20ce..8ee94a7c920 100644
--- a/database/pom.xml
+++ b/database/pom.xml
@@ -24,7 +24,7 @@
1.1.8
8.3.0
8.4.1.jre8
- 11.5.0.0
+ 11.5.9.0
${version.db2-11.5}
42.5.5
4.8.0
From e69be73b0808c5a2f83ae601fee6eea2bd95cfe9 Mon Sep 17 00:00:00 2001
From: Karsten Thoms
Date: Tue, 5 Nov 2024 08:26:59 +0100
Subject: [PATCH 12/37] feat(tests): Enable ProcessEngineExtension to inject
services into the super class of a test case
This is to allow a class hierarchy where the base class is annotated with @ExtendWith(ProcessEngineExtension.class) and declares (protected/package private) fields for engine services.
---
.../test/junit5/ProcessEngineExtension.java | 17 ++++++++++++++---
...cessEngineExtensionSubTypeInjectionTest.java | 15 +++++++++++++++
2 files changed, 29 insertions(+), 3 deletions(-)
create mode 100644 test-utils/junit5-extension/src/test/java/org/operaton/bpm/engine/test/junit5/ProcessEngineExtensionSubTypeInjectionTest.java
diff --git a/test-utils/junit5-extension/src/main/java/org/operaton/bpm/engine/test/junit5/ProcessEngineExtension.java b/test-utils/junit5-extension/src/main/java/org/operaton/bpm/engine/test/junit5/ProcessEngineExtension.java
index a626a61ea74..eac300eb485 100644
--- a/test-utils/junit5-extension/src/main/java/org/operaton/bpm/engine/test/junit5/ProcessEngineExtension.java
+++ b/test-utils/junit5-extension/src/main/java/org/operaton/bpm/engine/test/junit5/ProcessEngineExtension.java
@@ -34,6 +34,7 @@
import java.lang.reflect.Method;
import java.util.*;
import java.util.function.Supplier;
+import java.util.stream.Stream;
/**
* Junit 5 Extension to create and inject a {@link ProcessEngine} into the test class.
@@ -60,6 +61,7 @@
* you can register the extension directly and use the builder pattern to configure it.
*
* Usage with configuration:
+ *
*
* Usage:
*
@@ -216,10 +218,10 @@ public void postProcessTestInstance(Object testInstance, ExtensionContext contex
// allow other extensions to access the engine instance created by this extension
context.getStore(ExtensionContext.Namespace.create("Operaton")).put(ProcessEngine.class, processEngine);
}
- Arrays.stream(testInstance.getClass().getDeclaredFields())
+ getAllFields(testInstance.getClass())
.filter(field -> field.getType() == ProcessEngine.class)
.forEach(field -> inject(testInstance, field, processEngine));
- Arrays.stream(testInstance.getClass().getDeclaredFields())
+ getAllFields(testInstance.getClass())
.filter(field -> ProcessEngineConfiguration.class.isAssignableFrom(field.getType()))
.forEach(field -> inject(testInstance, field, processEngine.getProcessEngineConfiguration()));
@@ -229,6 +231,15 @@ public void postProcessTestInstance(Object testInstance, ExtensionContext contex
.forEach(serviceType -> injectProcessEngineService(testInstance, serviceType));
}
+ private Stream getAllFields(Class> clazz) {
+ Stream fields = Stream.of(clazz.getDeclaredFields());
+ Class> superclass = clazz.getSuperclass();
+
+ return superclass != null
+ ? Stream.concat(fields, getAllFields(superclass))
+ : fields;
+ }
+
private void injectProcessEngineService(Object testInstance, Class> serviceType) {
Objects.requireNonNull(processEngine, "ProcessEngine not initialized");
Optional