mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Made Lookup::getIndirectionPath() somewhat less ridiculous.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3262 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -238,7 +238,6 @@ class LayeredDirectoryNodeImpl extends DirectoryNodeImpl implements LayeredDirec
|
|||||||
{
|
{
|
||||||
// Capture the repository.
|
// Capture the repository.
|
||||||
Repository repo = lPath.getRepository();
|
Repository repo = lPath.getRepository();
|
||||||
// Otherwise we do an actual copy.
|
|
||||||
LayeredDirectoryNodeImpl newMe = null;
|
LayeredDirectoryNodeImpl newMe = null;
|
||||||
if (!lPath.isInThisLayer())
|
if (!lPath.isInThisLayer())
|
||||||
{
|
{
|
||||||
|
@@ -22,7 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This holds all the information necessary to perform operations
|
* This holds all the information necessary to perform operations
|
||||||
* on AVMNodes, and is internall structured as a list of path components
|
* on AVMNodes, and is structured internally as a list of path components
|
||||||
* from the root directory of a repository.
|
* from the root directory of a repository.
|
||||||
* @author britt
|
* @author britt
|
||||||
*/
|
*/
|
||||||
@@ -258,33 +258,28 @@ class Lookup
|
|||||||
*/
|
*/
|
||||||
public String getIndirectionPath()
|
public String getIndirectionPath()
|
||||||
{
|
{
|
||||||
// The path is the underlying path of the lowest layer that is directly contained
|
// The path is the underlying path of the lowest layer (in the path sense)
|
||||||
// by the top layer that is a primary indirection node.
|
// that is directly contained by the top layer and is a primary indirection node.
|
||||||
for (int pos = fLowestLayerIndex; pos >= fTopLayerIndex; pos--)
|
int pos = fLowestLayerIndex;
|
||||||
|
AVMNode node = fComponents.get(pos).getNode();
|
||||||
|
LayeredDirectoryNode oNode = null;
|
||||||
|
while (pos >= fTopLayerIndex && node.getType() != AVMNodeType.LAYERED_DIRECTORY &&
|
||||||
|
((oNode = (LayeredDirectoryNode)node).getLayerID() != fTopLayer.getLayerID() ||
|
||||||
|
!oNode.getPrimaryIndirection()))
|
||||||
{
|
{
|
||||||
AVMNode node = fComponents.get(pos).getNode();
|
pos--;
|
||||||
if (node.getType() != AVMNodeType.LAYERED_DIRECTORY)
|
node = fComponents.get(pos).getNode();
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
LayeredDirectoryNode oNode =
|
|
||||||
(LayeredDirectoryNode)node;
|
|
||||||
if (oNode.getLayerID() == fTopLayer.getLayerID() &&
|
|
||||||
oNode.getPrimaryIndirection())
|
|
||||||
{
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append(oNode.getUnderlying());
|
|
||||||
for (int i = pos + 1; i <= fPosition; i++)
|
|
||||||
{
|
|
||||||
builder.append("/");
|
|
||||||
builder.append(fComponents.get(i).getName());
|
|
||||||
}
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// TODO This is gross. There has to be a neater way to do this.
|
oNode = (LayeredDirectoryNode)node;
|
||||||
assert false : "Not reached.";
|
// We've found it.
|
||||||
return "bogus";
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append(oNode.getUnderlying());
|
||||||
|
for (int i = pos + 1; i <= fPosition; i++)
|
||||||
|
{
|
||||||
|
builder.append("/");
|
||||||
|
builder.append(fComponents.get(i).getName());
|
||||||
|
}
|
||||||
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user