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


Java ProcessEngine.getTaskService方法代码示例

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


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

示例1: createDefaultFilter

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
private void createDefaultFilter(ProcessEngine processEngine) {
    TaskService taskService = processEngine.getTaskService();
    FilterService filterService = processEngine.getFilterService();

    TaskQuery myTasksQuery = taskService.createTaskQuery().taskAssigneeExpression("${currentUser()}").active();
    FilterEntity myTasksFilter = (FilterEntity) filterService.newTaskFilter("Мої завдання");
    myTasksFilter.setQuery(myTasksQuery);
    myTasksFilter.setPropertiesInternal("{\"refresh\":true}");
    filterService.saveFilter(myTasksFilter);

    TaskQuery myQueueQuery = taskService.createTaskQuery().taskCandidateUserExpression("${currentUser()}").active();
    FilterEntity myQueueFilter = (FilterEntity) filterService.newTaskFilter("В черзі");
    myQueueFilter.setQuery(myQueueQuery);
    myQueueFilter.setPropertiesInternal("{\"refresh\":true}");
    filterService.saveFilter(myQueueFilter);

    addAuthorizationGroup(processEngine.getAuthorizationService(), Resources.FILTER, myTasksFilter.getId(), ALL_USERS, new Permission[] {Permissions.READ});
    addAuthorizationGroup(processEngine.getAuthorizationService(), Resources.FILTER, myQueueFilter.getId(), ALL_USERS, new Permission[] {Permissions.READ});
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:20,代码来源:ResourcesAuthorization.java

示例2: createViewFilter

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
private void createViewFilter(ProcessEngine processEngine, String userId) {
    TaskService taskService = processEngine.getTaskService();
    FilterService filterService = processEngine.getFilterService();
    TaskQuery myReadTaskQuery = taskService.createTaskQuery().processVariableValueLike("processReaders", "%" + userId + "%").active();
    FilterEntity myReadTaskFilter = (FilterEntity) filterService.newTaskFilter("На перегляд");
    myReadTaskFilter.setQuery(myReadTaskQuery);
    myReadTaskFilter.setOwner(userId);
    myReadTaskFilter.setPropertiesInternal("{\"refresh\":true}");
    filterService.saveFilter(myReadTaskFilter);
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:11,代码来源:ResourcesAuthorization.java

示例3: getComments

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@RequestMapping(value = "/{taskId}/comment", method = RequestMethod.GET)
@ResponseBody
public List<Comment> getComments(@PathVariable(value = "taskId") String taskId) {
    ProcessEngine processEngine = ResourcesAuthorization.lookupProcessEngine(ResourcesAuthorization.ENGINE_NAME);
    List<Comment> result = null;
    if (processEngine != null) {
        TaskService taskService = processEngine.getTaskService();
        String processInstanceId = taskService.createTaskQuery().taskId(taskId).singleResult().getProcessInstanceId();
        result = taskService.getProcessInstanceComments(processInstanceId);
        for (HistoricTaskInstance task : processEngine.getHistoryService().createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).list()) {
            result.addAll(taskService.getTaskComments(task.getId()));
        }
    }
    return result.stream().map(comment -> format(comment)).collect(Collectors.toList());
}
 
开发者ID:IntegrityVision,项目名称:Purchase-order-process-template,代码行数:16,代码来源:HistoryRestController.java

示例4: resolveNotCachedLinks

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
protected List<HalResource<?>> resolveNotCachedLinks(String[] linkedIds, ProcessEngine processEngine) {
  TaskService taskService = processEngine.getTaskService();

  List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(linkedIds[0]);

  List<HalResource<?>> resolvedIdentityLinks = new ArrayList<HalResource<?>>();
  for (IdentityLink identityLink : identityLinks) {
    resolvedIdentityLinks.add(HalIdentityLink.fromIdentityLink(identityLink));
  }

  return resolvedIdentityLinks;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:13,代码来源:HalIdentityLinkResolver.java

示例5: createTask

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void createTask(TaskDto taskDto) {
  ProcessEngine engine = getProcessEngine();
  TaskService taskService = engine.getTaskService();

  Task newTask = taskService.newTask(taskDto.getId());
  taskDto.updateTask(newTask);

  try {
    taskService.saveTask(newTask);

  } catch (NotValidException e) {
    throw new InvalidRequestException(Status.BAD_REQUEST, e, "Could not save task: " + e.getMessage());
  }

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:16,代码来源:TaskRestServiceImpl.java

示例6: setUp

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
@Before
public void setUp() {
  ProcessEngine processEngine = rule.getProcessEngine();

  identityService = processEngine.getIdentityService();
  repositoryService = processEngine.getRepositoryService();
  runtimeService = processEngine.getRuntimeService();
  taskService = processEngine.getTaskService();
  historyService = processEngine.getHistoryService();
  formService = processEngine.getFormService();

  identityService.clearAuthentication();
  identityService.setAuthentication("test", Arrays.asList("accounting"));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:AuthorizationTest.java

示例7: TestFixture

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public TestFixture(ProcessEngine processEngine) {
  this.processEngine = processEngine;
  repositoryService = processEngine.getRepositoryService();
  runtimeService = processEngine.getRuntimeService();
  managementService = processEngine.getManagementService();
  taskService = processEngine.getTaskService();
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:8,代码来源:TestFixture.java

示例8: startInvoiceProcess

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public static HashMap<String, ProcessDataContainer> startInvoiceProcess(ProcessEngine processEngine, final int numberOfInstances, boolean addRandomTimeInterval) {
  RepositoryService repositoryService = processEngine.getRepositoryService();
  RuntimeService runtimeService = processEngine.getRuntimeService();
  TaskService taskService = processEngine.getTaskService();

  Deployment deployment = repositoryService.createDeployment().addClasspathResource("invoice.bpmn").deploy();
  Assert.assertNotNull(repositoryService.createDeploymentQuery().deploymentId(deployment.getId()).singleResult());

  LOGGER.info("Creating " + numberOfInstances + " instances of 'invoice.bpmn' process.");


  HashMap<String, ProcessDataContainer> variablesByProcessIds = new HashMap<String, ProcessDataContainer>(numberOfInstances);

  for (int i = 0; i < numberOfInstances; i++) {
    if (addRandomTimeInterval) {
      ClockUtil.setCurrentTime(new Date(ClockUtil.getCurrentTime().getTime() + getRandomLong()));
    }

    HashMap<String, Object> variables = new HashMap<String, Object>();
    variables.put(TestDataGenerator.getRandomString(), TestDataGenerator.getRandomString());
    variables.put("long", TestDataGenerator.getRandomLong());
    variables.put("double", TestDataGenerator.getRandomDouble());

    ProcessInstance pi = runtimeService.startProcessInstanceByKey("invoice", variables);
    Assert.assertNotNull(pi);

    List<Task> tasks = taskService.createTaskQuery().processInstanceId(pi.getId()).list();

    assertEquals(1, tasks.size());
    assertEquals("assignApprover", tasks.get(0).getTaskDefinitionKey());

    variables.clear();
    String approver = TestDataGenerator.getRandomString();
    variables.put("approver", approver);
    taskService.complete(tasks.get(0).getId(), variables);

    tasks = taskService.createTaskQuery().processInstanceId(pi.getId()).list();

    assertEquals(1, tasks.size());
    assertEquals("approveInvoice", tasks.get(0).getTaskDefinitionKey());
    assertEquals(approver, tasks.get(0).getAssignee());

    variables.clear();
    variables.put("approved", Boolean.TRUE);
    taskService.complete(tasks.get(0).getId(), variables);

    tasks = taskService.createTaskQuery().processInstanceId(pi.getId()).list();

    // retrieve all variables
    List<VariableInstance> variableInstances = runtimeService.createVariableInstanceQuery().processInstanceIdIn(pi.getProcessInstanceId()).list();
    variablesByProcessIds.put(pi.getProcessInstanceId(), new ProcessDataContainer(pi.getProcessInstanceId(), pi.getBusinessKey(), variableInstances));

    assertEquals(1, tasks.size());
    assertEquals("prepareBankTransfer", tasks.get(0).getTaskDefinitionKey());
    taskService.complete(tasks.get(0).getId());

    ProcessEngineAssert.assertProcessEnded(processEngine, pi.getId());
  }

  LOGGER.info("Created " + numberOfInstances + " instances of 'invoice.bpmn' process.");

  return variablesByProcessIds;
}
 
开发者ID:camunda,项目名称:camunda-bpm-elasticsearch,代码行数:64,代码来源:TestDataGenerator.java

示例9: testDeployRevisedProcessAfterDeleteOnOtherProcessEngine

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public void testDeployRevisedProcessAfterDeleteOnOtherProcessEngine() {

    // Setup both process engines
    ProcessEngine processEngine1 = new StandaloneProcessEngineConfiguration()
      .setProcessEngineName("reboot-test-schema")
      .setDatabaseSchemaUpdate(org.camunda.bpm.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
      .setJdbcUrl("jdbc:h2:mem:activiti-process-cache-test;DB_CLOSE_DELAY=1000")
      .setJobExecutorActivate(false)
      .buildProcessEngine();
    RepositoryService repositoryService1 = processEngine1.getRepositoryService();

    ProcessEngine processEngine2 = new StandaloneProcessEngineConfiguration()
      .setProcessEngineName("reboot-test")
      .setDatabaseSchemaUpdate(org.camunda.bpm.engine.ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE)
      .setJdbcUrl("jdbc:h2:mem:activiti-process-cache-test;DB_CLOSE_DELAY=1000")
      .setJobExecutorActivate(false)
      .buildProcessEngine();
    RepositoryService repositoryService2 = processEngine2.getRepositoryService();
    RuntimeService runtimeService2 = processEngine2.getRuntimeService();
    TaskService taskService2 = processEngine2.getTaskService();

    // Deploy first version of process: start->originalTask->end on first process engine
    String deploymentId = repositoryService1.createDeployment()
      .addClasspathResource("org/camunda/bpm/engine/test/api/repository/RepositoryServiceTest.testDeployRevisedProcessAfterDeleteOnOtherProcessEngine.v1.bpmn20.xml")
      .deploy()
      .getId();

    // Start process instance on second engine
    String processDefinitionId = repositoryService2.createProcessDefinitionQuery().singleResult().getId();
    runtimeService2.startProcessInstanceById(processDefinitionId);
    Task task = taskService2.createTaskQuery().singleResult();
    assertEquals("original task", task.getName());

    // Delete the deployment on second process engine
    repositoryService2.deleteDeployment(deploymentId, true);
    assertEquals(0, repositoryService2.createDeploymentQuery().count());
    assertEquals(0, runtimeService2.createProcessInstanceQuery().count());

    // deploy a revised version of the process: start->revisedTask->end on first process engine
    //
    // Before the bugfix, this would set the cache on the first process engine,
    // but the second process engine still has the original process definition in his cache.
    // Since there is a deployment delete in between, the new generated process definition id is the same
    // as in the original deployment, making the second process engine using the old cached process definition.
    deploymentId = repositoryService1.createDeployment()
      .addClasspathResource("org/camunda/bpm/engine/test/api/repository/RepositoryServiceTest.testDeployRevisedProcessAfterDeleteOnOtherProcessEngine.v2.bpmn20.xml")
      .deploy()
      .getId();

    // Start process instance on second process engine -> must use revised process definition
    processDefinitionId = repositoryService2.createProcessDefinitionQuery().singleResult().getId();
    runtimeService2.startProcessInstanceByKey("oneTaskProcess");
    task = taskService2.createTaskQuery().singleResult();
    assertEquals("revised task", task.getName());

    // cleanup
    repositoryService1.deleteDeployment(deploymentId, true);
    processEngine1.close();
    processEngine2.close();
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:61,代码来源:RepositoryServiceTest.java

示例10: ProcessEngineAwareStep

import org.camunda.bpm.engine.ProcessEngine; //导入方法依赖的package包/类
public ProcessEngineAwareStep(ProcessEngine processEngine) {
  this.processEngine = processEngine;
  runtimeService = processEngine.getRuntimeService();
  taskService = processEngine.getTaskService();
  repositoryService = processEngine.getRepositoryService();
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:7,代码来源:ProcessEngineAwareStep.java


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