Package com.founder.fix.fixflow.core.runtime

Examples of com.founder.fix.fixflow.core.runtime.ProcessInstance


   
    Map<String,Object> result = new HashMap<String,Object>();
    if(StringUtil.isNotEmpty(processInstanceId)){
      String userId = (String) filter.get("userId");
      ProcessEngine engine = getProcessEngine(userId);
      ProcessInstance processInstance = engine.getRuntimeService().getProcessInstance(processInstanceId);
      String processName = processInstance.getProcessDefinition().getName();
      try{
        TaskQuery tq = engine.getTaskService().createTaskQuery();
        IdentityService identityService = engine.getIdentityService();
        tq.processInstanceId(processInstanceId);
        tq.taskIsEnd().orderByEndTime().asc();
        List<TaskInstance> instances = tq.list();
        List<Map<String,Object>> instanceMaps = new ArrayList<Map<String,Object>>();
        for(TaskInstance tmp:instances){
          Map<String,Object> instanceMap = tmp.getPersistentState();
          String assigneeUserId = tmp.getAssignee();
          if(StringUtil.isNotEmpty(assigneeUserId)){
            UserTo tmpUser = identityService.getUserTo(assigneeUserId);
            if(tmpUser!=null){
              instanceMap.put("assgneeUserName", tmpUser.getUserName());
            }
          }else{
            instanceMap.put("assgneeUserName", "(空用户名)");
          }
          instanceMaps.add(instanceMap);
        }
        tq.taskNotEnd().orderByTaskCreateTime().asc();
        List<TaskInstance> instancesNotEnd = tq.list();
       
        List<Map<String,Object>> notEndInstanceMaps = new ArrayList<Map<String,Object>>();
        for(TaskInstance tmp:instancesNotEnd){
          Map<String,Object> instanceMap = tmp.getPersistentState();
          String assigneeUserId = tmp.getAssignee();
          if(StringUtil.isNotEmpty(assigneeUserId)){
            UserTo tmpUser = identityService.getUserTo(assigneeUserId);
            if(tmpUser!=null){
              instanceMap.put("assgneeUserName", tmpUser.getUserName());
            }
          }else{
            instanceMap.put("assgneeUserName", "(空用户名)");
          }
          notEndInstanceMaps.add(instanceMap);
        }
        Map<String,Map<String,Object>> postionMap = engine.getModelService().GetFlowGraphicsElementPosition(processInstance.getProcessDefinitionId());
        result.put("notEnddataList", notEndInstanceMaps);
        result.put("dataList", instanceMaps);
        result.put("positionInfo", JSONUtil.parseObject2JSON(postionMap));
        result.put("taskEndedJson", JSONUtil.parseObject2JSON(instanceMaps));
        result.put("taskNotEndJson", JSONUtil.parseObject2JSON(instancesNotEnd));
View Full Code Here


      expandTaskCommand.setBusinessKey(businessKey);
    }
    expandTaskCommand.setParamMap(taskParams);

    ProcessEngine engine = getProcessEngine(userId);
    ProcessInstance processInstance = null;
    try{
      processInstance = (ProcessInstance)engine.getTaskService().expandTaskComplete(expandTaskCommand, null);
    }finally{
      closeProcessEngine();
    }
View Full Code Here

 
 
  public ProcessInstance execute(CommandContext commandContext) {
   

    ProcessInstance processInstance=commandContext.getProcessInstanceManager().findProcessInstanceById(processInstanceId);
   
   
    return processInstance;
  }
View Full Code Here

   
    ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
    Token token=processEngine.getRuntimeService().createTokenQuery().tokenId(tokenId).singleResult();
    String processInstanceId = token.getProcessInstanceId();

    ProcessInstance processInstance=processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
   
   
    ProcessInstanceManager processInstanceManager = commandContext.getProcessInstanceManager();

 
    ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();

    ProcessDefinitionBehavior processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processInstance.getProcessDefinitionId());

   

    ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId, processDefinition);
    TokenEntity tokenEntity = processInstanceImpl.getTokenMap().get(tokenId);
