public static String synckeyword_status(String str1) throws Throwable
{
int PAGE_SIZE = 10000;
List<String> data = new ArrayList<>();
AdWordsServicesInterface adWordsServices = AdWordsServices.getInstance();
AdGroupCriterionServiceInterface adGroupCriterionService = adWordsServices.get(session, AdGroupCriterionServiceInterface.class);
int offset = 0;
boolean morePages = true;
List<AdGroupCriterion> Keywords = new ArrayList<>();
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder.fields(AdGroupCriterionField.Status).offset(offset).limit(PAGE_SIZE).equals(AdGroupCriterionField.AdGroupId, str1.toString()).equals(CampaignCriterionField.IsNegative, "FALSE").equals(AdGroupCriterionField.CriteriaType, "KEYWORD").build();
AdGroupCriterionPage page = adGroupCriterionService.get(selector);
while(morePages)
{
page = adGroupCriterionService.get(selector);
if (page.getEntries() != null)
{
Keywords.addAll(Arrays.asList(page.getEntries()));
}
else
{
//System.out.println("No ad groups were found.");
}
offset += PAGE_SIZE;
selector = builder.increaseOffsetBy(PAGE_SIZE).build();
morePages = offset < page.getTotalNumEntries();
}
for (AdGroupCriterion adGroupCriterionResult : Keywords)
{
Criterion keyword1 = adGroupCriterionResult.getCriterion();
Keyword keyword = (Keyword) keyword1;
data.add(keyword.getId().toString());
BiddableAdGroupCriterion bac= (BiddableAdGroupCriterion) adGroupCriterionResult;
data.add((bac.getUserStatus().toString()));
}
String out = null;
int i = 0;
for(int j = 0; j<(page.getTotalNumEntries()); j++)
{
out = out + str1 + ";";
out = out + data.get(i) + ";";
i++;
out = out + data.get(i) + "~";
i++;
}
return out;
}