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


Java ProcessInstanceQuery类代码示例

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


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

示例1: setUp

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
@BeforeTest
public void setUp(){
	RuntimeService rts = mock(RuntimeService.class);
	List<ProcessInstance> processList = new ArrayList<ProcessInstance>();
	ExecutionEntity executionEntity = new  ExecutionEntity();
	executionEntity.setActive(false);
	processList.add(executionEntity);
	
	ProcessInstanceQuery pQuery = mock(ProcessInstanceQuery.class);
	when(pQuery.active()).thenReturn(pQuery);
	when(pQuery.list()).thenReturn(processList);
	when(rts.createProcessInstanceQuery()).thenReturn(pQuery);

	this.servlet.setRuntimeService(rts);
	this.servlet.setWoDispatcher(mock(WoDispatcher.class));
	this.servlet.init();
}
 
开发者ID:oneops,项目名称:oneops,代码行数:18,代码来源:CtrlrServletTest.java

示例2: runningList

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
/**
 * 流程定义列表
 */
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;
}
 
开发者ID:EleTeam,项目名称:Shop-for-JavaWeb,代码行数:20,代码来源:ActProcessService.java

示例3: testGetProcessInstanceById

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
@Test
public void testGetProcessInstanceById()
{
    String processInstanceId = "processInstanceId";
    ProcessInstanceQuery processInstanceQuery = mock(ProcessInstanceQuery.class);
    when(activitiRuntimeService.createProcessInstanceQuery()).thenReturn(processInstanceQuery);
    when(processInstanceQuery.processInstanceId(processInstanceId)).thenReturn(processInstanceQuery);
    when(processInstanceQuery.includeProcessVariables()).thenReturn(processInstanceQuery);
    ProcessInstance expectedProcessInstance = mock(ProcessInstance.class);
    when(processInstanceQuery.singleResult()).thenReturn(expectedProcessInstance);
    ProcessInstance actualProcessInstance = activitiService.getProcessInstanceById(processInstanceId);
    assertSame(expectedProcessInstance, actualProcessInstance);
    InOrder inOrder = inOrder(processInstanceQuery);
    inOrder.verify(processInstanceQuery).processInstanceId(processInstanceId);
    inOrder.verify(processInstanceQuery).includeProcessVariables();
    inOrder.verify(processInstanceQuery).singleResult();
    inOrder.verifyNoMoreInteractions();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:19,代码来源:ActivitiServiceTest.java

示例4: testQueryByProcessInstanceIds

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
public void testQueryByProcessInstanceIds() {
  Set<String> processInstanceIds = new HashSet<String>(this.processInstanceIds);

  // start an instance that will not be part of the query
  runtimeService.startProcessInstanceByKey("oneTaskProcess2", "2");
 
  ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processInstanceIds(processInstanceIds);
  assertEquals(5, processInstanceQuery.count());
  
  List<ProcessInstance> processInstances = processInstanceQuery.list();
  assertNotNull(processInstances);
  assertEquals(5, processInstances.size());
  
  for (ProcessInstance processInstance : processInstances) {
    assertTrue(processInstanceIds.contains(processInstance.getId()));
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:ProcessInstanceQueryTest.java

示例5: testCycleDateStartTimerEvent

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
@Deployment
public void testCycleDateStartTimerEvent() throws Exception {
  ClockUtil.setCurrentTime(new Date());

  // After process start, there should be timer created
  JobQuery jobQuery = managementService.createJobQuery();
  assertEquals(1, jobQuery.count());

  moveByMinutes(5);
  ProcessInstanceQuery piq = runtimeService.createProcessInstanceQuery().processDefinitionKey("startTimerEventExample");
  assertEquals(1, piq.count());
  assertEquals(1, jobQuery.count());

  moveByMinutes(5);
  assertEquals(2, piq.count());
  assertEquals(1, jobQuery.count());
  //have to manually delete pending timer
  cleanDB();

}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:StartTimerEventTest.java

示例6: testCycleWithLimitStartTimerEvent

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
@Deployment
public void testCycleWithLimitStartTimerEvent() throws Exception {
  ClockUtil.setCurrentTime(new Date());

  // After process start, there should be timer created
  JobQuery jobQuery = managementService.createJobQuery();
  assertEquals(1, jobQuery.count());

  moveByMinutes(5);
  ProcessInstanceQuery piq = runtimeService.createProcessInstanceQuery().processDefinitionKey("startTimerEventExampleCycle");
  assertEquals(1, piq.count());
  assertEquals(1, jobQuery.count());

  moveByMinutes(5);
  assertEquals(2, piq.count());
  assertEquals(0, jobQuery.count());

}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:StartTimerEventTest.java

示例7: getPaginatedInstances

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的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

示例8: getPiStatusByBizKey

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
@Override
public PiStatus getPiStatusByBizKey(String bizKey) {
	ProcessInstanceQuery query = runtimeService
			.createProcessInstanceQuery();
	long count = query.processInstanceBusinessKey(bizKey).count();
	if (count > 0) {
		// 流程正在运行中
		return PiStatus.Running;
	} else {
		count = historyService.createHistoricProcessInstanceQuery()
				.finished().processInstanceBusinessKey(bizKey).count();
		if (count > 0) {
			// 流程已经结束
			return PiStatus.Finished;
		} else {
			// 没有流程信息
			return PiStatus.NotFound;
		}
	}
}
 
开发者ID:lz84,项目名称:bachelor,代码行数:21,代码来源:BpmRuntimeServiceImpl.java

示例9: getPiStatusByPiId

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
@Override
public PiStatus getPiStatusByPiId(String piId) {
	ProcessInstanceQuery query = runtimeService
			.createProcessInstanceQuery();
	long count = query.processInstanceId(piId).count();
	if (count > 0) {
		// 流程正在运行中
		return PiStatus.Running;
	} else {
		count = historyService.createHistoricProcessInstanceQuery()
				.finished().processInstanceId(piId).count();
		if (count > 0) {
			// 流程已经结束
			return PiStatus.Finished;
		} else {
			// 没有流程信息
			return PiStatus.NotFound;
		}
	}
}
 
开发者ID:lz84,项目名称:bachelor,代码行数:21,代码来源:BpmRuntimeServiceImpl.java

示例10: mockProcessEngine

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
public ProcessEngine mockProcessEngine(String processInstanceId, String businessKey, String providerId) {
    ProcessInstance instance = mock(ProcessInstance.class);
    when(instance.getId()).thenReturn(processInstanceId);

    ProcessInstanceQuery query = mock(ProcessInstanceQuery.class);
    when(query.singleResult()).thenReturn(instance);
    when(query.processInstanceBusinessKey(eq(businessKey))).thenReturn(query);

    RuntimeService runtimeService = mock(RuntimeService.class);
    when(runtimeService.createProcessInstanceQuery()).thenReturn(query);
    when(runtimeService.getVariable(eq(processInstanceId), eq(CoreProcessVariables.PROVIDER)))
        .thenReturn(providerId);

    ProcessEngine processEngine = mock(ProcessEngine.class);
    when(processEngine.getRuntimeService()).thenReturn(runtimeService);

    return processEngine;
}
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:19,代码来源:DestroyPoolCommandTest.java

示例11: newMockProcessEngine

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
private ProcessEngine newMockProcessEngine() {
    final ProcessEngine engine = mock(ProcessEngine.class);
    final List<ProcessInstance> processes = ImmutableList.of(
        newProcessInstanceMock("p1", BUSINESS_KEY, true),
        newProcessInstanceMock("p2", BUSINESS_KEY, false),
        newProcessInstanceMock("p3", BUSINESS_KEY, true)
    );

    final RuntimeService runtimeService = mock(RuntimeService.class);
    final ProcessInstanceQuery processInstanceQuery = mock(ProcessInstanceQuery.class);

    when(engine.getRuntimeService()).thenReturn(runtimeService);
    when(runtimeService.createProcessInstanceQuery()).thenReturn(processInstanceQuery);
    when(processInstanceQuery.variableValueEquals(CoreProcessVariables.POOL_BUSINESS_KEY, BUSINESS_KEY))
        .thenReturn(processInstanceQuery);
    when(processInstanceQuery.orderByProcessInstanceId()).thenReturn(processInstanceQuery);
    when(processInstanceQuery.desc()).thenReturn(processInstanceQuery);
    when(processInstanceQuery.list()).thenReturn(processes);

    return engine;
}
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:22,代码来源:ResetRetriesCommandTest.java

示例12: mockRuntimeService

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
protected RuntimeService mockRuntimeService(Map<String, ProcessInstance> instances, 
                                          String... notFoundProcessInstanceIds) {
    RuntimeService runtimeService = mock(RuntimeService.class);

    ProcessInstanceQuery generalQuery = mock(ProcessInstanceQuery.class);
    for (Map.Entry<String, ProcessInstance> entry : instances.entrySet()) {
        ProcessInstanceQuery specificQuery = mock(ProcessInstanceQuery.class);
        when(specificQuery.singleResult()).thenReturn(entry.getValue());

        when(generalQuery.processInstanceId(eq(entry.getKey()))).thenReturn(specificQuery);
    }
    for (String notFound : notFoundProcessInstanceIds) {
        /* create a mock that returns null for all method calls (default) */
        when(generalQuery.processInstanceId(eq(notFound))).thenReturn(mock(ProcessInstanceQuery.class));
    }
    when(runtimeService.createProcessInstanceQuery()).thenReturn(generalQuery);

    return runtimeService;
}
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:20,代码来源:CheckProcessesTest.java

示例13: running

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
@RequestMapping(value = "running")
    public ModelAndView running(Model model, HttpServletRequest request) {
        ModelAndView mav = new ModelAndView("/workflow/running-manage");
//        Page<ProcessInstance> page = new Page<ProcessInstance>(PageUtil.PAGE_SIZE);
//        int[] pageParams = PageUtil.init(page, request);

        ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
        List<ProcessInstance> list = processInstanceQuery.listPage(1, 10);
//        page.setResult(list);
//        page.setTotalCount(processInstanceQuery.count());
        mav.addObject("page", list);
        return mav;
    }
 
开发者ID:batizhao,项目名称:microservice,代码行数:14,代码来源:ProcessInstanceController.java

示例14: processInstanceBusinessKey

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
@Override
public ProcessInstanceQuery processInstanceBusinessKey(String businessKey) {
    if (businessKey == null) {
        throw new ActivitiIllegalArgumentException("Business key is null");
    }
    if (inOrStatement) {
        this.currentOrQueryObject.businessKey = businessKey;
    } else {
        this.businessKey = businessKey;
    }
    return this;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:13,代码来源:ProcessInstanceQueryImpl.java

示例15: processInstanceTenantId

import org.activiti.engine.runtime.ProcessInstanceQuery; //导入依赖的package包/类
@Override
public ProcessInstanceQuery processInstanceTenantId(String tenantId) {
    if (tenantId == null) {
        throw new ActivitiIllegalArgumentException("process instance tenant id is null");
    }
    if (inOrStatement) {
        this.currentOrQueryObject.tenantId = tenantId;
    } else {
        this.tenantId = tenantId;
    }
    return this;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:13,代码来源:ProcessInstanceQueryImpl.java


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