mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-02 17:35:18 +00:00
Provided a getLatestSnapshotID() for AVMService. It returns the latest extant version of
a store. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4364 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
95c8647031
commit
2cab072bc1
@ -965,6 +965,20 @@ public class AVMRepository
|
||||
return store.getNextVersionID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the latest extant snapshotted version id.
|
||||
* @param name The store name.
|
||||
*/
|
||||
public int getLatestSnapshotID(String name)
|
||||
{
|
||||
AVMStore store = getAVMStoreByName(name);
|
||||
if (store == null)
|
||||
{
|
||||
throw new AVMNotFoundException("Store not found.");
|
||||
}
|
||||
return store.getLastVersionID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an AVMStore by name.
|
||||
* @param name The name of the AVMStore.
|
||||
|
@ -453,6 +453,21 @@ public class AVMServiceImpl implements AVMService
|
||||
return fAVMRepository.getLatestVersionID(repName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the latest snapshot id of a store.
|
||||
* @param storeName The store name.
|
||||
* @return The id of the latest extant version of the store.
|
||||
* @throws AVMNotFoundException If <code>storeName</code> does not exist.
|
||||
*/
|
||||
public int getLatestSnapshotID(String storeName)
|
||||
{
|
||||
if (storeName == null)
|
||||
{
|
||||
throw new AVMBadArgumentException("Illegal null argument.");
|
||||
}
|
||||
return fAVMRepository.getLatestSnapshotID(storeName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create snapshots of a group of AVMStores.
|
||||
* @param stores A List of AVMStore names.
|
||||
|
@ -254,7 +254,7 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
VersionPathStuffer stuffer = new VersionPathStuffer();
|
||||
stuffer.add(-1, "area:/a/b");
|
||||
String nodeList = stuffer.toString();
|
||||
action.setParameterValue(AVMRevertListAction.PARAM_VERSION, 1);
|
||||
action.setParameterValue(AVMRevertListAction.PARAM_VERSION, fService.getLatestSnapshotID("area"));
|
||||
action.setParameterValue(AVMRevertListAction.PARAM_NODE_LIST, nodeList);
|
||||
action.setParameterValue(AVMRevertListAction.PARAM_FLATTEN, true);
|
||||
action.setParameterValue(AVMRevertListAction.PARAM_STORE, "area");
|
||||
@ -273,6 +273,8 @@ public class AVMServiceTest extends AVMServiceTestBase
|
||||
new TxnWork());
|
||||
diffs = fSyncService.compare(-1, "area:/a", -1, "main:/a");
|
||||
assertEquals(0, diffs.size());
|
||||
System.out.println(recursiveList("area", -1, true));
|
||||
System.out.println(recursiveList("main", -1, true));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -45,6 +45,11 @@ public interface AVMStore
|
||||
*/
|
||||
public int getNextVersionID();
|
||||
|
||||
/**
|
||||
* This gets the last extant version id.
|
||||
*/
|
||||
public int getLastVersionID();
|
||||
|
||||
/**
|
||||
* Set a new root for this store.
|
||||
* @param root The root to set.
|
||||
|
@ -609,6 +609,10 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
{
|
||||
dir = AVMDAOs.Instance().fAVMNodeDAO.getAVMStoreRoot(this, version);
|
||||
}
|
||||
if (dir == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// Add an entry for the root.
|
||||
result.add(dir, "", write);
|
||||
dir = (DirectoryNode)result.getCurrentNode();
|
||||
@ -796,6 +800,14 @@ public class AVMStoreImpl implements AVMStore, Serializable
|
||||
return fNextVersionID;
|
||||
}
|
||||
|
||||
/**
|
||||
* This gets the last extant version id.
|
||||
*/
|
||||
public int getLastVersionID()
|
||||
{
|
||||
return AVMDAOs.Instance().fVersionRootDAO.getMaxVersionID(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the root directory. Hibernate.
|
||||
* @param root
|
||||
|
@ -303,6 +303,14 @@ public interface AVMService
|
||||
*/
|
||||
public int getLatestVersionID(String storeName);
|
||||
|
||||
/**
|
||||
* Get the latest snapshot id of a store.
|
||||
* @param storeName The store name.
|
||||
* @return The id of the latest extant version of the store.
|
||||
* @throws AVMNotFoundException If <code>storeName</code> does not exist.
|
||||
*/
|
||||
public int getLatestSnapshotID(String storeName);
|
||||
|
||||
/**
|
||||
* Snapshot the given AVMStores. When this is called everything that has been added,
|
||||
* deleted, or modified since the last time this function was called, is marked
|
||||
|
Loading…
x
Reference in New Issue
Block a user