if (parent != null) {
unit.setParentCriterionId(parent.getId());
unit.setCaseValue(value);
}
AdGroupCriterion criterion;
if (bidAmount != null && bidAmount > 0) {
BiddingStrategyConfiguration biddingStrategyConfiguration =
new BiddingStrategyConfiguration();
Money bidAmountMoney = new Money();
bidAmountMoney.setMicroAmount(bidAmount);
CpcBid cpcBid = new CpcBid();
cpcBid.setBid(bidAmountMoney);
biddingStrategyConfiguration.setBids(new Bids[] {cpcBid});
BiddableAdGroupCriterion biddableCriterion = new BiddableAdGroupCriterion();
biddableCriterion.setBiddingStrategyConfiguration(biddingStrategyConfiguration);
criterion = biddableCriterion;
} else {
criterion = new NegativeAdGroupCriterion();
}
criterion.setAdGroupId(adGroupId);
criterion.setCriterion(unit);
operations.add(createAddOperation(criterion));
return unit;
}