private static BudgetOperation buildBudgetOperation( Iterator<Long> tempIdGenerator, String namePrefix) { Budget budget = new Budget(); budget.setBudgetId(tempIdGenerator.next()); budget.setName(String.format("Interplanetary Cruise %s", namePrefix)); Money budgetAmount = new Money(); budgetAmount.setMicroAmount(50000000L); budget.setAmount(budgetAmount); budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD); budget.setPeriod(BudgetBudgetPeriod.DAILY); BudgetOperation budgetOperation = new BudgetOperation(); budgetOperation.setOperand(budget); budgetOperation.setOperator(Operator.ADD); return budgetOperation; }
private static List<CampaignOperation> buildCampaignOperations( Iterator<Long> tempIdGenerator, String namePrefix, BudgetOperation budgetOperation) { long budgetId = budgetOperation.getOperand().getBudgetId(); List<CampaignOperation> operations = Lists.newArrayList(); for (int i = 0; i < NUMBER_OF_CAMPAIGNS_TO_ADD; i++) { Campaign campaign = new Campaign(); campaign.setName(String.format("Batch Campaign %s.%s", namePrefix, i)); campaign.setStatus(CampaignStatus.PAUSED); campaign.setId(tempIdGenerator.next()); campaign.setAdvertisingChannelType(AdvertisingChannelType.SEARCH); Budget budget = new Budget(); budget.setBudgetId(budgetId); campaign.setBudget(budget); BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration(); biddingStrategyConfiguration.setBiddingStrategyType(BiddingStrategyType.MANUAL_CPC); // You can optionally provide a bidding scheme in place of the type. ManualCpcBiddingScheme cpcBiddingScheme = new ManualCpcBiddingScheme(); cpcBiddingScheme.setEnhancedCpcEnabled(false); biddingStrategyConfiguration.setBiddingScheme(cpcBiddingScheme); campaign.setBiddingStrategyConfiguration(biddingStrategyConfiguration); CampaignOperation operation = new CampaignOperation(); operation.setOperand(campaign); operation.setOperator(Operator.ADD); operations.add(operation); } return operations; }