mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user