From fe1e74a8568e8bce4e6b4f7b180988b5a8b456bb Mon Sep 17 00:00:00 2001
From: "ct-sdks[bot]" <153784748+ct-sdks[bot]@users.noreply.github.com>
Date: Tue, 17 Dec 2024 14:14:37 +0000
Subject: [PATCH] build(codegen): updating SDK
---
changes.md | 27 ++
.../main/resources/graphql/schema.graphqls | 79 +++++
.../cart/CartAddCustomLineItemAction.java | 4 +-
.../CartAddCustomLineItemActionBuilder.java | 4 +-
.../cart/CartAddCustomLineItemActionImpl.java | 2 +-
.../api/models/cart/CustomLineItem.java | 4 +-
.../models/cart/CustomLineItemBuilder.java | 4 +-
.../api/models/cart/CustomLineItemDraft.java | 4 +-
.../cart/CustomLineItemDraftBuilder.java | 4 +-
.../models/cart/CustomLineItemDraftImpl.java | 2 +-
.../api/models/cart/CustomLineItemImpl.java | 2 +-
.../models/cart/CustomLineItemPriceMode.java | 2 +-
.../CartDiscountPatternTarget.java | 218 +++++++++++++
.../CartDiscountPatternTargetBuilder.java | 297 ++++++++++++++++++
.../CartDiscountPatternTargetImpl.java | 172 ++++++++++
.../cart_discount/CartDiscountTarget.java | 13 +
.../CartDiscountTargetBuilder.java | 4 +
.../cart_discount/CartDiscountValueFixed.java | 19 ++
.../CartDiscountValueFixedBuilder.java | 34 +-
.../CartDiscountValueFixedDraft.java | 19 ++
.../CartDiscountValueFixedDraftBuilder.java | 34 +-
.../CartDiscountValueFixedDraftImpl.java | 25 +-
.../CartDiscountValueFixedImpl.java | 25 +-
.../CountOnCustomLineItemUnits.java | 184 +++++++++++
.../CountOnCustomLineItemUnitsBuilder.java | 165 ++++++++++
.../CountOnCustomLineItemUnitsImpl.java | 158 ++++++++++
.../cart_discount/CountOnLineItemUnits.java | 184 +++++++++++
.../CountOnLineItemUnitsBuilder.java | 165 ++++++++++
.../CountOnLineItemUnitsImpl.java | 158 ++++++++++
.../cart_discount/PatternComponent.java | 106 +++++++
.../PatternComponentBuilder.java | 30 ++
.../cart_discount/PatternComponentImpl.java | 72 +++++
.../order/CustomLineItemImportDraft.java | 4 +-
.../CustomLineItemImportDraftBuilder.java | 4 +-
.../order/CustomLineItemImportDraftImpl.java | 2 +-
.../StagedOrderAddCustomLineItemAction.java | 4 +-
...edOrderAddCustomLineItemActionBuilder.java | 4 +-
...tagedOrderAddCustomLineItemActionImpl.java | 2 +-
.../ProductSelectionAssignment.java | 8 +-
.../ProductSelectionAssignmentBuilder.java | 14 +-
.../ProductSelectionAssignmentImpl.java | 4 +-
...tDiscountPatternTargetQueryBuilderDsl.java | 66 ++++
.../CartDiscountTargetQueryBuilderDsl.java | 8 +
...iscountValueFixedDraftQueryBuilderDsl.java | 6 +
...CartDiscountValueFixedQueryBuilderDsl.java | 6 +
...tOnCustomLineItemUnitsQueryBuilderDsl.java | 44 +++
.../CountOnLineItemUnitsQueryBuilderDsl.java | 44 +++
.../PatternComponentQueryBuilderDsl.java | 36 +++
.../CartDiscountPatternTargetTest.java | 76 +++++
.../CartDiscountValueFixedDraftTest.java | 18 +-
.../CartDiscountValueFixedTest.java | 18 +-
.../CountOnCustomLineItemUnitsTest.java | 60 ++++
.../CountOnLineItemUnitsTest.java | 60 ++++
.../cart_discount/PatternComponent.java | 76 +++++
.../PatternComponentBuilder.java | 22 ++
.../cart_discount/PatternComponentImpl.java | 72 +++++
.../change_value/ChangeTargetChangeValue.java | 13 +
.../ChangeTargetChangeValueBuilder.java | 4 +
.../ChangeTargetPatternChangeValue.java | 218 +++++++++++++
...ChangeTargetPatternChangeValueBuilder.java | 279 ++++++++++++++++
.../ChangeTargetPatternChangeValueImpl.java | 170 ++++++++++
.../ChangeTargetPatternChangeValueTest.java | 75 +++++
references.txt | 1 +
63 files changed, 3587 insertions(+), 51 deletions(-)
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountPatternTarget.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountPatternTargetBuilder.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountPatternTargetImpl.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CountOnCustomLineItemUnits.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CountOnCustomLineItemUnitsBuilder.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CountOnCustomLineItemUnitsImpl.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CountOnLineItemUnits.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CountOnLineItemUnitsBuilder.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CountOnLineItemUnitsImpl.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/PatternComponent.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/PatternComponentBuilder.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/PatternComponentImpl.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-predicates-generated/com/commercetools/api/predicates/query/cart_discount/CartDiscountPatternTargetQueryBuilderDsl.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-predicates-generated/com/commercetools/api/predicates/query/cart_discount/CountOnCustomLineItemUnitsQueryBuilderDsl.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-predicates-generated/com/commercetools/api/predicates/query/cart_discount/CountOnLineItemUnitsQueryBuilderDsl.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/main/java-predicates-generated/com/commercetools/api/predicates/query/cart_discount/PatternComponentQueryBuilderDsl.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/test/java-generated/com/commercetools/api/models/cart_discount/CartDiscountPatternTargetTest.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/test/java-generated/com/commercetools/api/models/cart_discount/CountOnCustomLineItemUnitsTest.java
create mode 100644 commercetools/commercetools-sdk-java-api/src/test/java-generated/com/commercetools/api/models/cart_discount/CountOnLineItemUnitsTest.java
create mode 100644 commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/cart_discount/PatternComponent.java
create mode 100644 commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/cart_discount/PatternComponentBuilder.java
create mode 100644 commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/cart_discount/PatternComponentImpl.java
create mode 100644 commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/change_value/ChangeTargetPatternChangeValue.java
create mode 100644 commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/change_value/ChangeTargetPatternChangeValueBuilder.java
create mode 100644 commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/change_value/ChangeTargetPatternChangeValueImpl.java
create mode 100644 commercetools/commercetools-sdk-java-history/src/test/java-generated/com/commercetools/history/models/change_value/ChangeTargetPatternChangeValueTest.java
diff --git a/changes.md b/changes.md
index 3bc82431285..e34d29611cd 100644
--- a/changes.md
+++ b/changes.md
@@ -16,3 +16,30 @@
- added method `apiRoot.withProjectKey().channels().withKey().delete()`
+
+Added Type(s)
+
+- added type `CartDiscountPatternTarget`
+- added type `CountOnCustomLineItemUnits`
+- added type `CountOnLineItemUnits`
+- added type `PatternComponent`
+Added Property(s)
+
+- added property `applicationMode` to type `CartDiscountValueFixed`
+- added property `applicationMode` to type `CartDiscountValueFixedDraft`
+Added Type(s)
+
+- added type `ChangeTargetPatternChangeValue`
+- added type `PatternComponent`
+
Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.
+ *Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.
* @return priceMode */ @NotNull @@ -347,7 +347,7 @@ public void setDiscountedPricePerQuantity( public void setShippingDetails(final ItemShippingDetails shippingDetails); /** - *Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.
+ *Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.
* @param priceMode value to be set */ diff --git a/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemBuilder.java b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemBuilder.java index 1ac54c63c94..bb3e08b1566 100644 --- a/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemBuilder.java +++ b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemBuilder.java @@ -762,7 +762,7 @@ public CustomLineItemBuilder shippingDetails( } /** - *Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.
+ *Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.
* @param priceMode value to be set * @return Builder */ @@ -927,7 +927,7 @@ public com.commercetools.api.models.cart.ItemShippingDetails getShippingDetails( } /** - *Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.
+ *Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.
* @return priceMode */ diff --git a/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemDraft.java b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemDraft.java index 1c56d19cc13..a3a4f174039 100644 --- a/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemDraft.java +++ b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemDraft.java @@ -115,7 +115,7 @@ public interface CustomLineItemDraft extends com.commercetools.api.models.Custom /** *Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.
+ *Indicates whether Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.
*/ public com.commercetools.api.models.cart.CustomLineItemPriceMode getPriceMode() { diff --git a/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemPriceMode.java b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemPriceMode.java index 1fa9d7e1a5c..0b0f8121dae 100644 --- a/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemPriceMode.java +++ b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart/CustomLineItemPriceMode.java @@ -21,7 +21,7 @@ public interface CustomLineItemPriceMode extends JsonEnum {This is the default mode for backwards compatibility.
*/ CustomLineItemPriceMode STANDARD = CustomLineItemPriceModeEnum.STANDARD; /** -Deactivates application of Cart Discounts for the Custom Line Item, despite a matching CartDiscountCustomLineItemsTarget and MultiBuyCustomLineItemsTarget.
*/ +Deactivates application of Cart Discounts for the Custom Line Item despite a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget.
*/ CustomLineItemPriceMode EXTERNAL = CustomLineItemPriceModeEnum.EXTERNAL; /** diff --git a/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountPatternTarget.java b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountPatternTarget.java new file mode 100644 index 00000000000..066b5797db0 --- /dev/null +++ b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountPatternTarget.java @@ -0,0 +1,218 @@ + +package com.commercetools.api.models.cart_discount; + +import java.time.*; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +import javax.annotation.Nullable; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; + +import io.vrap.rmf.base.client.utils.Generated; + +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; + +/** + *Pattern targets can be used to model Buy and Get discounts.
+ *Unlike CartDiscountLineItemsTarget and CartDiscountCustomLineItemsTarget, it does not apply to a (Custom) Line Item as a whole, but to individual units of a (Custom) Line Item. The discounts can apply multiple times on the same cart, but each unit can be discounted only once.
+ * + *
+ * CartDiscountPatternTarget cartDiscountPatternTarget = CartDiscountPatternTarget.builder()
+ * .plusTargetPattern(targetPatternBuilder -> targetPatternBuilder)
+ * .selectionMode(SelectionMode.CHEAPEST)
+ * .build()
+ *
+ * Units of a (Custom) Line Item that trigger a discount application.
+ *Based on the availability of matching units, the triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set the maxOccurrence
.
If empty or not set, the Discount will apply indefinitely.
+ * @return triggerPattern + */ + @Valid + @JsonProperty("triggerPattern") + public ListUnits of (Custom) Line Items on which the Discount is applied.
+ *Based on the availability of matching units and the limits from the triggerPattern
or maxOccurence
, the targetPattern
can match multiple times.
Maximum number of times the Discount can apply on a Cart.
+ *If empty or not set, the Discount will apply indefinitely.
+ * @return maxOccurrence + */ + + @JsonProperty("maxOccurrence") + public Integer getMaxOccurrence(); + + /** + *Determines which of the matching units of (Custom) Line Items are discounted.
+ * @return selectionMode + */ + @NotNull + @JsonProperty("selectionMode") + public SelectionMode getSelectionMode(); + + /** + *Units of a (Custom) Line Item that trigger a discount application.
+ *Based on the availability of matching units, the triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set the maxOccurrence
.
If empty or not set, the Discount will apply indefinitely.
+ * @param triggerPattern values to be set + */ + + @JsonIgnore + public void setTriggerPattern(final PatternComponent... triggerPattern); + + /** + *Units of a (Custom) Line Item that trigger a discount application.
+ *Based on the availability of matching units, the triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set the maxOccurrence
.
If empty or not set, the Discount will apply indefinitely.
+ * @param triggerPattern values to be set + */ + + public void setTriggerPattern(final ListUnits of (Custom) Line Items on which the Discount is applied.
+ *Based on the availability of matching units and the limits from the triggerPattern
or maxOccurence
, the targetPattern
can match multiple times.
Units of (Custom) Line Items on which the Discount is applied.
+ *Based on the availability of matching units and the limits from the triggerPattern
or maxOccurence
, the targetPattern
can match multiple times.
Maximum number of times the Discount can apply on a Cart.
+ *If empty or not set, the Discount will apply indefinitely.
+ * @param maxOccurrence value to be set + */ + + public void setMaxOccurrence(final Integer maxOccurrence); + + /** + *Determines which of the matching units of (Custom) Line Items are discounted.
+ * @param selectionMode value to be set + */ + + public void setSelectionMode(final SelectionMode selectionMode); + + /** + * factory method + * @return instance of CartDiscountPatternTarget + */ + public static CartDiscountPatternTarget of() { + return new CartDiscountPatternTargetImpl(); + } + + /** + * factory method to create a shallow copy CartDiscountPatternTarget + * @param template instance to be copied + * @return copy instance + */ + public static CartDiscountPatternTarget of(final CartDiscountPatternTarget template) { + CartDiscountPatternTargetImpl instance = new CartDiscountPatternTargetImpl(); + instance.setTriggerPattern(template.getTriggerPattern()); + instance.setTargetPattern(template.getTargetPattern()); + instance.setMaxOccurrence(template.getMaxOccurrence()); + instance.setSelectionMode(template.getSelectionMode()); + return instance; + } + + /** + * factory method to create a deep copy of CartDiscountPatternTarget + * @param template instance to be copied + * @return copy instance + */ + @Nullable + public static CartDiscountPatternTarget deepCopy(@Nullable final CartDiscountPatternTarget template) { + if (template == null) { + return null; + } + CartDiscountPatternTargetImpl instance = new CartDiscountPatternTargetImpl(); + instance.setTriggerPattern(Optional.ofNullable(template.getTriggerPattern()) + .map(t -> t.stream() + .map(com.commercetools.api.models.cart_discount.PatternComponent::deepCopy) + .collect(Collectors.toList())) + .orElse(null)); + instance.setTargetPattern(Optional.ofNullable(template.getTargetPattern()) + .map(t -> t.stream() + .map(com.commercetools.api.models.cart_discount.PatternComponent::deepCopy) + .collect(Collectors.toList())) + .orElse(null)); + instance.setMaxOccurrence(template.getMaxOccurrence()); + instance.setSelectionMode(template.getSelectionMode()); + return instance; + } + + /** + * builder factory method for CartDiscountPatternTarget + * @return builder + */ + public static CartDiscountPatternTargetBuilder builder() { + return CartDiscountPatternTargetBuilder.of(); + } + + /** + * create builder for CartDiscountPatternTarget instance + * @param template instance with prefilled values for the builder + * @return builder + */ + public static CartDiscountPatternTargetBuilder builder(final CartDiscountPatternTarget template) { + return CartDiscountPatternTargetBuilder.of(template); + } + + /** + * accessor map function + * @param
+ * CartDiscountPatternTarget cartDiscountPatternTarget = CartDiscountPatternTarget.builder()
+ * .plusTargetPattern(targetPatternBuilder -> targetPatternBuilder)
+ * .selectionMode(SelectionMode.CHEAPEST)
+ * .build()
+ *
+ * Units of a (Custom) Line Item that trigger a discount application.
+ *Based on the availability of matching units, the triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set the maxOccurrence
.
If empty or not set, the Discount will apply indefinitely.
+ * @param triggerPattern value to be set + * @return Builder + */ + + public CartDiscountPatternTargetBuilder triggerPattern( + @Nullable final com.commercetools.api.models.cart_discount.PatternComponent... triggerPattern) { + this.triggerPattern = new ArrayList<>(Arrays.asList(triggerPattern)); + return this; + } + + /** + *Units of a (Custom) Line Item that trigger a discount application.
+ *Based on the availability of matching units, the triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set the maxOccurrence
.
If empty or not set, the Discount will apply indefinitely.
+ * @param triggerPattern value to be set + * @return Builder + */ + + public CartDiscountPatternTargetBuilder triggerPattern( + @Nullable final java.util.ListUnits of a (Custom) Line Item that trigger a discount application.
+ *Based on the availability of matching units, the triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set the maxOccurrence
.
If empty or not set, the Discount will apply indefinitely.
+ * @param triggerPattern value to be set + * @return Builder + */ + + public CartDiscountPatternTargetBuilder plusTriggerPattern( + @Nullable final com.commercetools.api.models.cart_discount.PatternComponent... triggerPattern) { + if (this.triggerPattern == null) { + this.triggerPattern = new ArrayList<>(); + } + this.triggerPattern.addAll(Arrays.asList(triggerPattern)); + return this; + } + + /** + *Units of a (Custom) Line Item that trigger a discount application.
+ *Based on the availability of matching units, the triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set the maxOccurrence
.
If empty or not set, the Discount will apply indefinitely.
+ * @param builder function to build the triggerPattern value + * @return Builder + */ + + public CartDiscountPatternTargetBuilder plusTriggerPattern( + FunctionUnits of a (Custom) Line Item that trigger a discount application.
+ *Based on the availability of matching units, the triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set the maxOccurrence
.
If empty or not set, the Discount will apply indefinitely.
+ * @param builder function to build the triggerPattern value + * @return Builder + */ + + public CartDiscountPatternTargetBuilder withTriggerPattern( + FunctionUnits of (Custom) Line Items on which the Discount is applied.
+ *Based on the availability of matching units and the limits from the triggerPattern
or maxOccurence
, the targetPattern
can match multiple times.
Units of (Custom) Line Items on which the Discount is applied.
+ *Based on the availability of matching units and the limits from the triggerPattern
or maxOccurence
, the targetPattern
can match multiple times.
Units of (Custom) Line Items on which the Discount is applied.
+ *Based on the availability of matching units and the limits from the triggerPattern
or maxOccurence
, the targetPattern
can match multiple times.
Units of (Custom) Line Items on which the Discount is applied.
+ *Based on the availability of matching units and the limits from the triggerPattern
or maxOccurence
, the targetPattern
can match multiple times.
Units of (Custom) Line Items on which the Discount is applied.
+ *Based on the availability of matching units and the limits from the triggerPattern
or maxOccurence
, the targetPattern
can match multiple times.
Maximum number of times the Discount can apply on a Cart.
+ *If empty or not set, the Discount will apply indefinitely.
+ * @param maxOccurrence value to be set + * @return Builder + */ + + public CartDiscountPatternTargetBuilder maxOccurrence(@Nullable final Integer maxOccurrence) { + this.maxOccurrence = maxOccurrence; + return this; + } + + /** + *Determines which of the matching units of (Custom) Line Items are discounted.
+ * @param selectionMode value to be set + * @return Builder + */ + + public CartDiscountPatternTargetBuilder selectionMode( + final com.commercetools.api.models.cart_discount.SelectionMode selectionMode) { + this.selectionMode = selectionMode; + return this; + } + + /** + *Units of a (Custom) Line Item that trigger a discount application.
+ *Based on the availability of matching units, the triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set the maxOccurrence
.
If empty or not set, the Discount will apply indefinitely.
+ * @return triggerPattern + */ + + @Nullable + public java.util.ListUnits of (Custom) Line Items on which the Discount is applied.
+ *Based on the availability of matching units and the limits from the triggerPattern
or maxOccurence
, the targetPattern
can match multiple times.
Maximum number of times the Discount can apply on a Cart.
+ *If empty or not set, the Discount will apply indefinitely.
+ * @return maxOccurrence + */ + + @Nullable + public Integer getMaxOccurrence() { + return this.maxOccurrence; + } + + /** + *Determines which of the matching units of (Custom) Line Items are discounted.
+ * @return selectionMode + */ + + public com.commercetools.api.models.cart_discount.SelectionMode getSelectionMode() { + return this.selectionMode; + } + + /** + * builds CartDiscountPatternTarget with checking for non-null required values + * @return CartDiscountPatternTarget + */ + public CartDiscountPatternTarget build() { + Objects.requireNonNull(targetPattern, CartDiscountPatternTarget.class + ": targetPattern is missing"); + Objects.requireNonNull(selectionMode, CartDiscountPatternTarget.class + ": selectionMode is missing"); + return new CartDiscountPatternTargetImpl(triggerPattern, targetPattern, maxOccurrence, selectionMode); + } + + /** + * builds CartDiscountPatternTarget without checking for non-null required values + * @return CartDiscountPatternTarget + */ + public CartDiscountPatternTarget buildUnchecked() { + return new CartDiscountPatternTargetImpl(triggerPattern, targetPattern, maxOccurrence, selectionMode); + } + + /** + * factory method for an instance of CartDiscountPatternTargetBuilder + * @return builder + */ + public static CartDiscountPatternTargetBuilder of() { + return new CartDiscountPatternTargetBuilder(); + } + + /** + * create builder for CartDiscountPatternTarget instance + * @param template instance with prefilled values for the builder + * @return builder + */ + public static CartDiscountPatternTargetBuilder of(final CartDiscountPatternTarget template) { + CartDiscountPatternTargetBuilder builder = new CartDiscountPatternTargetBuilder(); + builder.triggerPattern = template.getTriggerPattern(); + builder.targetPattern = template.getTargetPattern(); + builder.maxOccurrence = template.getMaxOccurrence(); + builder.selectionMode = template.getSelectionMode(); + return builder; + } + +} diff --git a/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountPatternTargetImpl.java b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountPatternTargetImpl.java new file mode 100644 index 00000000000..00efbfe4887 --- /dev/null +++ b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/cart_discount/CartDiscountPatternTargetImpl.java @@ -0,0 +1,172 @@ + +package com.commercetools.api.models.cart_discount; + +import java.time.*; +import java.util.*; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.*; + +import io.vrap.rmf.base.client.ModelBase; +import io.vrap.rmf.base.client.utils.Generated; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + *Pattern targets can be used to model Buy and Get discounts.
+ *Unlike CartDiscountLineItemsTarget and CartDiscountCustomLineItemsTarget, it does not apply to a (Custom) Line Item as a whole, but to individual units of a (Custom) Line Item. The discounts can apply multiple times on the same cart, but each unit can be discounted only once.
+ */ +@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") +public class CartDiscountPatternTargetImpl implements CartDiscountPatternTarget, ModelBase { + + private String type; + + private java.util.ListUnits of a (Custom) Line Item that trigger a discount application.
+ *Based on the availability of matching units, the triggerPattern
can match multiple times, effecting the number of times the discount will be applied. To further limit the discount application, set the maxOccurrence
.
If empty or not set, the Discount will apply indefinitely.
+ */ + + public java.util.ListUnits of (Custom) Line Items on which the Discount is applied.
+ *Based on the availability of matching units and the limits from the triggerPattern
or maxOccurence
, the targetPattern
can match multiple times.
Maximum number of times the Discount can apply on a Cart.
+ *If empty or not set, the Discount will apply indefinitely.
+ */ + + public Integer getMaxOccurrence() { + return this.maxOccurrence; + } + + /** + *Determines which of the matching units of (Custom) Line Items are discounted.
+ */ + + public com.commercetools.api.models.cart_discount.SelectionMode getSelectionMode() { + return this.selectionMode; + } + + public void setTriggerPattern(final com.commercetools.api.models.cart_discount.PatternComponent... triggerPattern) { + this.triggerPattern = new ArrayList<>(Arrays.asList(triggerPattern)); + } + + public void setTriggerPattern( + final java.util.ListIndicates how the discount is applied on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
+ *For CartDiscountPatternTarget, the mode can also be ProportionateDistribution
or EvenDistribution
.
Money values in cent precision or high precision of different currencies.
* @param money values to be set @@ -63,6 +72,14 @@ public interface CartDiscountValueFixed extends CartDiscountValue, CartDiscountV public void setMoney(final ListIndicates how the discount is applied on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
+ *For CartDiscountPatternTarget, the mode can also be ProportionateDistribution
or EvenDistribution
.
Money values in cent precision or high precision of different currencies.
* @param money value to be set @@ -89,6 +94,19 @@ public CartDiscountValueFixedBuilder withMoney( return this; } + /** + *Indicates how the discount is applied on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
+ *For CartDiscountPatternTarget, the mode can also be ProportionateDistribution
or EvenDistribution
.
Money values in cent precision or high precision of different currencies.
* @return money @@ -98,13 +116,24 @@ public java.util.ListIndicates how the discount is applied on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
+ *For CartDiscountPatternTarget, the mode can also be ProportionateDistribution
or EvenDistribution
.
Determines how the discount applies on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
+ *For CartDiscountPatternTarget, you can also set the mode to ProportionateDistribution
or EvenDistribution
.
Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.
*If the array is empty, the discount does not apply.
@@ -67,6 +76,14 @@ public interface CartDiscountValueFixedDraft public void setMoney(final ListDetermines how the discount applies on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
+ *For CartDiscountPatternTarget, you can also set the mode to ProportionateDistribution
or EvenDistribution
.
Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.
*If the array is empty, the discount does not apply.
@@ -118,6 +123,19 @@ public CartDiscountValueFixedDraftBuilder setMoney( return money(builder.apply(com.commercetools.api.models.common.MoneyBuilder.of())); } + /** + *Determines how the discount applies on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
+ *For CartDiscountPatternTarget, you can also set the mode to ProportionateDistribution
or EvenDistribution
.
Money values provided either in cent precision or high precision for different currencies. A fixed Cart Discount will match a price only if the array contains a value with the same currency. For example, if it contains 10€ and 15$, the matching € price will be discounted by 10€ and the matching $ price will be discounted to 15$. If the array has multiple values of the same currency, the API returns an InvalidOperation error.
*If the array is empty, the discount does not apply.
@@ -128,13 +146,24 @@ public java.util.ListDetermines how the discount applies on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
+ *For CartDiscountPatternTarget, you can also set the mode to ProportionateDistribution
or EvenDistribution
.
Determines how the discount applies on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
+ *For CartDiscountPatternTarget, you can also set the mode to ProportionateDistribution
or EvenDistribution
.
Indicates how the discount is applied on CartDiscountLineItemTarget or CartDiscountCustomLineItemTarget.
+ *For CartDiscountPatternTarget, the mode can also be ProportionateDistribution
or EvenDistribution
.
+ * CountOnCustomLineItemUnits countOnCustomLineItemUnits = CountOnCustomLineItemUnits.builder()
+ * .predicate("{predicate}")
+ * .build()
+ *
+ * Valid CustomLineItem predicate that determines the units participating in the Discount.
+ * @return predicate + */ + @NotNull + @JsonProperty("predicate") + public String getPredicate(); + + /** + *Minimum number of units of a Custom Line Item that match the predicate.
+ * @return minCount + */ + + @JsonProperty("minCount") + public Integer getMinCount(); + + /** + *Maximum number of units of a Custom Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.
+ *The value must be greater than or equal to minCount
. If not provided, the component will match all units that satisfy the predicate.
Number of units of a Custom Line Item to exclude on every application of the Discount.
+ *Set only when configuring the targetPattern
.
The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCount
and maxCount
are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount
value must be 2.
Valid CustomLineItem predicate that determines the units participating in the Discount.
+ * @param predicate value to be set + */ + + public void setPredicate(final String predicate); + + /** + *Minimum number of units of a Custom Line Item that match the predicate.
+ * @param minCount value to be set + */ + + public void setMinCount(final Integer minCount); + + /** + *Maximum number of units of a Custom Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.
+ *The value must be greater than or equal to minCount
. If not provided, the component will match all units that satisfy the predicate.
Number of units of a Custom Line Item to exclude on every application of the Discount.
+ *Set only when configuring the targetPattern
.
The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCount
and maxCount
are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount
value must be 2.
+ * CountOnCustomLineItemUnits countOnCustomLineItemUnits = CountOnCustomLineItemUnits.builder()
+ * .predicate("{predicate}")
+ * .build()
+ *
+ * Valid CustomLineItem predicate that determines the units participating in the Discount.
+ * @param predicate value to be set + * @return Builder + */ + + public CountOnCustomLineItemUnitsBuilder predicate(final String predicate) { + this.predicate = predicate; + return this; + } + + /** + *Minimum number of units of a Custom Line Item that match the predicate.
+ * @param minCount value to be set + * @return Builder + */ + + public CountOnCustomLineItemUnitsBuilder minCount(@Nullable final Integer minCount) { + this.minCount = minCount; + return this; + } + + /** + *Maximum number of units of a Custom Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.
+ *The value must be greater than or equal to minCount
. If not provided, the component will match all units that satisfy the predicate.
Number of units of a Custom Line Item to exclude on every application of the Discount.
+ *Set only when configuring the targetPattern
.
The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCount
and maxCount
are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount
value must be 2.
Valid CustomLineItem predicate that determines the units participating in the Discount.
+ * @return predicate + */ + + public String getPredicate() { + return this.predicate; + } + + /** + *Minimum number of units of a Custom Line Item that match the predicate.
+ * @return minCount + */ + + @Nullable + public Integer getMinCount() { + return this.minCount; + } + + /** + *Maximum number of units of a Custom Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.
+ *The value must be greater than or equal to minCount
. If not provided, the component will match all units that satisfy the predicate.
Number of units of a Custom Line Item to exclude on every application of the Discount.
+ *Set only when configuring the targetPattern
.
The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCount
and maxCount
are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount
value must be 2.
Valid CustomLineItem predicate that determines the units participating in the Discount.
+ */ + + public String getPredicate() { + return this.predicate; + } + + /** + *Minimum number of units of a Custom Line Item that match the predicate.
+ */ + + public Integer getMinCount() { + return this.minCount; + } + + /** + *Maximum number of units of a Custom Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.
+ *The value must be greater than or equal to minCount
. If not provided, the component will match all units that satisfy the predicate.
Number of units of a Custom Line Item to exclude on every application of the Discount.
+ *Set only when configuring the targetPattern
.
The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCount
and maxCount
are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount
value must be 2.
+ * CountOnLineItemUnits countOnLineItemUnits = CountOnLineItemUnits.builder()
+ * .predicate("{predicate}")
+ * .build()
+ *
+ * Valid LineItem predicate that determines the units participating in the Discount.
+ * @return predicate + */ + @NotNull + @JsonProperty("predicate") + public String getPredicate(); + + /** + *Minimum number of units of a Line Item that match the predicate.
+ * @return minCount + */ + + @JsonProperty("minCount") + public Integer getMinCount(); + + /** + *Maximum number of units of a Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.
+ *The value must be greater than or equal to minCount
. If not provided, the component will match all units that satisfy the predicate.
Number of units of a Line Item to exclude on every application of the Discount.
+ *Set only when configuring the targetPattern
.
The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCount
and maxCount
are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount
value must be 2.
Valid LineItem predicate that determines the units participating in the Discount.
+ * @param predicate value to be set + */ + + public void setPredicate(final String predicate); + + /** + *Minimum number of units of a Line Item that match the predicate.
+ * @param minCount value to be set + */ + + public void setMinCount(final Integer minCount); + + /** + *Maximum number of units of a Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.
+ *The value must be greater than or equal to minCount
. If not provided, the component will match all units that satisfy the predicate.
Number of units of a Line Item to exclude on every application of the Discount.
+ *Set only when configuring the targetPattern
.
The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCount
and maxCount
are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount
value must be 2.
+ * CountOnLineItemUnits countOnLineItemUnits = CountOnLineItemUnits.builder()
+ * .predicate("{predicate}")
+ * .build()
+ *
+ * Valid LineItem predicate that determines the units participating in the Discount.
+ * @param predicate value to be set + * @return Builder + */ + + public CountOnLineItemUnitsBuilder predicate(final String predicate) { + this.predicate = predicate; + return this; + } + + /** + *Minimum number of units of a Line Item that match the predicate.
+ * @param minCount value to be set + * @return Builder + */ + + public CountOnLineItemUnitsBuilder minCount(@Nullable final Integer minCount) { + this.minCount = minCount; + return this; + } + + /** + *Maximum number of units of a Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.
+ *The value must be greater than or equal to minCount
. If not provided, the component will match all units that satisfy the predicate.
Number of units of a Line Item to exclude on every application of the Discount.
+ *Set only when configuring the targetPattern
.
The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCount
and maxCount
are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount
value must be 2.
Valid LineItem predicate that determines the units participating in the Discount.
+ * @return predicate + */ + + public String getPredicate() { + return this.predicate; + } + + /** + *Minimum number of units of a Line Item that match the predicate.
+ * @return minCount + */ + + @Nullable + public Integer getMinCount() { + return this.minCount; + } + + /** + *Maximum number of units of a Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.
+ *The value must be greater than or equal to minCount
. If not provided, the component will match all units that satisfy the predicate.
Number of units of a Line Item to exclude on every application of the Discount.
+ *Set only when configuring the targetPattern
.
The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCount
and maxCount
are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount
value must be 2.
Valid LineItem predicate that determines the units participating in the Discount.
+ */ + + public String getPredicate() { + return this.predicate; + } + + /** + *Minimum number of units of a Line Item that match the predicate.
+ */ + + public Integer getMinCount() { + return this.minCount; + } + + /** + *Maximum number of units of a Line Item that match the predicate. There might be more units matching the predicate, but they will not be participating to the resulting set.
+ *The value must be greater than or equal to minCount
. If not provided, the component will match all units that satisfy the predicate.
Number of units of a Line Item to exclude on every application of the Discount.
+ *Set only when configuring the targetPattern
.
The units matched first (satisfying the pattern component) will be excluded from the resulting set. The minCount
and maxCount
are considered only after the exclusion. Pattern components are matched only if any further units satisfying the pattern component exist. For example, if 5 jeans are required but only 3 should be discounted, the excludeCount
value must be 2.
The pattern component it used to define a set of units based on some criteria. The criteria depends on the type of component used.
+ * + *
+ * PatternComponent patternComponent = PatternComponent.countOnCustomLineItemUnitsBuilder()
+ * predicate("{predicate}")
+ * .build()
+ *
+ * The pattern component it used to define a set of units based on some criteria. The criteria depends on the type of component used.
+ */ +@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") +public class PatternComponentImpl implements PatternComponent, ModelBase { + + private String type; + + /** + * create instance with all properties + */ + @JsonCreator + PatternComponentImpl(@JsonProperty("type") final String type) { + this.type = type; + } + + /** + * create empty instance + */ + public PatternComponentImpl() { + } + + /** + * + */ + + public String getType() { + return this.type; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + + if (o == null || getClass() != o.getClass()) + return false; + + PatternComponentImpl that = (PatternComponentImpl) o; + + return new EqualsBuilder().append(type, that.type).append(type, that.type).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(17, 37).append(type).toHashCode(); + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("type", type).build(); + } + +} diff --git a/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/order/CustomLineItemImportDraft.java b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/order/CustomLineItemImportDraft.java index 11961740cdc..c35d8112aea 100644 --- a/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/order/CustomLineItemImportDraft.java +++ b/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/order/CustomLineItemImportDraft.java @@ -105,7 +105,7 @@ public interface CustomLineItemImportDraft /** *Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget are applied to the Custom Line Item.Standard
, Cart Discounts with a matching CartDiscountCustomLineItemsTarget, MultiBuyCustomLineItemsTarget, or CartDiscountPatternTarget are applied to the Custom Line Item.External
, Cart Discounts are not considered on the Custom Line Item.Define which Variants of the added Product will be included in the Product Selection.
+ *Defines which particular Variants of the Product are included in the Product Selection. If undefined all Variants of the referenced Product are included.
*This field is only available for assignments to a Product Selection with Individual
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Defines which Variants of the Product will be excluded from the Product Selection.
+ *Defines which particular Variants of the Product are excluded from the Product Selection. If undefined all Variants of the referenced Product are excluded.
*This field is only available for assignments to a Product Selection with IndividualExclusion
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Define which Variants of the added Product will be included in the Product Selection.
+ *Defines which particular Variants of the Product are included in the Product Selection. If undefined all Variants of the referenced Product are included.
*This field is only available for assignments to a Product Selection with Individual
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Defines which Variants of the Product will be excluded from the Product Selection.
+ *Defines which particular Variants of the Product are excluded from the Product Selection. If undefined all Variants of the referenced Product are excluded.
*This field is only available for assignments to a Product Selection with IndividualExclusion
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Define which Variants of the added Product will be included in the Product Selection.
+ *Defines which particular Variants of the Product are included in the Product Selection. If undefined all Variants of the referenced Product are included.
*This field is only available for assignments to a Product Selection with Individual
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Define which Variants of the added Product will be included in the Product Selection.
+ *Defines which particular Variants of the Product are included in the Product Selection. If undefined all Variants of the referenced Product are included.
*This field is only available for assignments to a Product Selection with Individual
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Defines which Variants of the Product will be excluded from the Product Selection.
+ *Defines which particular Variants of the Product are excluded from the Product Selection. If undefined all Variants of the referenced Product are excluded.
*This field is only available for assignments to a Product Selection with IndividualExclusion
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Defines which Variants of the Product will be excluded from the Product Selection.
+ *Defines which particular Variants of the Product are excluded from the Product Selection. If undefined all Variants of the referenced Product are excluded.
*This field is only available for assignments to a Product Selection with IndividualExclusion
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Defines which Variants of the Product will be excluded from the Product Selection.
+ *Defines which particular Variants of the Product are excluded from the Product Selection. If undefined all Variants of the referenced Product are excluded.
*This field is only available for assignments to a Product Selection with IndividualExclusion
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Define which Variants of the added Product will be included in the Product Selection.
+ *Defines which particular Variants of the Product are included in the Product Selection. If undefined all Variants of the referenced Product are included.
*This field is only available for assignments to a Product Selection with Individual
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Defines which Variants of the Product will be excluded from the Product Selection.
+ *Defines which particular Variants of the Product are excluded from the Product Selection. If undefined all Variants of the referenced Product are excluded.
*This field is only available for assignments to a Product Selection with IndividualExclusion
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Define which Variants of the added Product will be included in the Product Selection.
+ *Defines which particular Variants of the Product are included in the Product Selection. If undefined all Variants of the referenced Product are included.
*This field is only available for assignments to a Product Selection with Individual
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
Defines which Variants of the Product will be excluded from the Product Selection.
+ *Defines which particular Variants of the Product are excluded from the Product Selection. If undefined all Variants of the referenced Product are excluded.
*This field is only available for assignments to a Product Selection with IndividualExclusion
ProductSelectionMode. The list of SKUs will be updated automatically on any change of those performed on the respective Product itself.
+ * PatternComponent patternComponent = PatternComponent.builder()
+ * .build()
+ *
+ *
+ * ChangeTargetPatternChangeValue changeTargetPatternChangeValue = ChangeTargetPatternChangeValue.builder()
+ * .plusTargetPattern(targetPatternBuilder -> targetPatternBuilder)
+ * .selectionMode(SelectionMode.CHEAPEST)
+ * .build()
+ *
+ * Units of a (Custom) Line Item that triggered the discount application.
+ * @return triggerPattern + */ + @Valid + @JsonProperty("triggerPattern") + public ListUnits of (Custom) Line Items on which the Discount is applied.
+ * @return targetPattern + */ + @NotNull + @Valid + @JsonProperty("targetPattern") + public ListMaximum number of times the Discount applies on a Cart.
+ *If empty, the Discount applies indefinitely.
+ * @return maxOccurrence + */ + + @JsonProperty("maxOccurrence") + public Integer getMaxOccurrence(); + + /** + *Indicates which of the matching units of (Custom) Line Items were discounted.
+ * @return selectionMode + */ + @NotNull + @JsonProperty("selectionMode") + public SelectionMode getSelectionMode(); + + /** + *Units of a (Custom) Line Item that triggered the discount application.
+ * @param triggerPattern values to be set + */ + + @JsonIgnore + public void setTriggerPattern(final PatternComponent... triggerPattern); + + /** + *Units of a (Custom) Line Item that triggered the discount application.
+ * @param triggerPattern values to be set + */ + + public void setTriggerPattern(final ListUnits of (Custom) Line Items on which the Discount is applied.
+ * @param targetPattern values to be set + */ + + @JsonIgnore + public void setTargetPattern(final PatternComponent... targetPattern); + + /** + *Units of (Custom) Line Items on which the Discount is applied.
+ * @param targetPattern values to be set + */ + + public void setTargetPattern(final ListMaximum number of times the Discount applies on a Cart.
+ *If empty, the Discount applies indefinitely.
+ * @param maxOccurrence value to be set + */ + + public void setMaxOccurrence(final Integer maxOccurrence); + + /** + *Indicates which of the matching units of (Custom) Line Items were discounted.
+ * @param selectionMode value to be set + */ + + public void setSelectionMode(final SelectionMode selectionMode); + + /** + * factory method + * @return instance of ChangeTargetPatternChangeValue + */ + public static ChangeTargetPatternChangeValue of() { + return new ChangeTargetPatternChangeValueImpl(); + } + + /** + * factory method to create a shallow copy ChangeTargetPatternChangeValue + * @param template instance to be copied + * @return copy instance + */ + public static ChangeTargetPatternChangeValue of(final ChangeTargetPatternChangeValue template) { + ChangeTargetPatternChangeValueImpl instance = new ChangeTargetPatternChangeValueImpl(); + instance.setTriggerPattern(template.getTriggerPattern()); + instance.setTargetPattern(template.getTargetPattern()); + instance.setMaxOccurrence(template.getMaxOccurrence()); + instance.setSelectionMode(template.getSelectionMode()); + return instance; + } + + /** + * factory method to create a deep copy of ChangeTargetPatternChangeValue + * @param template instance to be copied + * @return copy instance + */ + @Nullable + public static ChangeTargetPatternChangeValue deepCopy(@Nullable final ChangeTargetPatternChangeValue template) { + if (template == null) { + return null; + } + ChangeTargetPatternChangeValueImpl instance = new ChangeTargetPatternChangeValueImpl(); + instance.setTriggerPattern(Optional.ofNullable(template.getTriggerPattern()) + .map(t -> t.stream() + .map(com.commercetools.history.models.cart_discount.PatternComponent::deepCopy) + .collect(Collectors.toList())) + .orElse(null)); + instance.setTargetPattern(Optional.ofNullable(template.getTargetPattern()) + .map(t -> t.stream() + .map(com.commercetools.history.models.cart_discount.PatternComponent::deepCopy) + .collect(Collectors.toList())) + .orElse(null)); + instance.setMaxOccurrence(template.getMaxOccurrence()); + instance.setSelectionMode(template.getSelectionMode()); + return instance; + } + + /** + * builder factory method for ChangeTargetPatternChangeValue + * @return builder + */ + public static ChangeTargetPatternChangeValueBuilder builder() { + return ChangeTargetPatternChangeValueBuilder.of(); + } + + /** + * create builder for ChangeTargetPatternChangeValue instance + * @param template instance with prefilled values for the builder + * @return builder + */ + public static ChangeTargetPatternChangeValueBuilder builder(final ChangeTargetPatternChangeValue template) { + return ChangeTargetPatternChangeValueBuilder.of(template); + } + + /** + * accessor map function + * @param
+ * ChangeTargetPatternChangeValue changeTargetPatternChangeValue = ChangeTargetPatternChangeValue.builder()
+ * .plusTargetPattern(targetPatternBuilder -> targetPatternBuilder)
+ * .selectionMode(SelectionMode.CHEAPEST)
+ * .build()
+ *
+ * Units of a (Custom) Line Item that triggered the discount application.
+ * @param triggerPattern value to be set + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder triggerPattern( + @Nullable final com.commercetools.history.models.cart_discount.PatternComponent... triggerPattern) { + this.triggerPattern = new ArrayList<>(Arrays.asList(triggerPattern)); + return this; + } + + /** + *Units of a (Custom) Line Item that triggered the discount application.
+ * @param triggerPattern value to be set + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder triggerPattern( + @Nullable final java.util.ListUnits of a (Custom) Line Item that triggered the discount application.
+ * @param triggerPattern value to be set + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder plusTriggerPattern( + @Nullable final com.commercetools.history.models.cart_discount.PatternComponent... triggerPattern) { + if (this.triggerPattern == null) { + this.triggerPattern = new ArrayList<>(); + } + this.triggerPattern.addAll(Arrays.asList(triggerPattern)); + return this; + } + + /** + *Units of a (Custom) Line Item that triggered the discount application.
+ * @param builder function to build the triggerPattern value + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder plusTriggerPattern( + FunctionUnits of a (Custom) Line Item that triggered the discount application.
+ * @param builder function to build the triggerPattern value + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder withTriggerPattern( + FunctionUnits of (Custom) Line Items on which the Discount is applied.
+ * @param targetPattern value to be set + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder targetPattern( + final com.commercetools.history.models.cart_discount.PatternComponent... targetPattern) { + this.targetPattern = new ArrayList<>(Arrays.asList(targetPattern)); + return this; + } + + /** + *Units of (Custom) Line Items on which the Discount is applied.
+ * @param targetPattern value to be set + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder targetPattern( + final java.util.ListUnits of (Custom) Line Items on which the Discount is applied.
+ * @param targetPattern value to be set + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder plusTargetPattern( + final com.commercetools.history.models.cart_discount.PatternComponent... targetPattern) { + if (this.targetPattern == null) { + this.targetPattern = new ArrayList<>(); + } + this.targetPattern.addAll(Arrays.asList(targetPattern)); + return this; + } + + /** + *Units of (Custom) Line Items on which the Discount is applied.
+ * @param builder function to build the targetPattern value + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder plusTargetPattern( + FunctionUnits of (Custom) Line Items on which the Discount is applied.
+ * @param builder function to build the targetPattern value + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder withTargetPattern( + FunctionMaximum number of times the Discount applies on a Cart.
+ *If empty, the Discount applies indefinitely.
+ * @param maxOccurrence value to be set + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder maxOccurrence(@Nullable final Integer maxOccurrence) { + this.maxOccurrence = maxOccurrence; + return this; + } + + /** + *Indicates which of the matching units of (Custom) Line Items were discounted.
+ * @param selectionMode value to be set + * @return Builder + */ + + public ChangeTargetPatternChangeValueBuilder selectionMode( + final com.commercetools.history.models.common.SelectionMode selectionMode) { + this.selectionMode = selectionMode; + return this; + } + + /** + *Units of a (Custom) Line Item that triggered the discount application.
+ * @return triggerPattern + */ + + @Nullable + public java.util.ListUnits of (Custom) Line Items on which the Discount is applied.
+ * @return targetPattern + */ + + public java.util.ListMaximum number of times the Discount applies on a Cart.
+ *If empty, the Discount applies indefinitely.
+ * @return maxOccurrence + */ + + @Nullable + public Integer getMaxOccurrence() { + return this.maxOccurrence; + } + + /** + *Indicates which of the matching units of (Custom) Line Items were discounted.
+ * @return selectionMode + */ + + public com.commercetools.history.models.common.SelectionMode getSelectionMode() { + return this.selectionMode; + } + + /** + * builds ChangeTargetPatternChangeValue with checking for non-null required values + * @return ChangeTargetPatternChangeValue + */ + public ChangeTargetPatternChangeValue build() { + Objects.requireNonNull(targetPattern, ChangeTargetPatternChangeValue.class + ": targetPattern is missing"); + Objects.requireNonNull(selectionMode, ChangeTargetPatternChangeValue.class + ": selectionMode is missing"); + return new ChangeTargetPatternChangeValueImpl(triggerPattern, targetPattern, maxOccurrence, selectionMode); + } + + /** + * builds ChangeTargetPatternChangeValue without checking for non-null required values + * @return ChangeTargetPatternChangeValue + */ + public ChangeTargetPatternChangeValue buildUnchecked() { + return new ChangeTargetPatternChangeValueImpl(triggerPattern, targetPattern, maxOccurrence, selectionMode); + } + + /** + * factory method for an instance of ChangeTargetPatternChangeValueBuilder + * @return builder + */ + public static ChangeTargetPatternChangeValueBuilder of() { + return new ChangeTargetPatternChangeValueBuilder(); + } + + /** + * create builder for ChangeTargetPatternChangeValue instance + * @param template instance with prefilled values for the builder + * @return builder + */ + public static ChangeTargetPatternChangeValueBuilder of(final ChangeTargetPatternChangeValue template) { + ChangeTargetPatternChangeValueBuilder builder = new ChangeTargetPatternChangeValueBuilder(); + builder.triggerPattern = template.getTriggerPattern(); + builder.targetPattern = template.getTargetPattern(); + builder.maxOccurrence = template.getMaxOccurrence(); + builder.selectionMode = template.getSelectionMode(); + return builder; + } + +} diff --git a/commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/change_value/ChangeTargetPatternChangeValueImpl.java b/commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/change_value/ChangeTargetPatternChangeValueImpl.java new file mode 100644 index 00000000000..90dc81960c2 --- /dev/null +++ b/commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/models/change_value/ChangeTargetPatternChangeValueImpl.java @@ -0,0 +1,170 @@ + +package com.commercetools.history.models.change_value; + +import java.time.*; +import java.util.*; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.*; + +import io.vrap.rmf.base.client.ModelBase; +import io.vrap.rmf.base.client.utils.Generated; + +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * ChangeTargetPatternChangeValue + */ +@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") +public class ChangeTargetPatternChangeValueImpl implements ChangeTargetPatternChangeValue, ModelBase { + + private String type; + + private java.util.ListUnits of a (Custom) Line Item that triggered the discount application.
+ */ + + public java.util.ListUnits of (Custom) Line Items on which the Discount is applied.
+ */ + + public java.util.ListMaximum number of times the Discount applies on a Cart.
+ *If empty, the Discount applies indefinitely.
+ */ + + public Integer getMaxOccurrence() { + return this.maxOccurrence; + } + + /** + *Indicates which of the matching units of (Custom) Line Items were discounted.
+ */ + + public com.commercetools.history.models.common.SelectionMode getSelectionMode() { + return this.selectionMode; + } + + public void setTriggerPattern( + final com.commercetools.history.models.cart_discount.PatternComponent... triggerPattern) { + this.triggerPattern = new ArrayList<>(Arrays.asList(triggerPattern)); + } + + public void setTriggerPattern( + final java.util.List