*/
public void executeModelObject(ModelObject mo, EngineExecutor ee)
{
TokenContext context = ee.getTokenContext();
NodeSocket entrySocket = context.getCurrentSocket();
ActivityNode node = (ActivityNode) entrySocket.getNode();
NodeSocket nextSocket = node.getDefaultExitSocket();
// Activity reference missing, try the node's handler
TokenContext oldContext = context;
HandlerContext hc = getEngine().executeHandler(node.getActivityHandlerDefinition(), HandlerTypes.ACTIVITY, context, context.getCurrentSocket(), nextSocket);
if (hc != null)
{
context = hc.getTokenContext();
if (context != oldContext)
{
// Token context instance has changed due to rollback
ee.setTokenContext(context);
}
nextSocket = hc.getNextSocket();
if (nextSocket == null)
{
String msg = LogUtil.error(getClass(), "Handler of node $0 has set a null next socket. [{1}]", node.getQualifier(), context);
throw new EngineException("MissingNextSocket", msg);
}
}
else
{
// No handler present, try the default socket
if (nextSocket != null)
{
LogUtil.warn(getClass(), "No activity handler defined for activity node $0, using default exit socket $1.", node.getQualifier(), nextSocket.getName());
}
else
{
String msg = LogUtil.error(getClass(), "No activity handler found for activity node $0 and no default socket present. [{1}]", node.getQualifier(), context);
throw new EngineException("NoDefaultExitSocket", msg);
}
}
context.setCurrentSocket(nextSocket);