Examples of ExpandTaskCommand


Examples of com.founder.fix.fixflow.core.impl.command.ExpandTaskCommand

  @Deployment(resources = { "com/founder/fix/fixflow/test/engine/api/task/TaskServiceNewTest.bpmn"})
  public void testProcessInstanceQueryExpandQuery(){
   
    for(int i = 0;i<2;i++){
      //创建一个通用命令
      ExpandTaskCommand expandTaskCommand = new ExpandTaskCommand();
      //设置流程名
      expandTaskCommand.setProcessDefinitionKey("TaskServiceNewTest");
      //设置流程的业务关联键
      expandTaskCommand.setBusinessKey("BK_testStartProcessInstanceByKey");
      //命令类型,可以从流程引擎配置中查询   启动并提交为startandsubmit
      expandTaskCommand.setCommandType("startandsubmit");
      //设置提交人
      expandTaskCommand.setInitiator("1200119390");
      //设置命令的id,需和节点上配置的按钮编号对应,会执行按钮中的脚本。
      expandTaskCommand.setUserCommandId("HandleCommand_2");
      //执行这个启动并提交的命令,返回启动的流程实例
      ProcessInstance processInstance = (ProcessInstance)taskService.expandTaskComplete(expandTaskCommand, null);
      String processInstanceId = processInstance.getId();
      //验证是否成功启动
      assertNotNull(processInstanceId);
    }
   
    TaskQuery taskQuery = taskService.createTaskQuery();
    // 查找 1200119390 的这个流程实例的当前独占任务
    TaskInstance taskInstance = taskQuery.taskAssignee("1200119390").processDefinitionKey("TaskServiceNewTest").taskNotEnd().list().get(0);
    //创建通用命令
    ExpandTaskCommand expandTaskCommandSuspendProcessInstance=new ExpandTaskCommand();
    //设置命令为暂停实例
    expandTaskCommandSuspendProcessInstance.setCommandType("general");
    //设置命令按钮的iD,与节点上处理命令设置一致
    expandTaskCommandSuspendProcessInstance.setUserCommandId("HandleCommand_2");
    //设置命令的处理任务号
    expandTaskCommandSuspendProcessInstance.setTaskId(taskInstance.getId());
    //执行这个暂停实例的命令
    taskService.expandTaskComplete(expandTaskCommandSuspendProcessInstance, null);
    //创建流程实例查询
    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
    //获取TaskServiceNewTest的流程实例
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.