View Full Code Here

     
      if(processInstanceId==null||processInstanceId.equals("")){
        throw new FixFlowBizException("模拟执行的流程实例编号不能为空!");
      }
     
      ProcessInstance processInstance=commandContext.getProcessInstanceManager().findProcessInstanceById(processInstanceId);
      if(processInstance==null){
        throw new FixFlowBizException("流程实例没找到");
      }
      ProcessInstanceEntity processInstanceEntity=(ProcessInstanceEntity)processInstance;
     
     
      List<TaskInstanceEntity> taskInstanceEntities= processInstanceEntity.getTaskMgmtInstance().getTaskInstanceEntitys();
      List<TaskInstance> taskInstances=new ArrayList<TaskInstance>();
      for (TaskInstanceEntity taskInstanceEntity : taskInstanceEntities) {
        if(!taskInstanceEntity.hasEnded()){
          taskInstances.add(taskInstanceEntity);
        }
       
      }
      return taskInstances;
     
    }
    else{
     
     
      if(taskId==null||taskId.equals("")){
        throw new FixFlowBizException("模拟执行的任务编号不能为空!");
      }
     
     
     
     
     
     
      TaskInstance taskInstance=commandContext.getTaskManager().findTaskById(taskId);
     
   
     
     
      if(taskInstance==null){
        throw new FixFlowBizException("模拟执行的任务无法找到!");
      }
     
      String tokenIdString=taskInstance.getTokenId();
     
     
      if(!taskInstance.hasEnded()){
        throw new FixFlowBizException("模拟执行的当前任务必须已经结束!");
      }
     
      ProcessInstance processInstance=commandContext.getProcessInstanceManager().findProcessInstanceById(taskInstance.getProcessInstanceId());
     
      if(processInstance==null){
        throw new FixFlowBizException("未能找到任务对应的流程实例");
      }
      ProcessInstanceEntity processInstanceEntity=(ProcessInstanceEntity)processInstance;
View Full Code Here

    //将线程副本对象放置在引擎内
    processEngine.setExternalContent(externalContent);
    //获取运行时操作对象
    RuntimeService runtimeService = processEngine.getRuntimeService();
    //启动流程实例
    ProcessInstance processInstance=runtimeService.noneStartProcessInstance(startProcessInstanceCommand);


    System.out.println("定时任务启动成功");
   
    return processInstance;
View Full Code Here

   */
  public String getShareTaskNowNodeInfo(String processInstanceId) {
    try {
      String taskInfo = "";
      ProcessEngine engine = getProcessEngine(null);
      ProcessInstance processInstanceQueryTo = engine.getRuntimeService().getProcessInstance(processInstanceId);
      if (processInstanceQueryTo.getEndTime() != null) {
        if(processInstanceQueryTo.getInstanceType().equals(ProcessInstanceType.COMPLETE)){
          return "完成";
        }else{
          return "已终止";
        }
      }
View Full Code Here

   
    ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
    Token token=processEngine.getRuntimeService().createTokenQuery().tokenId(tokenId).singleResult();
    String processInstanceId = token.getProcessInstanceId();

    ProcessInstance processInstance=processEngine.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
   
   
    ProcessInstanceManager processInstanceManager = commandContext.getProcessInstanceManager();

 
    ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();

    ProcessDefinitionBehavior processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processInstance.getProcessDefinitionId());

   

    ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId, processDefinition);
    TokenEntity tokenEntity = processInstanceImpl.getTokenMap().get(tokenId);
View Full Code Here

  }
 
  public static String getShareTaskNowNodeInfo(String processInstanceId,ProcessEngine engine) {
    try {
      String taskInfo = "";
      ProcessInstance processInstanceQueryTo = engine.getRuntimeService().getProcessInstance(processInstanceId);
      if (processInstanceQueryTo.getEndTime() != null) {
        return "完成";
      }

      List<TaskInstance> taskInstanceQueryTos = new ArrayList<TaskInstance>();
      TaskQuery tq = engine.getTaskService().createTaskQuery();
View Full Code Here

    //设置提交人
    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();
   
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.runtime.ProcessInstance

Copyright © 2018 www.massapicom. 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.