Tabnine Logo
ProductData.getCategoryOrderHints
Code IndexAdd Tabnine to your IDE (free)

How to use
getCategoryOrderHints
method
in
io.sphere.sdk.products.ProductData

Best Java code snippets using io.sphere.sdk.products.ProductData.getCategoryOrderHints (Showing top 7 results out of 315)

origin: com.commercetools.sdk.jvm.core/commercetools-models

@Nullable
@Override
public CategoryOrderHints getCategoryOrderHints() {
  return productData.getCategoryOrderHints();
}
origin: io.sphere.sdk.jvm/sphere-models

@Nullable
@Override
public CategoryOrderHints getCategoryOrderHints() {
  return productData.getCategoryOrderHints();
}
origin: commercetools/commercetools-jvm-sdk

@Nullable
@Override
public CategoryOrderHints getCategoryOrderHints() {
  return productData.getCategoryOrderHints();
}
origin: commercetools/commercetools-jvm-sdk

private static Comparator<Product> comparatorOfStagedForCategory(final String categoryId) {
  final Function<Product, String> orderHintExtractor =
      p -> Optional.ofNullable(p.getMasterData().getStaged().getCategoryOrderHints())
          .map(categoryOrderHints -> categoryOrderHints.get(categoryId))
          .orElse(null);
  return comparing(orderHintExtractor, Comparator.nullsLast(Comparator.<String>naturalOrder()));
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void setCategoryOrderHint() throws Exception {
  withProductInCategory(client(), (product, category) -> {
    final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(product, SetCategoryOrderHint.of(category.getId(), "0.1234")));
    final CategoryOrderHints actual = updatedProduct.getMasterData().getStaged().getCategoryOrderHints();
    assertThat(actual).isEqualTo(CategoryOrderHints.of(category.getId(), "0.1234"));
    assertThat(actual.getAsMap()).isEqualTo(Collections.singletonMap(category.getId(), "0.1234"));
  });
}
origin: commercetools/commercetools-jvm-sdk

@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();
  });
}
origin: commercetools/commercetools-jvm-sdk

public void setCategoryOrderHintWithStaged(final Boolean staged) {
  withCategory(client(), category -> {
    withUpdateableProduct(client(), product -> {
      assertThat(product.getMasterData().getStaged().getCategories()).isEmpty();
      final String orderHint = "0.123";
      final Product productWithCategory = client()
          .executeBlocking(ProductUpdateCommand.of(product, AddToCategory.of(category, orderHint, false)));
      assertThat(productWithCategory.getMasterData().hasStagedChanges()).isFalse();
      final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(productWithCategory, SetCategoryOrderHint.of(category.getId(), "0.1234", staged)));
      final CategoryOrderHints actual = updatedProduct.getMasterData().getStaged().getCategoryOrderHints();
      assertThat(actual).isEqualTo(CategoryOrderHints.of(category.getId(), "0.1234"));
      assertThat(actual.getAsMap()).isEqualTo(Collections.singletonMap(category.getId(), "0.1234"));
      assertThat(updatedProduct.getMasterData().hasStagedChanges()).isEqualTo(staged);
      return productWithCategory;
    });
  });
}
io.sphere.sdk.productsProductDatagetCategoryOrderHints

Popular methods of ProductData

  • getCategories
  • getDescription
  • getMasterVariant
  • getMetaDescription
  • getMetaKeywords
  • getMetaTitle
  • getName
  • getSlug
  • getVariants
  • getSearchKeywords
  • getAllVariants
  • getAllVariants

Popular in Java

  • Reading from database using SQL prepared statement
  • runOnUiThread (Activity)
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • JFrame (javax.swing)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now