Package com.founder.fix.fixflow.core.impl.persistence

Examples of com.founder.fix.fixflow.core.impl.persistence.ProcessInstanceManager


    if (processInstanceId == null || processInstanceId.equals("")) {
      throw new FixFlowException("流程实例编号为空!");
    }

    // 创建流程实例管理器
    ProcessInstanceManager processInstanceManager = commandContext.getProcessInstanceManager();

    // 获取流程实例
    ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId);

   
    if(!processInstanceImpl.isSuspended()){
      throw new FixFlowException("流程实例没有暂停,不能恢复");
    }
   
    //恢复流程实例
    processInstanceImpl.resume();
 
    try {
      // 持久化实例
      processInstanceManager.saveProcessInstance(processInstanceImpl);
    } catch (Exception e) {
      throw new FixFlowException("流程实例持久化失败!", e);
    }
    return null;
  }
View Full Code Here


    if (processInstanceId == null || processInstanceId.equals("")) {
      throw new FixFlowException("流程实例编号为空!");
    }

    // 创建流程实例管理器
    ProcessInstanceManager processInstanceManager = commandContext.getProcessInstanceManager();

    // 获取流程实例
    ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId);

    // 结束流程实例
    processInstanceImpl.termination();
 
    try {
      // 持久化实例
      processInstanceManager.saveProcessInstance(processInstanceImpl);
    } catch (Exception e) {
      throw new FixFlowException("流程实例持久化失败!", e);
    }
    return null;
View Full Code Here

    TaskInstance taskInstanceQuery = taskManager.findTaskById(taskId);

    String tokenId = taskInstanceQuery.getTokenId();
    String nodeId = taskInstanceQuery.getNodeId();
    String processDefinitionId = taskInstanceQuery.getProcessDefinitionId();
    ProcessInstanceManager processInstanceManager = commandContext
        .getProcessInstanceManager();

    String processInstanceId = taskInstanceQuery.getProcessInstanceId();

    ProcessDefinitionManager processDefinitionManager = commandContext
        .getProcessDefinitionManager();

    ProcessDefinitionBehavior processDefinition = processDefinitionManager
        .findLatestProcessDefinitionById(processDefinitionId);

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

    TaskCommandInst taskCommand = userTask.getTaskCommandsMap().get(
        userCommandId);

    ProcessInstanceEntity processInstanceImpl = processInstanceManager
        .findProcessInstanceById(processInstanceId, processDefinition);

    processInstanceImpl.getContextInstance().addTransientVariable(
        "fixVariable_userCommand", userCommandId);
View Full Code Here

    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);
    if(transientVariables!=null&&transientVariables.keySet().size()>0){
      processInstanceImpl.getContextInstance().setTransientVariableMap(transientVariables);
   
    }
    if(dataVariables!=null&&dataVariables.keySet().size()>0){
      processInstanceImpl.getContextInstance().setDataVariable(dataVariables);
    }
   
    tokenEntity.signal();

    try {
      processInstanceManager.saveProcessInstance(processInstanceImpl);
    } catch (Exception e) {
      throw new FixFlowException("流程实例持久化失败!", e);
    }
    return null;
   
View Full Code Here

      throw new FixFlowException("没有查询到相关任务");
    }
   
    String tokenId = taskInstanceQuery.getTokenId();
    String processDefinitionId = taskInstanceQuery.getProcessDefinitionId();
    ProcessInstanceManager processInstanceManager = commandContext.getProcessInstanceManager();

    String processInstanceId = taskInstanceQuery.getProcessInstanceId();

    ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();

    ProcessDefinitionBehavior processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);

    ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId, processDefinition);

    TokenEntity token=processInstanceImpl.getTokenMap().get(tokenId);
   
   
   
View Full Code Here

      TaskInstance taskInstanceQuery = taskManager.findTaskById(taskId);

     
      String processDefinitionId = taskInstanceQuery.getProcessDefinitionId();
      ProcessInstanceManager processInstanceManager = commandContext.getProcessInstanceManager();

      String processInstanceId = taskInstanceQuery.getProcessInstanceId();

      ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();

      ProcessDefinitionBehavior processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);

     
     
      ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId, processDefinition);

   

      List<TaskInstanceEntity> taskInstances = processInstanceImpl.getTaskMgmtInstance().getTaskInstanceEntitys();

      for (TaskInstanceEntity taskInstance : taskInstances) {
        if (taskInstance.getId().equals(taskId)) {
       
         
          TaskInstanceEntity taskInstanceImpl= taskInstance;
            taskInstanceImpl.setTaskComment(this.taskComment);
           
        }
      }

      try {
        processInstanceManager.saveProcessInstance(processInstanceImpl);
      } catch (Exception e) {
        throw new FixFlowException("流程实例持久化失败!", e);
      }
      return null;
