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


Java ProcessEngine.getTaskService方法代码示例

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


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

示例1: setVariable

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
@Test
public void setVariable() {
    ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
    logger.info("### ============= 创建Activiti流程引擎实例, {}", processEngine);

    TaskService taskService = processEngine.getTaskService();

    Task task = taskService.createTaskQuery()
            .processInstanceId("2501")
            .singleResult();

    taskService.setVariable(task.getId(), "流程变量名01", "流程变量值01");
    taskService.setVariable(task.getId(), "流程变量名02", "流程变量值02");
    taskService.setVariable(task.getId(), "流程变量名03", "流程变量值03");

    processEngine.close();
}
 
开发者ID:Lzw2016,项目名称:study,代码行数:18,代码来源:Test01.java

示例2: getVariable

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
@Test
public void getVariable() {
    ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
    logger.info("### ============= 创建Activiti流程引擎实例, {}", processEngine);

    TaskService taskService = processEngine.getTaskService();

    Task task = taskService.createTaskQuery()
            .processInstanceId("2501")
            .singleResult();

    String tmp = taskService.getVariable(task.getId(), "流程变量名01", String.class);
    logger.info("### ==================== {}", tmp);
    tmp = taskService.getVariable(task.getId(), "流程变量名02", String.class);
    logger.info("### ==================== {}", tmp);
    tmp = taskService.getVariable(task.getId(), "流程变量名03", String.class);
    logger.info("### ==================== {}", tmp);

    processEngine.close();
}
 
开发者ID:Lzw2016,项目名称:study,代码行数:21,代码来源:Test01.java

示例3: main

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) {
	// 创建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 得到流程存储服务组件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到运行时服务组件
	RuntimeService runtimeService = engine.getRuntimeService();
	// 得到任务服务组件
	TaskService taskService = engine.getTaskService();
	// 得到管理服务组件
	ManagementService managementService = engine.getManagementService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/SignalThrowingEvent.bpmn").deploy();
	// 启动流程
	runtimeService.startProcessInstanceByKey("stProcess");
	// 完成选择商品任务
	Task firstTask = taskService.createTaskQuery().singleResult();
	taskService.complete(firstTask.getId());
	// 完成用户支付任务
	Task payTask = taskService.createTaskQuery().singleResult();
	taskService.complete(payTask.getId());
	// 由于使用了异步的中间Throwing事件,因此会产生2条工作数据
	List<Job> jobs = managementService.createJobQuery().list();
	System.out.println(jobs.size());
}
 
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:27,代码来源:SignalThrowingEvent.java

示例4: main

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) {
	// 创建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 得到流程存储服务组件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到运行时服务组件
	RuntimeService runtimeService = engine.getRuntimeService();
	TaskService taskService = engine.getTaskService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/MessageCatchingEvent.bpmn").deploy();
	// 启动流程
	ProcessInstance pi = runtimeService.startProcessInstanceByKey("mcProcess");
	Execution exe = runtimeService.createExecutionQuery().activityId("messageintermediatecatchevent1").singleResult();
	runtimeService.messageEventReceived("myMsg", exe.getId());
	// 输出当前的任务
	List<Task> tasks = taskService.createTaskQuery().list();
	for (Task task : tasks) {
		System.out.println(task.getName());
	}
}
 
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:22,代码来源:MessageCatchingEvent.java

示例5: main

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) {
	// 创建流程引擎
	ProcessEngine engine = ProcessEngines
			.getDefaultProcessEngine();
	// 得到流程存储服务组件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到运行时服务组件
	RuntimeService runtimeService = engine.getRuntimeService();
	// 获取流程任务组件
	TaskService taskService = engine.getTaskService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/ErrorBoundaryEvent.bpmn").deploy();
	// 启动流程
	runtimeService.startProcessInstanceByKey("ebProcess");
	// 进行任务查询
	Task task = taskService.createTaskQuery().singleResult();
	System.out.println(task.getName());
}
 
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:20,代码来源:ErrorBoundaryEvent.java

示例6: main

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) {
	// 创建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 得到流程存储服务组件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到运行时服务组件
	RuntimeService runtimeService = engine.getRuntimeService();
	TaskService taskService = engine.getTaskService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/SignalCatchingEvent.bpmn").deploy();
	// 启动流程
	runtimeService.startProcessInstanceByKey("scProcess");
	Task firstTask = taskService.createTaskQuery().singleResult();
	taskService.complete(firstTask.getId());
	// 此时会出现并行的两个流程分支,查找用户任务并完成
	Task payTask = taskService.createTaskQuery().singleResult();
	// 完成任务
	taskService.complete(payTask.getId());
	// 发送信号完成支付
	runtimeService.signalEventReceived("finishPay");
	Task finishTask = taskService.createTaskQuery().singleResult();
	System.out.println("当前流程任务:" + finishTask.getName());
}
 
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:25,代码来源:SignalCatchingEvent.java

