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..1354424122d 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,14 @@ type = "string" desc = "The id of the process definition that this process instance belongs to." /> + <#-- + GIT Issue : https://github.com/camunda/camunda-bpm-platform/issues/4049 + --> + <@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 +48,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/process-definition/{id}/start/post.ftl b/engine-rest/engine-rest-openapi/src/main/templates/paths/process-definition/{id}/start/post.ftl index 15d5b9e358d..e1bad79d9d5 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-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..93ba9037470 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(); @@ -49,6 +51,14 @@ public String getId() { public String getDefinitionId() { return definitionId; } + + /** + * @return the definitionKey + * GIT Issue : https://github.com/camunda/camunda-bpm-platform/issues/4049 + */ + 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/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 4a4a312996e..7c9e2d6bca8 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 @@ -1302,6 +1302,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); diff --git a/engine/src/main/java/org/camunda/bpm/engine/impl/cmd/StartProcessInstanceCmd.java b/engine/src/main/java/org/camunda/bpm/engine/impl/cmd/StartProcessInstanceCmd.java index ccb5c0328af..295f777c8e8 100644 --- a/engine/src/main/java/org/camunda/bpm/engine/impl/cmd/StartProcessInstanceCmd.java +++ b/engine/src/main/java/org/camunda/bpm/engine/impl/cmd/StartProcessInstanceCmd.java @@ -61,6 +61,8 @@ public ProcessInstanceWithVariables execute(CommandContext commandContext) { processInstance.setTenantId(instantiationBuilder.getTenantId()); } + processInstance.setProcessDefinitionKey(processDefinition.getKey()); + final ExecutionVariableSnapshotObserver variablesListener = new ExecutionVariableSnapshotObserver(processInstance); processInstance.start(instantiationBuilder.getVariables()); 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 a97d1922c31..30f3ba9075e 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 @@ -234,6 +234,11 @@ public class ExecutionEntity extends PvmExecutionImpl implements Execution, Proc */ protected String superCaseExecutionId; + /** + * The name of the process definition key + */ + protected String processDefinitionKey; + /** * Contains observers which are observe the execution. * @since 7.6 @@ -263,6 +268,7 @@ public ExecutionEntity createExecution() { // initialize the new execution createdExecution.setProcessDefinition(getProcessDefinition()); + createdExecution.setProcessDefinitionKey(getProcessDefinitionKey()); createdExecution.setProcessInstance(getProcessInstance()); createdExecution.setActivity(getActivity()); createdExecution.setSuspensionState(getSuspensionState()); @@ -1935,4 +1941,13 @@ 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..479f304b052 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.cockroachdb.create.engine.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.cockroachdb.create.engine.sql index 7789480cd53..1b557ea64f3 100644 --- a/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.cockroachdb.create.engine.sql +++ b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.cockroachdb.create.engine.sql @@ -101,6 +101,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_) ); @@ -593,4 +594,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.db2.create.engine.sql b/engine/src/main/resources/org/camunda/bpm/engine/db/create/activiti.db2.create.engine.sql index 4f61d68326d..bc1245a6c67 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 @@ -101,6 +101,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_) ); @@ -594,4 +595,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 72f0d2b6b4f..3e37ed9d3e1 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 @@ -101,6 +101,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_) ); @@ -585,4 +586,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 746203df164..86e2175a1cc 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 @@ -101,6 +101,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; @@ -586,4 +587,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 e8bf58836f1..aebe2e5738c 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 @@ -101,6 +101,7 @@ create table ACT_RU_EXECUTION ( CACHED_ENT_STATE_ int, SEQUENCE_COUNTER_ numeric(19,0), TENANT_ID_ nvarchar(64), + PROC_DEF_KEY_ nvarchar(255), primary key (ID_) ); @@ -590,4 +591,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 4c7965866ef..256104301a0 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 @@ -101,6 +101,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; @@ -586,4 +587,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 503ec586d99..ce175997e61 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 @@ -101,6 +101,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_) ); @@ -605,4 +606,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 e3a8b24a4e3..db5e050e0d8 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 @@ -101,6 +101,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_) ); @@ -600,4 +601,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/impl/mapping/entity/Execution.xml b/engine/src/main/resources/org/camunda/bpm/engine/impl/mapping/entity/Execution.xml index 83e03d773e4..97626c9bded 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,10 +45,10 @@ CACHED_ENT_STATE_, SEQUENCE_COUNTER_, TENANT_ID_, + PROC_DEF_KEY_, REV_ ) - values - ( + values ( #{id ,jdbcType=VARCHAR}, #{rootProcessInstanceIdRaw, jdbcType=VARCHAR}, #{processInstanceId, jdbcType=VARCHAR}, @@ -68,6 +68,7 @@ #{cachedEntityState, jdbcType=INTEGER}, #{sequenceCounter, jdbcType=BIGINT}, #{tenantId, jdbcType=VARCHAR}, + #{processDefinitionKey, jdbcType=VARCHAR}, 1 ) @@ -90,7 +91,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 +157,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..d1a777fb070 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,6 +109,7 @@ 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(); + } + }