public static RemoveFromCategory of(final ResourceIdentifier<Category> category, @Nullable final Boolean staged) { return new RemoveFromCategory(category, staged); } }
public static RemoveFromCategory of(final ResourceIdentifier<Category> category) { return of(category, null); }
public static RemoveFromCategory of(final ResourceIdentifier<Category> category, @Nullable final Boolean staged) { return new RemoveFromCategory(category, staged); } }
public static RemoveFromCategory of(final Referenceable<Category> category) { return of(category, null); }
public static RemoveFromCategory of(final Referenceable<Category> category, final ProductUpdateScope productUpdateScope) { return new RemoveFromCategory(category.toReference(), productUpdateScope); } }
public static RemoveFromCategory of(final ResourceIdentifier<Category> category) { return of(category, null); }
public static RemoveFromCategory of(final Referenceable<Category> category) { return new RemoveFromCategory(category.toReference()); } }
public static RemoveFromCategory of(final Referenceable<Category> category) { return of(category, null); }
public static RemoveFromCategory of(final Referenceable<Category> category, @Nullable final Boolean staged) { return new RemoveFromCategory(category.toReference(), staged); }
@Test public void addToCategory() throws Exception { withProductAndUnconnectedCategory(client(), (final Product product, final Category category) -> { assertThat(product.getMasterData().getStaged().getCategories()).isEmpty(); final String orderHint = "0.123"; final Product productWithCategory = client() .executeBlocking(ProductUpdateCommand.of(product, AddToCategory.of(category, orderHint))); final Reference<Category> categoryReference = productWithCategory.getMasterData().getStaged().getCategories().stream().findAny().get(); assertThat(categoryReference.referencesSameResource(category)).isTrue(); assertThat(productWithCategory.getMasterData().getStaged().getCategoryOrderHints().get(category.getId())).isEqualTo(orderHint); final Product productWithoutCategory = client() .executeBlocking(ProductUpdateCommand.of(productWithCategory, RemoveFromCategory.of(category))); assertThat(productWithoutCategory.getMasterData().getStaged().getCategories()).isEmpty(); }); }
public static RemoveFromCategory of(final Referenceable<Category> category, @Nullable final Boolean staged) { return new RemoveFromCategory(category.toReference(), staged); }
public void addToCategoryWithStaged(final Boolean staged) { withCategory(client(), category -> { withUpdateableProduct(client(), product -> { assertThat(product.getMasterData().getStaged().getCategories()).isEmpty(); assertThat(product.getMasterData().hasStagedChanges()).isFalse(); final String orderHint = "0.123"; final Product productWithCategory = client() .executeBlocking(ProductUpdateCommand.of(product, AddToCategory.of(category, orderHint, staged))); assertThat(productWithCategory.getMasterData().hasStagedChanges()).isEqualTo(staged); final Product publishedProductWithCategory = client().executeBlocking(ProductUpdateCommand.of(productWithCategory, Publish.of())); final Product productWithoutCategory = client() .executeBlocking(ProductUpdateCommand.of(publishedProductWithCategory, RemoveFromCategory.of(category, staged))); assertThat(productWithoutCategory.getMasterData().hasStagedChanges()).isEqualTo(staged); assertThat(productWithoutCategory.getMasterData().getStaged().getCategories()).isEmpty(); return productWithoutCategory; }); }); }