Examples of TaskCommandInst


Examples of com.founder.fix.fixflow.core.impl.bpmn.behavior.TaskCommandInst

   
    TaskInstanceEntity taskInstanceCallAct = (TaskInstanceEntity) processEngine.getTaskService().createTaskQuery()
        .callActivityInstanceId(subProcessInstanceId).taskNotEnd().singleResult();
   
    // 获取正在操作的任务命令对象实例
    TaskCommandInst taskCommand = getTaskCommandInst();
    taskInstanceCallAct.customEnd(taskCommand, this.taskComment);
    taskInstanceCallAct.setAssignee(Authentication.getAuthenticatedUserId());
    Context.getCommandContext().getTaskManager().saveTaskInstanceEntity((TaskInstanceEntity) taskInstanceCallAct);

   
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.bpmn.behavior.TaskCommandInst

    // 获取正在操作的任务实例对象
    TaskInstanceEntity taskInstance = getTaskInstanceEntity();

    // 获取正在操作的任务命令对象实例
    TaskCommandInst taskCommand = getTaskCommandInst();
   
   
   
    // TODO Auto-generated method stub
    List<TaskInstance> taskInstanceQueryTos = (new GetPreviousStepTaskByTaskIdCmd(this.taskId)).execute(commandContext);
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.bpmn.behavior.TaskCommandInst

    // 获取正在操作的任务实例对象
    TaskInstanceEntity taskInstanceTemp = getTaskInstanceEntity();

    // 获取正在操作的任务命令对象实例
    TaskCommandInst taskCommand = getTaskCommandInst();

    ProcessInstanceEntity processInstanceImpl = getProcessInstance();

    String userId = null;

    if (StringUtil.isEmpty(admin)) {
      if (StringUtil.isEmpty(agent)) {
        userId = Authentication.getAuthenticatedUserId();
      } else {
        userId = agent;
      }

    }

    List<TaskInstance> endTaskInstances = null;
    if (userId == null) {
      endTaskInstances = taskService.createTaskQuery().processInstanceId(taskInstanceTemp.getProcessInstanceId()).taskIsEnd().nodeId(recoverNodeId)
          .list();

    } else {
      endTaskInstances = taskService.createTaskQuery().processInstanceId(taskInstanceTemp.getProcessInstanceId()).taskAssignee(userId).taskIsEnd()
          .nodeId(recoverNodeId).list();

    }

    TaskInstance recoverToTask = endTaskInstances.get(0);

    String tokenId = recoverToTask.getTokenId();
    Token recoverToToken = runtimeService.createTokenQuery().tokenId(tokenId).singleResult();
    if (recoverToToken.getEndTime() == null) {

   

 
      ProcessDefinitionBehavior processDefinition = processInstanceImpl.getProcessDefinition();

      UserTaskBehavior userTask = (UserTaskBehavior) processDefinition.getDefinitions().getElement(recoverNodeId);

     

      TokenEntity tokenEntity = processInstanceImpl.getTokenMap().get(tokenId);

      tokenEntity.terminationChildTokenWithTask(taskCommand.getTaskCommandType(), taskCommand.getName(), this.taskComment, userId, this.agent, this.admin);

      //TokenEntity token = processInstanceImpl.getTokenMap().get(tokenId);

      ExecutionContext executionContext = ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(tokenEntity);

      //taskInstanceTemp.setAssigneeWithoutCascade(userId);
      taskInstanceTemp.customEnd(taskCommand, taskComment);

      tokenEntity.removeTaskInstanceSynchronization(taskCommand.getTaskCommandType(), taskCommand.getName(), this.taskComment, userId, this.agent, this.admin);

      if (recoverToTask.getTaskGroup() != null) {

        if (taskCommand != null) {

          userTask.enter(executionContext);

        }

        try {
          saveProcessInstance(commandContext);
        } catch (Exception e) {
          throw new FixFlowException("流程实例持久化失败!", e);
        }
        return null;

      } else {

        if (taskCommand != null) {

          executionContext.setRollBackAssignee(recoverToTask.getAssignee());
          userTask.enter(executionContext);

        }

        try {
          saveProcessInstance(commandContext);
        } catch (Exception e) {
          throw new FixFlowException("流程实例持久化失败!", e);
        }
        return null;

      }

    } else {
     
     
      ProcessDefinitionBehavior processDefinition = processInstanceImpl.getProcessDefinition();

      UserTaskBehavior userTask = (UserTaskBehavior) processDefinition.getDefinitions().getElement(recoverNodeId);

     
     

      TokenEntity tokenEntity = processInstanceImpl.getRootToken();

      tokenEntity.terminationChildTokenWithTask(taskCommand.getTaskCommandType(), taskCommand.getName(), this.taskComment, userId, this.agent, this.admin);

      //TokenEntity token = processInstanceImpl.getTokenMap().get(tokenId);

      ExecutionContext executionContext = ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(tokenEntity);

      //taskInstanceTemp.setAssigneeWithoutCascade(userId);
      taskInstanceTemp.customEnd(taskCommand, taskComment);

      tokenEntity.removeTaskInstanceSynchronization(taskCommand.getTaskCommandType(), taskCommand.getName(), this.taskComment, userId, this.agent, this.admin);

      if (recoverToTask.getTaskGroup() != null) {

        if (taskCommand != null) {
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.bpmn.behavior.TaskCommandInst

    //获取此流程的开始节点可显示的命令
    List<TaskCommandInst> commands = taskService.getSubTaskTaskCommandByKey("Process_TaskServiceTest");
    //验证是否为1个命令,开始节点只配了一个,详见流程定义
    assertEquals(1, commands.size());
    //获取这个命令
    TaskCommandInst taskCommandInst = commands.get(0);
    //验证这个命令是否为启动并提交
    assertEquals("startandsubmit", taskCommandInst.getTaskCommandType());
  }
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.bpmn.behavior.TaskCommandInst

    //获取流程追踪情况下的按钮
    List<TaskCommandInst> commands = taskService.GetTaskCommandByTaskInstance(taskDone, true);
    //验证按钮个数是否为1
    assertEquals(1, commands.size());
    //取得按钮对象
    TaskCommandInst command = commands.get(0);
    //验证按钮是否为追回按钮
    assertEquals("recover",command.getTaskCommandType());
  }
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.bpmn.behavior.TaskCommandInst

      return false;
    }

    if (isProcessTracking()) {

      TaskCommandInst taskCommandInst = getTaskCommandInst();

      ProcessEngine processEngine = ProcessEngineManagement.getDefaultProcessEngine();
      TaskQuery taskQuery = processEngine.getTaskService().createTaskQuery();
      List<TaskInstance> taskInstancesEnd = taskQuery.processInstanceId(taskInstance.getProcessInstanceId())
          .taskAssignee(Authentication.getAuthenticatedUserId()).taskIsEnd().list();

      String tokenId = taskInstance.getTokenId();

      String processDefinitionId = taskInstance.getProcessDefinitionId();
      ProcessInstanceManager processInstanceManager = Context.getCommandContext().getProcessInstanceManager();

      String processInstanceId = taskInstance.getProcessInstanceId();

      ProcessDefinitionManager processDefinitionManager = Context.getCommandContext().getProcessDefinitionManager();

      ProcessDefinitionBehavior processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);

      ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId, processDefinition);
      if(processInstanceImpl.hasEnded()){
        return false;
      }
      TokenEntity token = processInstanceImpl.getTokenMap().get(tokenId);

      ExecutionContext executionContext = ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(token);

      Object returnValueObject = null;
      if (taskCommandInst != null && taskCommandInst.getExpression() != null) {
        try {

          returnValueObject = ExpressionMgmt.execute(taskCommandInst.getExpression(), executionContext);
        } catch (Exception e) {
          throw new FixFlowException("用户命令表达式执行异常!", e);
        }
      }
      if (returnValueObject == null || returnValueObject.equals("")) {
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.bpmn.behavior.TaskCommandInst

   

    if(isProcessTracking()){
     
     
      TaskCommandInst taskCommandInst=getTaskCommandInst();
     
      ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
      TaskQuery taskQuery=processEngine.getTaskService().createTaskQuery();
      List<TaskInstance> taskInstancesEnd=taskQuery.processInstanceId(taskInstance.getProcessInstanceId()).taskAssignee(Authentication.getAuthenticatedUserId()).taskIsEnd().list();
     
     
      String tokenId = taskInstance.getTokenId();

      String processDefinitionId = taskInstance.getProcessDefinitionId();
      ProcessInstanceManager processInstanceManager =Context.getCommandContext().getProcessInstanceManager();

      String processInstanceId = taskInstance.getProcessInstanceId();

      ProcessDefinitionManager processDefinitionManager = Context.getCommandContext().getProcessDefinitionManager();

      ProcessDefinitionBehavior processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);


      ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId, processDefinition);
      if(processInstanceImpl.hasEnded()){
        return false;
      }

      TokenEntity token = processInstanceImpl.getTokenMap().get(tokenId);
 
      ExecutionContext executionContext = ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(token);
     
      Object returnValueObject=null;
      if (taskCommandInst != null && taskCommandInst.getExpression() != null) {
        try {
         
          returnValueObject=ExpressionMgmt.execute(taskCommandInst.getExpression(), executionContext);
        } catch (Exception e) {
          throw new FixFlowException("用户命令表达式执行异常!", e);
        }
      }
      if(returnValueObject==null||returnValueObject.equals("")){
View Full Code Here

Examples of com.founder.fix.fixflow.core.impl.bpmn.behavior.TaskCommandInst

    String formUrl = formService.getStartFormByKey("TaskServiceNewTest");
    //验证表单是否为配置的“add”
    assertEquals("add", formUrl);
    /*********2.获取提交表单Toolbar***********************/
    List<TaskCommandInst> commandList = taskService.getSubTaskTaskCommandByKey("TaskServiceNewTest");
    TaskCommandInst startAndSubmitCommand = null;
    for(int i = 0;i < commandList.size(); i++){
      if("startandsubmit".equals(commandList.get(i).getTaskCommandType())){
        startAndSubmitCommand = commandList.get(i);
      }
    }
    assertNotNull(startAndSubmitCommand);
    /*********3.处理提交表单toolbar***********************/
    //创建一个通用命令
    ExpandTaskCommand expandTaskCommand = new ExpandTaskCommand();
    //设置流程名
    expandTaskCommand.setProcessDefinitionKey("TaskServiceNewTest");
    //设置流程的业务关联键
    expandTaskCommand.setBusinessKey("BK_testStartProcessInstanceByKey");
    //命令类型
    expandTaskCommand.setCommandType(startAndSubmitCommand.getTaskCommandType());
    //设置提交人
    expandTaskCommand.setInitiator("1200119390");
    //设置命令的id,需和节点上配置的按钮编号对应,会执行按钮中的脚本。
    expandTaskCommand.setUserCommandId(startAndSubmitCommand.getId());
    //执行这个启动并提交的命令,返回启动的流程实例
    ProcessInstance processInstance = (ProcessInstance)taskService.expandTaskComplete(expandTaskCommand, null);
    String processInstanceId = processInstance.getId();
    //验证是否成功启动
    assertNotNull(processInstanceId);
   
    /*********4.获取第二个任务节点的任务【查询代办任务】***********************/
    // 创建任务查询
    TaskQuery taskQuery = taskService.createTaskQuery();
    // 查找 1200119390 的这个流程实例的当前独占任务
    List<TaskInstance> taskInstances = taskQuery.taskAssignee("1200119390").processInstanceId(processInstanceId).taskNotEnd().list();
    // 获取一条任务
    TaskInstance taskInstance = taskInstances.get(0);
    //验证这个待办是否为空
    assertNotNull(taskInstance);
    String nodeId = taskInstance.getNodeId();
    //验证流程实例是否在第二个节点
    assertEquals(nodeId, "UserTask_2");
   
    /*********5.打开第二个任务节点表单***********************/
   
    //获取任务节点上的formUrl
    String taskFormUrl = taskInstance.getFormUri();
    //验证是否为配置的add
    assertEquals("add", taskFormUrl);
   
    /*********6.获取第二个任务节点toolbar***********************/
    //创建流程定义查询
    ProcessDefinitionQuery processDefinitionQuery = modelService.createProcessDefinitionQuery();
    //获取流程定义
    ProcessDefinitionBehavior processDefinition = processDefinitionQuery.processDefinitionKey("TaskServiceNewTest").singleResult();
    //获取流程定义编号   页面上用的时候应该能拿到流程定义号,就不用这样取了。
    String processDefinitionId = processDefinition.getProcessDefinitionId();
    //获取节点上的处理命令
    List<TaskCommandInst> taskCommandList= taskService.getTaskCommandById(processDefinitionId, nodeId);
    assertNotNull(taskCommandList);
   
    /*********7.完成第二个节点处理命令***********************/
    TaskCommandInst generalTaskCommand = null;
    for(int i = 0;i < taskCommandList.size(); i++){
      if("general".equals(taskCommandList.get(i).getTaskCommandType())){
        generalTaskCommand = taskCommandList.get(i);
      }
    }
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.