sWorkflowName = sWorkflowName.substring(0, i);
}
XMLMetadataHelper.validateName(sWorkflowName);
final Workflow workflow = new Workflow(sWorkflowName);
workflow.setResourceName(m_helper.getCurResourceName());
workflow.setVersion(nVersion);
workflow.setMetaclass(m_metadata.getMetaclass(XMLUtil.getReqStringAttr(workflowElement, "class")));
workflow.setAttributes((Pair)m_helper.parse(
XMLUtil.getStringAttr(workflowElement, "attributes"),
true, null, null, m_metadata.getGlobalEnvironment()));
workflow.setPrivileged(XMLUtil.getBooleanAttr(workflowElement, "privileged", workflow.isPrivileged()));
workflow.setCaption(XMLUtil.getStringAttr(workflowElement, "caption"));
String sVarList = XMLUtil.getStringAttr(workflowElement, "variables");
if (sVarList != null)
{
for (StringTokenizer tokenizer = new StringTokenizer(sVarList); tokenizer.hasMoreTokens();)
{
String sVarName = tokenizer.nextToken();
XMLMetadataHelper.validateName(sVarName);
workflow.addVariable(new Variable(sVarName));
}
}
if (isWorkflowHandler(workflowElement))
{
loadWorkflowHandler(workflowElement, workflow, workflow);
}
m_flowFixupList = new ArrayList();
loadActivity(workflowElement.getFirstChild(), workflow);
m_metadata.addWorkflow(workflow);
m_helper.fixup(m_flowFixupList.iterator());
m_flowFixupList = null;
m_persistenceMappingFixupList.add(new ContextFixup(m_helper)
{
public void fixup()
{
workflow.resolve(m_machine);
}
});
}