Added two more special purpose calls, to improve flatten performance from

rotten to ok.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3809 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-09-15 21:26:26 +00:00
parent dfe49bf51b
commit 14ebe1726f
6 changed files with 105 additions and 4 deletions

View File

@@ -1285,4 +1285,38 @@ public class AVMRepository
}
dir.link(name, child);
}
/**
* Remove name without leaving behind a deleted node. Dangerous
* if used unwisely.
* @param lDir The layered directory node.
* @param name The name of the child.
*/
public void flatten(AVMNodeDescriptor lDir, String name)
{
AVMNode node = AVMContext.fgInstance.fAVMNodeDAO.getByID(lDir.getId());
if (!(node instanceof LayeredDirectoryNode))
{
throw new AVMWrongTypeException("Not a Layered Directory.");
}
LayeredDirectoryNode dir = (LayeredDirectoryNode)node;
if (!dir.getIsNew())
{
throw new AVMException("Directory has not already been copied.");
}
dir.flatten(name);
}
/**
* Force a copy on write.
* @param path The path to force.
*/
public void forceCopy(String path)
{
fLookupCount.set(1);
String [] pathParts = SplitPath(path);
AVMStore store = getAVMStoreByName(pathParts[0]);
// Just force a copy if needed by looking up in write mode.
store.lookup(-1, pathParts[1], true, false);
}
}