Skip to content

Commit

Permalink
feat(core): expose process def key in process instance API (#4847)
Browse files Browse the repository at this point in the history
related to #4049

Signed-off-by: Shenoy, Nandan <Nandan.Shenoy@fmr.com>
Co-authored-by: <yanavasileva@users.noreply.github.com>
  • Loading branch information
yanavasileva authored Jan 14, 2025
1 parent 5f95e68 commit efdc8c8
Show file tree
Hide file tree
Showing 43 changed files with 142 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -40,4 +45,4 @@
desc = "The tenant id of the process instance." />

</@lib.dto>
</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"links": [],
"id": "aProcInstId",
"definitionId": "aProcDefId",
"definitionKey": "aProcDefKey",
"businessKey": "aBusinessKey",
"caseInstanceId": null,
"ended": false,
Expand All @@ -49,6 +50,7 @@
"links": [],
"id": "anotherId",
"definitionId": "aProcDefId",
"definitionKey": "aProcDefKey",
"businessKey": "aBusinessKey",
"caseInstanceId": null,
"ended": false,
Expand All @@ -71,4 +73,4 @@
}
}

</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"links": [],
"id": "aProcInstId",
"definitionId": "aProcDefId",
"definitionKey": "aProcDefKey",
"businessKey": "aKey",
"caseInstanceId": "aCaseInstId",
"ended": false,
Expand Down Expand Up @@ -137,4 +138,4 @@
}
}

</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
],
"id":"anId",
"definitionId":"aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey":"myBusinessKey",
"caseInstanceId": null,
"tenantId":null,
Expand All @@ -134,6 +135,7 @@
],
"id": "aProcInstId",
"definitionId": "aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey": "myBusinessKey",
"caseInstanceId": null,
"ended": false,
Expand Down Expand Up @@ -168,6 +170,7 @@
],
"id":"anId",
"definitionId":"aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey":"myBusinessKey",
"caseInstanceId": null,
"tenantId":null,
Expand Down Expand Up @@ -196,4 +199,4 @@
}
}

</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
],
"id":"anId",
"definitionId":"aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey":"myBusinessKey",
"caseInstanceId": null,
"tenantId":null,
Expand Down Expand Up @@ -99,4 +100,4 @@
}
}

</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
],
"id":"anId",
"definitionId":"aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey":"myBusinessKey",
"caseInstanceId": null,
"tenantId":null,
Expand All @@ -140,6 +141,7 @@
],
"id": "aProcInstId",
"definitionId": "aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey": "myBusinessKey",
"caseInstanceId": null,
"ended": false,
Expand Down Expand Up @@ -174,6 +176,7 @@
],
"id":"anId",
"definitionId":"aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey":"myBusinessKey",
"caseInstanceId": null,
"tenantId":null,
Expand Down Expand Up @@ -202,4 +205,4 @@
}
}

</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
],
"id":"anId",
"definitionId":"aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey":"myBusinessKey",
"caseInstanceId": null,
"tenantId":null,
Expand Down Expand Up @@ -106,4 +107,4 @@
}
}

</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
],
"id":"anId",
"definitionId":"aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey":"myBusinessKey",
"caseInstanceId": null,
"tenantId":null,
Expand All @@ -133,6 +134,7 @@
],
"id": "aProcInstId",
"definitionId": "aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey": "myBusinessKey",
"caseInstanceId": null,
"ended": false,
Expand Down Expand Up @@ -167,6 +169,7 @@
],
"id":"anId",
"definitionId":"aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey":"myBusinessKey",
"caseInstanceId": null,
"tenantId":null,
Expand Down Expand Up @@ -195,4 +198,4 @@
}
}

</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
],
"id":"anId",
"definitionId":"aProcessDefinitionId",
"definitionKey":"aProcessDefinitionKey",
"businessKey":"myBusinessKey",
"caseInstanceId": null,
"tenantId":null,
Expand Down Expand Up @@ -98,4 +99,4 @@
}
}

</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"links": [],
"id": "anId",
"definitionId": "aProcDefId",
"definitionKey": "aProcDefKey",
"businessKey": "aKey",
"caseInstanceId": "aCaseInstanceId",
"ended": false,
Expand All @@ -53,4 +54,4 @@
}
}

</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"links": [],
"id": "anId",
"definitionId": "aProcessDefinitionId",
"definitionKey": "aProcessDefinitionKey",
"businessKey": "aKey",
"caseInstanceId": "aCaseInstanceId",
"ended": false,
Expand All @@ -80,4 +81,4 @@
}
}

</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"value": {
"id":"aProcessInstanceId",
"definitionId":"aProcDefId",
"definitionKey":"aProcDefKey",
"businessKey":"aKey",
"caseInstanceId":"aCaseInstanceId",
"ended":false,
Expand All @@ -45,4 +46,4 @@

}
}
</#macro>
</#macro>
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ public class ProcessInstanceDto extends LinkableDto {
private boolean ended;
private boolean suspended;
private String tenantId;
private String definitionKey;

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();
Expand All @@ -50,6 +52,10 @@ public String getDefinitionId() {
return definitionId;
}

public String getDefinitionKey() {
return definitionKey;
}

public String getBusinessKey() {
return businessKey;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,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);
Expand Down Expand Up @@ -2341,6 +2342,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);
Expand Down
Loading

0 comments on commit efdc8c8

Please sign in to comment.