public static List<Promotion> runExample(
      AdWordsServices adWordsServices, AdWordsSession session, Long businessId) throws Exception {

    session.setExpressBusinessId(businessId);

    // Get the PromotionService
    PromotionServiceInterface promotionService =
        adWordsServices.get(session, PromotionServiceInterface.class);

    int offset = 0;

    Selector selector =
        new SelectorBuilder()
            .fields(
                "PromotionId",
                "Name",
                "Status",
                "DestinationUrl",
                "CallTrackingEnabled",
                "Budget",
                "PromotionCriteria",
                "RemainingBudget",
                "Creatives",
                "CampaignIds")
            .offset(offset)
            .limit(PAGE_SIZE)
            .build();

    List<Promotion> promotions = Lists.newArrayList();
    PromotionPage page;
    do {
      // Get all promotions for the business
      page = promotionService.get(selector);

      // Display promotions
      if (page.getTotalNumEntries() > 0) {
        for (Promotion promotion : page.getEntries()) {
          System.out.printf(
              "Express promotion found with ID %d and name '%s'%n",
              promotion.getId(), promotion.getName());
          promotions.add(promotion);
        }
      } else {
        System.out.println("No promotions were found.");
      }

      offset += PAGE_SIZE;
      selector.getPaging().setStartIndex(offset);
    } while (offset < page.getTotalNumEntries());

    return promotions;
  }
  public static List<Promotion> runExample(
      AdWordsServices adWordsServices, AdWordsSession session, Long businessId) throws Exception {
    ExpressBusinessServiceInterface businessService =
        adWordsServices.get(session, ExpressBusinessServiceInterface.class);

    // Get the business for the businessId. We will need its geo point to create
    // a Proximity criterion for the new Promotion.
    Selector businessSelector =
        new SelectorBuilder()
            .fields(ExpressBusinessField.Id, ExpressBusinessField.GeoPoint)
            .equals(ExpressBusinessField.Id, String.valueOf(businessId))
            .build();

    ExpressBusiness business = businessService.get(businessSelector).getEntries(0);

    // Get the PromotionService
    PromotionServiceInterface promotionService =
        adWordsServices.get(session, PromotionServiceInterface.class);

    // PromotionService requires the businessId on the session
    session.setExpressBusinessId(businessId);

    // Set up the new Promotion
    Promotion marsTourPromotion = new Promotion();
    Money budget = new Money();
    budget.setMicroAmount(1000000L);
    marsTourPromotion.setName("Mars Tour Promotion " + System.currentTimeMillis());
    marsTourPromotion.setStatus(PromotionStatus.PAUSED);
    marsTourPromotion.setDestinationUrl("http://www.example.com");
    marsTourPromotion.setBudget(budget);
    marsTourPromotion.setCallTrackingEnabled(true);

    // Criteria
    List<Criterion> criteria = Lists.newArrayList();

    // Criterion - Travel Agency product/service.  See GetProductServices.java for an example
    // of how to get valid product/service settings.
    ProductService productService = new ProductService();
    productService.setText("Travel Agency");
    productService.setLocale("en_US");
    criteria.add(productService);

    // Criterion - English language
    // The ID can be found in the documentation:
    // https://developers.google.com/adwords/api/docs/appendix/languagecodes
    Language language = new Language();
    language.setId(1000L);
    criteria.add(language);

    // Criterion - Within 15 miles
    Proximity proximity = new Proximity();
    proximity.setGeoPoint(business.getGeoPoint());
    proximity.setRadiusDistanceUnits(ProximityDistanceUnits.MILES);
    proximity.setRadiusInUnits(15d);
    criteria.add(proximity);

    marsTourPromotion.setCriteria(criteria.toArray(new Criterion[criteria.size()]));

    // Creative
    Creative creative =
        new Creative("Standard Mars Trip", "Fly coach to Mars", "Free in-flight pretzels");

    marsTourPromotion.setCreatives(new Creative[] {creative});

    Promotion[] addedPromotions =
        promotionService.mutate(
            new PromotionOperation[] {
              new PromotionOperation(Operator.ADD, null, marsTourPromotion)
            });

    System.out.printf(
        "Added promotion ID %d with name '%s' to business ID %d%n",
        addedPromotions[0].getId(), addedPromotions[0].getName(), businessId);

    return Arrays.asList(addedPromotions);
  }