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

Examples of com.google.api.ads.adwords.jaxws.v201309.cm.Selector


      throws Exception {
    // Get the LocationCriterionService.
    LocationCriterionServiceInterface locationCriterionService =
        adWordsServices.get(session, LocationCriterionServiceInterface.class);

    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "LocationName", "CanonicalName", "DisplayType",
        "ParentLocations", "Reach", "TargetingStatus"});

    selector.setPredicates(new Predicate[] {
        // Location names must match exactly, only EQUALS and IN are
        // supported.
        new Predicate("LocationName", PredicateOperator.IN, locationNames),
        // Set the locale of the returned location names.
        new Predicate("Locale", PredicateOperator.EQUALS, new String[] {"en"})});
View Full Code Here


        adWordsServices.get(session, CampaignCriterionServiceInterface.class);

    int offset = 0;

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"CampaignId", "Id", "CriteriaType", "PlatformName",
        "LanguageName", "LocationName", "KeywordText"});
    selector.setPredicates(new Predicate[] {new Predicate("CriteriaType", PredicateOperator.IN,
        new String[] {"KEYWORD", "LANGUAGE", "LOCATION", "PLATFORM"})});
    selector.setPaging(new Paging(offset, PAGE_SIZE));

    CampaignCriterionPage page = null;
    do {
      page = campaignCriterionService.get(selector);

      if (page.getEntries() != null) {
        // Display campaigns.
        for (CampaignCriterion campaignCriterion : page.getEntries()) {
          System.out.printf("Campaign criterion with campaign id '%s', criterion id '%s', "
              + "and type '%s' was found.\n", campaignCriterion.getCampaignId(), campaignCriterion
              .getCriterion().getId(), campaignCriterion.getCriterion().getCriterionType());
        }
        Thread.sleep(1000);
      } else {
        System.out.println("No campaign criteria were found.");
      }
      offset += PAGE_SIZE;
      selector.getPaging().setStartIndex(offset);
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

    // Get the AdGroupAdService.
    AdGroupAdServiceInterface adGroupAdService =
        adWordsServices.get(session, AdGroupAdServiceInterface.class);

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "DisapprovalReasons"});
    selector.setOrdering(new OrderBy[] {new OrderBy("Id", SortOrder.ASCENDING)});

    // Create predicates.
    Predicate adGroupIdPredicate =
        new Predicate("AdGroupId", PredicateOperator.IN, new String[] {adGroupId.toString()});
    Predicate approvalStatusPredicate = new Predicate(
        "AdGroupCreativeApprovalStatus", PredicateOperator.IN, new String[] {"DISAPPROVED"});
    selector.setPredicates(new Predicate[] {adGroupIdPredicate, approvalStatusPredicate});

    // Get all disapproved ads.
    AdGroupAdPage page = adGroupAdService.get(selector);

    // Display ads.
View Full Code Here

    // Get the DataService.
    DataServiceInterface dataService =
        adWordsServices.get(session, DataServiceInterface.class);

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"AdGroupId", "CriterionId", "StartDate", "EndDate", "Bid",
        "LocalClicks", "LocalCost", "MarginalCpc", "LocalImpressions"});

    // Create predicates.
    Predicate adGroupIdPredicate =
        new Predicate("AdGroupId", PredicateOperator.IN, new String[] {adGroupId.toString()});
    Predicate criterionIdPredicate =
        new Predicate("CriterionId", PredicateOperator.IN, new String[] {criterionId.toString()});
    selector.setPredicates(new Predicate[] {adGroupIdPredicate, criterionIdPredicate});

    // Get bid landscape for ad group criteria.
    CriterionBidLandscapePage page = dataService.getCriterionBidLandscape(selector);

    // Display bid landscapes.
