Made revert to version behave better. Now when a node is reverted a clone of

the version being reverted to is created.  This clone has the previous head version
as its ancestor and a wcm:reverted aspect applied.  wcm:reverted contains
wcm:revertedid, the node id that the reversion is a clone of.  Revert to version is
now a simple call to a new AVMService method, revert().
Propagated this to the remote API.
Modified the the AVMRevertToVersionAction to use this mechanism. Though really the
action isn't really needed now.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4824 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2007-01-14 00:56:55 +00:00
parent 6d2dbe50e2
commit 0adccaeca8
17 changed files with 200 additions and 32 deletions

View File

@@ -2338,4 +2338,32 @@ public class AVMRepository
fPurgeStoreTxnListener.storePurged(sourceName);
fCreateStoreTxnListener.storeCreated(destName);
}
/**
* Revert a head path to a given version. This works by cloning
* the version to revert to, and then linking that new version into head.
* The reverted version will have the previous head version as ancestor.
* @param path The path to the parent directory.
* @param name The name of the node.
* @param toRevertTo The descriptor of the version to revert to.
*/
public void revert(String path, String name, AVMNodeDescriptor toRevertTo)
{
fLookupCount.set(1);
try
{
String [] pathParts = SplitPath(path);
AVMStore store = getAVMStoreByName(pathParts[0]);
if (store == null)
{
throw new AVMNotFoundException("Store not found: " + pathParts[0]);
}
fLookupCache.onWrite(pathParts[0]);
store.revert(pathParts[1], name, toRevertTo);
}
finally
{
fLookupCount.set(null);
}
}
}