-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/git issue 2334 fetch variable process instance api enhancement #4641
base: master
Are you sure you want to change the base?
Conversation
…iable-enhancement-for-process-instances-api(Get/Post) Updated the Get/Post Methods for Process Instace list to accommodate variables only when WithVariablesInReturn is set to true Signed-off-by: Shenoy, Nandan <Nandan.Shenoy@fmr.com>
…ancement-for-process-instances-api(Get/Post) Updated the Get/Post Methods for Process Instance list to accommodate variables only when WithVariablesInReturn is set to true Signed-off-by: Shenoy, Nandan <Nandan.Shenoy@fmr.com>
…ble-enhancement-for-process-instances-api(Get/Post) Updated the Get/Post Methods for Process Instance list to accommodate variables only when WithVariablesInReturn is set to true Signed-off-by: Shenoy, Nandan <Nandan.Shenoy@fmr.com>
…hancement-for-process-instances-api(Get/Post) Updated the Get/Post Methods for Process Instance list to accommodate variables only when WithVariablesInReturn is set to true Signed-off-by: Shenoy, Nandan <Nandan.Shenoy@fmr.com>
…fetch-variable-enhancement-for-process-instances-api(Get/Post) Updated the Get/Post Methods for Process Instance list to accommodate variables only when WithVariablesInReturn is set to true Signed-off-by: Shenoy, Nandan <Nandan.Shenoy@fmr.com>
…iable-process-instance-api-enhancement git issue-2334 : fetch-variable-process-instance-api-enhancement Signed-off-by: Shenoy, Nandan <Nandan.Shenoy@fmr.com>
Hi @Nandanrshenoy, |
Thanks @venetrius for your support !!! |
@venetrius , Thanks and Regards, |
@venetrius , Regards, |
@venetrius and @yanavasileva , Thanks and Regards, |
Hi @Nandanrshenoy, |
@@ -84,8 +85,18 @@ public List<ProcessInstanceDto> queryProcessInstances( | |||
|
|||
List<ProcessInstanceDto> instanceResults = new ArrayList<>(); | |||
for (ProcessInstance instance : matchingInstances) { | |||
ProcessInstanceDto resultInstance = ProcessInstanceDto.fromProcessInstance(instance); | |||
instanceResults.add(resultInstance); | |||
if (null!= queryDto.isWithVariablesInReturn() && queryDto.isWithVariablesInReturn()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please make sure your code changes are formatted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @venetrius,Would you wish to provide me all the comments at once so that I can push the changes in one commit.Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Nandanrshenoy, I will try to get to it this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @venetrius for all the support .Will mean a lot !!!
Hi @Nandanrshenoy |
Thanks @venetrius for the update.Will await for your inputs. Regards, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my comments.
instanceResults.add(resultInstance); | ||
if (null!= queryDto.isWithVariablesInReturn() && queryDto.isWithVariablesInReturn()){ | ||
RuntimeService runtimeService = engine.getRuntimeService(); | ||
VariableMap variableMap = (VariableMap) runtimeService.getVariables(instance.getProcessInstanceId()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Querying all the variable instances within a single query would improve the performance.
Can you give it a try?
I think you can get the VariableInstances similar to this:
List<VariableInstance> variableInstances =
runtimeService.createVariableInstanceQuery().activityInstanceIdIn(
matchingInstances.stream().map(ProcessInstance::getId).toArray(String[]::new)
).list();
then you need to match the VariableInstances to the Instances
type = "boolean" | ||
desc = "Indicates if the variables associated with the process instance should be returned. | ||
Value may only be true, as false is the default behavior." /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently variable values only returned for primitives and objects but not files.
{
"links": [],
"id": "0e0a6c59-f062-11ef-a093-22171c80391b",
"definitionId": "invoice:1:0de5a5f8-f062-11ef-a093-22171c80391b",
"businessKey": null,
"caseInstanceId": null,
"ended": false,
"suspended": false,
"tenantId": null,
"variables": {
"amount": {
"type": "Double",
"value": 30.0,
"valueInfo": {}
},
"approverGroups": {
"type": "Object",
"value": [
"accounting",
"sales"
],
"valueInfo": {
"objectTypeName": "java.util.ArrayList",
"serializationDataFormat": "application/x-java-serialized-object"
}
},
"invoiceNumber": {
"type": "String",
"value": "GPFE-23232323",
"valueInfo": {}
},
"invoiceDocument": {
"type": "File",
"value": null,
"valueInfo": {
"filename": "invoice.pdf",
"mimeType": "application/pdf"
}
},
"creditor": {
"type": "String",
"value": "Great Pizza for Everyone Inc.",
"valueInfo": {}
},
"invoiceCategory": {
"type": "String",
"value": "Travel Expenses",
"valueInfo": {}
}
}
},
This is not bug and inline with the user experience in other queries but it should be reflected in the docs as well
when(runtimeServiceMock.getVariables(anyString())).thenReturn(mockInstanceWithVariable); | ||
|
||
given() | ||
.queryParam("withVariablesInReturn", false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default behaviour is that withVariablesInReturn
is not part of the request. If withVariablesInReturn
is not present then it is the same sa withVariablesInReturn
is false
when(sampleInstanceQuery.listPage(0, 1)).thenReturn(mockProcessInstanceList); | ||
|
||
VariableMap mockInstanceWithVariable = MockProvider.createMockSerializedVariables(); | ||
when(runtimeServiceMock.getVariables(anyString())).thenReturn(mockInstanceWithVariable); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to check if getVariables is called with the actual processInstanceId and not any strig.
Closing due to lack of requested feedback. If you would like us to look at this, please provide the requested information to re-open the PR. |
@venetrius ,Thanks for your feedback.Let me take some time and go through your review comments. Will circle back incase I need any inputs. Regards, |
git-issue-2334-fetch-variable-enhancement-for-process-instances-api(Get/Post) : enhance the Get Process List API (Both Post and Get methods) to include Process related variables in its response
related to: #2334