mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Got rid of parent member of AVMNodes. Duplicated data unnecessarily.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3136 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -58,18 +58,6 @@ interface AVMNode
|
||||
*/
|
||||
public void setVersionID(int version);
|
||||
|
||||
/**
|
||||
* Get the (possibly null) parent.
|
||||
* @return The parent or null.
|
||||
*/
|
||||
public DirectoryNode getParent();
|
||||
|
||||
/**
|
||||
* Set the parent of this node.
|
||||
* @param parent The DirectoryNode to set.
|
||||
*/
|
||||
public void setParent(DirectoryNode parent);
|
||||
|
||||
/**
|
||||
* Perform a COW if required.
|
||||
* @param lPath The lookup path.
|
||||
|
@@ -45,11 +45,6 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
*/
|
||||
private AVMNode fMergedFrom;
|
||||
|
||||
/**
|
||||
* The parent of this.
|
||||
*/
|
||||
private DirectoryNode fParent;
|
||||
|
||||
/**
|
||||
* The Repository that owns this.
|
||||
*/
|
||||
@@ -94,7 +89,6 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
fVersionID = -1;
|
||||
fAncestor = null;
|
||||
fMergedFrom = null;
|
||||
fParent = null;
|
||||
fRepository = repo;
|
||||
fIsRoot = false;
|
||||
long time = System.currentTimeMillis();
|
||||
@@ -143,25 +137,6 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
return fMergedFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the canonical parent of this node. This parent
|
||||
* is the one under which this node was created.
|
||||
* @return The canonical parent.
|
||||
*/
|
||||
public DirectoryNode getParent()
|
||||
{
|
||||
return fParent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the canonical parent of this node.
|
||||
* @param parent The canonical parent.
|
||||
*/
|
||||
public void setParent(DirectoryNode parent)
|
||||
{
|
||||
fParent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a copy on write on this node and recursively
|
||||
* up to the repository root. This is a template method
|
||||
@@ -183,7 +158,7 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
newMe.setVersionID(repos.getNextVersionID());
|
||||
// Get our parent directory if we have one.
|
||||
DirectoryNode parent = null;
|
||||
if (getParent() != null)
|
||||
if (!getIsRoot())
|
||||
{
|
||||
parent = (DirectoryNode)lPath.getCurrentNode();
|
||||
}
|
||||
@@ -193,7 +168,6 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
|
||||
DirectoryNode newParent =
|
||||
(DirectoryNode)parent.copyOnWrite(lPath);
|
||||
newParent.putChild(myName, newMe);
|
||||
newMe.setParent(newParent);
|
||||
}
|
||||
else // Null parent means root of repository.
|
||||
{
|
||||
|
@@ -317,7 +317,6 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
||||
}
|
||||
DirectoryNode toModify = (DirectoryNode)copyOnWrite(lPath);
|
||||
toModify.putChild(name, child);
|
||||
child.setParent(toModify);
|
||||
child.setRepository(lPath.getRepository());
|
||||
return true;
|
||||
}
|
||||
|
@@ -226,15 +226,6 @@ class OrphanReaper implements Runnable
|
||||
Query delete = session.getNamedQuery("ChildEntry.DeleteByParent");
|
||||
delete.setEntity("parent", node);
|
||||
delete.executeUpdate();
|
||||
// Now find all the nodes that point to this node as their
|
||||
// canonical parent and null that reference out.
|
||||
query = session.getNamedQuery("AVMNode.GetByParent");
|
||||
query.setEntity("parent", node);
|
||||
List<AVMNode> children = (List<AVMNode>)query.list();
|
||||
for (AVMNode child : children)
|
||||
{
|
||||
child.setParent(null);
|
||||
}
|
||||
if (node instanceof LayeredDirectoryNode)
|
||||
{
|
||||
// More special work for layered directories.
|
||||
|
@@ -89,7 +89,6 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
|
||||
}
|
||||
DirectoryNode toModify = (DirectoryNode)copyOnWrite(lPath);
|
||||
toModify.putChild(name, child);
|
||||
child.setParent(toModify);
|
||||
child.setRepository(lPath.getRepository());
|
||||
return true;
|
||||
}
|
||||
|
@@ -32,10 +32,6 @@
|
||||
complete versioning semantics. -->
|
||||
<many-to-one name="mergedFrom" column="merged_from"
|
||||
class="AVMNodeImpl"/>
|
||||
<!-- Parent is a very specific notion of containment. The parent
|
||||
of an AVMNode is the parent in which that node was created. -->
|
||||
<many-to-one name="parent" column="parent_id"
|
||||
class="DirectoryNodeImpl"/>
|
||||
<!-- This should really be not null, but I haven't figured out
|
||||
the right way to build the relation so that nullability constraints
|
||||
won't cause violations in the db during saves. -->
|
||||
@@ -224,12 +220,6 @@
|
||||
where an.mergedFrom = :merged
|
||||
]]>
|
||||
</query>
|
||||
<query name="AVMNode.GetByParent">
|
||||
<![CDATA[
|
||||
from AVMNodeImpl an
|
||||
where an.parent = :parent
|
||||
]]>
|
||||
</query>
|
||||
<query name="VersionRoot.GetVersionRoot">
|
||||
<![CDATA[
|
||||
select v.root
|
||||
|
Reference in New Issue
Block a user