public final class PlainEnumValueUpdateActionUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> |
buildChangeLabelAction(java.lang.String attributeDefinitionName,
io.sphere.sdk.models.EnumValue oldEnumValue,
io.sphere.sdk.models.EnumValue newEnumValue)
Compares the
label values of an old EnumValue and a new EnumValue and
returns an Optional of update action, which would contain the "changeLabel"
UpdateAction . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> |
buildEnumValuesUpdateActions(java.lang.String attributeDefinitionName,
java.util.List<io.sphere.sdk.models.EnumValue> oldEnumValues,
java.util.List<io.sphere.sdk.models.EnumValue> newEnumValues)
Compares a list of old
EnumValue s with a list of new EnumValue s for a given
attribute definition and builds required update actions (e.g addEnumValue, removeEnumValue,
changeEnumValueOrder) and 1-1 update actions on enum values (e.g. |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> |
buildEnumValueUpdateActions(java.lang.String attributeDefinitionName,
io.sphere.sdk.models.EnumValue oldEnumValue,
io.sphere.sdk.models.EnumValue newEnumValue)
Compares all the fields of an old
EnumValue and a new EnumValue and returns a
list of UpdateAction <ProductType > as a result. |
@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> buildEnumValuesUpdateActions(@Nonnull java.lang.String attributeDefinitionName, @Nonnull java.util.List<io.sphere.sdk.models.EnumValue> oldEnumValues, @Nullable java.util.List<io.sphere.sdk.models.EnumValue> newEnumValues)
EnumValue
s with a list of new EnumValue
s for a given
attribute definition and builds required update actions (e.g addEnumValue, removeEnumValue,
changeEnumValueOrder) and 1-1 update actions on enum values (e.g. changeEnumValueLabel) for the
required resource. If both the EnumValue
's are identical, then no update action is
needed and hence an empty List
is returned.
If the list of new EnumValue
s is null
, then remove actions are built for
every existing plain enum value in the oldEnumValues
list.
attributeDefinitionName
- the attribute name whose plain enum values are going to be
synced.oldEnumValues
- the old list of plain enum values.newEnumValues
- the new list of plain enum values.DuplicateKeyException
- in case there are localized enum values with duplicate keys.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> buildEnumValueUpdateActions(@Nonnull java.lang.String attributeDefinitionName, @Nonnull io.sphere.sdk.models.EnumValue oldEnumValue, @Nonnull io.sphere.sdk.models.EnumValue newEnumValue)
EnumValue
and a new EnumValue
and returns a
list of UpdateAction
<ProductType
> as a result. If both EnumValue
have identical fields, then no update action is needed and hence an empty List
is
returned.attributeDefinitionName
- the attribute definition name whose plain enum values belong to.oldEnumValue
- the enum value which should be updated.newEnumValue
- the enum value where we get the new fields.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.producttypes.ProductType>> buildChangeLabelAction(@Nonnull java.lang.String attributeDefinitionName, @Nonnull io.sphere.sdk.models.EnumValue oldEnumValue, @Nonnull io.sphere.sdk.models.EnumValue newEnumValue)
label
values of an old EnumValue
and a new EnumValue
and
returns an Optional
of update action, which would contain the "changeLabel"
UpdateAction
. If both, old and new EnumValue
have the same label
values, then no update action is needed and empty optional will be returned.attributeDefinitionName
- the attribute definition name whose plain enum values belong to.oldEnumValue
- the old plain enum value.newEnumValue
- the new plain enum value which contains the new description.