// Get the LineItemCreativeAssociationService.
LineItemCreativeAssociationServiceInterface licaService =
user.getService(DfpService.V201311.LINEITEMCREATIVEASSOCIATION_SERVICE);
// Sets defaults for page and filterStatement.
LineItemCreativeAssociationPage page = new LineItemCreativeAssociationPage();
Statement filterStatement = new Statement();
int offset = 0;
do {
// Create a statement to get all LICAs.
filterStatement.setQuery("LIMIT 500 OFFSET " + offset);
// Get LICAs by statement.
page = licaService.getLineItemCreativeAssociationsByStatement(filterStatement);
if (page.getResults() != null) {
int i = page.getStartIndex();
for (LineItemCreativeAssociation lica : page.getResults()) {
if (lica.getCreativeSetId() != null) {
System.out.println(i + ") LICA with line item ID \"" + lica.getLineItemId()
+ "\", creative set ID \"" + lica.getCreativeSetId()
+ "\", and status \"" + lica.getStatus()
+ "\" was found.");
} else {
System.out.println(i + ") LICA with line item ID \"" + lica.getLineItemId()
+ "\", creative ID \"" + lica.getCreativeId()
+ "\", and status \"" + lica.getStatus()
+ "\" was found.");
}
i++;
}
}
offset += 500;
} while (offset < page.getTotalResultSetSize());
System.out.println("Number of results found: " + page.getTotalResultSetSize());
} catch (Exception e) {
e.printStackTrace();
}
}