码迷,mamicode.com
首页 > 其他好文 > 详细

Activiti历史查看

时间:2014-07-30 11:32:53      阅读:301      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   color   strong   io   for   art   

1、历史活动查看

// 历史活动查看(某一次流程的执行经历的多少步)
 @Test
 public void queryHistoricActivityInstance() throws Exception {
  String processInstanceId = "1401";
  List<HistoricActivityInstance> hais = historyService.createHistoricActivityInstanceQuery()
    // 过滤条件
    .processInstanceId(processInstanceId )
    // 分页条件
//     .listPage(firstResult, maxResults)
    // 排序条件
    .orderByHistoricActivityInstanceEndTime().asc()
    // 执行查询
    .list();
  for (HistoricActivityInstance hai : hais) {
   System.out.print("activitiId:" + hai.getActivityId()+",");
   System.out.print("name:" + hai.getActivityName()+",");
   System.out.print("type:" + hai.getActivityType()+",");
   System.out.print("pid:" + hai.getProcessInstanceId()+",");
   System.out.print("assignee:" + hai.getAssignee()+",");
   System.out.print("startTime:" + hai.getStartTime()+",");
   System.out.print("endTime:" + hai.getEndTime()+",");
   System.out.println("duration:" + hai.getDurationInMillis());
  }
 }

2、历史流程实例查看

// 历史流程实例查看(查找按照某个规则一共执行了多少次流程)
 @Test
 public void queryHistoricProcessInstance() throws Exception {
  // 获取历史流程实例的查询对象
  HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.createHistoricProcessInstanceQuery();
  // 设置查询参数
  historicProcessInstanceQuery
   //过滤条件
   .processDefinitionKey("varTest")
   // 分页条件
//     .listPage(firstResult, maxResults)
   // 排序条件
   .orderByProcessInstanceStartTime().desc();
  // 执行查询
  List<HistoricProcessInstance> hpis = historicProcessInstanceQuery.list();
  // 遍历查看结果
  for (HistoricProcessInstance hpi : hpis) {
   System.out.print("pid:" + hpi.getId()+",");
   System.out.print("pdid:" + hpi.getProcessDefinitionId()+",");
   System.out.print("startTime:" + hpi.getStartTime()+",");
   System.out.print("endTime:" + hpi.getEndTime()+",");
   System.out.print("duration:" + hpi.getDurationInMillis()+",");
   System.out.println("vars:" + hpi.getProcessVariables());
  }
 
 } 

 

Activiti历史查看,布布扣,bubuko.com

Activiti历史查看

标签:des   style   blog   color   strong   io   for   art   

原文地址:http://www.cnblogs.com/cxyj/p/3877230.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!