本文整理汇总了Java中org.activiti.engine.runtime.ExecutionQuery类的典型用法代码示例。如果您正苦于以下问题:Java ExecutionQuery类的具体用法?Java ExecutionQuery怎么用?Java ExecutionQuery使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExecutionQuery类属于org.activiti.engine.runtime包,在下文中一共展示了ExecutionQuery类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testReceiveMessageManual
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
/**
* 在审核文件节点抛出消息事件触发消息边界事件--cancelActivity='true'
*/
@Deployment(resources = "chapter11/boundaryEvent/signalBoundaryEvent.bpmn")
public void testReceiveMessageManual() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("signalBoundaryEvent");
assertNotNull(processInstance);
// 审核文件任务
Task task = taskService.createTaskQuery().taskName("审核文件").singleResult();
assertNotNull(task);
ExecutionQuery executionQuery = runtimeService.createExecutionQuery().signalEventSubscriptionName("S_协助处理");
Execution execution = executionQuery.singleResult();
runtimeService.signalEventReceived("S_协助处理", execution.getId());
// 任务到达“协助处理节点”
task = taskService.createTaskQuery().taskName("协助处理").singleResult();
assertNotNull(task);
taskService.complete(task.getId());
// 任务流转至审核文件节点
task = taskService.createTaskQuery().taskName("审核文件").singleResult();
assertNotNull(task);
// 验证流程实例运行结束
taskService.complete(task.getId());
assertEquals(1, historyService.createHistoricProcessInstanceQuery().finished().count());
}
示例2: testCompleteDirectly
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
/**
* 不触发消息边界事件,直接完成任务--cancelActivity='true'
*/
@Deployment(resources = "chapter11/boundaryEvent/signalBoundaryEvent.bpmn")
public void testCompleteDirectly() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("signalBoundaryEvent");
assertNotNull(processInstance);
// 审核文件任务
Task task = taskService.createTaskQuery().taskName("审核文件").singleResult();
assertNotNull(task);
ExecutionQuery executionQuery = runtimeService.createExecutionQuery();
Execution execution = executionQuery.signalEventSubscriptionName("S_协助处理").singleResult();
assertNotNull(execution);
taskService.complete(task.getId());
}
示例3: testCompleteDirectly
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
/**
* 不触发消息边界事件,直接完成任务--cancelActivity='true'
*/
@Deployment(resources = "chapter11/boundaryEvent/messageBoundaryEvent.bpmn")
public void testCompleteDirectly() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("messageBoundaryEvent");
assertNotNull(processInstance);
// 审核文件任务
Task task = taskService.createTaskQuery().taskName("审核文件").singleResult();
assertNotNull(task);
ExecutionQuery executionQuery = runtimeService.createExecutionQuery();
Execution execution = executionQuery.messageEventSubscriptionName("MSG_协助处理").singleResult();
assertNotNull(execution);
taskService.complete(task.getId());
execution = executionQuery.messageEventSubscriptionName("MSG_协助处理").singleResult();
assertNull(execution);
}
示例4: getExecutionByProcessInstanceIdAndActivitiId
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
@Test
public void getExecutionByProcessInstanceIdAndActivitiId()
{
String processInstanceId = "processInstanceId";
String activitiId = "activitiId";
ExecutionQuery executionQuery = mock(ExecutionQuery.class);
when(activitiRuntimeService.createExecutionQuery()).thenReturn(executionQuery);
when(executionQuery.processInstanceId(processInstanceId)).thenReturn(executionQuery);
when(executionQuery.activityId(activitiId)).thenReturn(executionQuery);
Execution expectedExecution = mock(Execution.class);
when(executionQuery.singleResult()).thenReturn(expectedExecution);
Execution actualExecution = activitiService.getExecutionByProcessInstanceIdAndActivitiId(processInstanceId, activitiId);
assertSame(expectedExecution, actualExecution);
InOrder inOrder = inOrder(executionQuery);
inOrder.verify(executionQuery).processInstanceId(processInstanceId);
inOrder.verify(executionQuery).activityId(activitiId);
inOrder.verify(executionQuery).singleResult();
inOrder.verifyNoMoreInteractions();
}
示例5: processInstanceBusinessKey
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
@Override
public ExecutionQuery processInstanceBusinessKey(String businessKey) {
if (businessKey == null) {
throw new ActivitiIllegalArgumentException("Business key is null");
}
this.businessKey = businessKey;
return this;
}
示例6: eventSubscription
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
public ExecutionQuery eventSubscription(String eventType, String eventName) {
if (eventName == null) {
throw new ActivitiIllegalArgumentException("event name is null");
}
if (eventType == null) {
throw new ActivitiIllegalArgumentException("event type is null");
}
if (eventSubscriptions == null) {
eventSubscriptions = new ArrayList<>();
}
eventSubscriptions.add(new EventSubscriptionQueryValue(eventName, eventType));
return this;
}
示例7: signal
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
/**
* Signals a task by its process instance ID and the ID of the task to signal.
*
* @param processInstanceId The process instance ID of the waiting task.
* @param signalTaskId The ID of the task to signal.
*/
public void signal(String processInstanceId, String signalTaskId)
{
ExecutionQuery signalTaskQuery = runtimeService.createExecutionQuery().processInstanceId(processInstanceId).activityId(signalTaskId);
Execution execution = signalTaskQuery.singleResult();
runtimeService.signal(execution.getId());
}
示例8: testSignal
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
@Test
public void testSignal()
{
// Create variables required for testing.
final String processInstanceId = ACTIVITI_ID;
final String signalTaskId = ACTIVITI_ID_2;
final String executionId = ACTIVITI_ID_3;
// Mock dependencies.
ExecutionQuery executionQuery = mock(ExecutionQuery.class);
Execution execution = mock(Execution.class);
when(runtimeService.createExecutionQuery()).thenReturn(executionQuery);
when(executionQuery.processInstanceId(processInstanceId)).thenReturn(executionQuery);
when(executionQuery.activityId(signalTaskId)).thenReturn(executionQuery);
when(executionQuery.singleResult()).thenReturn(execution);
when(execution.getId()).thenReturn(executionId);
// Call the method under test.
activitiRuntimeHelper.signal(processInstanceId, signalTaskId);
// Verify the calls.
verify(runtimeService).createExecutionQuery();
verify(executionQuery).processInstanceId(processInstanceId);
verify(executionQuery).activityId(signalTaskId);
verify(executionQuery).singleResult();
verify(execution).getId();
verify(runtimeService).signal(executionId);
verifyNoMoreInteractions(executionQuery, execution, runtimeService);
}
示例9: testQueryByProcessInstanceId
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
public void testQueryByProcessInstanceId() {
for (String processInstanceId : concurrentProcessInstanceIds) {
ExecutionQuery query = runtimeService.createExecutionQuery().processInstanceId(processInstanceId);
assertEquals(3, query.list().size());
assertEquals(3, query.count());
}
assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(sequentialProcessInstanceIds.get(0)).list().size());
}
示例10: testQueryByActivityId
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
public void testQueryByActivityId() {
ExecutionQuery query = runtimeService.createExecutionQuery().activityId("receivePayment");
assertEquals(4, query.list().size());
assertEquals(4, query.count());
try {
assertNull(query.singleResult());
fail();
} catch (ActivitiException e) { }
}
示例11: testQueryAllVariableTypes
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
@Deployment(resources={
"org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml"})
public void testQueryAllVariableTypes() throws Exception {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("nullVar", null);
vars.put("stringVar", "string");
vars.put("longVar", 10L);
vars.put("doubleVar", 1.2);
vars.put("integerVar", 1234);
vars.put("booleanVar", true);
vars.put("shortVar", (short) 123);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", vars);
ExecutionQuery query = runtimeService.createExecutionQuery()
.variableValueEquals("nullVar", null)
.variableValueEquals("stringVar", "string")
.variableValueEquals("longVar", 10L)
.variableValueEquals("doubleVar", 1.2)
.variableValueEquals("integerVar", 1234)
.variableValueEquals("booleanVar", true)
.variableValueEquals("shortVar", (short) 123);
List<Execution> executions = query.list();
Assert.assertNotNull(executions);
Assert.assertEquals(1, executions.size());
Assert.assertEquals(processInstance.getId(), executions.get(0).getId());
runtimeService.deleteProcessInstance(processInstance.getId(), "test");
}
示例12: processInstanceBusinessKey
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
public ExecutionQuery processInstanceBusinessKey(String businessKey) {
if (businessKey == null) {
throw new ActivitiException("Business key is null");
}
this.businessKey = businessKey;
return this;
}
示例13: eventSubscription
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
public ExecutionQuery eventSubscription(String eventType, String eventName) {
if(eventName == null) {
throw new ActivitiException("event name is null");
}
if(eventType == null) {
throw new ActivitiException("event type is null");
}
this.eventSubscriptionType = eventType;
this.eventSubscriptionName = eventName;
return this;
}
示例14: processInstanceBusinessKey
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
public ExecutionQuery processInstanceBusinessKey(String businessKey) {
if (businessKey == null) {
throw new ActivitiIllegalArgumentException("Business key is null");
}
this.businessKey = businessKey;
return this;
}
示例15: eventSubscription
import org.activiti.engine.runtime.ExecutionQuery; //导入依赖的package包/类
public ExecutionQuery eventSubscription(String eventType, String eventName) {
if(eventName == null) {
throw new ActivitiIllegalArgumentException("event name is null");
}
if(eventType == null) {
throw new ActivitiIllegalArgumentException("event type is null");
}
if(eventSubscriptions == null) {
eventSubscriptions = new ArrayList<EventSubscriptionQueryValue>();
}
eventSubscriptions.add(new EventSubscriptionQueryValue(eventName, eventType));
return this;
}