Class LocalizedEnumValueUpdateActionUtils
- java.lang.Object
-
- com.commercetools.sync.producttypes.utils.LocalizedEnumValueUpdateActionUtils
-
public final class LocalizedEnumValueUpdateActionUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<com.commercetools.api.models.product_type.ProductTypeUpdateAction>
buildLocalizedEnumValuesUpdateActions(java.lang.String attributeDefinitionName, java.util.List<com.commercetools.api.models.product_type.AttributeLocalizedEnumValue> oldEnumValues, java.util.List<com.commercetools.api.models.product_type.AttributeLocalizedEnumValue> newEnumValues)
Compares a list of oldAttributeLocalizedEnumValue
s with a list of newAttributeLocalizedEnumValue
s for a given attribute definition and builds required update actions (e.g addLocalizedEnumValue, removeLocalizedEnumValue, changeLocalizedEnumValueOrder) and 1-1 update actions on localized enum values (e.g.static java.util.List<com.commercetools.api.models.product_type.ProductTypeUpdateAction>
buildLocalizedEnumValueUpdateActions(java.lang.String attributeDefinitionName, com.commercetools.api.models.product_type.AttributeLocalizedEnumValue oldEnumValue, com.commercetools.api.models.product_type.AttributeLocalizedEnumValue newEnumValue)
Compares all the fields of an oldAttributeLocalizedEnumValue
and a newAttributeLocalizedEnumValue
and returns a list ofProductTypeUpdateAction
as a result.
-
-
-
Method Detail
-
buildLocalizedEnumValuesUpdateActions
@Nonnull public static java.util.List<com.commercetools.api.models.product_type.ProductTypeUpdateAction> buildLocalizedEnumValuesUpdateActions(@Nonnull java.lang.String attributeDefinitionName, @Nonnull java.util.List<com.commercetools.api.models.product_type.AttributeLocalizedEnumValue> oldEnumValues, @Nullable java.util.List<com.commercetools.api.models.product_type.AttributeLocalizedEnumValue> newEnumValues)
Compares a list of oldAttributeLocalizedEnumValue
s with a list of newAttributeLocalizedEnumValue
s for a given attribute definition and builds required update actions (e.g addLocalizedEnumValue, removeLocalizedEnumValue, changeLocalizedEnumValueOrder) and 1-1 update actions on localized enum values (e.g. changeLocalizedEnumValueLabel) for the required resource. If both theAttributeLocalizedEnumValue
's are identical, then no update action is needed and hence an emptyList
is returned.If the list of new
AttributeLocalizedEnumValue
s isnull
, then remove actions are built for every existing localized enum value in theoldEnumValues
list.- Parameters:
attributeDefinitionName
- the attribute name whose localized enum values are going to be synced.oldEnumValues
- the old list of localized enum values.newEnumValues
- the new list of localized enum values.- Returns:
- a list of localized enum values update actions if the list of localized enum values is not identical. Otherwise, if the localized enum values are identical, an empty list is returned.
- Throws:
DuplicateKeyException
- in case there are localized enum values with duplicate keys.
-
buildLocalizedEnumValueUpdateActions
@Nonnull public static java.util.List<com.commercetools.api.models.product_type.ProductTypeUpdateAction> buildLocalizedEnumValueUpdateActions(@Nonnull java.lang.String attributeDefinitionName, @Nonnull com.commercetools.api.models.product_type.AttributeLocalizedEnumValue oldEnumValue, @Nonnull com.commercetools.api.models.product_type.AttributeLocalizedEnumValue newEnumValue)
Compares all the fields of an oldAttributeLocalizedEnumValue
and a newAttributeLocalizedEnumValue
and returns a list ofProductTypeUpdateAction
as a result. If bothAttributeLocalizedEnumValue
have identical fields then no update action is needed and hence an emptyList
is returned.- Parameters:
attributeDefinitionName
- the attribute definition name whose localized enum values belong to.oldEnumValue
- the localized enum value which should be updated.newEnumValue
- the localized enum value where we get the new fields.- Returns:
- A list with the update actions or an empty list if the localized enum values are identical.
-
-