// Get the PlacementService.
PlacementServiceInterface placementService =
user.getService(DfpService.V201208.PLACEMENT_SERVICE);
// Sets defaults for page and filterStatement.
PlacementPage page = new PlacementPage();
Statement filterStatement = new Statement();
int offset = 0;
do {
// Create a statement to get all ad units.
filterStatement.setQuery("LIMIT 500 OFFSET " + offset);
// Get ad units by filter.
page = placementService.getPlacementsByStatement(filterStatement);
if (page.getResults() != null) {
int i = page.getStartIndex();
for (Placement placement : page.getResults()) {
System.out.println(i + ") Placement with ID \"" + placement.getId()
+ "\" and name \"" + placement.getName() + "\" was found.");
i++;
}
}
offset += 500;
} while (offset < page.getTotalResultSetSize());
System.out.println("Number of results found: " + page.getTotalResultSetSize());
} catch (Exception e) {
e.printStackTrace();
}
}