// Set the number of requests to 50 or more.Long NUMBER_OF_REQUESTS = 50L;// Statement to fetch suggested ad units in descending order by number of // requests.String statementText = "ORDER BY numRequests DESC LIMIT 500";Statement filterStatement = new StatementBuilder(statementText).toStatement();SuggestedAdUnitPage page = new SuggestedAdUnitPage();// List of suggested ad unit ids to approve.List<String> suggestedAdUnitIds = new ArrayList<String>();page = suggestedAdUnitService.getSuggestedAdUnitsByStatement( filterStatement);if (page.getResults() != null) { for (SuggestedAdUnit suggestedAdUnit : page.getResults()) { if (suggestedAdUnit.getNumRequests() >= NUMBER_OF_REQUESTS) { // Add it to the ID list to be approved. suggestedAdUnitIds.add(suggestedAdUnit.getId()); /* * Promoting the page as a featured content. * Recognize the user for quality content and auto-approve their * pages. */ } }}if (suggestedAdUnitIds.size() > 0) { // Modify statement to select suggested ad units from the list. filterStatement.setQuery( "WHERE id IN (" + StringUtils.join(suggestedAdUnitIds, ",") + ")"); // Create action to approve suggested ad units. ApproveSuggestedAdUnit action = new ApproveSuggestedAdUnit(); // Perform the action. UpdateResult result = suggestedAdUnitService.performSuggestedAdUnitAction( action, filterStatement);}