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


Java HistoricProcessInstanceQuery类代码示例

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


HistoricProcessInstanceQuery类属于org.activiti.engine.history包,在下文中一共展示了HistoricProcessInstanceQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testGetHistoricProcessInstanceByProcessInstanceId

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
@Test
public void testGetHistoricProcessInstanceByProcessInstanceId()
{
    String processInstanceId = "processInstanceId";
    HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
    when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.processInstanceId(processInstanceId)).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.includeProcessVariables()).thenReturn(historicProcessInstanceQuery);
    HistoricProcessInstance expectedHistoricProcessInstance = mock(HistoricProcessInstance.class);
    when(historicProcessInstanceQuery.singleResult()).thenReturn(expectedHistoricProcessInstance);
    HistoricProcessInstance actualHistoricProcessInstance = activitiService.getHistoricProcessInstanceByProcessInstanceId(processInstanceId);
    assertSame(expectedHistoricProcessInstance, actualHistoricProcessInstance);
    InOrder inOrder = inOrder(historicProcessInstanceQuery);
    inOrder.verify(historicProcessInstanceQuery).processInstanceId(processInstanceId);
    inOrder.verify(historicProcessInstanceQuery).includeProcessVariables();
    inOrder.verify(historicProcessInstanceQuery).singleResult();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:19,代码来源:ActivitiServiceTest.java

示例4: testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeys

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
@Test
public void testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeys()
{
    JobStatusEnum jobStatus = JobStatusEnum.RUNNING;
    Collection<String> processDefinitionKeys = new ArrayList<>();
    DateTime startTime = new DateTime();
    DateTime endTime = new DateTime();
    HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
    when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys))).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.unfinished()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.startedAfter(startTime.toDate())).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.finishedBefore(endTime.toDate())).thenReturn(historicProcessInstanceQuery);
    List<HistoricProcessInstance> expectedHistoricProcessInstances = new ArrayList<>();
    when(historicProcessInstanceQuery.list()).thenReturn(expectedHistoricProcessInstances);
    List<HistoricProcessInstance> actualHistoricProcessInstance =
        activitiService.getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(jobStatus, processDefinitionKeys, startTime, endTime);
    assertSame(expectedHistoricProcessInstances, actualHistoricProcessInstance);
    InOrder inOrder = inOrder(historicProcessInstanceQuery);
    inOrder.verify(historicProcessInstanceQuery).processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys));
    inOrder.verify(historicProcessInstanceQuery).unfinished();
    inOrder.verify(historicProcessInstanceQuery).startedAfter(startTime.toDate());
    inOrder.verify(historicProcessInstanceQuery).finishedBefore(endTime.toDate());
    inOrder.verify(historicProcessInstanceQuery).list();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:27,代码来源:ActivitiServiceTest.java

示例5: testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenStatusCompleted

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
@Test
public void testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenStatusCompleted()
{
    JobStatusEnum jobStatus = JobStatusEnum.COMPLETED;
    Collection<String> processDefinitionKeys = new ArrayList<>();
    DateTime startTime = new DateTime();
    DateTime endTime = new DateTime();
    HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
    when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys))).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.unfinished()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.startedAfter(startTime.toDate())).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.finishedBefore(endTime.toDate())).thenReturn(historicProcessInstanceQuery);
    List<HistoricProcessInstance> expectedHistoricProcessInstances = new ArrayList<>();
    when(historicProcessInstanceQuery.list()).thenReturn(expectedHistoricProcessInstances);
    List<HistoricProcessInstance> actualHistoricProcessInstance =
        activitiService.getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(jobStatus, processDefinitionKeys, startTime, endTime);
    assertSame(expectedHistoricProcessInstances, actualHistoricProcessInstance);
    InOrder inOrder = inOrder(historicProcessInstanceQuery);
    inOrder.verify(historicProcessInstanceQuery).processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys));
    inOrder.verify(historicProcessInstanceQuery).finished();
    inOrder.verify(historicProcessInstanceQuery).startedAfter(startTime.toDate());
    inOrder.verify(historicProcessInstanceQuery).finishedBefore(endTime.toDate());
    inOrder.verify(historicProcessInstanceQuery).list();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:27,代码来源:ActivitiServiceTest.java

