public final class RemoveEnumValues extends UpdateActionImpl<ProductType>
EnumAttributeType
, a LocalizedEnumAttributeType
or a SetAttributeType
of these types.
All attributes of all products using those enum keys will also be removed in an eventually consistent way.
See also ProductTypeUpdateCommand.
withUpdateableProductType(client(), productType -> { final String attributeName = Sizes.ATTRIBUTE.getName(); final ProductType updatedProductType = client().executeBlocking(ProductTypeUpdateCommand.of(productType, RemoveEnumValues.ofEnumValue(attributeName, Arrays.asList(Sizes.S, Sizes.X)))); assertThat(updatedProductType.getAttribute(attributeName).getAttributeType()) .isInstanceOf(EnumAttributeType.class) .matches(type -> ((EnumAttributeType) type).getValues().size() == 1); return updatedProductType; });
See the test code.
Modifier and Type | Method and Description |
---|---|
String |
getAttributeName() |
List<String> |
getKeys() |
static RemoveEnumValues |
of(String attributeName,
List<String> keys) |
static RemoveEnumValues |
of(String attributeName,
String key) |
static RemoveEnumValues |
ofEnumValue(String attributeName,
EnumValue enumValue) |
static RemoveEnumValues |
ofEnumValue(String attributeName,
List<EnumValue> enumValues) |
static RemoveEnumValues |
ofLocalizedEnumValue(String attributeName,
List<LocalizedEnumValue> localizedEnumValues) |
static RemoveEnumValues |
ofLocalizedEnumValue(String attributeName,
LocalizedEnumValue localizedEnumValue) |
getAction
public static RemoveEnumValues of(String attributeName, List<String> keys)
public static RemoveEnumValues of(String attributeName, String key)
public static RemoveEnumValues ofLocalizedEnumValue(String attributeName, List<LocalizedEnumValue> localizedEnumValues)
public static RemoveEnumValues ofLocalizedEnumValue(String attributeName, LocalizedEnumValue localizedEnumValue)
public static RemoveEnumValues ofEnumValue(String attributeName, List<EnumValue> enumValues)
public static RemoveEnumValues ofEnumValue(String attributeName, EnumValue enumValue)
public String getAttributeName()