getVersions returns the set of all versions of the specified
document.
public List<Document> getVersions(Document document)
public List<Document> getVersions(Document document)
returns the version history of the specified document.
Parameters
- Document document
- A Document instance representing the document to return the version history for.
Returns
A List<Document> a set of all versions for the document.
Exception
Throws an SkyVaultServiceException if the operation cannot be carried out.
Example
public PagingResult<Document> getVersions(Document document, ListingContext listingContext)
public PagingResult<Document> getVersions(Document document,
ListingContext listingContext) returns the version history of the specified
document.
Parameters
- Document document
- A Document instance representing the document to return the version history for.
- ListingContext listingContext
- The listing context to use to control paging of results. See ListingContext for further information.
Returns
A PagingResult<Document> a set of all versions for the document.
Exception
Throws an SkyVaultServiceException if the operation cannot be carried out.
Example
VersionService vs = session.getServiceRegistry()
.getVersionService();
ListingContext lc = new ListingContext();
int skipCount = 0;
lc.setMaxItems(10);
lc.setSkipCount(skipCount);
Document document = getTestDocument(session, "TEST_DOC");
Log.d(TAG, "title: " + document.getTitle());
PagingResult<Document> results = vs.getVersions(document, lc);
List<Document> docs = results.getList();
for(Document doc : docs){
Log.d(TAG, "Name: " + doc.getName());
Log.d(TAG, "Version: " + doc.getVersionLabel());
Log.d(TAG, "latestVersion: " + doc.isLatestVersion());
}
Returns output such as the following:
Name: TEST_DOC
Version: 1.4
latestVersion: true
Name: TEST_DOC
Version: 1.3
latestVersion: false
Name: TEST_DOC
Version: 1.2
latestVersion: false
Name: TEST_DOC
Version: 1.1
latestVersion: false
Name: TEST_DOC
Version: 1.0
latestVersion: false