• activiti7流程变量的测试(设置全局变量)


    package com.zcc.activiti03;

    import org.activiti.engine.*;
    import org.activiti.engine.repository.Deployment;
    import org.activiti.engine.runtime.ProcessInstance;
    import org.activiti.engine.task.Task;
    import org.assertj.core.internal.bytebuddy.asm.Advice;

    import java.net.URL;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;

    /**
    * 流程变量的测试
    */
    public class VariablesTest {
    /*public static void main(String[] args) {

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    //得到RepositoryService
    RepositoryService repositoryService = processEngine.getRepositoryService();
    //流程部署
    Deployment deploy = repositoryService.createDeployment()
    .addClasspathResource("diagram/my4.bpmn").name("请假流程-流程变量").deploy();
    System.out.println(deploy.getId());
    System.out.println(deploy.getName());

    }*/

    //流程实例启动,设置流程变量的值
    /*public static void main(String[] args) {

    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    //得到RepositoryService
    RuntimeService runtimeService = processEngine.getRuntimeService();

    String key="myProcess4";
    Map<String,Object> variables=new HashMap<>();
    Leave leave=new Leave();
    leave.setNum(1);
    variables.put("leave",leave);
    //启动流程实例
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(key, variables);

    System.out.println(processInstance.getName());
    System.out.println(processInstance.getId());
    System.out.println(processInstance.getProcessVariables());


    }*/

    public static void main(String[] args) {
    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();

    TaskService taskService = processEngine.getTaskService();
    //查询当前用户是否有任务
    Task task = taskService.createTaskQuery().processDefinitionKey("myProcess4").taskAssignee("wangwu").singleResult();

    if (task!=null){
    taskService.complete(task.getId());
    System.out.println("任务完成");
    }

    }
    }
  • 相关阅读:
    关于浏览器缓存
    JavaScript基本概念(数组)
    JavaScript基本概念(对象)
    变量作用域
    Javascript基本概念(语句和函数)
    JavaScript基本概念(操作符)
    JavaScript基本概念(变量和数据类型)
    博客园主题美化,修改主题
    一种简易的表达式求值算法
    Go实现的一个命令行HTTP抓包工具
  • 原文地址:https://www.cnblogs.com/yscec/p/11802784.html
Copyright © 2020-2023  润新知