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


Java TaskQuery.singleResult方法代码示例

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


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

示例1: testOrderProcessWithCallActivity

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
@Deployment(resources={
  "org/activiti/examples/bpmn/callactivity/orderProcess.bpmn20.xml",
  "org/activiti/examples/bpmn/callactivity/checkCreditProcess.bpmn20.xml"       
})
public void testOrderProcessWithCallActivity() {
  // After the process has started, the 'verify credit history' task should be active
  ProcessInstance pi = runtimeService.startProcessInstanceByKey("orderProcess");
  TaskQuery taskQuery = taskService.createTaskQuery();
  Task verifyCreditTask = taskQuery.singleResult();
  assertEquals("Verify credit history", verifyCreditTask.getName());
  
  // Verify with Query API
  ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult();
  assertNotNull(subProcessInstance);
  assertEquals(pi.getId(), runtimeService.createProcessInstanceQuery().subProcessInstanceId(subProcessInstance.getId()).singleResult().getId());
  
  // Completing the task with approval, will end the subprocess and continue the original process
  taskService.complete(verifyCreditTask.getId(), CollectionUtil.singletonMap("creditApproved", true));
  Task prepareAndShipTask = taskQuery.singleResult();
  assertEquals("Prepare and Ship", prepareAndShipTask.getName());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:CallActivityTest.java

示例2: testOrderProcessWithCallActivity

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
@Deployment(resources={
  "org/activiti/examples/bpmn/callactivity/orderProcess.bpmn20.xml",
  "org/activiti/examples/bpmn/callactivity/checkCreditProcess.bpmn20.xml"       
})
public void testOrderProcessWithCallActivity() {
  // After the process has started, the 'verify credit history' task should be active
  ProcessInstance pi = runtimeService.startProcessInstanceByKey("orderProcess");
  TaskQuery taskQuery = taskService.createTaskQuery();
  Task verifyCreditTask = taskQuery.singleResult();
  
  // Completing the task with approval, will end the subprocess and continue the original process
  taskService.complete(verifyCreditTask.getId(), CollectionUtil.singletonMap("creditApproved", true));
  Task prepareAndShipTask = taskQuery.singleResult();
  assertEquals("Prepare and Ship", prepareAndShipTask.getName());
  
   //verify
  HistoricProcessInstance historicProcessInstance = 
  	  historyService.createHistoricProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult();
  assertNotNull(historicProcessInstance);
  assertTrue(historicProcessInstance.getProcessDefinitionId().contains("checkCreditProcess"));
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:HistoryServiceTest.java

示例3: testCallSimpleSubProcess

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
@Deployment(resources = {
  "org/activiti/engine/test/bpmn/callactivity/CallActivity.testCallSimpleSubProcess.bpmn20.xml", 
  "org/activiti/engine/test/bpmn/callactivity/simpleSubProcess.bpmn20.xml" 
})
public void testCallSimpleSubProcess() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callSimpleSubProcess");
  
  // one task in the subprocess should be active after starting the process instance
  TaskQuery taskQuery = taskService.createTaskQuery();
  Task taskBeforeSubProcess = taskQuery.singleResult();
  assertEquals("Task before subprocess", taskBeforeSubProcess.getName());
  
  // Completing the task continues the process which leads to calling the subprocess
  taskService.complete(taskBeforeSubProcess.getId());
  Task taskInSubProcess = taskQuery.singleResult();
  assertEquals("Task in subprocess", taskInSubProcess.getName());
  
  // Completing the task in the subprocess, finishes the subprocess
  taskService.complete(taskInSubProcess.getId());
  Task taskAfterSubProcess = taskQuery.singleResult();
  assertEquals("Task after subprocess", taskAfterSubProcess.getName());
  
  // Completing this task end the process instance
  taskService.complete(taskAfterSubProcess.getId());
  assertProcessEnded(processInstance.getId());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:27,代码来源:CallActivityAdvancedTest.java

示例4: testSubProcessEndsSuperProcess

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
/**
 * Test case for a possible tricky case: reaching the end event
 * of the subprocess leads to an end event in the super process instance.
 */
@Deployment(resources = {
  "org/activiti/engine/test/bpmn/callactivity/CallActivity.testSubProcessEndsSuperProcess.bpmn20.xml", 
  "org/activiti/engine/test/bpmn/callactivity/simpleSubProcess.bpmn20.xml" })
public void testSubProcessEndsSuperProcess() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("subProcessEndsSuperProcess");
  
  // one task in the subprocess should be active after starting the process instance
  TaskQuery taskQuery = taskService.createTaskQuery();
  Task taskBeforeSubProcess = taskQuery.singleResult();
  assertEquals("Task in subprocess", taskBeforeSubProcess.getName());
  
  // Completing this task ends the subprocess which leads to the end of the whole process instance
  taskService.complete(taskBeforeSubProcess.getId());
  assertProcessEnded(processInstance.getId());
  assertEquals(0, runtimeService.createExecutionQuery().list().size());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:CallActivityAdvancedTest.java

示例5: testTimerOnCallActivity

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
@Deployment(resources = {
  "org/activiti/engine/test/bpmn/callactivity/CallActivity.testTimerOnCallActivity.bpmn20.xml",
  "org/activiti/engine/test/bpmn/callactivity/simpleSubProcess.bpmn20.xml"})
public void testTimerOnCallActivity() {
  Date startTime = ClockUtil.getCurrentTime();
  
  // After process start, the task in the subprocess should be active
  runtimeService.startProcessInstanceByKey("timerOnCallActivity");
  TaskQuery taskQuery = taskService.createTaskQuery();
  Task taskInSubProcess = taskQuery.singleResult();
  assertEquals("Task in subprocess", taskInSubProcess.getName());
  
  // When the timer on the subprocess is fired, the complete subprocess is destroyed
  ClockUtil.setCurrentTime(new Date(startTime.getTime() + (6 * 60 * 1000))); // + 6 minutes, timer fires on 5 minutes
  waitForJobExecutorToProcessAllJobs(10000, 100);
  
  Task escalatedTask = taskQuery.singleResult();
  assertEquals("Escalated Task", escalatedTask.getName());
  
  // Completing the task ends the complete process
  taskService.complete(escalatedTask.getId());
  assertEquals(0, runtimeService.createExecutionQuery().list().size());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:24,代码来源:CallActivityAdvancedTest.java

示例6: testQueryByCandidateGroupIn

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
public void testQueryByCandidateGroupIn() {
  List<String> groups = Arrays.asList("management", "accountancy");
  TaskQuery query = taskService.createTaskQuery().taskCandidateGroupIn(groups);
  assertEquals(5, query.count());
  assertEquals(5, query.list().size());
  try {
    query.singleResult();
    fail("expected exception");
  } catch (ActivitiException e) {
    // OK
  }

  // Unexisting groups or groups that don't have candidate tasks shouldn't influence other results
  groups = Arrays.asList("management", "accountancy", "sales", "unexising");
  query = taskService.createTaskQuery().taskCandidateGroupIn(groups);
  assertEquals(5, query.count());
  assertEquals(5, query.list().size());
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:19,代码来源:TaskQueryTest.java

示例7: testOrderProcessWithCallActivity

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
@Deployment(resources = { "org/activiti/examples/bpmn/callactivity/orderProcess.bpmn20.xml",
    "org/activiti/examples/bpmn/callactivity/checkCreditProcess.bpmn20.xml" })
public void testOrderProcessWithCallActivity() {
  // After the process has started, the 'verify credit history' task should be
  // active
  ProcessInstance pi = runtimeService.startProcessInstanceByKey("orderProcess");
  TaskQuery taskQuery = taskService.createTaskQuery();
  Task verifyCreditTask = taskQuery.singleResult();

  // Completing the task with approval, will end the subprocess and continue
  // the original process
  taskService.complete(verifyCreditTask.getId(), CollectionUtil.singletonMap("creditApproved", true));
  Task prepareAndShipTask = taskQuery.singleResult();
  assertEquals("Prepare and Ship", prepareAndShipTask.getName());

  // verify
  HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult();
  assertNotNull(historicProcessInstance);
  assertTrue(historicProcessInstance.getProcessDefinitionId().contains("checkCreditProcess"));
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:21,代码来源:HistoryServiceTest.java

示例8: testSimple

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
@Deployment
public void testSimple() {
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc");
  TaskQuery taskQuery = taskService.createTaskQuery();
  Task userTask = taskQuery.singleResult();
  assertEquals("userTask1", userTask.getName());
  
  taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789"));
  
  assertProcessEnded(processInstance.getId());
  
  List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list();
  assertEquals(1, variables.size());
  
  HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
  assertEquals("test456", historicVariable.getTextValue());
  
  assertEquals(5, historyService.createHistoricActivityInstanceQuery().count());
  assertEquals(3, historyService.createHistoricDetailQuery().count());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:21,代码来源:HistoricVariableInstanceTest.java

示例9: testTimerOnCallActivity

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
@Deployment(resources = {
  "org/activiti/engine/test/bpmn/callactivity/CallActivity.testTimerOnCallActivity.bpmn20.xml",
  "org/activiti/engine/test/bpmn/callactivity/simpleSubProcess.bpmn20.xml"})
public void testTimerOnCallActivity() {
  Date startTime = ClockUtil.getCurrentTime();
  
  // After process start, the task in the subprocess should be active
  runtimeService.startProcessInstanceByKey("timerOnCallActivity");
  TaskQuery taskQuery = taskService.createTaskQuery();
  Task taskInSubProcess = taskQuery.singleResult();
  assertEquals("Task in subprocess", taskInSubProcess.getName());
  
  // When the timer on the subprocess is fired, the complete subprocess is destroyed
  ClockUtil.setCurrentTime(new Date(startTime.getTime() + (6 * 60 * 1000))); // + 6 minutes, timer fires on 5 minutes
  waitForJobExecutorToProcessAllJobs(10000, 5000L);
  
  Task escalatedTask = taskQuery.singleResult();
  assertEquals("Escalated Task", escalatedTask.getName());
  
  // Completing the task ends the complete process
  taskService.complete(escalatedTask.getId());
  assertEquals(0, runtimeService.createExecutionQuery().list().size());
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:24,代码来源:CallActivityAdvancedTest.java

示例10: getTaskInstance

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
public Task getTaskInstance(String taskId)
{
    TaskQuery taskQuery = taskService.createTaskQuery().taskId(taskId);
    if(!deployWorkflowsInTenant) {
    	taskQuery.processVariableValueEquals(ActivitiConstants.VAR_TENANT_DOMAIN, TenantUtil.getCurrentDomain());
    }
    return taskQuery.singleResult();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:ActivitiUtil.java

示例11: testQueryNoCriteria

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
public void testQueryNoCriteria() {
  TaskQuery query = taskService.createTaskQuery();
  assertEquals(12, query.count());
  assertEquals(12, query.list().size());
  try {
    query.singleResult();
    fail("expected exception");
  } catch (ActivitiException e) {
    // OK
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:12,代码来源:TaskQueryTest.java

示例12: testQueryByName

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
public void testQueryByName() {
  TaskQuery query = taskService.createTaskQuery().taskName("testTask");
  assertEquals(6, query.list().size());
  assertEquals(6, query.count());
  
  try {
    query.singleResult();
    fail("expected exception");
  } catch (ActivitiException e) {
    // OK
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:13,代码来源:TaskQueryTest.java

示例13: testQueryByDescription

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
public void testQueryByDescription() {
  TaskQuery query = taskService.createTaskQuery().taskDescription("testTask description");
  assertEquals(6, query.list().size());
  assertEquals(6, query.count());
  
  try {
    query.singleResult();
    fail();
  } catch (ActivitiException e) {}
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:11,代码来源:TaskQueryTest.java

示例14: testQueryByPriority

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
public void testQueryByPriority() {
  TaskQuery query = taskService.createTaskQuery().taskPriority(10);
  assertEquals(2, query.list().size());
  assertEquals(2, query.count());
  
  try {
    query.singleResult();
    fail();
  } catch (ActivitiException e) {}
  
  query = taskService.createTaskQuery().taskPriority(100);
  assertNull(query.singleResult());
  assertEquals(0, query.list().size());
  assertEquals(0, query.count());

  query = taskService.createTaskQuery().taskMinPriority(50);
  assertEquals(3, query.list().size());

  query = taskService.createTaskQuery().taskMinPriority(10);
  assertEquals(5, query.list().size());

  query = taskService.createTaskQuery().taskMaxPriority(10);
  assertEquals(9, query.list().size());

  query = taskService.createTaskQuery().taskMaxPriority(3);
  assertEquals(6, query.list().size());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:28,代码来源:TaskQueryTest.java

示例15: testQueryByCandidateGroup

import org.activiti.engine.task.TaskQuery; //导入方法依赖的package包/类
public void testQueryByCandidateGroup() {
  TaskQuery query = taskService.createTaskQuery().taskCandidateGroup("management");
  assertEquals(3, query.count());
  assertEquals(3, query.list().size());
  try {
    query.singleResult();
    fail("expected exception");
  } catch (ActivitiException e) {
    // OK
  }

  query = taskService.createTaskQuery().taskCandidateGroup("sales");
  assertEquals(0, query.count());
  assertEquals(0, query.list().size());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:16,代码来源:TaskQueryTest.java


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