Package com.google.api.ads.adwords.axis.v201309.cm

Examples of com.google.api.ads.adwords.axis.v201309.cm.AdGroupCriterion


    FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
    FeedReturnValue mutateFeedResult = feedService.mutate(new FeedOperation[] {feedOperation});

    // Get the new attributes from the mutated feed.
    Feed mutatedFeed = mutateFeedResult.getValue()[0];
    line1Attribute = mutatedFeed.getAttributes(nextAttributeIndex);
    line2Attribute = mutatedFeed.getAttributes(nextAttributeIndex + 1);
    return new FeedAttribute[] {line1Attribute, line2Attribute};
  }
View Full Code Here


    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");
    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();
    siteLinksData.linkUrlFeedAttributeId = savedAttributes[1].getId();
    siteLinksData.line1FeedAttributeId = savedAttributes[2].getId();
    siteLinksData.line2FeedAttributeId = savedAttributes[3].getId();
    System.out.printf("Feed with name '%s' and ID %d with linkTextAttributeId %d"
        + " and linkUrlAttributeId %d and line1AttributeId %d"
        + " and line2AttributeId %d was created.\n",
        savedFeed.getName(),
        savedFeed.getId(),
        savedAttributes[0].getId(),
        savedAttributes[1].getId(),
        savedAttributes[2].getId(),
        savedAttributes[3].getId());
  }
View Full Code Here

        new Predicate("Id", PredicateOperator.EQUALS, new String[] {feedId.toString()})});
    Feed feed = feedService.get(selector).getEntries()[0];

    // Add new attributes to the feed.
    FeedAttribute[] newAttributes = addLine1And2FeedAttributes(adWordsServices, session, feed);
    FeedAttribute line1Attribute = newAttributes[0];
    FeedAttribute line2Attribute = newAttributes[1];

    // Update feed items.
    updateFeedItems(adWordsServices, session, feedId, line1Attribute, line2Attribute,
        feedItemDescriptions);
