private static void createSiteLinksFeed(
AdWordsServices adWordsServices, AdWordsSession session, SiteLinksDataHolder siteLinksData)
throws Exception {
// Get the FeedService.
FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
// Create attributes.
FeedAttribute textAttribute = new FeedAttribute();
textAttribute.setType(FeedAttributeType.STRING);
textAttribute.setName("Link Text");
FeedAttribute urlAttribute = new FeedAttribute();
urlAttribute.setType(FeedAttributeType.URL);
urlAttribute.setName("Link URL");
FeedAttribute line1Attribute = new FeedAttribute();
line1Attribute.setType(FeedAttributeType.STRING);
line1Attribute.setName("Line 1 Description");
FeedAttribute line2Attribute = new FeedAttribute();
line2Attribute.setType(FeedAttributeType.STRING);
line2Attribute.setName("Line 2 Description");
// Create the feed.
Feed siteLinksFeed = new Feed();
siteLinksFeed.setName("Feed For Site Links#" + System.currentTimeMillis());
siteLinksFeed.setAttributes(
new FeedAttribute[] {textAttribute, urlAttribute, line1Attribute, line2Attribute});
siteLinksFeed.setOrigin(FeedOrigin.USER);
// Create operation.
FeedOperation operation = new FeedOperation();
operation.setOperand(siteLinksFeed);
operation.setOperator(Operator.ADD);
// Add the feed.
FeedReturnValue result = feedService.mutate(new FeedOperation[] {operation});
Feed savedFeed = result.getValue()[0];
siteLinksData.siteLinksFeedId = savedFeed.getId();
FeedAttribute[] savedAttributes = savedFeed.getAttributes();
siteLinksData.linkTextFeedAttributeId = savedAttributes[0].getId();