*/
private static CampaignAdExtension getLegacySitelinksForCampaign(
CampaignAdExtensionServiceInterface campaignExtensionService, long campaignId)
throws Exception {
// Create the selector.
Selector selector = new Selector();
selector.setFields(new String[] {"AdExtensionId", "DisplayText", "DestinationUrl"});
// Filter the results for specified campaign id.
Predicate campaignPredicate = new Predicate();
campaignPredicate.setOperator(PredicateOperator.EQUALS);
campaignPredicate.setField("CampaignId");
campaignPredicate.setValues(new String[] {Long.toString(campaignId)});
// Filter the results for active campaign ad extensions. You may add
// additional filtering conditions here as required.
Predicate statusPredicate = new Predicate();
statusPredicate.setOperator(PredicateOperator.EQUALS);
statusPredicate.setField("Status");
statusPredicate.setValues(new String[] {CampaignAdExtensionStatus.ACTIVE.getValue()});
// Filter for sitelinks ad extension type.
Predicate typePredicate = new Predicate();
typePredicate.setOperator(PredicateOperator.EQUALS);
typePredicate.setField("AdExtensionType");
typePredicate.setValues(new String[] {EXTENSION_NAME_FOR_SITELINKS});
selector.setPredicates(new Predicate[] {campaignPredicate, statusPredicate, typePredicate});
CampaignAdExtensionPage page = campaignExtensionService.get(selector);
if (page.getEntries() != null && page.getEntries().length > 0) {
return page.getEntries()[0];
} else {