Examples of ProductPartition


Examples of com.google.api.ads.adwords.axis.v201402.cm.ProductPartition

     * @param  parent the node that should be this node's parent
     * @param  value the value being partitioned on
     * @return a new subdivision node
     */
    public ProductPartition createSubdivision(ProductPartition parent, ProductDimension value) {
      ProductPartition division = new ProductPartition();
      division.setPartitionType(ProductPartitionType.SUBDIVISION);
     
      division.setId(nextId--);

      // The root node has neither a parent nor a value
      if (parent != null) {
        division.setParentCriterionId(parent.getId());
        division.setCaseValue(value);
      }

      BiddableAdGroupCriterion criterion = new BiddableAdGroupCriterion();
      criterion.setAdGroupId(adGroupId);
      criterion.setCriterion(division);
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201402.cm.ProductPartition

     * @param  bidAmount the amount to bid for matching products, in micros
     * @return a new unit node
     */
    public ProductPartition createUnit(ProductPartition parent, ProductDimension value,
        Long bidAmount) {
      ProductPartition unit = new ProductPartition();
      unit.setPartitionType(ProductPartitionType.UNIT);

      // The root node has neither a parent nor a value
      if (parent != null) {
        unit.setParentCriterionId(parent.getId());
        unit.setCaseValue(value);
      }

      AdGroupCriterion criterion;
      if (bidAmount != null && bidAmount > 0) {
        BiddingStrategyConfiguration biddingStrategyConfiguration =
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201402.cm.ProductPartition

    ProductPartitionHelper helper = new ProductPartitionHelper(adGroupId);

    // The most trivial partition tree has only a unit nodes as the root:
    // helper.createUnit(null, null, 100000L);

    ProductPartition root = helper.createSubdivision(null, null);

    ProductCanonicalCondition newProductCondition = new ProductCanonicalCondition();
    newProductCondition.setCondition(ProductCanonicalConditionCondition.NEW);
    helper.createUnit(root, newProductCondition, 200000L);

    ProductCanonicalCondition usedProductCondition = new ProductCanonicalCondition();
    usedProductCondition.setCondition(ProductCanonicalConditionCondition.USED);
    helper.createUnit(root, usedProductCondition, 100000L);

    ProductPartition otherCondition =
        helper.createSubdivision(root, new ProductCanonicalCondition());

    ProductBrand coolProductBrand = new ProductBrand();
    coolProductBrand.setValue("CoolBrand");
    helper.createUnit(otherCondition, coolProductBrand, 900000L);

    ProductBrand cheapProductBrand = new ProductBrand();
    cheapProductBrand.setValue("CheapBrand");
    helper.createUnit(otherCondition, cheapProductBrand, 10000L);

    ProductPartition otherBrand = helper.createSubdivision(otherCondition, new ProductBrand());

    // The value for the bidding category is a fixed ID for the 'Luggage & Bags'
    // category. You can retrieve IDs for categories from the ConstantDataService.
    // See the 'GetProductCategoryTaxonomy' example for more details.
    ProductBiddingCategory biddingCategory = new ProductBiddingCategory();
    biddingCategory.setType(ProductDimensionType.BIDDING_CATEGORY_L1);
    biddingCategory.setValue(-5914235892932915235L);
    helper.createUnit(otherBrand, biddingCategory, 750000L);

    ProductBiddingCategory otherBiddingCategory = new ProductBiddingCategory();
    otherBiddingCategory.setType(ProductDimensionType.BIDDING_CATEGORY_L1);
    helper.createUnit(otherBrand, otherBiddingCategory, 110000L);

    // Make the mutate request.
    AdGroupCriterionReturnValue result = adGroupCriterionService.mutate(helper.getOperations());

    // For each criterion, make a list containing each of its children.
    // We always create the parent before the child, so we can rely on that here.
    Map<Long, List<ProductPartition>> children = Maps.newHashMap();
    ProductPartition rootNode = null;
    for (AdGroupCriterion adGroupCriterion : result.getValue()) {
      children.put(adGroupCriterion.getCriterion().getId(), Lists.<ProductPartition>newArrayList());

      if (!(adGroupCriterion.getCriterion() instanceof ProductPartition)) {
        throw new IllegalStateException("Expected criterion of ProductPartition but found "
            + adGroupCriterion.getCriterion() + ".");
      }
      ProductPartition criterion = (ProductPartition) adGroupCriterion.getCriterion();
      if (criterion.getParentCriterionId() != null) {
        List<ProductPartition> criterionChildren = children.get(criterion.getParentCriterionId());
        criterionChildren.add(criterion);
      } else {
        rootNode = criterion;
      }
    }
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.cm.ProductPartition

    ProductPartitionHelper helper = new ProductPartitionHelper(adGroupId);

    // The most trivial partition tree has only a unit nodes as the root:
    // helper.createUnit(null, null, 100000L);

    ProductPartition root = helper.createSubdivision(null, null);

    ProductCanonicalCondition newProductCondition = new ProductCanonicalCondition();
    newProductCondition.setCondition(ProductCanonicalConditionCondition.NEW);
    helper.createUnit(root, newProductCondition, 200000L);

    ProductCanonicalCondition usedProductCondition = new ProductCanonicalCondition();
    usedProductCondition.setCondition(ProductCanonicalConditionCondition.USED);
    helper.createUnit(root, usedProductCondition, 100000L);

    ProductPartition otherCondition =
        helper.createSubdivision(root, new ProductCanonicalCondition());

    ProductBrand coolProductBrand = new ProductBrand();
    coolProductBrand.setValue("CoolBrand");
    helper.createUnit(otherCondition, coolProductBrand, 900000L);

    ProductBrand cheapProductBrand = new ProductBrand();
    cheapProductBrand.setValue("CheapBrand");
    helper.createUnit(otherCondition, cheapProductBrand, 10000L);

    ProductPartition otherBrand = helper.createSubdivision(otherCondition, new ProductBrand());

    // The value for the bidding category is a fixed ID for the 'Luggage & Bags'
    // category. You can retrieve IDs for categories from the ConstantDataService.
    // See the 'GetProductCategoryTaxonomy' example for more details.
    ProductBiddingCategory biddingCategory = new ProductBiddingCategory();
    biddingCategory.setType(ProductDimensionType.BIDDING_CATEGORY_L1);
    biddingCategory.setValue(-5914235892932915235L);
    helper.createUnit(otherBrand, biddingCategory, 750000L);

    ProductBiddingCategory otherBiddingCategory = new ProductBiddingCategory();
    otherBiddingCategory.setType(ProductDimensionType.BIDDING_CATEGORY_L1);
    helper.createUnit(otherBrand, otherBiddingCategory, 110000L);

    // Make the mutate request.
    AdGroupCriterionReturnValue result = adGroupCriterionService.mutate(helper.getOperations());

    // For each criterion, make a list containing each of its children.
    // We always create the parent before the child, so we can rely on that here.
    Map<Long, List<ProductPartition>> children = Maps.newHashMap();
    ProductPartition rootNode = null;
    for (AdGroupCriterion adGroupCriterion : result.getValue()) {
      children.put(adGroupCriterion.getCriterion().getId(), Lists.<ProductPartition>newArrayList());

      if (!(adGroupCriterion.getCriterion() instanceof ProductPartition)) {
        throw new IllegalStateException("Expected criterion of ProductPartition but found "
            + adGroupCriterion.getCriterion() + ".");
      }
      ProductPartition criterion = (ProductPartition) adGroupCriterion.getCriterion();
      if (criterion.getParentCriterionId() != null) {
        List<ProductPartition> criterionChildren = children.get(criterion.getParentCriterionId());
        criterionChildren.add(criterion);
      } else {
        rootNode = criterion;
      }
    }
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.cm.ProductPartition

     * @param  parent the node that should be this node's parent
     * @param  value the value being partitioned on
     * @return a new subdivision node
     */
    public ProductPartition createSubdivision(ProductPartition parent, ProductDimension value) {
      ProductPartition division = new ProductPartition();
      division.setPartitionType(ProductPartitionType.SUBDIVISION);
     
      division.setId(nextId--);

      // The root node has neither a parent nor a value
      if (parent != null) {
        division.setParentCriterionId(parent.getId());
        division.setCaseValue(value);
      }

      BiddableAdGroupCriterion criterion = new BiddableAdGroupCriterion();
      criterion.setAdGroupId(adGroupId);
      criterion.setCriterion(division);
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.cm.ProductPartition

     * @param  bidAmount the amount to bid for matching products, in micros
     * @return a new unit node
     */
    public ProductPartition createUnit(ProductPartition parent, ProductDimension value,
        Long bidAmount) {
      ProductPartition unit = new ProductPartition();
      unit.setPartitionType(ProductPartitionType.UNIT);

      // The root node has neither a parent nor a value
      if (parent != null) {
        unit.setParentCriterionId(parent.getId());
        unit.setCaseValue(value);
      }

      AdGroupCriterion criterion;
      if (bidAmount != null && bidAmount > 0) {
        BiddingStrategyConfiguration biddingStrategyConfiguration =
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.