Class ScrollResult

java.lang.Object
eu.c6.gibraltar.api.common.ScrollResult
All Implemented Interfaces:
Iterable<ICObject>

public class ScrollResult extends Object implements Iterable<ICObject>
The Class ScrollResult to manage scrollable result with an index.

Example :

 
 IAnySession anySession = AnySession.getInstance("http://localhost:8080/any", "user01", "password01");
 anySession.setApplication("demo");
 
 ScrollResult result = anySession.getRoomsManager().getContents("demo_room__room0001", 0, Arrays.asList("core.name"));
 List<ICObject> allResults = new ArrayList<>(result.getResults());
 
 while (!result.isEmpty()) {
        result = anySession.getRoomsManager().getContents("demo_room__room0001", result.getNextIndex(), Arrays.asList("core.name"));
        allResults.addAll(result.getResults());
 }
 
 allResults.forEach(r -> System.out.println(r.getString("core.name")));
 System.out.println("Total found : " + allResults.size());
 
 
  • Constructor Details

    • ScrollResult

      public ScrollResult(int fromIndex, int totalCount, List<ICObject> results)
      Instantiates a new scroll result.
      Parameters:
      fromIndex - the from index (starts at 0)
      totalCount - the total count
      results - the results
  • Method Details

    • getFromIndex

      public int getFromIndex()
      Gets the from index (starts at 0).
      Returns:
      the from index
    • getResults

      public List<ICObject> getResults()
      Gets the results.
      Returns:
      the results
    • getTotalCount

      public int getTotalCount()
      Gets the total count.
      Returns:
      the total count
    • isEmpty

      public boolean isEmpty()
      Checks if result list is empty.
      Returns:
      true, if result list is empty
    • getNextIndex

      public int getNextIndex()
      Gets the next index.
      Returns:
      the next index
    • iterator

      public Iterator<ICObject> iterator()
      Specified by:
      iterator in interface Iterable<ICObject>