see on GitHub

Revisions: Loading Revisions

There are a few methods that allow you to download revisions from a database:

  • session.advanced().revisions().getFor
    • can be used to return all previous revisions for a specified document
  • session.advanced().revisions().getMetadataFor
    • can be used to return metadata of all previous revisions for a specified document
  • session.advanced().revisions().get
    • can be used to retrieve a revision(s) using a change vector(s)

getFor

Syntax

<T> List<T> getFor(Class<T> clazz, String id);

<T> List<T> getFor(Class<T> clazz, String id, int start);

<T> List<T> getFor(Class<T> clazz, String id, int start, int pageSize);

Parameters
id String document ID for which the revisions will be returned for
start int used for paging
pageSize int used for paging

Example

List<Order> orderRevisions = session
    .advanced()
    .revisions()
    .getFor(Order.class, "orders/1-A", 0, 10);

getMetadataFor

Syntax

List<MetadataAsDictionary> getMetadataFor(String id);

List<MetadataAsDictionary> getMetadataFor(String id, int start);

List<MetadataAsDictionary> getMetadataFor(String id, int start, int pageSize);

Parameters
id String document ID for which the revisions will be returned for
start int used for paging
pageSize int used for paging

Example

List<MetadataAsDictionary> orderRevisionsMetadata = session
    .advanced()
    .revisions()
    .getMetadataFor("orders/1-A", 0, 10);

get

Syntax

<T> T get(Class<T> clazz, String changeVector);

<T> Map<String, T> get(Class<T> clazz, String[] changeVectors);

Parameters
changeVector or changeVectors String or String[] one or many revision change vectors

Example

Order orderRevision = session
    .advanced()
    .revisions()
    .get(Order.class, orderRevisionChangeVector);