List<CampaignCriterionOperation> operations = new ArrayList<CampaignCriterionOperation>();
for (Criterion criterion : new Criterion[] {california, mexico, english, spanish,
locationGroupTier3, locationGroupDowntown}) {
CampaignCriterionOperation operation = new CampaignCriterionOperation();
CampaignCriterion campaignCriterion = new CampaignCriterion();
campaignCriterion.setCampaignId(campaignId);
campaignCriterion.setCriterion(criterion);
operation.setOperand(campaignCriterion);
operation.setOperator(Operator.ADD);
operations.add(operation);
}
CampaignCriterionReturnValue result =
campaignCriterionService.mutate(operations
.toArray(new CampaignCriterionOperation[operations.size()]));
// Display campaigns.
for (CampaignCriterion campaignCriterion : result.getValue()) {
System.out.printf("Campaign criterion with campaign id '%s', criterion id '%s', "
+ "and type '%s' was added.\n", campaignCriterion.getCampaignId(), campaignCriterion
.getCriterion().getId(), campaignCriterion.getCriterion().getCriterionType());
}
}