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

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

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

origin: commercetools/commercetools-jvm-sdk

private void changeMasterVariantWithVariantIdWithStaged(final Boolean staged) {
  withUpdateableProductOfMultipleVariants(client(), product -> {
    assertThat(product.getMasterData().hasStagedChanges()).isFalse();
    final ProductVariant variantSupposedToBeMaster = product.getMasterData().getStaged().getAllVariants().get(2);
    final Integer variantId = variantSupposedToBeMaster.getId();
    final ChangeMasterVariant updateAction = ChangeMasterVariant.ofVariantId(variantId, staged);
    final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(product, updateAction));
    assertThat(updatedProduct.getMasterData().hasStagedChanges()).isEqualTo(staged);
    assertThat(updatedProduct.getMasterData().getStaged().getMasterVariant().getId()).isEqualTo(variantId);
    return updatedProduct;
  });
}
origin: commercetools/commercetools-jvm-sdk

@Test
@SuppressWarnings({"varargs", "unchecked"})
public void ofUnsetAttribute() {
  assertThat(product.getMasterData().getStaged().getAllVariants())
      .extracting(variant -> variant.getAttribute(ATTR_NAME).getValueAsLocalizedEnumValueSet())
      .as("product attributes present")
      .contains(new HashSet<>(ALL_ATTRIBUTE_VALUES));
  final UpdateAction<Product> action = SetAttributeInAllVariants.ofUnsetAttribute("ProductFlags");
  product = client().executeBlocking(ProductUpdateCommand.of(product, action));
  assertThat(product.getMasterData().getStaged().getAllVariants())
      .extracting(variant -> variant.hasAttribute(ATTR_NAME))
      .as("attribute is deleted")
      .containsExactly(false, false);
}
origin: commercetools/commercetools-jvm-sdk

private void changeMasterVariantWithSkuWithStaged(final Boolean staged) {
  withUpdateableProductOfMultipleVariants(client(), product -> {
    assertThat(product.getMasterData().hasStagedChanges()).isFalse();
    final int originalMasterVariantId = product.getMasterData().getStaged().getMasterVariant().getId();
    final ProductVariant variantSupposedToBeMaster = product.getMasterData().getStaged().getAllVariants().get(2);
    final String sku = variantSupposedToBeMaster.getSku();
    final ChangeMasterVariant updateAction = ChangeMasterVariant.ofSku(sku, staged);
    final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(product, updateAction));
    assertThat(updatedProduct.getMasterData().hasStagedChanges()).isEqualTo(staged);
    assertThat(updatedProduct.getMasterData().getStaged().getMasterVariant().getSku()).isEqualTo(sku);
    assertThat(updatedProduct.getMasterData().getStaged().getMasterVariant().getId())
        .as("variant IDs don't change in reordering")
        .isNotEqualTo(originalMasterVariantId)
        .isEqualTo(variantSupposedToBeMaster.getId());
    return updatedProduct;
  });
}
io.sphere.sdk.productsProductDatagetAllVariants

Popular methods of ProductData

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

Popular in Java

  • Making http post requests using okhttp
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • notifyDataSetChanged (ArrayAdapter)
  • Menu (java.awt)
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • From CI to AI: The AI layer in your organization
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