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

📄 swimlaneimpl.java

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

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

public class SwimlaneImpl implements Swimlane {

  private Long id = null;
  private String name = null;
  private String description = null;
  private DefinitionImpl definition = null;
  private transient DelegationImpl assignmentDelegation = null;
  
  public SwimlaneImpl() {}
  
  public SwimlaneImpl(String name) {
    this.name = name;
  }

  public Long getId() { return this.id; }
  public void setId(Long id) { this.id = id; }

  public String getName() { return this.name; }
  public void setName(String name) { this.name = name; }

  public String getDescription() { return this.description; }
  public void setDescription(String description) { this.description = description; }
  
  public Definition getDefinition() { return this.definition; }
  public void setDefinition(DefinitionImpl definition) { this.definition = definition; }
  
  public DelegationImpl getAssignmentDelegation() { return this.assignmentDelegation; }
  public void setAssignmentDelegation(DelegationImpl assignmentDelegation) { this.assignmentDelegation = assignmentDelegation; }
  
  public String getActorId( ExecutionContextImpl executionContext ) throws NoActorException, DelegationException {
    String actorId = null;
    
    // get the actorId that was stored in the variable for this actor
    actorId = (String) executionContext.getVariable( name );
    
    // if the actor was not yet assigned a value
    if ( actorId == null ) {

      // perform the assignment delegation
      if ( assignmentDelegation == null ) {
        throw new NoActorException( "swimlane '" + name + "' does not have an AssignmentHandler delegation" );
      }
      AssignmentHandler assignmentHandler = (AssignmentHandler) assignmentDelegation.instantiate();
      
      try {
        actorId = assignmentHandler.selectActor( executionContext );
      } catch (RuntimeException e) {
        assignmentDelegation.handleException(e);
      }
      
      if ( actorId == null ) {
        TokenImpl token = (TokenImpl) executionContext.getToken();
        throw new NoActorException( "assignment handler '" + assignmentDelegation.getClassName() +"' returned a null-value when token '" + token.getName() +"' arrived in state '" + token.getState().getName() + "'" );
      }
    }
    
    return actorId;
  }

	public void toXml(org.dom4j.Element swimlaneElement) {
    swimlaneElement.addAttribute( "name", name );
    if ( description != null ) swimlaneElement.addElement( "description" ).addText( description );
    if ( assignmentDelegation != null ) {
      assignmentDelegation.toXml( swimlaneElement.addElement( "delegation" ) );
    }
	}
}

⌨️ 快捷键说明

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