}
public static void runExample(AdWordsServices adWordsServices, AdWordsSession session)
throws Exception {
// Get the AlertService.
AlertServiceInterface alertService =
adWordsServices.get(session, AlertServiceInterface.class);
// Create alert query.
AlertQuery alertQuery = new AlertQuery();
alertQuery.setClientSpec(ClientSpec.ALL);
alertQuery.setFilterSpec(FilterSpec.ALL);
alertQuery.setTypes(new AlertType[] {AlertType.ACCOUNT_BUDGET_BURN_RATE,
AlertType.ACCOUNT_BUDGET_ENDING, AlertType.ACCOUNT_ON_TARGET, AlertType.CAMPAIGN_ENDED,
AlertType.CAMPAIGN_ENDING, AlertType.CREDIT_CARD_EXPIRING, AlertType.DECLINED_PAYMENT,
AlertType.MANAGER_LINK_PENDING, AlertType.MISSING_BANK_REFERENCE_NUMBER,
AlertType.PAYMENT_NOT_ENTERED, AlertType.TV_ACCOUNT_BUDGET_ENDING,
AlertType.TV_ACCOUNT_ON_TARGET, AlertType.TV_ZERO_DAILY_SPENDING_LIMIT,
AlertType.USER_INVITE_ACCEPTED, AlertType.USER_INVITE_PENDING,
AlertType.ZERO_DAILY_SPENDING_LIMIT});
alertQuery.setSeverities(new AlertSeverity[] {AlertSeverity.GREEN, AlertSeverity.YELLOW,
AlertSeverity.RED});
alertQuery.setTriggerTimeSpec(TriggerTimeSpec.ALL_TIME);
int offset = 0;
// Create selector.
AlertSelector selector = new AlertSelector();
selector.setQuery(alertQuery);
selector.setPaging(new Paging(offset, PAGE_SIZE));
AlertPage page = null;
do {
// Get all alerts.
page = alertService.get(selector);
// Display alerts.
if (page.getEntries() != null && page.getEntries().length > 0) {
for (Alert alert : page.getEntries()) {
System.out.printf(