static ApplyProductPartitionActionsResponse applyPartitionActions(
      ArrayOfAdGroupCriterionAction actions) throws RemoteException, Exception {
    ApplyProductPartitionActionsRequest request = new ApplyProductPartitionActionsRequest();
    request.setCriterionActions(actions);

    return CampaignService.getService().applyProductPartitionActions(request);
  }
  static void deleteCampaigns(long accountId, ArrayOflong campaignIds)
      throws RemoteException, Exception {
    DeleteCampaignsRequest request = new DeleteCampaignsRequest();
    request.setAccountId(accountId);
    request.setCampaignIds(campaignIds);

    CampaignService.getService().deleteCampaigns(request);
  }
  static ArrayOfAdGroupCriterion getAdGroupCriterionsByIds(
      long accountId, long adGroupId, ArrayOflong adGroupCriterionIds, CriterionType criterionType)
      throws RemoteException, Exception {
    GetAdGroupCriterionsByIdsRequest request = new GetAdGroupCriterionsByIdsRequest();
    request.setAccountId(accountId);
    request.setAdGroupId(adGroupId);
    request.setAdGroupCriterionIds(adGroupCriterionIds);

    return CampaignService.getService().getAdGroupCriterionsByIds(request).getAdGroupCriterions();
  }
  static AddAdsResponse addAds(long adGroupId, ArrayOfAd ads) throws RemoteException, Exception {
    AddAdsRequest request = new AddAdsRequest();

    // Set the request information.

    request.setAdGroupId(adGroupId);
    request.setAds(ads);

    return CampaignService.getService().addAds(request);
  }
  static AddCampaignsResponse addCampaigns(long accountId, ArrayOfCampaign campaigns)
      throws RemoteException, Exception {
    AddCampaignsRequest request = new AddCampaignsRequest();

    // Set the request information.

    request.setAccountId(accountId);
    request.setCampaigns(campaigns);

    return CampaignService.getService().addCampaigns(request);
  }
    public static AdGroupEstimatedBid getAdGroupEstimatedBidByKeywords(Currency currency, ArrayOfKeywordAndMatchType keywordAndMatchTypes, 
    		java.lang.String language, ArrayOfstring publisherCountries, TargetAdPosition targetPositionForAds) throws RemoteException, Exception
    {
        GetEstimatedBidByKeywordsRequest request = new GetEstimatedBidByKeywordsRequest();
        
        // Set the Currency, Keywords, Language, PublisherCountries, and TargetPositionForAds
        // for the estimated bid by keywords request.
        
        request.setCurrency(currency);
        request.setGetBidsAtLevel(2); // Set GetBidsAtLevel to 2 to get one AdGroupEstimatedBid.
        request.setKeywords(keywordAndMatchTypes);
        request.setLanguage(language);
        request.setPublisherCountries(publisherCountries);
        request.setTargetPositionForAds(targetPositionForAds);

        return AdIntelligenceService.getService().getEstimatedBidByKeywords(request).getAdGroupEstimatedBid();
    }
  static AddCampaignCriterionsResponse addCampaignCriterion(final long CAMPAIGN_ID)
      throws RemoteException, Exception {
    AddCampaignCriterionsRequest request =
        new AddCampaignCriterionsRequest() {
          {
            criterionType =
                new ArrayList<CampaignCriterionType>() {
                  {
                    add(CampaignCriterionType.PRODUCT_SCOPE);
                  }
                };
            campaignCriterions =
                new ArrayOfCampaignCriterion() {
                  {
                    campaignCriterions =
                        new ArrayList<CampaignCriterion>() {
                          {
                            add(
                                new CampaignCriterion() {
                                  {
                                    campaignId = CAMPAIGN_ID;
                                    bidAdjustment = null; // Reserved for future use
                                    criterion =
                                        new ProductScope() {
                                          {
                                            conditions =
                                                new ArrayOfProductCondition() {
                                                  {
                                                    productConditions =
                                                        new ArrayList<ProductCondition>() {
                                                          {
                                                            add(
                                                                new ProductCondition() {
                                                                  {
                                                                    operand = "Condition";
                                                                    attribute = "New";
                                                                  }
                                                                });
                                                            add(
                                                                new ProductCondition() {
                                                                  {
                                                                    operand = "Brand";
                                                                    attribute = "Contoso";
                                                                  }
                                                                });
                                                          }
                                                        };
                                                  }
                                                };
                                          }
                                        };
                                  }
                                });
                          }
                        };
                  }
                };
          }
        };

    return CampaignService.getService().addCampaignCriterions(request);
  }
  static ArrayOfBMCStore getBMCStoresByCustomerId() throws RemoteException, Exception {
    GetBMCStoresByCustomerIdRequest request = new GetBMCStoresByCustomerIdRequest();

    return CampaignService.getService().getBMCStoresByCustomerId(request).getBMCStores();
  }