当前位置: 首页>>代码示例>>Java>>正文


Java HistoricProcessInstanceQuery.list方法代码示例

本文整理汇总了Java中org.activiti.engine.history.HistoricProcessInstanceQuery.list方法的典型用法代码示例。如果您正苦于以下问题:Java HistoricProcessInstanceQuery.list方法的具体用法?Java HistoricProcessInstanceQuery.list怎么用?Java HistoricProcessInstanceQuery.list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.history.HistoricProcessInstanceQuery的用法示例。


在下文中一共展示了HistoricProcessInstanceQuery.list方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWorkflowsInternal

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<WorkflowInstance> getWorkflowsInternal(WorkflowInstanceQuery workflowInstanceQuery, boolean isActive, int maxItems, int skipCount)
{
    // MNT-9074 My Tasks fails to render if tasks quantity is excessive
    HistoricProcessInstanceQuery query = createQuery(workflowInstanceQuery, isActive);

    LinkedList<WorkflowInstance> results = new LinkedList<WorkflowInstance>();

    List<HistoricProcessInstance> completedInstances;
    if (maxItems > 0)
    {
        completedInstances = query.orderByProcessInstanceDuration().desc().listPage(skipCount, maxItems);
    }
    else
    {
        completedInstances = query.list();
    }

    List<WorkflowInstance> completedResults = typeConverter.doSpecialTenantFilterAndSafeConvert(completedInstances, new Function<HistoricProcessInstance, String>()
    {
        public String apply(HistoricProcessInstance historicProcessInstance)
        {
            ProcessDefinition procDef = activitiUtil.getProcessDefinition(historicProcessInstance.getProcessDefinitionId());
            return procDef.getKey();
        }
    });

    results.addAll(completedResults);
    return results;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:ActivitiWorkflowEngine.java

示例2: getActivitiToMidpoint

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
private Map<String, String> getActivitiToMidpoint(Set<String> activeProcessInstances, OperationResult result) {
	Map<String,String> rv = new HashMap<>();
	int processWithoutTaskOidCount = 0;
	HistoricProcessInstanceQuery query = activitiEngine.getHistoryService().createHistoricProcessInstanceQuery()
			.includeProcessVariables()
			.excludeSubprocesses(true);
	List<HistoricProcessInstance> processes = query.list();
	for (HistoricProcessInstance process : processes) {
		String taskOid = (String) process.getProcessVariables().get(CommonProcessVariableNames.VARIABLE_MIDPOINT_TASK_OID);
		rv.put(process.getId(), taskOid);
		if (taskOid == null) {
			processWithoutTaskOidCount++;
		}
		if (process.getEndTime() == null) {
			activeProcessInstances.add(process.getId());
		}
	}
	LOGGER.info("Found {} processes; among these, {} have no task OID. Active processes: {}",
			rv.size(), processWithoutTaskOidCount, activeProcessInstances.size());
	return rv;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:22,代码来源:ProcessInstanceManager.java

示例3: testHistoricProcessInstanceQueryByProcessInstanceIds

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
@Deployment(resources = {
        "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml",
        "org/activiti/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml"       
      })
public void testHistoricProcessInstanceQueryByProcessInstanceIds() {
  HashSet<String> processInstanceIds = new HashSet<String>();
  for (int i = 0; i < 4; i++) {
    processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess", i + "").getId());
  }
  processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess2", "1").getId());
  
  // start an instance that will not be part of the query
  runtimeService.startProcessInstanceByKey("oneTaskProcess2", "2");
          
  HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery().processInstanceIds(processInstanceIds);
  assertEquals(5, processInstanceQuery.count());
  
  List<HistoricProcessInstance> processInstances = processInstanceQuery.list();
  assertNotNull(processInstances);
  assertEquals(5, processInstances.size());
  
  for (HistoricProcessInstance historicProcessInstance : processInstances) {
    assertTrue(processInstanceIds.contains(historicProcessInstance.getId()));
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:26,代码来源:HistoryServiceTest.java

示例4: getProcessInstance

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
@Override
public List<HistoricProcessInstance> getProcessInstance(String pdId,
		String domainId, String userId, String startTime, String endTime) {
	HistoricProcessInstanceQuery query = historyService
			.createHistoricProcessInstanceQuery().finished();

	if (StringUtils.isEmpty(pdId)) {
		query.processInstanceId(pdId);
	}
	if (StringUtils.isEmpty(domainId)) {
		query.processInstanceBusinessKey(domainId);
	}
	if (StringUtils.isEmpty(userId)) {
		query.involvedUser(userId);
	}
	if (StringUtils.isEmpty(startTime)) {
		query.startedAfter(new Date(startTime));
	}
	if (StringUtils.isEmpty(endTime)) {
		query.finishedBefore(new Date(endTime));
	}
	List<HistoricProcessInstance> hpi = query.list();
	return hpi;
}
 
开发者ID:lz84,项目名称:bachelor,代码行数:25,代码来源:BpmHistoryServiceImpl.java

示例5: testHistoricProcessInstanceQueryByProcessInstanceIds

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml", "org/activiti/engine/test/api/runtime/oneTaskProcess2.bpmn20.xml" })
public void testHistoricProcessInstanceQueryByProcessInstanceIds() {
  HashSet<String> processInstanceIds = new HashSet<String>();
  for (int i = 0; i < 4; i++) {
    processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess", i + "").getId());
  }
  processInstanceIds.add(runtimeService.startProcessInstanceByKey("oneTaskProcess2", "1").getId());

  // start an instance that will not be part of the query
  runtimeService.startProcessInstanceByKey("oneTaskProcess2", "2");

  HistoricProcessInstanceQuery processInstanceQuery = historyService.createHistoricProcessInstanceQuery().processInstanceIds(processInstanceIds);
  assertEquals(5, processInstanceQuery.count());

  List<HistoricProcessInstance> processInstances = processInstanceQuery.list();
  assertNotNull(processInstances);
  assertEquals(5, processInstances.size());

  for (HistoricProcessInstance historicProcessInstance : processInstances) {
    assertTrue(processInstanceIds.contains(historicProcessInstance.getId()));
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:23,代码来源:HistoryServiceTest.java

示例6: deleteAllHistoricJobs

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
/**
 * Deletes all Activiti jobs from the history table.
 */
protected void deleteAllHistoricJobs()
{
    HistoricProcessInstanceQuery query = activitiHistoryService.createHistoricProcessInstanceQuery();
    List<HistoricProcessInstance> historicProcessInstances = query.list();
    for (HistoricProcessInstance historicProcessInstance : historicProcessInstances)
    {
        activitiHistoryService.deleteHistoricProcessInstance(historicProcessInstance.getId());
    }
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:13,代码来源:AbstractServiceTest.java

示例7: deleteAllCompletedInstances

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
/**
 * Delete all completed instances
 */
public void deleteAllCompletedInstances(){
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    HistoryService historyService = BPMNServerHolder.getInstance().getEngine().getHistoryService();
    HistoricProcessInstanceQuery query =
            historyService.createHistoricProcessInstanceQuery().processInstanceTenantId(tenantId.toString()).finished();
    for(HistoricProcessInstance instance: query.list()){
        historyService.deleteHistoricProcessInstance(instance.getId());
    }
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:13,代码来源:BPMNInstanceService.java

示例8: getAvgTimeDurationForCompletedProcesses

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
/**
 * Get the average time duration of completed processes
 *
 * @return list with the completed processes and the average time duration taken for each process
 */
@GET
@Path("/process-instances/duration/average")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public ResponseHolder getAvgTimeDurationForCompletedProcesses() {

    ResponseHolder response = new ResponseHolder();
    List<Object> list = new ArrayList<>();

    HistoryService historyService = BPMNOSGIService.getHistoryService();
    RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
    List<ProcessDefinition> deployedProcessList = repositoryService.
            createProcessDefinitionQuery().processDefinitionTenantId(getTenantIdStr()).list();

    for (ProcessDefinition instance : deployedProcessList) {
        ProcessInstanceAverageInfo bpmnProcessInstance = new ProcessInstanceAverageInfo();
        bpmnProcessInstance.setProcessDefinitionId(instance.getId());
        double totalTime = 0;
        double averageTime;
        String processDefinitionID = instance.getId();

        HistoricProcessInstanceQuery historicProcessInstanceQuery = historyService.
                createHistoricProcessInstanceQuery().processInstanceTenantId(getTenantIdStr()).
                    processDefinitionId(processDefinitionID).finished();
        long instanceCount = historicProcessInstanceQuery.count();

        if (instanceCount != 0) {
            List<HistoricProcessInstance> instanceList = historicProcessInstanceQuery.list();

            for (HistoricProcessInstance completedProcess : instanceList) {
                double timeDurationOfTask = completedProcess.getDurationInMillis();
                double timeInMins = timeDurationOfTask / (1000 * 60);
                totalTime += timeInMins;
            }
            averageTime = totalTime / instanceCount;
            bpmnProcessInstance.setAverageTimeForCompletion(averageTime);
            list.add(bpmnProcessInstance);
        }
    }
    response.setData(list);
    return response;
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:47,代码来源:ProcessStatisticsService.java

示例9: queryProcess

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入方法依赖的package包/类
@Override
	public List<HistoricProcessInstance> queryProcess(
			String processDefinitionId, String taskDefinitionKey,
			String startedOrgId, Date startTime, Date endTime) {
		HistoricProcessInstanceQuery query = historyService
				.createHistoricProcessInstanceQuery().unfinished();
		if (processDefinitionId != null && !"".equals(processDefinitionId)) {
			query.processDefinitionId(processDefinitionId);
		}
		if (startTime != null && !"".equals(startTime)) {
			query.startedAfter(startTime);
		}
		if (endTime != null && !"".equals(endTime)) {
			query.startedAfter(endTime);
		}
		if (!StringUtils.isEmpty(startedOrgId)) {
			query.variableValueEquals("startCompanyId", startedOrgId);
		}
		List<HistoricProcessInstance> hPiList = query.list();
		if (hPiList == null || hPiList.size() < 1)
			return null;
		List<HistoricProcessInstance> temphPis = new ArrayList<HistoricProcessInstance>();
		for (HistoricProcessInstance pi : hPiList) {
			// 获取流程的当前节点
			// 执行实例
			ExecutionEntity execution = (ExecutionEntity) runtimeService
					.createProcessInstanceQuery().processInstanceId(pi.getId())
					.singleResult();
			String activityId = execution.getActivityId();
			// 判断流程是否包含选定的节点定义key
			if (taskDefinitionKey != null
					&& StringUtils.isNotEmpty(taskDefinitionKey)
					&& !taskDefinitionKey.equals(activityId)) {
				// 将不满足条件的流程从集合中移除
				temphPis.add(pi);
			}
			if (!StringUtils.isEmpty(startedOrgId)
					&& !StringUtils.isEmpty(pi.getStartUserId())) {
				String userId = pi.getStartUserId();
				IBaseEntity user = authService.resolveUserByUserExp(userId);
//				if (user != null && !startedOrgId.equals(user.getOrgId())) {
//					temphPis.add(pi);
//				}
			}
		}
		// 将不满足条件的流程从集合中移除
		hPiList.removeAll(temphPis);
		if (hPiList.size() > 0) {
			return hPiList;
		} else {
			return null;
		}
	}
 
开发者ID:lz84,项目名称:bachelor,代码行数:54,代码来源:BpmRepositoryServiceImpl.java


注:本文中的org.activiti.engine.history.HistoricProcessInstanceQuery.list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。