Fixed an embarassing not so corner case failure. Non primary

layered directories cannot be just linked in for update, but must instead
be recursively linked in.  


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3801 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-09-15 03:04:57 +00:00
parent 5eca8bd6e0
commit 83b4cdb76d
6 changed files with 85 additions and 20 deletions

View File

@@ -772,14 +772,19 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
* Link a node with the given id into this directory.
* @param lPath The Lookup for this.
* @param name The name to give the node.
* @param id The id of the node to insert.
* @param toLink The node to link in.
*/
public void link(Lookup lPath, String name, long id)
public void link(Lookup lPath, String name, AVMNodeDescriptor toLink)
{
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(id);
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(toLink.getId());
if (node == null)
{
throw new AVMNotFoundException("Not Found: " + id);
throw new AVMNotFoundException("Not Found: " + toLink.getId());
}
if (node.getType() == AVMNodeType.LAYERED_DIRECTORY &&
!((LayeredDirectoryNode)node).getPrimaryIndirection())
{
throw new AVMBadArgumentException("Non primary layered directories cannot be linked.");
}
// Look for an existing child of that name.
AVMNode existing = lookupChild(lPath, name, -1, false, true);