}
}
if (type.startsWith("Escalation-")) {
boolean cancelActivity = (Boolean) node.getMetaData().get("CancelActivity");
CompositeContextNode compositeNode = (CompositeContextNode) attachedNode;
ExceptionScope exceptionScope = (ExceptionScope)
compositeNode.getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
if (exceptionScope == null) {
exceptionScope = new ExceptionScope();
compositeNode.addContext(exceptionScope);
compositeNode.setDefaultContext(exceptionScope);
}
String escalationCode = (String) node.getMetaData().get("EscalationEvent");
ActionExceptionHandler exceptionHandler = new ActionExceptionHandler();
exceptionHandler.setAction(new DroolsConsequenceAction("java",
(cancelActivity ? "((org.jbpm.workflow.instance.NodeInstance) kcontext.getNodeInstance()).cancel();" : "") +
"kcontext.getProcessInstance().signalEvent(\"Escalation-" + attachedTo + "-" + escalationCode + "\", null);"));
exceptionScope.setExceptionHandler(escalationCode, exceptionHandler);
} else if (type.startsWith("Error-")) {
CompositeContextNode compositeNode = (CompositeContextNode) attachedNode;
ExceptionScope exceptionScope = (ExceptionScope)
compositeNode.getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
if (exceptionScope == null) {
exceptionScope = new ExceptionScope();
compositeNode.addContext(exceptionScope);
compositeNode.setDefaultContext(exceptionScope);
}
String errorCode = (String) node.getMetaData().get("ErrorEvent");
ActionExceptionHandler exceptionHandler = new ActionExceptionHandler();
exceptionHandler.setAction(new DroolsConsequenceAction("java",
"((org.jbpm.workflow.instance.NodeInstance) kcontext.getNodeInstance()).cancel();" +
"kcontext.getProcessInstance().signalEvent(\"Error-" + attachedTo + "-" + errorCode + "\", null);"));
exceptionScope.setExceptionHandler(errorCode, exceptionHandler);
} else if (type.startsWith("Timer-")) {
boolean cancelActivity = (Boolean) node.getMetaData().get("CancelActivity");
CompositeContextNode compositeNode = (CompositeContextNode) attachedNode;
String timeDuration = (String) node.getMetaData().get("TimeDuration");
String timeCycle = (String) node.getMetaData().get("TimeCycle");