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

@@ -407,15 +407,20 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
* Link a node with the given id into this directory.
* @param lPath The Lookup for this directory.
* @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)
{
// Assure that the incoming node exists.
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(id);
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(toLink.getId());
if (node == null)
{
throw new AVMNotFoundException("Node not found: " + id);
throw new AVMNotFoundException("Node not found: " + toLink.getId());
}
if (node.getType() == AVMNodeType.LAYERED_DIRECTORY &&
!((LayeredDirectoryNode)node).getPrimaryIndirection())
{
throw new AVMBadArgumentException("Non primary layered directories cannot be linked.");
}
// Check for an existing child by the given name.
ChildEntry child = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);