📄 defaultforkhandler.java
字号:
package org.jbpm.delegation.fork;
import java.util.*;
import org.jbpm.*;
import org.jbpm.delegation.*;
import org.jbpm.model.definition.*;
import org.jbpm.model.definition.impl.*;
import org.jbpm.model.execution.impl.*;
public class DefaultForkHandler implements ForkHandler {
public void fork(ForkContext forkContext) throws ExecutionException {
int i = 0;
Map childTokens = forkContext.getToken().getChildren();
if ( childTokens != null ) {
i = childTokens.size();
}
JoinImpl correspondingJoin = (JoinImpl) ((Fork)forkContext.getNode()).getCorrespondingJoin();
Iterator iter = forkContext.getNode().getLeavingTransitions().iterator();
while( iter.hasNext() ) {
Transition transition = (Transition) iter.next();
TokenImpl childToken = (TokenImpl) forkContext.createToken( transition, getTokenName(i,transition) );
childToken.setReactivationJoin( correspondingJoin );
i++;
}
}
private String getTokenName(int index, Transition transition) {
String tokenName = null;
String transitionName = transition.getName();
if ( transitionName != null ) {
tokenName = transitionName;
} else {
if ( index < tokenNames.length ) {
tokenName = tokenNames[index];
} else {
tokenName = Integer.toString( index+1 );
}
}
return tokenName;
}
private static final String[] tokenNames = new String[]{
"first",
"second",
"third",
"fourth",
"fifth",
"sixth",
"seventh",
"eight",
"nineth",
"tenth"
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -