static AdGroupCriterion addPartition(
      long adGroupId,
      AdGroupCriterion parent,
      ProductCondition condition,
      ProductPartitionType partitionType,
      FixedBid bid,
      Boolean isNegative) {
    AdGroupCriterion adGroupCriterion = null;

    if (isNegative) {
      adGroupCriterion = new NegativeAdGroupCriterion();
    } else {
      adGroupCriterion = new BiddableAdGroupCriterion();
      ((BiddableAdGroupCriterion) adGroupCriterion).setCriterionBid(bid);
    }

    adGroupCriterion.setAdGroupId(adGroupId);

    ProductPartition criterion = new ProductPartition();
    criterion.setCondition(condition);
    criterion.setParentCriterionId((parent != null) ? parent.getId() : null);

    if (partitionType == ProductPartitionType.SUBDIVISION) {
      criterion.setPartitionType(ProductPartitionType.SUBDIVISION); // Branch
      adGroupCriterion.setId(_referenceId--);
    } else {
      criterion.setPartitionType(ProductPartitionType.UNIT); // Leaf
    }

    adGroupCriterion.setCriterion(criterion);

    addPartitionAction(adGroupCriterion, ItemAction.ADD);

    return adGroupCriterion;
  }
  static BulkAdGroupProductPartition addPartition(
      long adGroupId,
      BulkAdGroupProductPartition parent,
      ProductCondition condition,
      ProductPartitionType partitionType,
      FixedBid bid,
      Boolean isNegative,
      java.lang.String clientId) {
    AdGroupCriterion adGroupCriterion = null;

    if (isNegative) {
      adGroupCriterion = new NegativeAdGroupCriterion();
    } else {
      adGroupCriterion = new BiddableAdGroupCriterion();
      ((BiddableAdGroupCriterion) adGroupCriterion).setCriterionBid(bid);
    }

    adGroupCriterion.setAdGroupId(adGroupId);

    ProductPartition criterion = new ProductPartition();
    criterion.setCondition(condition);
    criterion.setParentCriterionId(
        (parent != null && parent.getAdGroupCriterion() != null)
            ? parent.getAdGroupCriterion().getId()
            : null);

    if (partitionType == ProductPartitionType.SUBDIVISION) {
      criterion.setPartitionType(ProductPartitionType.SUBDIVISION); // Branch
      adGroupCriterion.setId(_referenceId--);
    } else {
      criterion.setPartitionType(ProductPartitionType.UNIT); // Leaf
    }

    adGroupCriterion.setCriterion(criterion);

    BulkAdGroupProductPartition partitionAction = new BulkAdGroupProductPartition();
    partitionAction.setAdGroupCriterion(adGroupCriterion);
    partitionAction.setClientId(clientId);
    _partitionActions.add(partitionAction);

    return partitionAction;
  }