It doesn't solve my problem .
please find the java code below for clear visualization what i am trying to do.
ProductPartitionTree partitionTree = ProductPartitionTree.createAdGroupTree(adWordsServices, adWordsSession,
adGroupId);
Long partitionId = null;
ProductPartitionNode rootNode = partitionTree.getRoot().asSubdivision();
ProductCustomAttribute productCustomAttribute1 = ProductDimensions.createCustomAttribute(ProductDimensionType.CUSTOM_ATTRIBUTE_1, customLabelValues.getCustomLabel1());
if(!rootNode.hasChild(productCustomAttribute1)){
rootNode.addChild(productCustomAttribute1).asSubdivision();
}
ProductCustomAttribute excludedProductCustomAttribute1 = ProductDimensions.createCustomAttribute(ProductDimensionType.CUSTOM_ATTRIBUTE_1, null);
if(!rootNode.hasChild(excludedProductCustomAttribute1)){
rootNode.addChild(excludedProductCustomAttribute1).asExcludedUnit();
}
rootNode = rootNode.getChild(productCustomAttribute1);
ProductCustomAttribute productCustomAttribute2 = ProductDimensions.createCustomAttribute(ProductDimensionType.CUSTOM_ATTRIBUTE_2, customLabelValues.getCustomLabel2());
if(!rootNode.hasChild(productCustomAttribute2)){
rootNode.addChild(productCustomAttribute2).asSubdivision();
}
ProductCustomAttribute excludedProductCustomAttribute2 = ProductDimensions.createCustomAttribute(ProductDimensionType.CUSTOM_ATTRIBUTE_2, null);
if(!rootNode.hasChild(excludedProductCustomAttribute2)){
rootNode.addChild(excludedProductCustomAttribute2).asExcludedUnit();
}
rootNode = rootNode.getChild(productCustomAttribute2);
ProductCustomAttribute productCustomAttribute3 = ProductDimensions.createCustomAttribute(ProductDimensionType.CUSTOM_ATTRIBUTE_3, customLabelValues.getCustomLabel3());
if(!rootNode.hasChild(productCustomAttribute3)){
rootNode.addChild(productCustomAttribute3).asBiddableUnit().setBid(bidAmount);
}else if(!rootNode.getChild(productCustomAttribute3).getBid().equals(bidAmount)){
rootNode.getChild(productCustomAttribute3).setBid(bidAmount);
partitionId = rootNode.getChild(productCustomAttribute3).getProductPartitionId();
}
ProductCustomAttribute excludedProductCustomAttribute3 = ProductDimensions.createCustomAttribute(ProductDimensionType.CUSTOM_ATTRIBUTE_3, null);
if(!rootNode.hasChild(excludedProductCustomAttribute3)){
rootNode.addChild(excludedProductCustomAttribute3).asExcludedUnit();
}
AdGroupCriterionServiceInterface adGroupCriterionService = adWordsServices.get(adWordsSession,
AdGroupCriterionServiceInterface.class);
java.util.List<AdGroupCriterionOperation> mutateOperations = partitionTree.getMutateOperations();
if (mutateOperations.isEmpty()) {
//Skipping the mutate call because the original tree and the current tree are logically identical
return rootNode.getChild(productCustomAttribute3).getProductPartitionId();
} else {
adGroupCriterionService.mutate(mutateOperations.toArray(new AdGroupCriterionOperation[0]));
if(partitionId!=null)
return partitionId;
partitionTree = ProductPartitionTree.createAdGroupTree(adWordsServices, adWordsSession,
adGroupId);
rootNode = partitionTree.getRoot().asSubdivision();
return rootNode.getChild(productCustomAttribute1).getChild(productCustomAttribute2).getChild(productCustomAttribute3).getProductPartitionId();
}
On Thursday, June 23, 2016 at 2:04:59 PM UTC+5:30, Joyce Lava wrote:
Hi,Please refer to this forum discussion. Please check also the documentation for more information (Java client library).Hope it helps.Thanks,Joyce, AdWords API Team
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/1e332277-0129-40b8-9fc1-9adada2c569e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment