Problem with 'Get Process Instance Details' Java API
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2013 07:39 AM
I am using Activiti 5.12. You have provided REST API to get he details of a process instance, i.e :
GET /process-instance/{processInstanceId}
Response :
<code>
{
"id": "2",
"processDefinitionId": "financialReport:1",
"businessKey": "55",
"startTime": "2010-10-13T14:54:26.750+02:00",
"startActivityId": "startFinancialAnalysis",
"startUserId": "kermit",
"completed": false,
"tasks": [
{
"taskId": "3",
"taskName": "Analyze report",
"owner": null,
"assignee": "Kermit",
"startTime": "2010-10-13T14:53:26.750+02:00",
"completed": false
}
],
"activities": [
{
"activityId": "4",
"activityName": "Get report",
"activityType": "ServiceTask",
"startTime": "2010-10-13T14:53:25.750+02:00",
"completed": true,
"startTime": "2010-10-13T14:53:25.950+02:00",
"duration": 200
}
],
"variables": [
{
"variableName": "reportName",
"variableValue": "classified.pdf",
}
]
"historyVariables": [
{
"variableName": "reportName",
"variableValue": "classified.pdf",
"variableType": "String",
"revision": 1,
"time": "2010-10-13T14:53:26.750+02:00"
}
]
}
<c/ode>
Respective JAVA API as provided in user guide is :
<b>ProcessEngines.getProcessEngine(configuredProcessEngineName).getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(..).singleResult()<b>
This API returns an HistoricProcessInstance, and it does not contain any methods to get the list of tasks.
I need those list of tasks to know which state the process instance is, that means which tasks are completed or which is not.
Can you please help me in that.
GET /process-instance/{processInstanceId}
Response :
<code>
{
"id": "2",
"processDefinitionId": "financialReport:1",
"businessKey": "55",
"startTime": "2010-10-13T14:54:26.750+02:00",
"startActivityId": "startFinancialAnalysis",
"startUserId": "kermit",
"completed": false,
"tasks": [
{
"taskId": "3",
"taskName": "Analyze report",
"owner": null,
"assignee": "Kermit",
"startTime": "2010-10-13T14:53:26.750+02:00",
"completed": false
}
],
"activities": [
{
"activityId": "4",
"activityName": "Get report",
"activityType": "ServiceTask",
"startTime": "2010-10-13T14:53:25.750+02:00",
"completed": true,
"startTime": "2010-10-13T14:53:25.950+02:00",
"duration": 200
}
],
"variables": [
{
"variableName": "reportName",
"variableValue": "classified.pdf",
}
]
"historyVariables": [
{
"variableName": "reportName",
"variableValue": "classified.pdf",
"variableType": "String",
"revision": 1,
"time": "2010-10-13T14:53:26.750+02:00"
}
]
}
<c/ode>
Respective JAVA API as provided in user guide is :
<b>ProcessEngines.getProcessEngine(configuredProcessEngineName).getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(..).singleResult()<b>
This API returns an HistoricProcessInstance, and it does not contain any methods to get the list of tasks.
I need those list of tasks to know which state the process instance is, that means which tasks are completed or which is not.
Can you please help me in that.
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2013 02:52 AM
That's right, you have to use the HistoricTaskInstanceQuery to get a list of tasks related to a process instance.
Best regards,
Best regards,
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2013 09:15 AM
Thanks trademak.
List<HistoricTaskIntance> taskList = getHistoryService()
.createHistoricTaskInstanceQuery()
.processInstanceId(processInstanceId)
.list()
Iterated through This task list and finding if any of its task end time is "null".
That is one way or directly accessing the db "act_hi_taskinst" to get the task.
List<HistoricTaskIntance> taskList = getHistoryService()
.createHistoricTaskInstanceQuery()
.processInstanceId(processInstanceId)
.list()
Iterated through This task list and finding if any of its task end time is "null".
That is one way or directly accessing the db "act_hi_taskinst" to get the task.
