public final class SetSku extends UpdateActionImpl<T>
See also ProductUpdateCommand.
final String oldSku = randomKey(); withProductOfSku(oldSku, (Product product) -> { assertThat(product.getMasterData().getStaged().getMasterVariant().getSku()).isEqualTo(oldSku); assertThat(product.getMasterData().getCurrent().getMasterVariant().getSku()).isEqualTo(oldSku); assertThat(product.getMasterData().hasStagedChanges()).isFalse(); final String newSku = randomKey(); final ProductUpdateCommand cmd = ProductUpdateCommand.of(product, SetSku.of(MASTER_VARIANT_ID, newSku)); final Product updatedProduct = client().executeBlocking(cmd); assertThat(updatedProduct.getMasterData().getStaged().getMasterVariant().getSku()) .as("update action updates SKU in staged") .isEqualTo(newSku); assertThat(updatedProduct.getMasterData().getCurrent().getMasterVariant().getSku()) .as("update action updates NOT directly in current") .isEqualTo(oldSku) .isNotEqualTo(newSku); assertThat(updatedProduct.getMasterData().hasStagedChanges()).isTrue(); return updatedProduct; });
See the test code.
setSku
which is staged,
previous to this version it was setSKU
(upper case 'K' and 'U')
which updates in staged and current and has been moved to the deprecated class LegacySetSku
.
See also the HTTP API doc of SetSku.Modifier and Type | Method and Description |
---|---|
String |
getSku() |
Integer |
getVariantId() |
Boolean |
isStaged() |
static SetSku |
of(Integer variantId,
String sku) |
static SetSku |
of(Integer variantId,
String sku,
Boolean staged) |
getAction
public Integer getVariantId()