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

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


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

     
    }
    */
    TokenEntity token=new TokenEntity(executionContext.getToken(), this.name);
    token.setSubProcessRootToken(true);
    StartEvent startEvent=(StartEvent)getStartElement();
    ExecutionContext executionContextSub=ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(token);
    startEvent.enter(executionContextSub);
   
   
View Full Code Here


    String nodeId = taskInstanceQuery.getNodeId();

    this.processInstanceAbstract = processInstanceManager.findProcessInstanceById(processInstanceId);

    TokenEntity tokenEntity = this.processInstanceAbstract.getTokenMap().get(tokenId);

    this.executionContextAbstract = ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(tokenEntity);

    ProcessDefinitionBehavior processDefinition = this.processInstanceAbstract.getProcessDefinition();
View Full Code Here

      }
    }
   
    for (TokenEntity tokenEntity : tokenEntities) {
      if(StringUtil.isNotEmpty(tokenEntity.getParentTokenId())){
        TokenEntity tokenEntityParent=processInstanceEntity.getTokenMap().get(tokenEntity.getParentTokenId());
        tokenEntity.setParent(tokenEntityParent);
        tokenEntityParent.addChild(tokenEntity);
      }
    }
   
    List<TaskInstanceEntity> taskInstanceEntities=getCommandContext().getTaskManager().findTaskByProcessInstanceIdNotEnd(rocessInstanceId);
 
    for (TaskInstanceEntity taskInstanceEntity : taskInstanceEntities) {
     
      TokenEntity tokenEntity =processInstanceEntity.getTokenMap().get(taskInstanceEntity.getTokenId());
      if(tokenEntity.getFlowNode() instanceof UserTask){
        processInstanceEntity.getTaskMgmtInstance().addTaskInstanceEntity(taskInstanceEntity);
       
        taskInstanceEntity.setToken(tokenEntity);
      }
View Full Code Here

   * 递归保存令牌实例
   * @param tokenEntity
   */
  public void saveTokenAndChildren(Token token){
   
    TokenEntity tmpTokenEntity = findTokenById(token.getId());
    if(tmpTokenEntity == null){
      insert("insertToken", token);
    }else{
      update("updateToken", token);
    }
    if (token.getChildren() != null) {
      for (String tokenKey : token.getChildren().keySet()) {
        TokenEntity tokenChildren = token.getChildren().get(tokenKey);
        saveToken(tokenChildren);
      }
    }
  }
View Full Code Here

import com.founder.fix.fixflow.expand.database.TableUtil;

public class UpdateToken implements UpdateRulesScript {

  public void execute(Object parameter, SqlCommand sqlCommand, ProcessEngineConfigurationImpl processEngineConfiguration) {
    TokenEntity token=(TokenEntity)parameter;
    Object[] objectParamWhere = new Object[1];
    objectParamWhere[0]=token.getId() ;
    sqlCommand.update(TableUtil.getTokenRunTableName(),  token.getPersistentDbMap(), " TOKEN_ID=?",objectParamWhere);
  }
View Full Code Here

   
    //救活它。。
    processInstance.setEndTime(null);
    //获取根令牌
    TokenEntity token=processInstance.getRootToken();
    //救活它。。
    token.setEndTime(null);
    //获取流程定义
    ProcessDefinitionBehavior processDefinition=processInstance.getProcessDefinition();
    //获取指定的节点
    BaseElement baseElement=processDefinition.getDefinitions().getElement(nodeId);
    if(baseElement instanceof FlowNode){
View Full Code Here

import com.founder.fix.fixflow.expand.database.TableUtil;

public class InsertToken implements InsertRulesScript {

  public void execute(Object parameter, SqlCommand sqlCommand, ProcessEngineConfigurationImpl processEngineConfiguration) {
    TokenEntity token=(TokenEntity)parameter;
    sqlCommand.insert(TableUtil.getTokenRunTableName(),token.getPersistentDbMap());
  }
View Full Code Here

   
 
   
    ProcessEngine processEngine=ProcessEngineManagement.getDefaultProcessEngine();
   
    TokenEntity parentToken=parentProcessInstance.getTokenMap().get(parentProcessTokenId);
   
    ExecutionContext parentExecutionContext=ProcessObjectFactory.FACTORYINSTANCE.createExecutionContext(parentToken);
   
   
    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);

   
    List<TaskInstance> taskInstanceQueryTos = (new GetRollBackTaskCmd(taskInstanceCallAct.getId())).execute(commandContext);
   
    TaskInstance taskInstanceQueryRollBack = null;

    for (TaskInstance taskInstanceQueryTo : taskInstanceQueryTos) {
      if (taskInstanceQueryTo.getNodeId().equals(rollBackNodeId)) {
        taskInstanceQueryRollBack = taskInstanceQueryTo;
        break;
      }
    }
    if (taskInstanceQueryRollBack == null) {
      throw new FixFlowException("主流程没有可以退回的任务!");
    }

   
   


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

      try {
       
        UserTaskBehavior backNodeUserTask = (UserTaskBehavior) parentExecutionContext.getProcessDefinition().getDefinitions().getElement(rollBackNodeId);

        parentExecutionContext.setToFlowNode(backNodeUserTask);
 
        parentToken.signal(parentExecutionContext);

       
        //taskInstance.toFlowNodeEnd(taskCommand, taskComment, backNodeUserTask, null);

      } catch (Exception e) {

        throw new FixFlowException("任务: " + taskId + " 退回失败!", e);
      }

      try {
        Context.getCommandContext().getProcessInstanceManager().saveProcessInstance(parentProcessInstance);
      } catch (Exception e) {
        throw new FixFlowException("流程实例持久化失败!", e);
      }
 

    } else {

      try {
       
        UserTaskBehavior backNodeUserTask = (UserTaskBehavior) parentExecutionContext.getProcessDefinition().getDefinitions().getElement(rollBackNodeId);

        parentExecutionContext.setToFlowNode(backNodeUserTask);
       
        parentExecutionContext.setRollBackAssignee(taskInstanceQueryRollBack.getAssignee());
       
        parentToken.signal(parentExecutionContext);
       
     
       
      } catch (Exception e) {
View Full Code Here

  public void executeOld(ExecutionContext executionContext) throws Exception {
   
    FlowNode flowNode=executionContext.getTimeOutNode();

    UserTaskBehavior userTask=null;
    TokenEntity token=executionContext.getToken();
    if(flowNode instanceof UserTask){
      userTask=(UserTaskBehavior)flowNode;
    }
    if(userTask==null){
      return;
    }
   
    if(commandId==null){
      return;
    }
    else{
      TaskCommandInst taskCommandInst=userTask.getTaskCommandsMap().get(commandId);
     
     
      if (taskCommandInst != null && taskCommandInst.getExpression() != null) {
        try {
         
          ExpressionMgmt.execute(taskCommandInst.getExpression(), executionContext);
        } catch (Exception e) {
          throw new FixFlowException("用户命令表达式执行异常!", e);
        }
      }
     
     
      List<TaskInstanceEntity> taskInstances= token.getProcessInstance().getTaskMgmtInstance().getTaskInstanceEntitys(token);
      for (TaskInstanceEntity taskInstanceEntity : taskInstances) {
        if(taskInstanceEntity.hasEnded()){
          taskInstanceEntity.setCommandId(taskCommandInst.getId());
          taskInstanceEntity.setCommandMessage(opinion);
          taskInstanceEntity.setCommandType(taskCommandInst.getTaskCommandType());
View Full Code Here

    // 执行处理命令中的开发人员设置的表达式
    runCommandExpression();

   
    //获取当前操作任务的令牌
    TokenEntity token = getTaskInstanceEntity().getToken();
    //恢复令牌
    token.resume();
   
    try {
      //保存流程实例
      saveProcessInstance(commandContext);
     
View Full Code Here

TOP

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

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.