⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 processinstanceimpl.java

📁 一个java工作流引擎
💻 JAVA
字号:
package org.jbpm.model.execution.impl;

import java.util.*;

import org.jbpm.*;
import org.jbpm.model.definition.*;
import org.jbpm.model.definition.impl.*;
import org.jbpm.model.execution.*;

public class ProcessInstanceImpl implements ProcessInstance {
  
  private Long id = null;
  private DefinitionImpl definition = null;
  private TokenImpl root = null;
  private Date start = null;
  private Date end = null;
  private TokenImpl superProcessToken = null;
  
  public ProcessInstanceImpl() {}

  public ProcessInstanceImpl( DefinitionImpl definition ) {
    this.definition = definition;
    this.root = new TokenImpl( this );
    this.start = root.getStart();
  }
  
  public Long getId() { return this.id; }
  public void setId(Long id) { this.id = id; }
  
  public Definition getDefinition() { return this.definition; }
	public void setDefinition(DefinitionImpl definition) { this.definition = definition; }
  
	public Token getRoot() { return this.root; }
	public void setRoot(TokenImpl root) { this.root = root; }

  public Date getStart() { return this.start; }
  public void setStart(Date start) { this.start = start; }
  
  public Date getEnd() { return this.end; }
  public void setEnd(Date end) { this.end = end; }

  public void end(ExecutionContextImpl executionContext, boolean checkSuperProcess) throws ExecutionException {

    // if the root token is still alive
    if ( ! root.hasEnded() ) {
      // kill it
      root.end( executionContext, false ); 
    }
    
    // end this process instance
    this.end = root.getEnd();

    // execute the actions that are scheduled upon the process instance end
    definition.executeActions( EventType.PROCESS_END, executionContext );

    // if this was a sub-process of another super-process...
    if ( checkSuperProcess ) {
      if ( superProcessToken != null ) {
        // reactivate the parent-process
        ProcessStateImpl processState = (ProcessStateImpl) superProcessToken.getState();
        ExecutionContextImpl superExecutionContext = new ExecutionContextImpl( executionContext, superProcessToken );
        
        processState.subProcessEnded( superExecutionContext, executionContext );
      }
    }
  }

  public boolean hasEnded() {
    return (this.end != null);
  }

  public Token getSuperProcessToken() { return this.superProcessToken; }
  public void setSuperProcessToken(TokenImpl superProcessToken) { 
    this.superProcessToken = superProcessToken;
    if ( ( superProcessToken != null )
         && ( superProcessToken.getSubProcessInstance() != this ) ) {
      superProcessToken.setSubProcessInstance( this );
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -