*/
public class GetAdvertisers {
public static void runExample(DfpServices dfpServices, DfpSession session) throws Exception {
// Get the CompanyService.
CompanyServiceInterface companyService =
dfpServices.get(session, CompanyServiceInterface.class);
// Create a statement to only select companies that are advertisers.
StatementBuilder statementBuilder = new StatementBuilder()
.where("type = :type")
.orderBy("id ASC")
.limit(StatementBuilder.SUGGESTED_PAGE_LIMIT)
.withBindVariableValue("type", CompanyType.ADVERTISER.toString());
// Default for total result set size.
int totalResultSetSize = 0;
do {
// Get companies by statement.
CompanyPage page = companyService.getCompaniesByStatement(statementBuilder.toStatement());
if (page.getResults() != null) {
totalResultSetSize = page.getTotalResultSetSize();
int i = page.getStartIndex();
for (Company company : page.getResults()) {