AdWordsSession session, SiteLinksDataHolder siteLinksData, Long campaignId) throws Exception {
// Get the CampaignFeedService.
CampaignFeedServiceInterface campaignFeedService =
adWordsServices.get(session, CampaignFeedServiceInterface.class);
RequestContextOperand requestContextOperand = new RequestContextOperand();
requestContextOperand.setContextType(RequestContextOperandContextType.FEED_ITEM_ID);
Function feedItemFunction = new Function();
feedItemFunction.setLhsOperand(new FunctionArgumentOperand[] {requestContextOperand});
feedItemFunction.setOperator(FunctionOperator.IN);
List<FunctionArgumentOperand> operands = new ArrayList<FunctionArgumentOperand>();
for (long feedItemId : siteLinksData.siteLinkFeedItemIds) {
ConstantOperand constantOperand = new ConstantOperand();
constantOperand.setLongValue(feedItemId);
constantOperand.setType(ConstantOperandConstantType.LONG);
operands.add(constantOperand);
}
feedItemFunction.setRhsOperand(operands.toArray(new FunctionArgumentOperand[operands.size()]));
// Optional: to target to a platform, define a function and 'AND' it with
// the feed item ID link:
RequestContextOperand platformRequestContextOperand = new RequestContextOperand();
platformRequestContextOperand.setContextType(RequestContextOperandContextType.DEVICE_PLATFORM);
ConstantOperand platformOperand = new ConstantOperand();
platformOperand.setStringValue("Mobile");
platformOperand.setType(ConstantOperandConstantType.STRING);