示例6: testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenStatusNotSpecified

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
@Test
public void testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenStatusNotSpecified()
{
    JobStatusEnum jobStatus = null;
    Collection<String> processDefinitionKeys = new ArrayList<>();
    DateTime startTime = new DateTime();
    DateTime endTime = new DateTime();
    HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
    when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys))).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.unfinished()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.startedAfter(startTime.toDate())).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.finishedBefore(endTime.toDate())).thenReturn(historicProcessInstanceQuery);
    List<HistoricProcessInstance> expectedHistoricProcessInstances = new ArrayList<>();
    when(historicProcessInstanceQuery.list()).thenReturn(expectedHistoricProcessInstances);
    List<HistoricProcessInstance> actualHistoricProcessInstance =
        activitiService.getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(jobStatus, processDefinitionKeys, startTime, endTime);
    assertSame(expectedHistoricProcessInstances, actualHistoricProcessInstance);
    InOrder inOrder = inOrder(historicProcessInstanceQuery);
    inOrder.verify(historicProcessInstanceQuery).processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys));
    inOrder.verify(historicProcessInstanceQuery).startedAfter(startTime.toDate());
    inOrder.verify(historicProcessInstanceQuery).finishedBefore(endTime.toDate());
    inOrder.verify(historicProcessInstanceQuery).list();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:26,代码来源:ActivitiServiceTest.java

示例7: testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenStartTimeNotSpecified

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
@Test
public void testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenStartTimeNotSpecified()
{
    JobStatusEnum jobStatus = JobStatusEnum.RUNNING;
    Collection<String> processDefinitionKeys = new ArrayList<>();
    DateTime startTime = null;
    DateTime endTime = new DateTime();
    HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
    when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys))).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.unfinished()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.finishedBefore(endTime.toDate())).thenReturn(historicProcessInstanceQuery);
    List<HistoricProcessInstance> expectedHistoricProcessInstances = new ArrayList<>();
    when(historicProcessInstanceQuery.list()).thenReturn(expectedHistoricProcessInstances);
    List<HistoricProcessInstance> actualHistoricProcessInstance =
        activitiService.getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(jobStatus, processDefinitionKeys, startTime, endTime);
    assertSame(expectedHistoricProcessInstances, actualHistoricProcessInstance);
    InOrder inOrder = inOrder(historicProcessInstanceQuery);
    inOrder.verify(historicProcessInstanceQuery).processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys));
    inOrder.verify(historicProcessInstanceQuery).unfinished();
    inOrder.verify(historicProcessInstanceQuery).finishedBefore(endTime.toDate());
    inOrder.verify(historicProcessInstanceQuery).list();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:25,代码来源:ActivitiServiceTest.java

示例8: testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenEndTimeNotSpecified

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
@Test
public void testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenEndTimeNotSpecified()
{
    JobStatusEnum jobStatus = JobStatusEnum.RUNNING;
    Collection<String> processDefinitionKeys = new ArrayList<>();
    DateTime startTime = new DateTime();
    DateTime endTime = null;
    HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
    when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys))).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.unfinished()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.startedAfter(startTime.toDate())).thenReturn(historicProcessInstanceQuery);
    List<HistoricProcessInstance> expectedHistoricProcessInstances = new ArrayList<>();
    when(historicProcessInstanceQuery.list()).thenReturn(expectedHistoricProcessInstances);
    List<HistoricProcessInstance> actualHistoricProcessInstance =
        activitiService.getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(jobStatus, processDefinitionKeys, startTime, endTime);
    assertSame(expectedHistoricProcessInstances, actualHistoricProcessInstance);
    InOrder inOrder = inOrder(historicProcessInstanceQuery);
    inOrder.verify(historicProcessInstanceQuery).processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys));
    inOrder.verify(historicProcessInstanceQuery).unfinished();
    inOrder.verify(historicProcessInstanceQuery).startedAfter(startTime.toDate());
    inOrder.verify(historicProcessInstanceQuery).list();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:25,代码来源:ActivitiServiceTest.java

