Mryqu's Notes


  • 首页

  • 搜索
close

Retrieve the status of an process instance in Activiti

时间: 2015-03-13   |   分类: workflow     |   阅读: 219 字 ~2分钟

Retrieve the status of an running process instance

Use the executionQuery() or processInstanceQuery() to find out ifany result is returned or not when querying execution/process byId.

runtimeService.createProcessInstanceQuery().processInstanceId(specifiedProcessInstanceId).singleResult()
runtimeService.createExecutionQuery().executionId(specifiedExecutionId).singleResult()

Specially when the history capabilities of Activiti engine isenabled:

  • Specified process/execution instance id:
    ProcessInstance inst = historyService.createHistoricProcessInstanceQuery().processInstanceId(specifiedProcessInstanceId).singleResult();
    inst.isEnd()
    
  • Unspecified process/execution instance id:
    historyService.createHistoricProcessInstanceQuery().finished().list()
    historyService.createHistoricProcessInstanceQuery().unfinished().list()
    

Retrieve the active node of an running process instance

RuntimeService provide the API to retrieve the active node of anrunning process instance:

 // Finds the activity ids for all executions that are waiting in activities.
 // This is a list because a single activity can be active multiple times.
 // 
 // @param executionId
 //          id of the execution, cannot be null.
 // @throws ActivitiObjectNotFoundException
 //           when no execution exists with the given executionId.
 List getActiveActivityIds(String executionId);

Its implementation work as below: Retrieve the status of an process instance in Activiti The API usage in Activiti demo:

  • org.activiti.rest.diagram.services.BaseProcessDefinitionDiagramLayoutResource: dead code org.activiti.rest.diagram.services.ProcessDefinitionDiagramLayoutResource doesn’t satisfy the condition to run getActiveActivityIds method. org.activiti.rest.diagram.services.ProcessInstanceDiagramLayoutResourceis not used in Activiti demo.
  • org.activiti.rest.diagram.services.ProcessInstanceHighlightsResource: used to high light current active node and sequence flow Retrieve the status of an process instance in Activiti
  • org.activiti.explorer.ui.process.ProcessDefinitionImageStreamResourceBuilder: used to high light current active node Retrieve the status of an process instance in Activiti
  • org.activiti.rest.service.api.runtime.process.ExecutionActiveActivitiesCollectionResource: no usage in Activiti demo
  • org.activiti.rest.service.api.runtime.process.ProcessInstanceDiagramResource: no usage in Activiti demo

Reference

Activiti user guide: history confiugration
Activiti Forums: ProcessInstance.isEnded() returns false
Activiti Forums: How to determine when process is complete after signal()?
Activiti Forums: any api to get the current node?

标题:Retrieve the status of an process instance in Activiti
作者:mryqu
声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 CN 许可协议。转载请注明出处!

#activiti# #process_instance# #status# #retrieve#
[OpenUI5] 将布尔型数据在数据表中显示为checkbox
粗览Activiti Explorer源代码
  • 文章目录
  • 站点概览

Programmer & Architect

662 日志
27 分类
1472 标签
GitHub Twitter FB Page
    • Retrieve the status of an running process instance
    • Retrieve the active node of an running process instance
    • Reference
© 2009 - 2023 Mryqu's Notes
Powered by - Hugo v0.120.4
Theme by - NexT
0%