mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Added new AVM node type DeletedNode (aka, ghost, tombstone), a marker node for a
node that has been deleted in a version. This makes tree comparisons easier by resolving the cases in which one wants to know whether a deletions is more or less recent than another version of a node. Along the way got rid of DeletedChild and friends including a table in the schema, since DeletedNode takes on all the work that it performed. Deleted two illegally named files in Virgin content. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3748 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -99,6 +99,10 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
List<ChildEntry> children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
||||
for (ChildEntry child : children)
|
||||
{
|
||||
if (child.getChild().getType() == AVMNodeType.DELETED_NODE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.put(child.getName(), child.getChild());
|
||||
}
|
||||
return result;
|
||||
@@ -129,6 +133,10 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
List<ChildEntry> children = AVMContext.fgInstance.fChildEntryDAO.getByParent(this);
|
||||
for (ChildEntry child : children)
|
||||
{
|
||||
if (child.getChild().getType() == AVMNodeType.DELETED_NODE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
result.put(child.getName(),
|
||||
child.getChild().getDescriptor(dir.getPath(), child.getName(), dir.getIndirection()));
|
||||
}
|
||||
@@ -155,13 +163,13 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
@SuppressWarnings("unchecked")
|
||||
public AVMNode lookupChild(Lookup lPath, String name, int version, boolean write)
|
||||
{
|
||||
// We're doing the hand unrolling of the proxy because
|
||||
// Hibernate/CGLIB proxies are broken.
|
||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
if (entry == null)
|
||||
if (entry == null || entry.getChild().getType() == AVMNodeType.DELETED_NODE)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// We're doing the hand unrolling of the proxy because
|
||||
// Hibernate/CGLIB proxies are broken.
|
||||
return AVMNodeUnwrapper.Unwrap(entry.getChild());
|
||||
}
|
||||
|
||||
@@ -178,7 +186,7 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
throw new AVMBadArgumentException("Path is null.");
|
||||
}
|
||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
if (entry == null)
|
||||
if (entry == null || entry.getChild().getType() == AVMNodeType.DELETED_NODE)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -187,15 +195,27 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
|
||||
/**
|
||||
* Remove a child, no copying.
|
||||
* @param lPath The path by which this was found.
|
||||
* @param name The name of the child to remove.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void removeChild(String name)
|
||||
public void removeChild(Lookup lPath, String name)
|
||||
{
|
||||
ChildEntry entry = AVMContext.fgInstance.fChildEntryDAO.getByNameParent(name, this);
|
||||
if (entry != null)
|
||||
{
|
||||
AVMNode child = entry.getChild();
|
||||
if (child.getType() == AVMNodeType.DELETED_NODE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
AVMNode ghost = new DeletedNodeImpl(lPath.getAVMStore().getAVMRepository().issueID(),
|
||||
lPath.getAVMStore());
|
||||
AVMContext.fgInstance.fChildEntryDAO.delete(entry);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.save(ghost);
|
||||
AVMContext.fgInstance.fAVMNodeDAO.flush();
|
||||
ghost.setAncestor(child);
|
||||
putChild(name, ghost);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user