View Full Code Here

  private static FeedAttribute[] addLine1And2FeedAttributes(AdWordsServices adWordsServices,
      AdWordsSession session, Feed feed) throws Exception {
    // This will be the starting index for the new attributes created below.
    int nextAttributeIndex = feed.getAttributes().length;

    FeedAttribute line1Attribute = new FeedAttribute();
    FeedAttribute line2Attribute = new FeedAttribute();
    line1Attribute.setType(FeedAttributeType.STRING);
    line1Attribute.setName("Line 1 Description");
    line2Attribute.setType(FeedAttributeType.STRING);
    line2Attribute.setName("Line 2 Description");
    feed.setAttributes(new FeedAttribute[] {line1Attribute, line2Attribute});

    FeedOperation feedOperation = new FeedOperation();
    feedOperation.setOperand(feed);
    feedOperation.setOperator(Operator.SET);
View Full Code Here

      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");
    siteLinksFeed.setAttributes(
View Full Code Here

    FeedItemAttributeValue line2TextAttributeValue = new FeedItemAttributeValue();
    line2TextAttributeValue.setFeedAttributeId(siteLinksData.line2FeedAttributeId);
    line2TextAttributeValue.setStringValue(line2);

    // Create the feed item and operation.
    FeedItem item = new FeedItem();
    item.setFeedId(siteLinksData.siteLinksFeedId);
    item.setAttributeValues(new FeedItemAttributeValue[] {linkTextAttributeValue,
        linkUrlAttributeValue, line1TextAttributeValue, line2TextAttributeValue});

    // Optional: use item.setStartTime() and item.setEndTime() to specify the
    // time period for the feed to deliver.  The example below will make the feed
    // start now and stop in one month.
View Full Code Here

    for (FeedItem feedItem : feedItems) {
      // Construct a FeedItemOperation that will set the line 1 and line 2
      // attribute values for this FeedItem.
      FeedItemAttributeValue[] itemAttributeValues = new FeedItemAttributeValue[2];

      FeedItemAttributeValue line1AttributeValue = new FeedItemAttributeValue();
      line1AttributeValue.setFeedAttributeId(line1Attribute.getId());
      line1AttributeValue.setStringValue(feedItemDescriptions.get(feedItem.getFeedItemId())[0]);
      itemAttributeValues[0] = line1AttributeValue;

      FeedItemAttributeValue line2AttributeValue = new FeedItemAttributeValue();
      line2AttributeValue.setFeedAttributeId(line2Attribute.getId());
      line2AttributeValue.setStringValue(feedItemDescriptions.get(feedItem.getFeedItemId())[1]);

      itemAttributeValues[1] = line2AttributeValue;
      feedItem.setAttributeValues(itemAttributeValues);

      FeedItemOperation operation = new FeedItemOperation();
View Full Code Here

  }

  private static FeedItemOperation newSiteLinkFeedItemAddOperation(
      SiteLinksDataHolder siteLinksData, String text, String url, String line1, String line2) {
    // Create the FeedItemAttributeValues for our text values.
    FeedItemAttributeValue linkTextAttributeValue = new FeedItemAttributeValue();
    linkTextAttributeValue.setFeedAttributeId(siteLinksData.linkTextFeedAttributeId);
    linkTextAttributeValue.setStringValue(text);
    FeedItemAttributeValue linkUrlAttributeValue = new FeedItemAttributeValue();
    linkUrlAttributeValue.setFeedAttributeId(siteLinksData.linkUrlFeedAttributeId);
    linkUrlAttributeValue.setStringValue(url);
    FeedItemAttributeValue line1TextAttributeValue = new FeedItemAttributeValue();
    line1TextAttributeValue.setFeedAttributeId(siteLinksData.line1FeedAttributeId);
    line1TextAttributeValue.setStringValue(line1);
    FeedItemAttributeValue line2TextAttributeValue = new FeedItemAttributeValue();
    line2TextAttributeValue.setFeedAttributeId(siteLinksData.line2FeedAttributeId);
    line2TextAttributeValue.setStringValue(line2);

    // Create the feed item and operation.
    FeedItem item = new FeedItem();
    item.setFeedId(siteLinksData.siteLinksFeedId);
    item.setAttributeValues(new FeedItemAttributeValue[] {linkTextAttributeValue,
View Full Code Here

      line2AttributeValue.setStringValue(feedItemDescriptions.get(feedItem.getFeedItemId())[1]);

      itemAttributeValues[1] = line2AttributeValue;
      feedItem.setAttributeValues(itemAttributeValues);

      FeedItemOperation operation = new FeedItemOperation();
      operation.setOperator(Operator.SET);
      operation.setOperand(feedItem);
      itemOperations.add(operation);
    }
    FeedItemReturnValue itemsUpdateReturnValue =
        feedItemService.mutate(itemOperations.toArray(new FeedItemOperation[0]));
    System.out.printf("Updated %d items%n", itemsUpdateReturnValue.getValue().length);
View Full Code Here

    // Get the FeedItemService.
    FeedItemServiceInterface feedItemService =
        adWordsServices.get(session, FeedItemServiceInterface.class);

    // Create operations to add FeedItems.
    FeedItemOperation home = newSiteLinkFeedItemAddOperation(siteLinksData, "Home",
        "http://www.example.com", "Home line 1", "Home line 2");
    FeedItemOperation stores = newSiteLinkFeedItemAddOperation(siteLinksData, "Stores",
        "http://www.example.com/stores", "Stores line 1", "Stores line 2");
    FeedItemOperation onSale = newSiteLinkFeedItemAddOperation(siteLinksData, "On Sale",
        "http://www.example.com/sale", "On Sale line 1", "On Sale line 2");
    FeedItemOperation support = newSiteLinkFeedItemAddOperation(siteLinksData, "Support",
        "http://www.example.com/support", "Support line 1", "Support line 2");
    FeedItemOperation products = newSiteLinkFeedItemAddOperation(siteLinksData, "Products",
        "http://www.example.com/prods", "Products line 1", "Products line 2");
    FeedItemOperation aboutUs = newSiteLinkFeedItemAddOperation(siteLinksData, "About Us",
        "http://www.example.com/about", "About Us line 1", "About Us line 2");

    FeedItemOperation[] operations =
        new FeedItemOperation[] {home, stores, onSale, support, products, aboutUs};
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.axis.v201309.cm.AdGroupCriterion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.