*/
public class GetActiveLabels {
public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
// Get the LabelService.
LabelServiceInterface labelService =
dfpServices.get(session, LabelServiceInterface.class);
// Create a statement to only select active labels.
StatementBuilder statementBuilder = new StatementBuilder()
.where("isActive = :isActive")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("isActive", true);
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get labels by statement.
LabelPage page =
labelService.getLabelsByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Label label : page.getResults()) {