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

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


    TaskInstanceEntity taskInstance = getTaskInstanceEntity();

    // 获取正在操作的任务命令对象实例
    TaskCommandInst taskCommand = getTaskCommandInst();
   
    ProcessInstanceEntity processInstanceImpl=getProcessInstance();
   
    ProcessDefinitionBehavior processDefinition=processInstanceImpl.getProcessDefinition();


    if (businessKey != null) {
      processInstanceImpl.setBizKeyWithoutCascade(this.businessKey);
    }

    if (initiator != null) {
      processInstanceImpl.setInitiatorWithoutCascade(this.initiator);
    }

    if (processDefinition.getTaskSubject() != null && processDefinition.getTaskSubject().getExpressionValue() != null) {

      Object result = ExpressionMgmt.execute(processDefinition.getTaskSubject().getExpressionValue(), getExecutionContext());

      if (result != null) {
        processInstanceImpl.setSubject(result.toString());
      }
    } else {
      processInstanceImpl.setSubject(processDefinition.getName());
    }

   
    TaskInstanceEntity taskInstanceImpl = getTaskInstanceEntity();
View Full Code Here


      taskInstanceNew.setFormUri(resolvedTask.getFormUri());
    }

    // 获取当前正在操作的流程实例对象
    ProcessInstanceEntity processInstance = getProcessInstance();
    // 将新创建的出的任务插入任务管理器中
    processInstance.getTaskMgmtInstance().addTaskInstanceEntity(taskInstanceNew);
    // 获取流程上下文
    ExecutionContext executionContext = getExecutionContext();
    // 触发节点的任务分配事件
    ((FlowNodeImpl) executionContext.getToken().getFlowNode()).fireEvent(BaseElementEvent.EVENTTYPE_TASK_ASSIGN, executionContext, taskInstanceNew);
View Full Code Here

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

public class InsertProcessInstance implements InsertRulesScript {

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

      runCommandExpression();

      // 获取正在操作的任务实例对象
      TaskInstanceEntity taskInstance = getTaskInstanceEntity();
     
      ProcessInstanceEntity processInstanceImpl=getProcessInstance();
     
     
     
      //在第一次启动的时候没有bizkey 的时候,在保存草稿的时候去设置bizkey
      if(processInstanceImpl.getBizKey()==null&&this.businessKey!=null){
        processInstanceImpl.setBizKey(this.businessKey);
      }
     
      ProcessDefinitionBehavior processDefinition=processInstanceImpl.getProcessDefinition();
     
     
      if(taskInstance!=null){
       
        if(taskInstance.getBizKey()==null||taskInstance.equals("")){
          taskInstance.setBizKey(this.businessKey);
        }
       
       
        taskInstance.setDraft(true);
       
        TaskDefinition taskDefinition=taskInstance.getTaskDefinition();
       
        if (taskDefinition != null && taskDefinition.getDescriptionExpression() != null) {

          Object result = ExpressionMgmt.execute(taskDefinition.getDescriptionExpression(), getExecutionContext());
          if (result != null) {
            taskInstance.setDescription(result.toString());
          } else {
            taskInstance.setDescription(taskInstance.getToken().getFlowNode().getName());
          }
        } else {
         
          if (processDefinition.getTaskSubject() != null && processDefinition.getTaskSubject().getExpressionValue() != null) {

            Object result = ExpressionMgmt.execute(processInstanceImpl.getProcessDefinition().getTaskSubject().getExpressionValue(),
                getExecutionContext());

            if (result != null) {
              taskInstance.setDescription(result.toString());
            }
View Full Code Here

     
    }else{
      throw new FixFlowException("没有找到id为: "+taskId+" 的任务");
    }
   
    ProcessInstanceEntity processInstanceImpl=getProcessInstance();
    //结束流程实例
    processInstanceImpl.termination();
 
    try {
      //持久化实例
      saveProcessInstance(commandContext);
    } catch (Exception e) {
View Full Code Here

    taskInstanceNew.setAgent(null);
    // 将新任务的管理员设置为空
    taskInstanceNew.setAdmin(null);

    // 获取当前正在操作的流程实例对象
    ProcessInstanceEntity processInstance = getProcessInstance();
    // 将新创建的出的任务插入任务管理器中
    processInstance.getTaskMgmtInstance().addTaskInstanceEntity(taskInstanceNew);
    // 获取流程上下文
    ExecutionContext executionContext = getExecutionContext();
    // 触发节点的任务分配事件
    ((FlowNodeImpl) executionContext.getToken().getFlowNode()).fireEvent(BaseElementEvent.EVENTTYPE_TASK_ASSIGN, executionContext, taskInstanceNew);
View Full Code Here

      // 结束任务
      taskInstance.customEnd(taskCommand, this.taskComment);

    }

    ProcessInstanceEntity processInstanceImpl = getProcessInstance();
   
    String parentProcessTokenId=processInstanceImpl.getParentProcessInstanceTokenId();
    if(StringUtil.isEmpty(parentProcessTokenId)){
      throw new FixFlowException("流程实例没有父流程");
    }
   
    // 终止流程实例
    processInstanceImpl.termination();

    saveProcessInstance(commandContext);

    ProcessInstanceEntity parentProcessInstance = processInstanceImpl.getParentProcessInstance();

    parentProcessInstance.terminationSubProcess(parentProcessTokenId);
   
   

   
View Full Code Here

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

public class ProcessInstancePersistentDbMap implements BusinessRulesScript {

  public Object execute(Object parameter, SqlCommand sqlCommand, ProcessEngineConfigurationImpl processEngineConfiguration) {
   
    ProcessInstanceEntity processInstance=(ProcessInstanceEntity)parameter;
   
    Map<String, Object> objectParam = new HashMap<String, Object>();
    objectParam.put("PROCESSINSTANCE_ID", processInstance.getId());
    objectParam.put("SUBJECT", processInstance.getSubject());
    objectParam.put("PROCESSDEFINITION_KEY", processInstance.getProcessDefinitionKey());
    objectParam.put("PROCESSDEFINITION_ID", processInstance.getProcessDefinitionId());
    //objectParam.put("DEFINITION_ID", parameter.getProcessDefinition().getDefinitions().getId());
    objectParam.put("ROOTTOKEN_ID", processInstance.getRootTokenId());
    objectParam.put("PARENT_INSTANCE_ID", processInstance.getParentProcessInstanceId());
    objectParam.put("PARENT_INSTANCE_TOKEN_ID", processInstance.getParentProcessInstanceTokenId());
    objectParam.put("BIZ_KEY", processInstance.getBizKey());
    objectParam.put("INITIATOR", processInstance.getInitiator());
    objectParam.put("START_AUTHOR", processInstance.getStartAuthor());
    objectParam.put("START_TIME", processInstance.getStartTime());
    objectParam.put("END_TIME", processInstance.getEndTime());
    objectParam.put("UPDATE_TIME", processInstance.getUpdateTime());
    objectParam.put("ARCHIVE_TIME", processInstance.getArchiveTime());
    objectParam.put("ISSUSPENDED", String.valueOf(processInstance.isSuspended()));
    objectParam.put("PROCESSLOCATION", processInstance.getProcessLocation());
    objectParam.put("INSTANCE_STATUS", processInstance.getInstanceType().toString());
   
    Map<String, Object> persistenceExtensionFields=processInstance.getPersistenceExtensionFields();   
    for (String key : persistenceExtensionFields.keySet()) {
      objectParam.put(key, persistenceExtensionFields.get(key));
    }
    return objectParam;
View Full Code Here

      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) {
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.