// Get the OrderService.
OrderServiceInterface orderService =
user.getService(DfpService.V201302.ORDER_SERVICE);
// Sets defaults for page and filter.
OrderPage page = new OrderPage();
Statement filterStatement = new Statement();
int offset = 0;
do {
// Create a statement to get all orders.
filterStatement.setQuery("LIMIT 500 OFFSET " + offset);
// Get orders by statement.
page = orderService.getOrdersByStatement(filterStatement);
if (page.getResults() != null) {
int i = page.getStartIndex();
for (Order order : page.getResults()) {
System.out.println(i + ") Order with ID \""
+ order.getId() + "\", name \"" + order.getName()
+ "\", and advertiser ID \"" + order.getAdvertiserId()
+ "\" was found.");
i++;
}
}
offset += 500;
} while (page.getResults() != null && page.getResults().length == 500);
System.out.println("Number of results found: " + page.getTotalResultSetSize());
} catch (Exception e) {
e.printStackTrace();
}
}