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

Examples of com.google.api.ads.adwords.axis.v201306.cm.OrderBy


        adWordsServices.get(session, AdGroupAdServiceInterface.class);

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "AdGroupAdDisapprovalReasons"});
    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(
View Full Code Here


    int offset = 0;

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

    CampaignPage page = null;
    do {
      // Get all campaigns.
View Full Code Here

    boolean morePages = true;

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "AdGroupId", "MatchType", "KeywordText"});
    selector.setOrdering(new OrderBy[] {new OrderBy("AdGroupId", SortOrder.ASCENDING)});
    selector.setPaging(new Paging(offset, PAGE_SIZE));

    // Create predicates.
    Predicate adGroupIdPredicate =
        new Predicate("AdGroupId", PredicateOperator.IN, new String[] {adGroupId.toString()});
View Full Code Here

   * @return the new set of OrderBy objects with different instance for each of the OrderBy
   */
  private Set<OrderBy> copyOrderingSet() {
    Set<OrderBy> orderingCopy = Sets.newLinkedHashSet();
    for (OrderBy order : this.ordering) {
      OrderBy copyOrder = new OrderBy();
      copyOrder.setField(order.getField());
      copyOrder.setSortOrder(order.getSortOrder());
      orderingCopy.add(copyOrder);
    }
    return orderingCopy;
  }
View Full Code Here

   * Adds the order by the given field, on ASCENDING sort.
   *
   * @return the builder itself to proceed the chain.
   */
  public SelectorBuilder orderAscBy(String field) {
    OrderBy orderBy = new OrderBy();
    orderBy.setField(field);
    orderBy.setSortOrder(SortOrder.ASCENDING);

    this.ordering.add(orderBy);

    return this;
  }
View Full Code Here

   * Adds the order by the given field, on DESCENDING sort.
   *
   * @return the builder itself to proceed the chain.
   */
  public SelectorBuilder orderDescBy(String field) {
    OrderBy orderBy = new OrderBy();
    orderBy.setField(field);
    orderBy.setSortOrder(SortOrder.DESCENDING);

    this.ordering.add(orderBy);

    return this;
  }
View Full Code Here

   * @return the builder itself to proceed the chain.
   */
  public SelectorBuilder removeOrderBy(String field) {
    Iterator<OrderBy> iterator = this.ordering.iterator();
    while (iterator.hasNext()) {
      OrderBy order = iterator.next();
      if (order.getField().equals(field)) {
        iterator.remove();
      }
    }

    return this;
View Full Code Here

    Selector selector = builder.build();

    Assert.assertNotNull(selector.getOrdering());
    Assert.assertEquals(1, selector.getOrdering().length);

    OrderBy orderBy = selector.getOrdering()[0];

    Assert.assertEquals("AverageCpm", orderBy.getField());
    Assert.assertEquals(SortOrder.ASCENDING, orderBy.getSortOrder());

    builder.orderAscBy("AverageCpm").orderDescBy("AverageCpc");
    selector = builder.build();

    Assert.assertNotNull(selector.getOrdering());
    Assert.assertEquals(2, selector.getOrdering().length);

    orderBy = selector.getOrdering()[0];

    Assert.assertEquals("AverageCpm", orderBy.getField());
    Assert.assertEquals(SortOrder.ASCENDING, orderBy.getSortOrder());

    orderBy = selector.getOrdering()[1];

    Assert.assertEquals("AverageCpc", orderBy.getField());
    Assert.assertEquals(SortOrder.DESCENDING, orderBy.getSortOrder());

    selector = builder.removeOrderBy("AverageCpm").build();

    Assert.assertNotNull(selector.getOrdering());
    Assert.assertEquals(1, selector.getOrdering().length);

    orderBy = selector.getOrdering()[0];

    Assert.assertEquals("AverageCpc", orderBy.getField());
    Assert.assertEquals(SortOrder.DESCENDING, orderBy.getSortOrder());

  }
View Full Code Here

  public void testUniqueInternalOrderByState() {
    SelectorBuilder builder = new SelectorBuilder();
    Selector selectorOne = builder.orderAscBy("Id").build();
    Selector selectorTwo = builder.build();

    OrderBy orderTwo = selectorTwo.getOrdering(0);
    orderTwo.setField("Status");

    Assert.assertEquals("Id", selectorOne.getOrdering(0).getField());
    Assert.assertEquals("Status", selectorTwo.getOrdering(0).getField());
  }
View Full Code Here

    boolean morePages = true;

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "AdGroupId", "PlacementUrl"});
    selector.setOrdering(new OrderBy[] {new OrderBy("AdGroupId", SortOrder.ASCENDING)});
    selector.setPaging(new Paging(offset, PAGE_SIZE));

    // Create predicates.
    Predicate adGroupIdPredicate =
        new Predicate("AdGroupId", PredicateOperator.IN, new String[] {adGroupId.toString()});
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.axis.v201306.cm.OrderBy

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.