package com.zcc.activiti03;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.task.TaskQuery;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*启动流程实例,动态设置assignee人
*/
public class AssigneeUEL {
public static void main(String[] args) {
//创建流程引擎配置类
ProcessEngineConfiguration processEngineConfiguration=
ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml");
//流程引擎对象
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();
//获取runtimeService
RuntimeService runtimeService = processEngine.getRuntimeService();
//设置assignee,用户可以在界面上设置任务节点的执行人
Map map=new HashMap<>();
map.put("assignee0","张三");
map.put("assignee1","李四");
map.put("assignee2","王五");
//启动流程实例,同时设置任务节点执行人
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProcess2", map);
System.out.println(processInstance.getName());
}
}