Tabnine Logo
ProductQueryModel.of
Code IndexAdd Tabnine to your IDE (free)

How to use
of
method
in
io.sphere.sdk.products.queries.ProductQueryModel

Best Java code snippets using io.sphere.sdk.products.queries.ProductQueryModel.of (Showing top 12 results out of 315)

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

ProductQueryImpl(){
  super(ProductEndpoint.ENDPOINT.endpoint(), ProductQuery.resultTypeReference(), ProductQueryModel.of(), ProductExpansionModel.of(), ProductQueryImpl::new);
}
origin: commercetools/commercetools-jvm-sdk

ProductQueryImpl(){
  super(ProductEndpoint.ENDPOINT.endpoint(), ProductQuery.resultTypeReference(), ProductQueryModel.of(), ProductExpansionModel.of(), ProductQueryImpl::new);
}
origin: io.sphere.sdk.jvm/sphere-models

ProductQueryImpl(){
  super(ProductEndpoint.ENDPOINT.endpoint(), ProductQuery.resultTypeReference(), ProductQueryModel.of(), ProductExpansionModel.of(), ProductQueryImpl::new);
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void variants() throws Exception {
  assertThat(ProductQueryModel.of().masterData().current().variants().sku().is("bar").toSphereQuery())
      .isEqualTo("masterData(current(variants(sku=\"bar\")))");
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void pure() throws Exception {
  final QueryPredicate<Product> purePredicate = ProductQueryModel.of().masterData().current().name().lang(ENGLISH).is("Yes");
  assertThat(purePredicate.toSphereQuery()).isEqualTo("masterData(current(name(en=\"Yes\")))");
}
origin: commercetools/commercetools-jvm-sdk

  default ProductQuery bySku(final String sku, final ProductProjectionType type) {
    final QueryPredicate<EmbeddedProductVariantQueryModel> skuPredicate = EmbeddedProductVariantQueryModel.of().sku().is(sku);
    final ProductDataQueryModel<Product> projection = ProductQueryModel.of().masterData().forProjection(type);
    final QueryPredicate<Product> masterVariantSkuPredicate = projection.masterVariant().where(skuPredicate);
    final QueryPredicate<Product> variantsSkuPredicate = projection.variants().where(skuPredicate);
    return withPredicates(masterVariantSkuPredicate.or(variantsSkuPredicate));
  }
}
origin: io.sphere.sdk.jvm/sphere-models

  default ProductQuery bySku(final String sku, final ProductProjectionType type) {
    final QueryPredicate<PartialProductVariantQueryModel> skuPredicate = PartialProductVariantQueryModel.of().sku().is(sku);
    final ProductDataQueryModel<Product> projection = ProductQueryModel.of().masterData().forProjection(type);
    final QueryPredicate<Product> masterVariantSkuPredicate = projection.masterVariant().where(skuPredicate);
    final QueryPredicate<Product> variantsSkuPredicate = projection.variants().where(skuPredicate);
    return withPredicates(masterVariantSkuPredicate.or(variantsSkuPredicate));
  }
}
origin: com.commercetools.sdk.jvm.core/commercetools-models

  default ProductQuery bySku(final String sku, final ProductProjectionType type) {
    final QueryPredicate<EmbeddedProductVariantQueryModel> skuPredicate = EmbeddedProductVariantQueryModel.of().sku().is(sku);
    final ProductDataQueryModel<Product> projection = ProductQueryModel.of().masterData().forProjection(type);
    final QueryPredicate<Product> masterVariantSkuPredicate = projection.masterVariant().where(skuPredicate);
    final QueryPredicate<Product> variantsSkuPredicate = projection.variants().where(skuPredicate);
    return withPredicates(masterVariantSkuPredicate.or(variantsSkuPredicate));
  }
}
origin: commercetools/commercetools-jvm-sdk

@Test
public void allVariantsInProduct() throws Exception {
  assertThat(ProductQueryModel.of().masterData().current().allVariants().where(m -> m.sku().is("bar")))
      .isEqualTo(ProductQueryModel.of().masterData().current().where(m -> m.masterVariant().sku().is("bar").or(m.variants().sku().is("bar"))))
      .isEqualTo(QueryPredicate.<Product>of(embeddedProductPredicate));
}
origin: commercetools/commercetools-jvm-sdk

  @Override
  public Query<Product> get() {
    final QueryPredicate<Product> predicate = ProductQueryModel.of().
        masterData().current().name().lang(Locale.ENGLISH).is("simple cotton t-shirt");
    return ProductQuery.of().withPredicates(predicate);
  }
}
origin: commercetools/commercetools-jvm-sdk

public static void deleteProductsProductTypeAndProductDiscounts(final BlockingSphereClient client, final ProductType productType) {
  client.executeBlocking(ProductDiscountQuery.of().withLimit(500L)).getResults()
      .forEach(discount -> client.executeBlocking(ProductDiscountDeleteCommand.of(discount)));
  if (productType != null) {
    QueryPredicate<Product> ofProductType = ProductQueryModel.of().productType().is(productType);
    ProductQuery productsOfProductTypeQuery = ProductQuery.of().withPredicates(ofProductType).withLimit(500L);
    do {
      final List<Product> products = client.executeBlocking(productsOfProductTypeQuery).getResults();
      final List<Product> unpublishedProducts = products.stream().map(
          product -> {
            if (product.getMasterData().isPublished()) {
              return client.executeBlocking(ProductUpdateCommand.of(product, Unpublish.of()));
            } else {
              return product;
            }
          }
      ).collect(toList());
      final List<CompletionStage<Product>> stages = new LinkedList<>();
      unpublishedProducts.forEach(
          product -> {
            final CompletionStage<Product> completionStage = client.execute(ProductDeleteCommand.of(product));
            stages.add(completionStage);
          }
      );
      stages.forEach(stage -> SphereClientUtils.blockingWait(stage, 30, TimeUnit.SECONDS));
      deleteProductType(client, productType);
    } while (client.executeBlocking(productsOfProductTypeQuery).getCount() > 0);
  }
}
origin: commercetools/commercetools-jvm-sdk

  @Test
  public void combinedEmbeddedQueries() throws Exception {
    final QueryPredicate<EmbeddedProductDataQueryModel> predicate =
        DATA_QUERY_MODEL.name().lang(ENGLISH).is("Yes").or(DATA_QUERY_MODEL.name().lang(GERMAN).is("Ja"));
    final QueryPredicate<Product> resultPredicate = ProductQueryModel.of().masterData().where(m -> m.current().where(predicate).and(m.staged().where(predicate)));
    assertThat(resultPredicate.toSphereQuery()).isEqualTo("masterData(current(name(en=\"Yes\") or name(de=\"Ja\")) and staged(name(en=\"Yes\") or name(de=\"Ja\")))");
  }
}
io.sphere.sdk.products.queriesProductQueryModelof

Popular methods of ProductQueryModel

  • masterData
  • productType
  • <init>
  • get
  • id
  • is
  • referenceModel
  • referenceOptionalModel
  • reviewRatingStatistics
  • state

Popular in Java

  • Making http requests using okhttp
  • putExtra (Intent)
  • notifyDataSetChanged (ArrayAdapter)
  • setContentView (Activity)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • 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