private static DSAFeedDetails createFeed ( AdWordsServicesInterface adWordsServices , AdWordsSession session ) throws ApiException , RemoteException { // Get the FeedService. FeedServiceInterface feedService = adWordsServices . get ( session , FeedServiceInterface . class ) ; // Create attributes. FeedAttribute urlAttribute = new FeedAttribute ( ) ; urlAttribute . setType ( FeedAttributeType . URL_LIST ) ; urlAttribute . setName ( "Page URL" ) ; FeedAttribute labelAttribute = new FeedAttribute ( ) ; labelAttribute . setType ( FeedAttributeType . STRING_LIST ) ; labelAttribute . setName ( "Label" ) ; // Create the feed. Feed dsaPageFeed = new Feed ( ) ; dsaPageFeed . setName ( "DSA Feed #" + System . currentTimeMillis ( ) ) ; dsaPageFeed . setAttributes ( new FeedAttribute [ ] { urlAttribute , labelAttribute } ) ; dsaPageFeed . setOrigin ( FeedOrigin . USER ) ; // Create operation. FeedOperation operation = new FeedOperation ( ) ; operation . setOperand ( dsaPageFeed ) ; operation . setOperator ( Operator . ADD ) ; // Add the feed. Feed newFeed = feedService . mutate ( new FeedOperation [ ] { operation } ) . getValue ( 0 ) ; DSAFeedDetails feedDetails = new DSAFeedDetails ( ) ; feedDetails . feedId = newFeed . getId ( ) ; FeedAttribute [ ] savedAttributes = newFeed . getAttributes ( ) ; feedDetails . urlAttributeId = savedAttributes [ 0 ] . getId ( ) ; feedDetails . labelAttributeId = savedAttributes [ 1 ] . getId ( ) ; System . out . printf ( "Feed with name '%s' and ID %d with urlAttributeId %d" + " and labelAttributeId %d was created.%n" , newFeed . getName ( ) , feedDetails . feedId , feedDetails . urlAttributeId , feedDetails . labelAttributeId ) ; return feedDetails ; }
Creates the feed for DSA page URLs .