// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get line items by statement.
LineItemPage page =
lineItemService.getLineItemsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (LineItem lineItem : page.getResults()) {
System.out.printf(
"%d) Line item with ID \"%d\" and name \"%s\" was found.\n", i++,
lineItem.getId(), lineItem.getName());
}
}