Node subprocessInitialNode = subprocess.getNodeByName(entryName);
if (subprocessInitialNode == null)
{
String msg = LogUtil.error(getClass(), "Initial node $0 called by $1 not found in process $2. [{3}]", entryName, node.getQualifier(), subprocess.getQualifier(), context);
throw new EngineException("InitialNodeNotFound", msg);
}
if (!(subprocessInitialNode instanceof InitialNode))
{
String msg = LogUtil.error(getClass(), "Node $0 called by $1 is not an initial node. [{2}]", subprocessInitialNode.getQualifier(), node.getQualifier(), context);
throw new EngineException("NotAnInitialNode", msg);
}
// Continue with the initial node of the sub process
nextSocket = subprocessInitialNode.getDefaultExitSocket();
if (nextSocket == null)
{
String msg = LogUtil.error(getClass(), "No default exit socket present for sub process initial node $0. [{1}]", subprocessInitialNode.getQualifier(), context);
throw new EngineException("NoDefaultExitSocket", msg);
}
// Push the current position onto the call stack
context.getCallStack().pushSubprocess(entrySocket);
// Create the process variables of the subprocess
EngineUtil.createProcessVariables(subprocess, context);
// Copy the data of the node entry socket in the current context
// to the initial node of the sub process in the new context
EngineUtil.copySocketData(entrySocket, context, nextSocket, context);
}
else
{
String msg = LogUtil.error(getClass(), "Missing sub process for sub process node $0. [{1}]", node.getQualifier(), context);
throw new EngineException("MissingSubprocess", msg);
}
context.setCurrentSocket(nextSocket);
}