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:
Britt Park
2006-06-18 17:03:49 +00:00
parent c892c5a4b5
commit 606096011c
6 changed files with 1 additions and 60 deletions

View File

@@ -58,18 +58,6 @@ interface AVMNode
*/ */
public void setVersionID(int version); 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. * Perform a COW if required.
* @param lPath The lookup path. * @param lPath The lookup path.

View File

@@ -45,11 +45,6 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
*/ */
private AVMNode fMergedFrom; private AVMNode fMergedFrom;
/**
* The parent of this.
*/
private DirectoryNode fParent;
/** /**
* The Repository that owns this. * The Repository that owns this.
*/ */
@@ -94,7 +89,6 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
fVersionID = -1; fVersionID = -1;
fAncestor = null; fAncestor = null;
fMergedFrom = null; fMergedFrom = null;
fParent = null;
fRepository = repo; fRepository = repo;
fIsRoot = false; fIsRoot = false;
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
@@ -143,25 +137,6 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
return fMergedFrom; 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 * Perform a copy on write on this node and recursively
* up to the repository root. This is a template method * up to the repository root. This is a template method
@@ -183,7 +158,7 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
newMe.setVersionID(repos.getNextVersionID()); newMe.setVersionID(repos.getNextVersionID());
// Get our parent directory if we have one. // Get our parent directory if we have one.
DirectoryNode parent = null; DirectoryNode parent = null;
if (getParent() != null) if (!getIsRoot())
{ {
parent = (DirectoryNode)lPath.getCurrentNode(); parent = (DirectoryNode)lPath.getCurrentNode();
} }
@@ -193,7 +168,6 @@ abstract class AVMNodeImpl implements AVMNode, Serializable
DirectoryNode newParent = DirectoryNode newParent =
(DirectoryNode)parent.copyOnWrite(lPath); (DirectoryNode)parent.copyOnWrite(lPath);
newParent.putChild(myName, newMe); newParent.putChild(myName, newMe);
newMe.setParent(newParent);
} }
else // Null parent means root of repository. else // Null parent means root of repository.
{ {

View File

@@ -317,7 +317,6 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
} }
DirectoryNode toModify = (DirectoryNode)copyOnWrite(lPath); DirectoryNode toModify = (DirectoryNode)copyOnWrite(lPath);
toModify.putChild(name, child); toModify.putChild(name, child);
child.setParent(toModify);
child.setRepository(lPath.getRepository()); child.setRepository(lPath.getRepository());
return true; return true;
} }

View File

@@ -226,15 +226,6 @@ class OrphanReaper implements Runnable
Query delete = session.getNamedQuery("ChildEntry.DeleteByParent"); Query delete = session.getNamedQuery("ChildEntry.DeleteByParent");
delete.setEntity("parent", node); delete.setEntity("parent", node);
delete.executeUpdate(); 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) if (node instanceof LayeredDirectoryNode)
{ {
// More special work for layered directories. // More special work for layered directories.

View File

@@ -89,7 +89,6 @@ class PlainDirectoryNodeImpl extends DirectoryNodeImpl implements PlainDirectory
} }
DirectoryNode toModify = (DirectoryNode)copyOnWrite(lPath); DirectoryNode toModify = (DirectoryNode)copyOnWrite(lPath);
toModify.putChild(name, child); toModify.putChild(name, child);
child.setParent(toModify);
child.setRepository(lPath.getRepository()); child.setRepository(lPath.getRepository());
return true; return true;
} }

View File

@@ -32,10 +32,6 @@
complete versioning semantics. --> complete versioning semantics. -->
<many-to-one name="mergedFrom" column="merged_from" <many-to-one name="mergedFrom" column="merged_from"
class="AVMNodeImpl"/> 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 <!-- This should really be not null, but I haven't figured out
the right way to build the relation so that nullability constraints the right way to build the relation so that nullability constraints
won't cause violations in the db during saves. --> won't cause violations in the db during saves. -->
@@ -224,12 +220,6 @@
where an.mergedFrom = :merged where an.mergedFrom = :merged
]]> ]]>
</query> </query>
<query name="AVMNode.GetByParent">
<![CDATA[
from AVMNodeImpl an
where an.parent = :parent
]]>
</query>
<query name="VersionRoot.GetVersionRoot"> <query name="VersionRoot.GetVersionRoot">
<![CDATA[ <![CDATA[
select v.root select v.root