示例9: getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
@Test
public void getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys()
{
    JobStatusEnum jobStatus = JobStatusEnum.RUNNING;
    Collection<String> processDefinitionKeys = new ArrayList<>();
    DateTime startTime = new DateTime();
    DateTime endTime = new DateTime();
    HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
    when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys))).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.unfinished()).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.startedAfter(startTime.toDate())).thenReturn(historicProcessInstanceQuery);
    when(historicProcessInstanceQuery.finishedBefore(endTime.toDate())).thenReturn(historicProcessInstanceQuery);
    long expectedResult = 1234l;
    when(historicProcessInstanceQuery.count()).thenReturn(expectedResult);
    long actualResult =
        activitiService.getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys(jobStatus, processDefinitionKeys, startTime, endTime);
    assertEquals(expectedResult, actualResult);
    InOrder inOrder = inOrder(historicProcessInstanceQuery);
    inOrder.verify(historicProcessInstanceQuery).processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys));
    inOrder.verify(historicProcessInstanceQuery).unfinished();
    inOrder.verify(historicProcessInstanceQuery).startedAfter(startTime.toDate());
    inOrder.verify(historicProcessInstanceQuery).finishedBefore(endTime.toDate());
    inOrder.verify(historicProcessInstanceQuery).count();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:27,代码来源:ActivitiServiceTest.java

示例10: 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

示例11: getPaginatedInstances

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
/**
 * Get paginated instances
 *
 * @param start
 * @param size
 * @return list of BPMNInstances
 * @throws BPSFault
 */