示例7: ActivitiUtil

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public ActivitiUtil(ProcessEngine engine, boolean deployWorkflowsInTenant)
{
    this.repoService = engine.getRepositoryService();
    this.runtimeService = engine.getRuntimeService();
    this.taskService = engine.getTaskService();
    this.historyService = engine.getHistoryService();
    this.formService = engine.getFormService();
    this.managementService = engine.getManagementService();
    this.deployWorkflowsInTenant = deployWorkflowsInTenant;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:ActivitiUtil.java

示例8: ApprovalTestApplication

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public ApprovalTestApplication() {
	property(CrnkProperties.RESOURCE_SEARCH_PACKAGE, getClass().getPackage().getName());
	property(CrnkProperties.RESOURCE_DEFAULT_DOMAIN, "http://test.local");

	CrnkFeature feature = new CrnkFeature();
	initObjectMapper(feature);

	ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
	RuntimeService runtimeService = processEngine.getRuntimeService();
	TaskService taskService = processEngine.getTaskService();
	ModuleRegistry moduleRegistry = feature.getBoot().getModuleRegistry();

	processEngine.getRepositoryService().createDeployment()
			.addClasspathResource("approval.bpmn20.xml")
			.deploy();

	ActivitiResourceMapper resourceMapper =
			new ActivitiResourceMapper(moduleRegistry.getTypeParser(), new DefaultDateTimeMapper());
	ApprovalMapper mapper = new ApprovalMapper();
	ApprovalManager approvalManager = new ApprovalManagerFactory().getInstance();
	approvalManager.init(runtimeService, taskService, resourceMapper, mapper, moduleRegistry);
	feature.addModule(createApprovalModule(approvalManager));
	feature.addModule(createActivitiModule(processEngine));
	feature.addModule(new TestModule());

	registerInstances(feature);
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:28,代码来源:ApprovalTestApplication.java

示例9: main

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	// 创建流程引擎
	ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
	// 得到流程存储服务组件
	RepositoryService repositoryService = engine.getRepositoryService();
	// 得到运行时服务组件
	RuntimeService runtimeService = engine.getRuntimeService();
	// 获取流程任务组件
	TaskService taskService = engine.getTaskService();
	// 部署流程文件
	repositoryService.createDeployment()
			.addClasspathResource("bpmn/SignalBoundaryEvent.bpmn").deploy();
	// 启动2个流程实例
	ProcessInstance pi1 = runtimeService
			.startProcessInstanceByKey("sbProcess");
	ProcessInstance pi2 = runtimeService
			.startProcessInstanceByKey("sbProcess");
	// 查找第一个流程实例中签订合同的任务
	Task pi1Task = taskService.createTaskQuery()
			.processInstanceId(pi1.getId()).singleResult();
	taskService.complete(pi1Task.getId());
	// 查找第二个流程实例中签订合同的任务
	Task pi2Task = taskService.createTaskQuery()
			.processInstanceId(pi2.getId()).singleResult();
	taskService.complete(pi2Task.getId());
	// 此时执行流到达确认合同任务,发送一次信号
	runtimeService.signalEventReceived("contactChangeSignal");
	// 查询全部的任务
	List<Task> tasks = taskService.createTaskQuery().list();
	// 输出结果
	for (Task task : tasks) {
		System.out.println(task.getProcessInstanceId() + "---"
				+ task.getName());
	}
}
 
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:39,代码来源:SignalBoundaryEvent.java

示例10: main

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// Build process enigne
ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
								// enable process definition info cache
								 .setEnableProcessDefinitionInfoCache(true)
								 .buildProcessEngine();
   
   RepositoryService repositoryService = processEngine.getRepositoryService();
   RuntimeService runtimeService = processEngine.getRuntimeService();
   
   // deploy process definition
   repositoryService.createDeployment()
     .addClasspathResource("dynamic-user-task.bpmn20.xml")
     .deploy();
   
   String processDefinitionId = repositoryService.createProcessDefinitionQuery()
								.singleResult().getId();
   
   // change user task candidate groups
   DynamicBpmnService dynamicBpmnService = processEngine.getDynamicBpmnService();
   ObjectNode infoNode = dynamicBpmnService
   					.changeUserTaskCandidateGroup("userTask", 
   							"management", true);
   
   dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
   
   // start a process instance
   runtimeService.startProcessInstanceByKey("dynamic-user-task");

   TaskService taskService = processEngine.getTaskService();
   
   // tasks claimable by users group
   long count = taskService.createTaskQuery()
		.taskCandidateGroup("users").count();
   
   System.out.println("tasks claimable by users group " + count);
   
   // fetch the task (tasks claimable by management group)
   Task task = taskService.createTaskQuery()
   				.taskCandidateGroup("management")
   				.singleResult();
   
   // claim task and complete
   taskService.claim(task.getId(), "manager");
   taskService.complete(task.getId());
   
 }
 
开发者ID:balsarori,项目名称:activiti-examples,代码行数:48,代码来源:ChangeUserTask.java

示例11: activitiTaskService

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
@Bean
public TaskService activitiTaskService(ProcessEngine activitiProcessEngine) throws Exception
{
    return activitiProcessEngine.getTaskService();
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:6,代码来源:ServiceSpringModuleConfig.java

示例12: testDeployRevisedProcessAfterDeleteOnOtherProcessEngine

import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public void testDeployRevisedProcessAfterDeleteOnOtherProcessEngine() {
  
  // Setup both process engines
  ProcessEngine processEngine1 = new StandaloneProcessEngineConfiguration()
    .setProcessEngineName("reboot-test-schema")
    .setDatabaseSchemaUpdate(org.activiti.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.activiti.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/activiti/engine/test/cache/originalProcess.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/activiti/engine/test/cache/revisedProcess.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:logicalhacking,项目名称:SecureBPMN,代码行数:61,代码来源:ProcessDefinitionCacheTest.java


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