{
return;
}
fireEvent(EVENT_ADD_NODES, key, nodes, true);
ConfigurationNode parent;
List target = fetchNodeList(key);
if (target.size() == 1)
{
// existing unique key
parent = (ConfigurationNode) target.get(0);
}
else
{
// otherwise perform an add operation
parent = processNodeAddData(getExpressionEngine().prepareAdd(
getRootNode(), key));
}
if (parent.isAttribute())
{
throw new IllegalArgumentException(
"Cannot add nodes to an attribute node!");
}
// a visitor to ensure that the nodes' references are cleared; this is
// necessary if the nodes are moved from another configuration
ConfigurationNodeVisitor clearRefVisitor = new ConfigurationNodeVisitorAdapter()
{
public void visitBeforeChildren(ConfigurationNode node)
{
node.setReference(null);
}
};
for (Iterator it = nodes.iterator(); it.hasNext();)
{
ConfigurationNode child = (ConfigurationNode) it.next();
if (child.isAttribute())
{
parent.addAttribute(child);
}
else
{
parent.addChild(child);
}
child.visit(clearRefVisitor);
}
fireEvent(EVENT_ADD_NODES, key, nodes, false);
}