View Full Code Here

    CustomerSyncServiceInterface customerSyncService =
        adWordsServices.get(session, CustomerSyncServiceInterface.class);

    // Get a list of all campaign IDs.
    List<Long> campaignIds = new ArrayList<Long>();
    Selector selector = new Selector();
    selector.setFields(new String[] {"Id"});
    CampaignPage campaigns = campaignService.get(selector);
    if (campaigns.getEntries() != null) {
      for (Campaign campaign : campaigns.getEntries()) {
        campaignIds.add(campaign.getId());
      }
View Full Code Here

   * @return A {@link SiteLinksFeed} if a feed is found, or null otherwise.
   * @throws Exception if an error occurs when retrieving an existing feed.
   */
  private static SiteLinksFeed getExistingFeed(FeedMappingServiceInterface feedMappingService)
      throws Exception {
    Selector selector = new Selector();
    selector.setFields(new String[] {"FeedId", "FeedMappingId", "PlaceholderType", "Status",
        "AttributeFieldMappings"});

    Predicate placeHolderPredicate = new Predicate();
    placeHolderPredicate.setField("PlaceholderType");
    placeHolderPredicate.setOperator(PredicateOperator.EQUALS);
    placeHolderPredicate.setValues(new String[] {Integer.toString(PLACEHOLDER_SITELINKS)});

    Predicate statusPredicate = new Predicate();
    statusPredicate.setField("Status");
    statusPredicate.setOperator(PredicateOperator.EQUALS);
    statusPredicate.setValues(new String[] {"ACTIVE"});

    selector.setPredicates(new Predicate[] {placeHolderPredicate, statusPredicate});

    FeedMappingPage page = feedMappingService.get(selector);

    if (page != null && page.getEntries() != null && page.getEntries().length > 0) {
      for (FeedMapping feedMapping : page.getEntries()) {
View Full Code Here

  }

  public static void runExample(AdWordsServices adWordsServices, AdWordsSession session,
      Long feedId, Map<Long, String[]> feedItemDescriptions) throws Exception {
    FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
    Selector selector = new Selector();
    // Do not include "Attributes" because you do not want to pass existing
    // attributes into the subsequent mutate (SET) call.
    selector.setFields(new String[] {"Id", "Attributes"});
    selector.setPredicates(new Predicate[] {
        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);
View Full Code Here

  private static void updateFeedItems(AdWordsServices adWordsServices, AdWordsSession session,
      Long feedId, FeedAttribute line1Attribute, FeedAttribute line2Attribute,
      Map<Long, String[]> feedItemDescriptions) throws Exception {
    FeedItemServiceInterface feedItemService =
        adWordsServices.get(session, FeedItemServiceInterface.class);
    Selector itemSelector = new Selector();
    itemSelector.setFields(new String[] {"FeedId", "FeedItemId", "AttributeValues"});

    List<String> feedItemIds = Lists.newArrayList(
        Iterables.transform(feedItemDescriptions.keySet(), Functions.toStringFunction()));
    itemSelector.setPredicates(new Predicate[] {
        // Limit FeedItems to the feed.
        new Predicate("FeedId", PredicateOperator.EQUALS, new String[] {feedId.toString()}),
        // Limit FeedItems to the items in the feedItemDescriptions map.
        new Predicate("FeedItemId", PredicateOperator.IN, feedItemIds.toArray(new String[0]))});
View Full Code Here

  private static void updateFeedMapping(AdWordsServices adWordsServices, AdWordsSession session,
      Long feedId, FeedAttribute line1FeedAttribute, FeedAttribute line2FeedAttribute)
      throws Exception {
    FeedMappingServiceInterface mappingService =
        adWordsServices.get(session, FeedMappingServiceInterface.class);
    Selector selector = new Selector();
    selector.setFields(
        new String[] {"FeedId", "FeedMappingId", "PlaceholderType", "AttributeFieldMappings"});
    selector.setPredicates(new Predicate[] {
        new Predicate("FeedId", PredicateOperator.EQUALS, new String[] {feedId.toString()})});

    FeedMapping feedMapping = mappingService.get(selector).getEntries()[0];

    // Remove the existing mapping (FeedMapping is immutable).
View Full Code Here

        adWordsServices.get(session, MediaServiceInterface.class);

    int offset = 0;

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"MediaId", "Width", "Height", "MimeType"});
    selector.setPaging(new Paging(offset, PAGE_SIZE));
    selector.setOrdering(new OrderBy[] {new OrderBy("MediaId", SortOrder.ASCENDING)});
    selector.setPaging(new Paging(offset, PAGE_SIZE));

    // Create predicates.
    Predicate typePredicate =
        new Predicate("Type", PredicateOperator.IN, new String[] {"IMAGE", "VIDEO"});
    selector.setPredicates(new Predicate[] {typePredicate});

    MediaPage page = null;

    do {
      // Get all images.
      page = mediaService.get(selector);

      // Display images.
      if (page != null && page.getEntries() != null) {
        for (Media media : page.getEntries()) {
          Map<MediaSize, Dimensions> dimensions = Maps.toMap(media.getDimensions());
          System.out.println("Media with id '" + media.getMediaId() +
              (!dimensions.isEmpty()
                  ? "', dimensions '" + dimensions.get(MediaSize.FULL).getWidth() + "x"
                    + dimensions.get(MediaSize.FULL).getHeight()
                  : "") + "', and MIME type '"
              + media.getMediaType() + "' was found.");
        }
      } else {
        System.out.println("No images/videos were found.");
      }
      offset += PAGE_SIZE;
      selector.getPaging().setStartIndex(offset);
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.jaxws.v201309.cm.Selector

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.