public BPMNInstance[] getPaginatedInstances(int start, int size) throws BPSFault {
    List<BPMNInstance> bpmnInstanceList = new ArrayList<>();
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    ProcessEngine engine = BPMNServerHolder.getInstance().getEngine();
    RuntimeService runtimeService = engine.getRuntimeService();
    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery().processInstanceTenantId(tenantId.toString());
    HistoricProcessInstanceQuery historicQuery = BPMNServerHolder.getInstance().getEngine().getHistoryService()
            .createHistoricProcessInstanceQuery().processInstanceTenantId(tenantId.toString());
    processInstanceCount = (int) query.count();
    List<ProcessInstance> instances = query.includeProcessVariables().listPage(start, size);
    for (ProcessInstance instance: instances) {
        BPMNInstance bpmnInstance = new BPMNInstance();
        bpmnInstance.setInstanceId(instance.getId());
        bpmnInstance.setProcessId(instance.getProcessDefinitionId());
        bpmnInstance.setSuspended(instance.isSuspended());
        bpmnInstance.setStartTime(historicQuery.processInstanceId(instance.getId()).singleResult().getStartTime());
        bpmnInstance.setVariables(formatVariables(instance.getProcessVariables()));
        bpmnInstanceList.add(bpmnInstance);
    }
    return bpmnInstanceList.toArray(new BPMNInstance[bpmnInstanceList.size()]);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:30,代码来源:BPMNInstanceService.java

示例12: getPaginatedHistoryInstances

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
/**
 * Get paginated history instances
 *
 * @param start
 * @param size
 * @return list of BPMNInstances
 */
public BPMNInstance[] getPaginatedHistoryInstances(int start, int size){
    BPMNInstance bpmnInstance;
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    List<BPMNInstance> bpmnInstances = new ArrayList<>();
    HistoryService historyService = BPMNServerHolder.getInstance().getEngine().getHistoryService();
    HistoricProcessInstanceQuery query =
            historyService.createHistoricProcessInstanceQuery().processInstanceTenantId(tenantId.toString())
                    .finished().includeProcessVariables();
    historyInstanceCount = (int) query.count();
    List<HistoricProcessInstance> historicProcessInstances = query.listPage(start, size);
    for(HistoricProcessInstance instance: historicProcessInstances){
        bpmnInstance = new BPMNInstance();
        bpmnInstance.setInstanceId(instance.getId());
        bpmnInstance.setProcessId(instance.getProcessDefinitionId());
        bpmnInstance.setStartTime(instance.getStartTime());
        bpmnInstance.setEndTime(instance.getEndTime());
        bpmnInstance.setVariables(formatVariables(instance.getProcessVariables()));
        bpmnInstances.add(bpmnInstance);
    }
    return bpmnInstances.toArray(new BPMNInstance[bpmnInstances.size()]);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:29,代码来源:BPMNInstanceService.java

示例13: getTenantBPMNHistoryInstances

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
/**
 * Get tenant history instances from a passed list
 *
 * @param instances
 * @return list of BPMNInstances
 */
private BPMNInstance[] getTenantBPMNHistoryInstances(List<ProcessInstance> instances) {
    BPMNInstance bpmnInstance;
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    List<BPMNInstance> bpmnInstances = new ArrayList<BPMNInstance>();
    RuntimeService runtimeService = BPMNServerHolder.getInstance().getEngine().getRuntimeService();
    HistoricProcessInstanceQuery query = BPMNServerHolder.getInstance().getEngine().getHistoryService()
            .createHistoricProcessInstanceQuery().processInstanceTenantId(tenantId.toString());
    for (ProcessInstance instance : instances) {
        bpmnInstance = new BPMNInstance();
        bpmnInstance.setInstanceId(instance.getId());
        bpmnInstance.setProcessId(instance.getProcessDefinitionId());
        bpmnInstance.setSuspended(instance.isSuspended());
        bpmnInstance.setStartTime(query.processInstanceId(instance.getId()).singleResult().getStartTime());
        bpmnInstance.setVariables(formatVariables(runtimeService.getVariables(instance.getId())));
        bpmnInstances.add(bpmnInstance);
    }
    return bpmnInstances.toArray(new BPMNInstance[bpmnInstances.size()]);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:25,代码来源:BPMNInstanceService.java

示例14: getTenantBPMNInstances

import org.activiti.engine.history.HistoricProcessInstanceQuery; //导入依赖的package包/类
/**
 * Internally used method to get all tenant BPMN instances from a passed instance list
 *
 * @param instances
 * @return list of BPMNInstances
 */
private BPMNInstance[] getTenantBPMNInstances(List<ProcessInstance> instances) {
    BPMNInstance bpmnInstance;
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    List<BPMNInstance> bpmnInstances = new ArrayList<BPMNInstance>();
    RuntimeService runtimeService = BPMNServerHolder.getInstance().getEngine().getRuntimeService();
    HistoricProcessInstanceQuery query = BPMNServerHolder.getInstance().getEngine().getHistoryService()
            .createHistoricProcessInstanceQuery().processInstanceTenantId(tenantId.toString());
    for (ProcessInstance instance : instances) {
        bpmnInstance = new BPMNInstance();
        bpmnInstance.setInstanceId(instance.getId());
        bpmnInstance.setProcessId(instance.getProcessDefinitionId());
        bpmnInstance.setSuspended(instance.isSuspended());
        bpmnInstance.setStartTime(query.processInstanceId(instance.getId()).singleResult().getStartTime());
        bpmnInstance.setVariables(formatVariables(runtimeService.getVariables(instance.getId())));
        bpmnInstances.add(bpmnInstance);
    }
    return bpmnInstances.toArray(new BPMNInstance[bpmnInstances.size()]);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:25,代码来源:BPMNInstanceService.java

示例15: 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


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