This in theory makes AVMSyncService feature complete, by added flatten, which

essentially resets a users layer to be as much like the target tree as possible
to keep comparisons fast.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3797 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-09-14 19:59:08 +00:00
parent 1386cedef5
commit 348ec8b265
2 changed files with 52 additions and 5 deletions

View File

@@ -508,16 +508,16 @@ public class AVMSyncServiceImpl implements AVMSyncService
* @param layer The on top node.
* @param underlying The underlying node.
*/
private void flatten(AVMNodeDescriptor layer, AVMNodeDescriptor underlying)
private boolean flatten(AVMNodeDescriptor layer, AVMNodeDescriptor underlying)
{
if (!layer.isLayeredDirectory())
{
return;
return false;
}
// layer and underlying must match for flattening to be useful.
if (!layer.getIndirection().equals(underlying.getPath()))
{
return;
return false;
}
// The underlying thing must be a directory.
if (!underlying.isDirectory())
@@ -529,11 +529,12 @@ public class AVMSyncServiceImpl implements AVMSyncService
// If the layer is empty (directly, that is) we're done.
if (layerListing.size() == 0)
{
return;
return true;
}
// Grab the listing
Map<String, AVMNodeDescriptor> underListing =
fAVMService.getDirectoryListing(-1, underlying.getPath(), true);
boolean flattened = true;
for (String name : layerListing.keySet())
{
AVMNodeDescriptor topNode = layerListing.get(name);
@@ -551,9 +552,18 @@ public class AVMSyncServiceImpl implements AVMSyncService
else
{
// Otherwise recursively flatten the children.
flatten(topNode, bottomNode);
if (flatten(topNode, bottomNode))
{
fAVMService.removeNode(layer.getPath(), name);
fAVMService.uncover(layer.getPath(), name);
}
else
{
flattened = false;
}
}
}
return flattened;
}
/**