mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Introduces a new variant on the link() call that makes the update() call
way faster in the worst case, i.e. tolerable so far. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3808 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
|
||||
package org.alfresco.repo.avm;
|
||||
|
||||
import org.alfresco.service.cmr.avm.AVMBadArgumentException;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.AVMNotFoundException;
|
||||
|
||||
/**
|
||||
* Base class for Directories.
|
||||
* @author britt
|
||||
@@ -40,4 +44,26 @@ abstract class DirectoryNodeImpl extends AVMNodeImpl implements DirectoryNode
|
||||
{
|
||||
super(id, repo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dangerous version of link.
|
||||
* @param name The name to give the child.
|
||||
* @param toLink The child to link in.
|
||||
*/
|
||||
public void link(String name, AVMNodeDescriptor toLink)
|
||||
{
|
||||
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(toLink.getId());
|
||||
if (node == null)
|
||||
{
|
||||
throw new AVMNotFoundException("Child node not found.");
|
||||
}
|
||||
if (node.getType() == AVMNodeType.LAYERED_DIRECTORY &&
|
||||
!((LayeredDirectoryNode)node).getPrimaryIndirection())
|
||||
{
|
||||
throw new AVMBadArgumentException("Non primary layered directories cannot be linked.");
|
||||
}
|
||||
// Make the new ChildEntry and save.
|
||||
ChildEntry newChild = new ChildEntryImpl(name, this, node);
|
||||
AVMContext.fgInstance.fChildEntryDAO.save(newChild);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user