View Full Code Here

    if (processInstanceId == null || processInstanceId.equals("")) {
      throw new FixFlowException("流程实例编号为空!");
    }

    // 创建流程实例管理器
    ProcessInstanceManager processInstanceManager = commandContext.getProcessInstanceManager();

    // 获取流程实例
    ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId);

   
    if(processInstanceImpl.isSuspended()){
      throw new FixFlowException("流程实例已经暂停,不能再次暂停");
    }
   
    if(processInstanceImpl.hasEnded()){
      throw new FixFlowException("流程实例已经结束,不能暂停");
    }
   
    //暂停流程实例
    processInstanceImpl.suspend();
 
    try {
      // 持久化实例
      processInstanceManager.saveProcessInstance(processInstanceImpl);
    } catch (Exception e) {
      throw new FixFlowException("流程实例持久化失败!", e);
    }
    return null;
  }
View Full Code Here

    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);
    processInstanceImpl.getContextInstance().setTransientVariableMap(transientVariables);
   
    if(nodeId==null){
      Event event=(Event)tokenEntity.getFlowNode();
      if(event instanceof BoundaryEvent){
        BoundaryEvent boundaryEvent=(BoundaryEvent)event;
        Activity activity =boundaryEvent.getAttachedToRef();
        boolean isCancelActivity=boundaryEvent.isCancelActivity();
        if(isCancelActivity){
          //如果是终止事件 则结束进入节点的时候的散发的所有子令牌 然后将父令牌 移动到超时节点往下进行
          tokenEntity.signalKillChildMoveParentToken(boundaryEvent,activity);
        }
        else{
          //如果不是终止事件 则默认方法驱动令牌
          tokenEntity.signal();
        }
       
      }
      if(event instanceof CatchEvent){
        tokenEntity.signal();
      }
     
    }
    else{
      BaseElement baseElement=processDefinition.getDefinitions().getElement(nodeId);
      if(baseElement instanceof BoundaryEvent){
        BoundaryEvent boundaryEvent=(BoundaryEvent)baseElement;
        Activity activity =boundaryEvent.getAttachedToRef();
       
        //String nodeTokenId = this.getId();
        // 创建分支令牌并添加到集合中
        boolean isCancelActivity=boundaryEvent.isCancelActivity();
        if(isCancelActivity){
         
          //设置超时节点
          //nodeChildExecutionContext.setTimeOutNode(nodeToken.getFlowNode());
          //ExecutionContext executionContext=ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(tokenEntity);
          tokenEntity.signalKillChildMoveParentToken(boundaryEvent,activity);
          //boundaryEvent.leave(executionContext);
        }
        else{
          TokenEntity nodeToken=((FlowNodeImpl)tokenEntity.getFlowNode()).createForkedToken(tokenEntity, boundaryEvent.getId()).token;
         
          ExecutionContext nodeChildExecutionContext = ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(nodeToken);
          //设置超时节点
          nodeChildExecutionContext.setTimeOutNode(activity);
          boundaryEvent.leave(nodeChildExecutionContext);
          //this.forkedTokenEnter(nodeChildExecutionContext);
        }
       
       
      }
    }
   
    try {
      processInstanceManager.saveProcessInstance(processInstanceImpl);
    } catch (Exception e) {
      throw new FixFlowException("流程实例持久化失败!", e);
    }
    return null;
  }
View Full Code Here

   
    try {

      subProcessInstance.noneStart();

      ProcessInstanceManager processInstanceManager = Context.getCommandContext().getProcessInstanceManager();

      processInstanceManager.saveProcessInstance(subProcessInstance);

    } catch (Exception e) {

      throw new FixFlowException("子流程 " + this.getName() + " 启动异常!", e);
View Full Code Here

    TaskInstance taskInstanceQuery = taskManager.findTaskById(taskId);
   
   
    String tokenId = taskInstanceQuery.getTokenId();
    String processDefinitionId = taskInstanceQuery.getProcessDefinitionId();
    ProcessInstanceManager processInstanceManager = commandContext.getProcessInstanceManager();

    String processInstanceId = taskInstanceQuery.getProcessInstanceId();

    ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();

    ProcessDefinitionBehavior processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);

    ProcessInstanceEntity processInstanceImpl = processInstanceManager.findProcessInstanceById(processInstanceId, processDefinition);

    TokenEntity token=processInstanceImpl.getTokenMap().get(tokenId);
   
   
   
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.impl.persistence.ProcessInstanceManager

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.