// Get DfpUser from "~/dfp.properties".
DfpUser user = new DfpUser();
// Get the CompanyService.
CompanyServiceInterface companyService =
user.getService(DfpService.V201308.COMPANY_SERVICE);
// Create a statement to only select companies that are advertisers.
Statement filterStatement =
new StatementBuilder("WHERE type = :type LIMIT 500")
.putValue("type", CompanyType.ADVERTISER.toString()).toStatement();
// Get the companies by statement.
CompanyPage page =
companyService.getCompaniesByStatement(filterStatement);
if (page.getResults() != null) {
Company[] companies = page.getResults();
// Update each local company object by appending LLC. to its name.
for (Company company : companies) {
company.setName(company.getName() + " LLC.");
}
// Update the companies on the server.
companies = companyService.updateCompanies(companies);
if (companies != null) {
for (Company company : companies) {
System.out.println("A company with ID \"" + company.getId()
+ "\" and name \"" + company.getName() + "\" was updated.");