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

Examples of com.founder.fix.fixflow.core.impl.runtime.ProcessInstanceEntity


    ProcessDefinitionManager processDefinitionManager = commandContext.getProcessDefinitionManager();

    ProcessDefinitionBehavior processDefinition = processDefinitionManager.findLatestProcessDefinitionById(processDefinitionId);

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

    TokenEntity token=processInstanceImpl.getTokenMap().get(tokenId);
   
   
   
    List<String> tokenIdList=new ArrayList<String>();
   
View Full Code Here


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

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

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

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

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

    // 结束流程实例
    processInstanceImpl.termination();
 
    try {
      // 持久化实例
      processInstanceManager.saveProcessInstance(processInstanceImpl);
    } catch (Exception e) {
View Full Code Here

      }
    } else {
      throw new FixFlowException("processDefinitionKey 和 processDefinitionId 不能都为空");
    }

    ProcessInstanceEntity processInstanceEntity = null;
    try {
     
      processInstanceEntity =  processDefinition.createProcessInstance(businessKey);

      processInstanceEntity.setStartAuthor(startAuthor);
      processInstanceEntity.getContextInstance().setTransientVariableMap(transientVariables);
      processInstanceEntity.getContextInstance().setVariableMap(variables);
 
      BaseElement baseElement=processDefinition.getDefinitions().getElement(nodeId);
     
      if(baseElement !=null){
        processInstanceEntity.start((FlowNode)baseElement);
      }
      else{
        throw new FixFlowException("没有找到messageId为 "+ messageId+" 的消息启动节点");
      }
     
View Full Code Here

      }
    } else {
      throw new FixFlowException("processDefinitionKey 和 processDefinitionId 不能都为空");
    }

    ProcessInstanceEntity processInstanceEntity = null;
    try {
     
      processInstanceEntity =  processDefinition.createProcessInstance(businessKey);

      processInstanceEntity.setStartAuthor(startAuthor);
      processInstanceEntity.getContextInstance().setTransientVariableMap(transientVariables);
      processInstanceEntity.getContextInstance().setVariableMap(variables);
 

      processInstanceEntity.start();
     
     
      commandContext.getProcessInstanceManager().saveProcessInstance(processInstanceEntity);

    } catch (Exception e) {
View Full Code Here

 
 
  public Boolean execute(CommandContext commandContext) {
    // TODO Auto-generated method stub
   
    ProcessInstanceEntity processInstanceQueryTo=commandContext.getProcessInstanceManager().findProcessInstanceByDefKeyAndBusinessKey(processDefinitionKey, businessKey);
    if(processInstanceQueryTo==null){
      return false;
    }
    String  processInstanceId=processInstanceQueryTo.getId();
   
    commandContext.getProcessInstanceManager().deleteProcessInstance(processInstanceId, cascade);
   
    return true;
  }
View Full Code Here

      }
    } else {
      throw new FixFlowException("processDefinitionKey 和 processDefinitionId 不能都为空");
    }

    ProcessInstanceEntity processInstanceEntity = null;
    try {
      /*if(parentProcessInstance!=null){
       
        if(parentProcessInstanceToken!=null){
          processInstanceEntity=new ProcessInstanceEntity(processDefinition, businessKey, parentProcessInstance, (TokenEntity) parentProcessInstanceToken);
         
        }
        else{
          throw new FixFlowException("子流程启动失败");
        }
       
      }
      else{
        processInstanceEntity =  processDefinition.createProcessInstance(businessKey);

      }*/
      processInstanceEntity =  processDefinition.createProcessInstance(businessKey);
     
      processInstanceEntity.setStartAuthor(startAuthor);
      if(this.initiator!=null&&!this.initiator.equals("")){
        processInstanceEntity.setInitiatorWithoutCascade(this.initiator);
      }
      processInstanceEntity.getContextInstance().setTransientVariableMap(transientVariables);
      processInstanceEntity.getContextInstance().setVariableMap(variables);
 

      processInstanceEntity.noneStart();
     
     
      commandContext.getProcessInstanceManager().saveProcessInstance(processInstanceEntity);

    } catch (Exception e) {
View Full Code Here

        .getDefinitions().getElement(nodeId);

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

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

    processInstanceImpl.getContextInstance().addTransientVariable(
        "fixVariable_userCommand", userCommandId);

    processInstanceImpl.getContextInstance().setVariableMap(variables);

    // processInstanceImpl.setBizKey(this.businessKey);

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

    processInstanceImpl.getContextInstance().setTransientVariableMap(
        transientVariables);

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

    if (taskCommand != null && taskCommand.getExpression() != null) {
      try {

        ExpressionMgmt.execute(taskCommand.getExpression(),
            executionContext);
      } catch (Exception e) {
        throw new FixFlowException("用户命令表达式执行异常!", e);
      }
    }

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

    for (TaskInstanceEntity taskInstance : taskInstances) {
      if (taskInstance.getId().equals(taskId)) {
View Full Code Here

    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 {
View Full Code Here

     
      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;
      TokenEntity tokenEntity=processInstanceEntity.getTokenMap().get(tokenIdString);
     
     
     
     
      List<TaskInstanceEntity> taskInstanceEntities= processInstanceEntity.getTaskMgmtInstance().getTaskInstanceEntitys();
      List<TaskInstance> taskInstances=new ArrayList<TaskInstance>();
      for (TaskInstanceEntity taskInstanceEntity : taskInstanceEntities) {
        if(!taskInstanceEntity.hasEnded()){
          String nextTokenId=taskInstanceEntity.getTokenId();
          if(tokenIdString.equals(nextTokenId)){
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.impl.runtime.ProcessInstanceEntity

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.