use of com.google.api.ads.adwords.axis.v201809.cm.CampaignOperation in project googleads-java-lib by googleads.
the class AddCompleteCampaignsUsingBatchJob method buildAdGroupOperations.
private static List<AdGroupOperation> buildAdGroupOperations(Iterator<Long> tempIdGenerator, String namePrefix, Iterable<CampaignOperation> campaignOperations) {
List<AdGroupOperation> operations = new ArrayList<>();
for (CampaignOperation campaignOperation : campaignOperations) {
for (int i = 0; i < NUMBER_OF_ADGROUPS_TO_ADD; i++) {
AdGroup adGroup = new AdGroup();
adGroup.setCampaignId(campaignOperation.getOperand().getId());
adGroup.setId(tempIdGenerator.next());
adGroup.setName(String.format("Batch Ad Group %s.%s", namePrefix, i));
BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
CpcBid bid = new CpcBid();
bid.setBid(new Money(null, 10000000L));
biddingStrategyConfiguration.setBids(new Bids[] { bid });
adGroup.setBiddingStrategyConfiguration(biddingStrategyConfiguration);
AdGroupOperation operation = new AdGroupOperation();
operation.setOperand(adGroup);
operation.setOperator(Operator.ADD);
operations.add(operation);
}
}
return operations;
}
Aggregations