Update can now handle source paths with incomplete corresponding destination paths.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3887 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-09-22 14:42:26 +00:00
parent eb4a1429b9
commit 37edacd63c
2 changed files with 50 additions and 1 deletions

View File

@@ -401,6 +401,7 @@ public class AVMSyncServiceImpl implements AVMSyncService
*/
private void linkIn(String parentPath, String name, AVMNodeDescriptor toLink, boolean removeFirst)
{
mkdirs(parentPath);
if (removeFirst)
{
fAVMService.removeNode(parentPath, name);
@@ -674,4 +675,25 @@ public class AVMSyncServiceImpl implements AVMSyncService
fAVMService.removeNode(parts[0], parts[1]);
fAVMService.createLayeredDirectory(desc.getIndirection(), parts[0], parts[1]);
}
/**
* Make sure this entire directory path exists.
* @param path
*/
private void mkdirs(String path)
{
if (fAVMService.lookup(-1, path) != null)
{
return;
}
String [] pathParts = AVMNodeConverter.SplitBase(path);
if (pathParts[0] == null)
{
// This is a root path and as such has to exist.
// Something else is going on.
throw new AVMSyncException("No corresponding destination path: " + path);
}
mkdirs(pathParts[0]);
fAVMService.createDirectory(pathParts[0], pathParts[1]);
}
}