diff --git a/engine-rest/engine-rest-openapi/src/main/templates/models/org/camunda/bpm/engine/rest/dto/runtime/ProcessInstanceDto.ftl b/engine-rest/engine-rest-openapi/src/main/templates/models/org/camunda/bpm/engine/rest/dto/runtime/ProcessInstanceDto.ftl index 57919f2efc7..87ad6a62b30 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/models/org/camunda/bpm/engine/rest/dto/runtime/ProcessInstanceDto.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/models/org/camunda/bpm/engine/rest/dto/runtime/ProcessInstanceDto.ftl @@ -12,6 +12,11 @@ type = "string" desc = "The id of the process definition that this process instance belongs to." /> + <@lib.property + name = "definitionKey" + type = "string" + desc = "The key of the process definition that this process instance belongs to." /> + <@lib.property name = "businessKey" type = "string" @@ -40,4 +45,4 @@ desc = "The tenant id of the process instance." /> - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/condition/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/condition/post.ftl index 5ec0fd60029..c3265a491ae 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/condition/post.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/condition/post.ftl @@ -39,6 +39,7 @@ "links": [], "id": "aProcInstId", "definitionId": "aProcDefId", + "definitionKey": "aProcDefKey", "businessKey": "aBusinessKey", "caseInstanceId": null, "ended": false, @@ -49,6 +50,7 @@ "links": [], "id": "anotherId", "definitionId": "aProcDefId", + "definitionKey": "aProcDefKey", "businessKey": "aBusinessKey", "caseInstanceId": null, "ended": false, @@ -71,4 +73,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/message/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/message/post.ftl index 8479acf423e..191459468b4 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/message/post.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/message/post.ftl @@ -89,6 +89,7 @@ "links": [], "id": "aProcInstId", "definitionId": "aProcDefId", + "definitionKey": "aProcDefKey", "businessKey": "aKey", "caseInstanceId": "aCaseInstId", "ended": false, @@ -137,4 +138,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/start/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/start/post.ftl index d167f29f5c9..3c86652424d 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/start/post.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/start/post.ftl @@ -134,6 +134,7 @@ ], "id": "aProcInstId", "definitionId": "aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey": "myBusinessKey", "caseInstanceId": null, "ended": false, @@ -168,6 +169,7 @@ ], "id":"anId", "definitionId":"aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey":"myBusinessKey", "caseInstanceId": null, "tenantId":null, @@ -196,4 +198,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/submit-form/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/submit-form/post.ftl index ef01fa4113d..5add06e8dda 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/submit-form/post.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/submit-form/post.ftl @@ -62,6 +62,7 @@ ], "id":"anId", "definitionId":"aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey":"myBusinessKey", "caseInstanceId": null, "tenantId":null, @@ -99,4 +100,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/tenant-id/{tenant-id}/start/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/tenant-id/{tenant-id}/start/post.ftl index 198165a030c..304e307aa8c 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/tenant-id/{tenant-id}/start/post.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/tenant-id/{tenant-id}/start/post.ftl @@ -120,6 +120,7 @@ ], "id":"anId", "definitionId":"aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey":"myBusinessKey", "caseInstanceId": null, "tenantId":null, @@ -140,6 +141,7 @@ ], "id": "aProcInstId", "definitionId": "aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey": "myBusinessKey", "caseInstanceId": null, "ended": false, @@ -174,6 +176,7 @@ ], "id":"anId", "definitionId":"aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey":"myBusinessKey", "caseInstanceId": null, "tenantId":null, @@ -202,4 +205,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/tenant-id/{tenant-id}/submit-form/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/tenant-id/{tenant-id}/submit-form/post.ftl index b8cf46ea14d..71190939ee8 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/tenant-id/{tenant-id}/submit-form/post.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/key/{key}/tenant-id/{tenant-id}/submit-form/post.ftl @@ -69,6 +69,7 @@ ], "id":"anId", "definitionId":"aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey":"myBusinessKey", "caseInstanceId": null, "tenantId":null, @@ -106,4 +107,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/{id}/start/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/{id}/start/post.ftl index 15d5b9e358d..4807fbe2715 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/{id}/start/post.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/{id}/start/post.ftl @@ -113,6 +113,7 @@ ], "id":"anId", "definitionId":"aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey":"myBusinessKey", "caseInstanceId": null, "tenantId":null, @@ -133,6 +134,7 @@ ], "id": "aProcInstId", "definitionId": "aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey": "myBusinessKey", "caseInstanceId": null, "ended": false, @@ -167,6 +169,7 @@ ], "id":"anId", "definitionId":"aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey":"myBusinessKey", "caseInstanceId": null, "tenantId":null, @@ -195,4 +198,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/{id}/submit-form/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/{id}/submit-form/post.ftl index 528e2f95d26..f4059fc87ad 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/{id}/submit-form/post.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/{id}/submit-form/post.ftl @@ -61,6 +61,7 @@ ], "id":"anId", "definitionId":"aProcessDefinitionId", + "definitionKey":"aProcessDefinitionKey", "businessKey":"myBusinessKey", "caseInstanceId": null, "tenantId":null, @@ -98,4 +99,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/get.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/get.ftl index 307a176bebf..de25976f184 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/get.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/get.ftl @@ -34,6 +34,7 @@ "links": [], "id": "anId", "definitionId": "aProcDefId", + "definitionKey": "aProcDefKey", "businessKey": "aKey", "caseInstanceId": "aCaseInstanceId", "ended": false, @@ -53,4 +54,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/post.ftl index 2b071dc7a2d..a52e08a5c82 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/post.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/post.ftl @@ -60,6 +60,7 @@ "links": [], "id": "anId", "definitionId": "aProcessDefinitionId", + "definitionKey": "aProcessDefinitionKey", "businessKey": "aKey", "caseInstanceId": "aCaseInstanceId", "ended": false, @@ -80,4 +81,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/{id}/get.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/{id}/get.ftl index 7f89c4bafe9..933bdffa4c4 100644 --- a/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/{id}/get.ftl +++ b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-instance/{id}/get.ftl @@ -28,6 +28,7 @@ "value": { "id":"aProcessInstanceId", "definitionId":"aProcDefId", + "definitionKey":"aProcDefKey", "businessKey":"aKey", "caseInstanceId":"aCaseInstanceId", "ended":false, @@ -45,4 +46,4 @@ } } - \ No newline at end of file + diff --git a/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/runtime/ProcessInstanceDto.java b/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/runtime/ProcessInstanceDto.java index e7461c640ea..575ac30bdae 100644 --- a/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/runtime/ProcessInstanceDto.java +++ b/engine-rest/engine-rest/src/main/java/org/camunda/bpm/engine/rest/dto/runtime/ProcessInstanceDto.java @@ -28,6 +28,7 @@ public class ProcessInstanceDto extends LinkableDto { private boolean ended; private boolean suspended; private String tenantId; + private String definitionKey; public ProcessInstanceDto() { } @@ -35,6 +36,7 @@ public ProcessInstanceDto() { public ProcessInstanceDto(ProcessInstance instance) { this.id = instance.getId(); this.definitionId = instance.getProcessDefinitionId(); + this.definitionKey = instance.getProcessDefinitionKey(); this.businessKey = instance.getBusinessKey(); this.caseInstanceId = instance.getCaseInstanceId(); this.ended = instance.isEnded(); @@ -50,6 +52,10 @@ public String getDefinitionId() { return definitionId; } + public String getDefinitionKey() { + return definitionKey; + } + public String getBusinessKey() { return businessKey; } diff --git a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ConditionRestServiceTest.java b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ConditionRestServiceTest.java index d5557e73677..f79ac931f54 100644 --- a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ConditionRestServiceTest.java +++ b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ConditionRestServiceTest.java @@ -276,8 +276,11 @@ public void shouldReturnErrorCode() { protected void checkResult(String content) { Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID, from(content).get("[" + 0 + "].id")); Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID, from(content).get("[" + 0+ "].definitionId")); + Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY, from(content).get("[" + 0+ "].definitionKey")); Assert.assertEquals(MockProvider.ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID, from(content).get("[" + 1 + "].id")); Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID, from(content).get("[" + 1+ "].definitionId")); + Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY, from(content).get("[" + 1+ "].definitionKey")); + } } diff --git a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/MessageRestServiceTest.java b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/MessageRestServiceTest.java index 52d20d5731e..d8519ed52af 100644 --- a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/MessageRestServiceTest.java +++ b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/MessageRestServiceTest.java @@ -263,6 +263,7 @@ protected void checkProcessInstanceResult(String content, int idx) { //process instance should be filled and execution should be null Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID, from(content).get("[" + idx + "].processInstance.id")); Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID, from(content).get("[" + idx + "].processInstance.definitionId")); + Assert.assertEquals(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY, from(content).get("[" + idx + "].processInstance.definitionKey")); Assert.assertNull(from(content).get("[" + idx + "].execution")); } diff --git a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ProcessInstanceRestServiceInteractionTest.java b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ProcessInstanceRestServiceInteractionTest.java index 345be01068e..7bcf0d9750d 100644 --- a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ProcessInstanceRestServiceInteractionTest.java +++ b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ProcessInstanceRestServiceInteractionTest.java @@ -1083,6 +1083,7 @@ public void testGetSingleInstance() { .body("id", Matchers.equalTo(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)) .body("ended", Matchers.equalTo(MockProvider.EXAMPLE_PROCESS_INSTANCE_IS_ENDED)) .body("definitionId", Matchers.equalTo(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)) + .body("definitionKey", Matchers.equalTo(MockProvider.EXAMPLE_PROCESS_DEFINITION_KEY)) .body("businessKey", Matchers.equalTo(MockProvider.EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY)) .body("suspended", Matchers.equalTo(MockProvider.EXAMPLE_PROCESS_INSTANCE_IS_SUSPENDED)) .body("tenantId", Matchers.equalTo(MockProvider.EXAMPLE_TENANT_ID)) diff --git a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/helper/MockProvider.java b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/helper/MockProvider.java index 09d82eb3018..871fd041f0a 100644 --- a/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/helper/MockProvider.java +++ b/engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/helper/MockProvider.java @@ -1312,6 +1312,7 @@ public static ProcessInstance createMockInstance(String tenantId) { when(mock.getBusinessKey()).thenReturn(EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY); when(mock.getCaseInstanceId()).thenReturn(EXAMPLE_CASE_INSTANCE_ID); when(mock.getProcessDefinitionId()).thenReturn(EXAMPLE_PROCESS_DEFINITION_ID); + when(mock.getProcessDefinitionKey()).thenReturn(EXAMPLE_PROCESS_DEFINITION_KEY); when(mock.getProcessInstanceId()).thenReturn(EXAMPLE_PROCESS_INSTANCE_ID); when(mock.isSuspended()).thenReturn(EXAMPLE_PROCESS_INSTANCE_IS_SUSPENDED); when(mock.isEnded()).thenReturn(EXAMPLE_PROCESS_INSTANCE_IS_ENDED); @@ -2336,6 +2337,7 @@ public static ProcessInstance createAnotherMockInstance() { when(mock.getId()).thenReturn(ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID); when(mock.getBusinessKey()).thenReturn(EXAMPLE_PROCESS_INSTANCE_BUSINESS_KEY); when(mock.getProcessDefinitionId()).thenReturn(EXAMPLE_PROCESS_DEFINITION_ID); + when(mock.getProcessDefinitionKey()).thenReturn(EXAMPLE_PROCESS_DEFINITION_KEY); when(mock.getProcessInstanceId()).thenReturn(ANOTHER_EXAMPLE_PROCESS_INSTANCE_ID); when(mock.isSuspended()).thenReturn(EXAMPLE_PROCESS_INSTANCE_IS_SUSPENDED); when(mock.isEnded()).thenReturn(EXAMPLE_PROCESS_INSTANCE_IS_ENDED); diff --git a/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java b/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java index 5da5887b70b..465a7517e41 100644 --- a/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java +++ b/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ExecutionEntity.java @@ -239,6 +239,11 @@ public class ExecutionEntity extends PvmExecutionImpl implements Execution, Proc */ protected String restartedProcessInstanceId; + /** + * The name of the process definition key + */ + protected String processDefinitionKey; + /** * Contains observers which are observe the execution. * @since 7.6 @@ -268,6 +273,7 @@ public ExecutionEntity createExecution() { // initialize the new execution createdExecution.setProcessDefinition(getProcessDefinition()); + createdExecution.setProcessDefinitionKey(getProcessDefinitionKey()); createdExecution.setProcessInstance(getProcessInstance()); createdExecution.setActivity(getActivity()); createdExecution.setSuspensionState(getSuspensionState()); @@ -774,9 +780,11 @@ public void setProcessDefinition(ProcessDefinitionImpl processDefinition) { this.processDefinition = processDefinition; if (processDefinition != null) { this.processDefinitionId = processDefinition.getId(); + this.processDefinitionKey = getProcessDefinition().getKey(); } else { this.processDefinitionId = null; + this.processDefinitionKey = null; } } @@ -1447,6 +1455,7 @@ public Object getPersistentState() { persistentState.put("suspensionState", this.suspensionState); persistentState.put("cachedEntityState", getCachedEntityState()); persistentState.put("sequenceCounter", getSequenceCounter()); + persistentState.put("processDefinitionKey", this.processDefinitionKey); return persistentState; } @@ -1948,4 +1957,12 @@ public ProcessEngine getProcessEngine() { public String getProcessDefinitionTenantId() { return getProcessDefinition().getTenantId(); } + + public void setProcessDefinitionKey(String processDefinitionKey) { + this.processDefinitionKey = processDefinitionKey; + } + + public String getProcessDefinitionKey() { + return processDefinitionKey; + } } diff --git a/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessInstanceWithVariablesImpl.java b/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessInstanceWithVariablesImpl.java index 080c6c8705a..848b3eff95b 100644 --- a/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessInstanceWithVariablesImpl.java +++ b/engine/src/main/java/org/camunda/bpm/engine/impl/persistence/entity/ProcessInstanceWithVariablesImpl.java @@ -86,4 +86,9 @@ public String getProcessInstanceId() { public String getTenantId() { return executionEntity.getTenantId(); } + + @Override + public String getProcessDefinitionKey() { + return executionEntity.getProcessDefinitionKey(); + } } diff --git a/engine/src/main/java/org/camunda/bpm/engine/runtime/Execution.java b/engine/src/main/java/org/camunda/bpm/engine/runtime/Execution.java index 2c78e6b6e4c..1cbae07dd64 100644 --- a/engine/src/main/java/org/camunda/bpm/engine/runtime/Execution.java +++ b/engine/src/main/java/org/camunda/bpm/engine/runtime/Execution.java @@ -52,4 +52,9 @@ public interface Execution { */ String getTenantId(); + /** + * The Key of the process definition. + */ + String getProcessDefinitionKey(); + } diff --git a/engine/src/main/java/org/camunda/bpm/engine/runtime/ProcessInstance.java b/engine/src/main/java/org/camunda/bpm/engine/runtime/ProcessInstance.java index d8a07d494aa..dd2bbed9e71 100644 --- a/engine/src/main/java/org/camunda/bpm/engine/runtime/ProcessInstance.java +++ b/engine/src/main/java/org/camunda/bpm/engine/runtime/ProcessInstance.java @@ -32,6 +32,11 @@ public interface ProcessInstance extends Execution { */ String getProcessDefinitionId(); + /** + * The key of the process definition of the process instance. + */ + String getProcessDefinitionKey(); + /** * The business key of this process instance. */ diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.db2.create.engine.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.db2.create.engine.sql index 30f3fd07859..d11ca85d878 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.db2.create.engine.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.db2.create.engine.sql @@ -98,6 +98,7 @@ create table ACT_RU_EXECUTION ( CACHED_ENT_STATE_ integer, SEQUENCE_COUNTER_ bigint, TENANT_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), primary key (ID_) ); @@ -595,4 +596,4 @@ create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); -- indices for history cleanup: https://jira.camunda.com/browse/CAM-11616 create index ACT_IDX_AUTH_ROOT_PI on ACT_RU_AUTHORIZATION(ROOT_PROC_INST_ID_); -create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); \ No newline at end of file +create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.h2.create.engine.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.h2.create.engine.sql index bc7e32606a8..84ec69f3f9f 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.h2.create.engine.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.h2.create.engine.sql @@ -98,6 +98,7 @@ create table ACT_RU_EXECUTION ( CACHED_ENT_STATE_ integer, SEQUENCE_COUNTER_ integer, TENANT_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), primary key (ID_) ); @@ -586,4 +587,4 @@ alter table ACT_RU_VARIABLE -- indices for history cleanup: https://jira.camunda.com/browse/CAM-11616 create index ACT_IDX_AUTH_ROOT_PI on ACT_RU_AUTHORIZATION(ROOT_PROC_INST_ID_); -create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); \ No newline at end of file +create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mariadb.create.engine.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mariadb.create.engine.sql index bedc6bbda37..b460001da14 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mariadb.create.engine.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mariadb.create.engine.sql @@ -98,6 +98,7 @@ create table ACT_RU_EXECUTION ( CACHED_ENT_STATE_ integer, SEQUENCE_COUNTER_ bigint, TENANT_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -587,4 +588,4 @@ create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); -- indices for history cleanup: https://jira.camunda.com/browse/CAM-11616 create index ACT_IDX_AUTH_ROOT_PI on ACT_RU_AUTHORIZATION(ROOT_PROC_INST_ID_); -create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); \ No newline at end of file +create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mssql.create.engine.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mssql.create.engine.sql index c7c19f60c1f..bba8dcf715d 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mssql.create.engine.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mssql.create.engine.sql @@ -98,6 +98,7 @@ create table ACT_RU_EXECUTION ( CACHED_ENT_STATE_ int, SEQUENCE_COUNTER_ numeric(19,0), TENANT_ID_ nvarchar(64), + PROC_DEF_KEY_ varchar(255), primary key (ID_) ); @@ -591,4 +592,4 @@ create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); -- indices for history cleanup: https://jira.camunda.com/browse/CAM-11616 create index ACT_IDX_AUTH_ROOT_PI on ACT_RU_AUTHORIZATION(ROOT_PROC_INST_ID_); -create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); \ No newline at end of file +create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mysql.create.engine.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mysql.create.engine.sql index 50ad4c10075..abbba80d311 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mysql.create.engine.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.mysql.create.engine.sql @@ -98,6 +98,7 @@ create table ACT_RU_EXECUTION ( CACHED_ENT_STATE_ integer, SEQUENCE_COUNTER_ bigint, TENANT_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), primary key (ID_) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; @@ -587,4 +588,4 @@ create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); -- indices for history cleanup: https://jira.camunda.com/browse/CAM-11616 create index ACT_IDX_AUTH_ROOT_PI on ACT_RU_AUTHORIZATION(ROOT_PROC_INST_ID_); -create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); \ No newline at end of file +create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.oracle.create.engine.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.oracle.create.engine.sql index 235009f074e..b25d35d87f0 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.oracle.create.engine.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.oracle.create.engine.sql @@ -98,6 +98,7 @@ create table ACT_RU_EXECUTION ( CACHED_ENT_STATE_ INTEGER, SEQUENCE_COUNTER_ NUMBER(19,0), TENANT_ID_ NVARCHAR2(64), + PROC_DEF_KEY_ NVARCHAR2(255), primary key (ID_) ); @@ -606,4 +607,4 @@ create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); -- indices for history cleanup: https://jira.camunda.com/browse/CAM-11616 create index ACT_IDX_AUTH_ROOT_PI on ACT_RU_AUTHORIZATION(ROOT_PROC_INST_ID_); -create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); \ No newline at end of file +create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.postgres.create.engine.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.postgres.create.engine.sql index 5d73df89922..277e1fc5421 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.postgres.create.engine.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.postgres.create.engine.sql @@ -98,6 +98,7 @@ create table ACT_RU_EXECUTION ( CACHED_ENT_STATE_ integer, SEQUENCE_COUNTER_ bigint, TENANT_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), primary key (ID_) ); @@ -601,4 +602,4 @@ create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); -- indices for history cleanup: https://jira.camunda.com/browse/CAM-11616 create index ACT_IDX_AUTH_ROOT_PI on ACT_RU_AUTHORIZATION(ROOT_PROC_INST_ID_); -create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); \ No newline at end of file +create index ACT_IDX_AUTH_RM_TIME on ACT_RU_AUTHORIZATION(REMOVAL_TIME_); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/db2_engine_7.22_to_7.23.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/db2_engine_7.22_to_7.23.sql index c75ac812e12..da0552e4028 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/db2_engine_7.22_to_7.23.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/db2_engine_7.22_to_7.23.sql @@ -16,4 +16,6 @@ -- insert into ACT_GE_SCHEMA_LOG -values ('1200', CURRENT_TIMESTAMP, '7.23.0'); \ No newline at end of file +values ('1200', CURRENT_TIMESTAMP, '7.23.0'); + +alter table ACT_RU_EXECUTION add PROC_DEF_KEY_ varchar(255); \ No newline at end of file diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/h2_engine_7.22_to_7.23.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/h2_engine_7.22_to_7.23.sql index c75ac812e12..5f8e6b6c402 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/h2_engine_7.22_to_7.23.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/h2_engine_7.22_to_7.23.sql @@ -16,4 +16,6 @@ -- insert into ACT_GE_SCHEMA_LOG -values ('1200', CURRENT_TIMESTAMP, '7.23.0'); \ No newline at end of file +values ('1200', CURRENT_TIMESTAMP, '7.23.0'); + +alter table ACT_RU_EXECUTION add PROC_DEF_KEY_ varchar(255); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mariadb_engine_7.22_to_7.23.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mariadb_engine_7.22_to_7.23.sql index c75ac812e12..5f8e6b6c402 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mariadb_engine_7.22_to_7.23.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mariadb_engine_7.22_to_7.23.sql @@ -16,4 +16,6 @@ -- insert into ACT_GE_SCHEMA_LOG -values ('1200', CURRENT_TIMESTAMP, '7.23.0'); \ No newline at end of file +values ('1200', CURRENT_TIMESTAMP, '7.23.0'); + +alter table ACT_RU_EXECUTION add PROC_DEF_KEY_ varchar(255); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mssql_engine_7.22_to_7.23.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mssql_engine_7.22_to_7.23.sql index c75ac812e12..73e78774dcf 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mssql_engine_7.22_to_7.23.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mssql_engine_7.22_to_7.23.sql @@ -14,6 +14,7 @@ -- See the License for the specific language governing permissions and -- limitations under the License. -- - insert into ACT_GE_SCHEMA_LOG -values ('1200', CURRENT_TIMESTAMP, '7.23.0'); \ No newline at end of file +values ('1200', CURRENT_TIMESTAMP, '7.23.0'); + +alter table ACT_RU_EXECUTION add PROC_DEF_KEY_ nvarchar(255); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mysql_engine_7.22_to_7.23.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mysql_engine_7.22_to_7.23.sql index c75ac812e12..8d219c1d3a4 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mysql_engine_7.22_to_7.23.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/mysql_engine_7.22_to_7.23.sql @@ -16,4 +16,6 @@ -- insert into ACT_GE_SCHEMA_LOG -values ('1200', CURRENT_TIMESTAMP, '7.23.0'); \ No newline at end of file +values ('1200', CURRENT_TIMESTAMP, '7.23.0'); + +alter table ACT_RU_EXECUTION add column PROC_DEF_KEY_ varchar(255); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/oracle_engine_7.22_to_7.23.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/oracle_engine_7.22_to_7.23.sql index c75ac812e12..fd4cbe0aecb 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/oracle_engine_7.22_to_7.23.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/oracle_engine_7.22_to_7.23.sql @@ -16,4 +16,6 @@ -- insert into ACT_GE_SCHEMA_LOG -values ('1200', CURRENT_TIMESTAMP, '7.23.0'); \ No newline at end of file +values ('1200', CURRENT_TIMESTAMP, '7.23.0'); + +alter table ACT_RU_EXECUTION add PROC_DEF_KEY_ NVARCHAR2(255); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/postgres_engine_7.22_to_7.23.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/postgres_engine_7.22_to_7.23.sql index c75ac812e12..385df9a4bd6 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/postgres_engine_7.22_to_7.23.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/upgrade/postgres_engine_7.22_to_7.23.sql @@ -16,4 +16,6 @@ -- insert into ACT_GE_SCHEMA_LOG -values ('1200', CURRENT_TIMESTAMP, '7.23.0'); \ No newline at end of file +values ('1200', CURRENT_TIMESTAMP, '7.23.0'); + +alter table ACT_RU_EXECUTION add column PROC_DEF_KEY_ varchar(64); diff --git a/engine/src/main/resources/org/camunda/bpm/engine/impl/mapping/entity/Execution.xml b/engine/src/main/resources/org/camunda/bpm/engine/impl/mapping/entity/Execution.xml index 83e03d773e4..728804e5e29 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/impl/mapping/entity/Execution.xml +++ b/engine/src/main/resources/org/camunda/bpm/engine/impl/mapping/entity/Execution.xml @@ -45,6 +45,7 @@ CACHED_ENT_STATE_, SEQUENCE_COUNTER_, TENANT_ID_, + PROC_DEF_KEY_, REV_ ) values @@ -68,6 +69,7 @@ #{cachedEntityState, jdbcType=INTEGER}, #{sequenceCounter, jdbcType=BIGINT}, #{tenantId, jdbcType=VARCHAR}, + #{processDefinitionKey, jdbcType=VARCHAR}, 1 ) @@ -90,7 +92,8 @@ SUSPENSION_STATE_ = #{suspensionState, jdbcType=INTEGER}, CACHED_ENT_STATE_ = #{cachedEntityState, jdbcType=INTEGER}, SEQUENCE_COUNTER_ = #{sequenceCounter, jdbcType=BIGINT}, - TENANT_ID_ = #{tenantId, jdbcType=BIGINT} + TENANT_ID_ = #{tenantId, jdbcType=BIGINT}, + PROC_DEF_KEY_ = #{processDefinitionKey, jdbcType=VARCHAR} where ID_ = #{id, jdbcType=VARCHAR} and REV_ = #{revision, jdbcType=INTEGER} @@ -155,6 +158,7 @@ + diff --git a/engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/ExecutionQueryTest.java b/engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/ExecutionQueryTest.java index d73785530cc..bc79a0d3b6e 100644 --- a/engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/ExecutionQueryTest.java +++ b/engine/src/test/java/org/camunda/bpm/engine/test/api/runtime/ExecutionQueryTest.java @@ -98,6 +98,7 @@ public void testQueryByProcessDefinitionKey() { // Concurrent process with 3 executions for each process instance assertEquals(12, runtimeService.createExecutionQuery().processDefinitionKey(CONCURRENT_PROCESS_KEY).list().size()); assertEquals(1, runtimeService.createExecutionQuery().processDefinitionKey(SEQUENTIAL_PROCESS_KEY).list().size()); + assertNotNull(runtimeService.createExecutionQuery().processDefinitionKey(SEQUENTIAL_PROCESS_KEY).singleResult().getProcessDefinitionKey()); } @Test diff --git a/engine/src/test/java/org/camunda/bpm/engine/test/standalone/entity/ExecutionEntityTest.java b/engine/src/test/java/org/camunda/bpm/engine/test/standalone/entity/ExecutionEntityTest.java index 94bd35929df..465cd47ae2c 100644 --- a/engine/src/test/java/org/camunda/bpm/engine/test/standalone/entity/ExecutionEntityTest.java +++ b/engine/src/test/java/org/camunda/bpm/engine/test/standalone/entity/ExecutionEntityTest.java @@ -109,8 +109,8 @@ public void testRemoveExecutionSequence() { // when assertNotNull(execution); assertEquals(pi.getId(), execution.getProcessInstanceId()); + assertEquals(pi.getProcessDefinitionKey(), execution.getProcessDefinitionKey()); processEngineRule.getRuntimeService().signal(execution.getId()); - // then (see #TestLocalVariableTaskListener::notify) } diff --git a/engine/src/test/java/org/camunda/bpm/engine/test/util/ExecutionTree.java b/engine/src/test/java/org/camunda/bpm/engine/test/util/ExecutionTree.java index a35e07aeb7b..189410b1496 100644 --- a/engine/src/test/java/org/camunda/bpm/engine/test/util/ExecutionTree.java +++ b/engine/src/test/java/org/camunda/bpm/engine/test/util/ExecutionTree.java @@ -176,4 +176,9 @@ protected static String executionTreeToString(ExecutionTree executionTree) { return sb.toString(); } + @Override + public String getProcessDefinitionKey() { + return wrappedExecution.getProcessDefinitionKey(); + } + }