public SWITCH(ActivityInfo self, ScopeFrame scopeFrame, LinkFrame linkFrame) {
super(self, scopeFrame, linkFrame);
}
public final void run() {
OSwitch oswitch = (OSwitch)_self.o;
OSwitch.OCase matchedOCase = null;
FaultData faultData = null;
EvaluationContext evalCtx = getEvaluationContext();
for (Iterator i = oswitch.getCases().iterator(); i.hasNext();) {
OSwitch.OCase ocase = (OSwitch.OCase) i.next();
try{
if(getBpelRuntimeContext().getExpLangRuntime().evaluateAsBoolean(ocase.expression, evalCtx)){
matchedOCase = ocase;
break;
}
} catch (EvaluationException e) {
String msg = "Unexpected evaluation exception.";
__log.error(msg,e);
// TODO: Better location information.
throw new InvalidProcessException(msg,e);
}catch(FaultException e){
__log.error(e.getMessage(),e);
faultData = createFault(e.getQName(), ocase);
_self.parent.completed(faultData, CompensationHandler.emptySet());
// Dead path all the child activiites:
for (Iterator<OSwitch.OCase> j = oswitch.getCases().iterator(); j.hasNext(); )
dpe(j.next().activity);
return;
}
}
// Dead path cases not chosen
for (Iterator<OSwitch.OCase> i = oswitch.getCases().iterator(); i.hasNext(); ) {
OSwitch.OCase cs = i.next();
if (cs != matchedOCase)
dpe(cs.activity);
}