/**
   * easyui 运行中流程列表数据
   *
   * @param request
   * @param response
   * @param dataGrid
   */
  @RequestMapping(params = "runningProcessDataGrid")
  public void runningProcessDataGrid(
      HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {

    /*
     * List<HistoricProcessInstance> historicProcessInstances =
     * historyService .createHistoricProcessInstanceQuery()
     * .unfinished().list();
     */
    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
    List<ProcessInstance> list = processInstanceQuery.list();

    StringBuffer rows = new StringBuffer();
    for (ProcessInstance hi : list) {
      rows.append(
          "{'id':"
              + hi.getId()
              + ",'processDefinitionId':'"
              + hi.getProcessDefinitionId()
              + "','processInstanceId':'"
              + hi.getProcessInstanceId()
              + "','activityId':'"
              + hi.getActivityId()
              + "'},");
    }

    String rowStr = StringUtils.substringBeforeLast(rows.toString(), ",");

    JSONObject jObject =
        JSONObject.fromObject("{'total':" + list.size() + ",'rows':[" + rowStr + "]}");
    responseDatagrid(response, jObject);
  }
 /**
  * @param businessKey
  * @return
  */
 @Override
 public List<ProcessInstance> queryProcessInstancesSuspendedByBusinessKey(String businessKey) {
   ProcessInstanceQuery query =
       runtimeService
           .createProcessInstanceQuery()
           .processInstanceBusinessKey(businessKey)
           .suspended()
           .orderByProcessInstanceId()
           .desc();
   List<ProcessInstance> list = query.listPage(0, 100);
   return list;
 }
 /**
  * @param businessKey
  * @return
  */
 @Override
 public List<ProcessInstance> queryProcessInstancesActiveByBusinessKey(
     String businessKey, String processDefinitionKey) {
   ProcessInstanceQuery query =
       runtimeService
           .createProcessInstanceQuery()
           .processInstanceBusinessKey(businessKey, processDefinitionKey)
           .active()
           .orderByProcessInstanceId()
           .desc();
   List<ProcessInstance> list = query.listPage(0, 100);
   return list;
 }
Beispiel #4
0
  /** 流程定义列表 */
  public Page<ProcessInstance> runningList(
      Page<ProcessInstance> page, String procInsId, String procDefKey) {

    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();

    if (StringUtils.isNotBlank(procInsId)) {
      processInstanceQuery.processInstanceId(procInsId);
    }

    if (StringUtils.isNotBlank(procDefKey)) {
      processInstanceQuery.processDefinitionKey(procDefKey);
    }

    page.setCount(processInstanceQuery.count());
    page.setList(processInstanceQuery.listPage(page.getFirstResult(), page.getMaxResults()));
    return page;
  }