Class ProductEndpoint

java.lang.Object
com.broadleafcommerce.catalog.web.endpoint.ProductEndpoint

@FrameworkRestController @FrameworkMapping("/products") @DataRouteByExample(Product.class) public class ProductEndpoint extends Object
Operations that are performed for a Product and PromotionalProducts
Author:
Phillip Verheyden (phillipuniverse), Samarth Dhruva (samarthd)
  • Field Details

  • Constructor Details

  • Method Details

    • readAllProducts

      @Deprecated public org.springframework.data.domain.Page<Product> readAllProducts(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @RequestParam(value="q",required=false) String query, @RequestParam(value="hydratePrimaryAssets",defaultValue="true") boolean hydratePrimaryAssets, cz.jirutka.rsql.parser.ast.Node filters, @PageableDefault(size=50) org.springframework.data.domain.Pageable page)
      Deprecated.
    • readAllProducts

      @FrameworkGetMapping @Policy(permissionRoots="PRODUCT") public org.springframework.data.domain.Page<Product> readAllProducts(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @RequestParam(value="q",required=false) String query, @RequestParam(value="businessType",required=false) String businessType, @RequestParam(value="hydratePrimaryAssets",defaultValue="true") boolean hydratePrimaryAssets, cz.jirutka.rsql.parser.ast.Node filters, @PageableDefault(size=50) org.springframework.data.domain.Pageable page)
    • readProductById

      @FrameworkGetMapping("/{id}") @Policy(permissionRoots="PRODUCT") public Product readProductById(jakarta.servlet.http.HttpServletRequest request, @ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String productId)
    • updateProduct

      @FrameworkPatchMapping(value="/{id}", consumes="application/json") @Policy(permissionRoots="PRODUCT") public Product updateProduct(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @RequestBody Product req)
    • replaceProduct

      @FrameworkPutMapping(value="/{id}", consumes="application/json") @Policy(permissionRoots="PRODUCT") public Product replaceProduct(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @RequestBody Product req)
    • cloneProduct

      @FrameworkPostMapping("/{id}/clone") @Policy(permissionRoots="PRODUCT") public Product cloneProduct(@ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String productId, @RequestBody CloneProductRequest cloneProductRequest)
    • bulkUpdateProducts

      @FrameworkPostMapping(value="/bulk-updates", consumes="application/json") @Policy(permissionRoots="PRODUCT") public void bulkUpdateProducts(@RequestParam(value="cq",defaultValue="") String filterString, @RequestBody com.broadleafcommerce.bulk.domain.BulkUpdateRequest bulkUpdateRequest, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • getProductBulkUpdates

      @FrameworkGetMapping("/bulk-updates") @Policy(permissionRoots="PRODUCT") public org.springframework.data.domain.Page<com.broadleafcommerce.bulk.domain.BulkUpdate> getProductBulkUpdates(@ContextOperation(READ) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PageableDefault(size=50) org.springframework.data.domain.Pageable pageable)
    • replaceAllProductTranslations

      @FrameworkPutMapping(value="/{id}/translations/{locale}", consumes="application/json") @Policy(permissionRoots="PRODUCT") public com.broadleafcommerce.translation.service.dto.TranslationsPayload replaceAllProductTranslations(@ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @PathVariable("locale") Locale locale, @RequestBody com.broadleafcommerce.translation.service.dto.TranslationsPayload translationRequest)
    • createProduct

      @FrameworkPostMapping(consumes="application/json") @Policy(permissionRoots="PRODUCT") public Product createProduct(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @RequestBody Product req)
    • deleteProduct

      @FrameworkDeleteMapping("/{id}") @Policy(permissionRoots="PRODUCT") public void deleteProduct(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(DELETE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id)
    • generateOptionsFromTemplates

      @FrameworkPostMapping(value="/{id}/generate-options", consumes="application/json") @Policy(permissionRoots="PRODUCT") public Product generateOptionsFromTemplates(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String id, @RequestBody OptionGenerationRequest optionGenerationRequest)
    • readAllSKUs

      @FrameworkGetMapping("/{id}/skus") @Policy(permissionRoots="PRODUCT") public org.springframework.data.domain.Page<SKUContainer> readAllSKUs(jakarta.servlet.http.HttpServletRequest request, @ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, cz.jirutka.rsql.parser.ast.Node filters, @PageableDefault(size=50) org.springframework.data.domain.Pageable page, @PathVariable("id") String id, @RequestParam(value="q",required=false,defaultValue="") String query)
    • generateSkus

      @FrameworkPostMapping(value="/{id}/generate-skus", consumes="application/json") @Policy(permissionRoots="PRODUCT") public Map<String,List<Variant>> generateSkus(@PathVariable("id") String productId, @ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @RequestBody SkuGenerationParameters generationParameters)
    • readPromotionalProducts

      @FrameworkGetMapping("/{id}/promotional-products") @Policy(permissionRoots="PRODUCT") public org.springframework.data.domain.Page<PromotionalProduct> readPromotionalProducts(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("id") String productId, cz.jirutka.rsql.parser.ast.Node filters, @PageableDefault(size=50) org.springframework.data.domain.Pageable page)
    • addPromotionalProduct

      @FrameworkPostMapping(value="/{id}/promotional-products", consumes="application/json") @Policy(permissionRoots="PRODUCT") public PromotionalProduct addPromotionalProduct(@ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("id") String productId, @RequestBody PromotionalProduct promotionalProduct, OptionalSortPositionRequest givenSortRequest) throws InvalidRelatedProductException
      Throws:
      InvalidRelatedProductException
    • updatePromotionalProduct

      @FrameworkPatchMapping(value="/{id}/promotional-products/{promotionalProductId}", consumes="application/json") @Policy(permissionRoots="PRODUCT") public PromotionalProduct updatePromotionalProduct(@ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("id") String productId, @PathVariable("promotionalProductId") String promotionalProductId, @RequestBody PromotionalProduct promotionalProduct) throws InvalidRelatedProductException
      Throws:
      InvalidRelatedProductException
    • reorderPromotionalProduct

      @FrameworkPatchMapping("/{id}/promotional-products/{promotionalProductId}/sort") @Policy(permissionRoots="PRODUCT") public PromotionalProduct reorderPromotionalProduct(jakarta.servlet.http.HttpServletRequest request, @ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("id") String productId, @PathVariable("promotionalProductId") String promotionalProductId, @UpdateSortOperation("promotionalProductId") com.broadleafcommerce.data.tracking.core.sort.SortPositionRequest sortPositionRequest)
    • replaceAllPromotionalProductTranslations

      @FrameworkPutMapping(value="/{id}/promotional-products/{promotionalProductId}/translations/{locale}", consumes="application/json") @Policy(permissionRoots="PRODUCT") public com.broadleafcommerce.translation.service.dto.TranslationsPayload replaceAllPromotionalProductTranslations(@ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("id") String productId, @PathVariable("promotionalProductId") String promotionalProductId, @PathVariable("locale") Locale locale, @RequestBody com.broadleafcommerce.translation.service.dto.TranslationsPayload translationRequest)
    • replacePromotionalProduct

      @FrameworkPutMapping(value="/{id}/promotional-products/{promotionalProductId}", consumes="application/json") @Policy(permissionRoots="PRODUCT") public PromotionalProduct replacePromotionalProduct(@ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("id") String productId, @PathVariable("promotionalProductId") String promotionalProductId, @RequestBody PromotionalProduct givenPromotionalProduct) throws InvalidRelatedProductException
      Throws:
      InvalidRelatedProductException
    • deletePromotionalProduct

      @FrameworkDeleteMapping("/{id}/promotional-products/{promotionalProductId}") @Policy(permissionRoots="PRODUCT") public void deletePromotionalProduct(@ContextOperation(DELETE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("id") String productId, @PathVariable("promotionalProductId") String promotionalProductId)
    • readCategories

      @FrameworkGetMapping("/{id}/categories") @Policy(permissionRoots="PRODUCT") public org.springframework.data.domain.Page<CategoryProduct> readCategories(@PathVariable("id") String productId, @PageableDefault(size=50) org.springframework.data.domain.Pageable page, @ContextOperation(READ) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, cz.jirutka.rsql.parser.ast.Node filters)
    • createCategoryRefFromCategory

      protected CategoryRef createCategoryRefFromCategory(Category category)
    • readAllProductIdsIgnoreNarrowing

      @FrameworkGetMapping("/ignore-narrowing/ids") @Policy(permissionRoots="PRODUCT_IGNORE_NARROWING") public List<String> readAllProductIdsIgnoreNarrowing(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, cz.jirutka.rsql.parser.ast.Node filters, @RequestParam("size") int page)
    • readAllProductIdsProduction

      @FrameworkGetMapping("/production/ids") @Policy(permissionRoots="PRODUCT_IGNORE_NARROWING") public List<String> readAllProductIdsProduction(cz.jirutka.rsql.parser.ast.Node filters, ProductStipulations stipulations, @RequestParam("size") int pageSize, @ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Read all production product ids in batches. Note, this fetch is narrowed by the provided ContextInfo and is automatically further limited to only non-archived, production records (i.e. no sandbox records). Further filter refinements may be provided via RSQL, and optional query params.
      Parameters:
      filters - RSQL filter to apply to the fetch query to further refine results
      stipulations - Additional filtering context to be applied during product fetch. Optional.
      pageSize - The number of records to return. Note, this is generally used in concert with a "starting id" RSQL param (id=gt=([id]). If the RSQL param is omitted, it is assumed this is the first "page".
      context - The tenant and application context information that will serve to filter results based on application visibility
      Returns:
      The page of appropriately filtered product ids
    • readAllProductsIgnoreNarrowingHydrated

      @FrameworkGetMapping("/ignore-narrowing/hydrated") @Policy(permissionRoots="PRODUCT_IGNORE_NARROWING") public List<ConsolidatedProduct> readAllProductsIgnoreNarrowingHydrated(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, cz.jirutka.rsql.parser.ast.Node filters)
      See Also:
    • readAllProductsIgnoreNarrowingHydratedWithConfiguration

      @FrameworkGetMapping(value="/ignore-narrowing/hydrated", params="configurable=true") @Policy(permissionRoots="PRODUCT_IGNORE_NARROWING") public List<ConsolidatedProduct> readAllProductsIgnoreNarrowingHydratedWithConfiguration(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, cz.jirutka.rsql.parser.ast.Node filters, ProductConsolidationRequest productConsolidationRequest)
      Read all hydrated ConsolidatedProducts with narrowing ignored and specified product consolidation request.
      Since:
      2.1.1, 2.0.2
      See Also:
    • readAllProductsProduction

      @FrameworkGetMapping("/production/hydrated") @Policy(permissionRoots="PRODUCT_IGNORE_NARROWING") public List<ConsolidatedProduct> readAllProductsProduction(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, cz.jirutka.rsql.parser.ast.Node filters)
      See Also:
    • readAllProductsProductionWithConfiguration

      @FrameworkGetMapping(value="/production/hydrated", params="configurable=true") @Policy(permissionRoots="PRODUCT_IGNORE_NARROWING") public List<ConsolidatedProduct> readAllProductsProductionWithConfiguration(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo context, cz.jirutka.rsql.parser.ast.Node filters, ProductConsolidationRequest productConsolidationRequest)
      Read all non-archived, production products with specified product consolidation request. This call is generally used in concert with readAllProductIdsProduction(Node, ProductStipulations, int, ContextInfo). By convention, it is expected that the results of this call are limited by using a RSQL "IN" clause to select on a list of ids provided in batch by the readAllProductIdsProduction call.
      Since:
      2.1.1, 2.0.2
      See Also:
    • applyBusinessTypeFilters

      @NonNull protected cz.jirutka.rsql.parser.ast.Node applyBusinessTypeFilters(String businessType, cz.jirutka.rsql.parser.ast.Node filters)
    • cleanConsolidatedProducts

      @NonNull protected List<ConsolidatedProduct> cleanConsolidatedProducts(List<ConsolidatedProduct> consolidatedProducts)
      Remove unneeded information (such as contextState and fieldChanges) from the emitted structure.
      Parameters:
      consolidatedProducts - The generated ConsolidatedProduct list to clean
      Returns:
      The list of ConsolidatedProducts whose data structure has been optimized
    • getProductSvc

      protected ProductService<Product> getProductSvc()
    • getCloneProductSvc

      protected CloneProductService<Product,CloneProductRequest> getCloneProductSvc()
    • getSkuGenerationSvc

      protected SkuGenerationService<Variant> getSkuGenerationSvc()
    • getPromotionalProductSvc

      protected PromotionalProductService<PromotionalProduct> getPromotionalProductSvc()
    • getCategoryService

      protected CategoryService<Category> getCategoryService()
    • getTranslationEntityService

      protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> getTranslationEntityService()
    • getCategoryProductService

      protected CategoryProductService<CategoryProduct> getCategoryProductService()
    • getBulkUpdateManager

      protected com.broadleafcommerce.bulk.service.BulkUpdateManager getBulkUpdateManager()
    • getBulkUpdateService

      protected com.broadleafcommerce.bulk.service.BulkUpdateService<com.broadleafcommerce.bulk.domain.BulkUpdate> getBulkUpdateService()
    • getCatalogFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getCatalogFactory()
    • getProductConsolidationService

      protected ProductConsolidationService getProductConsolidationService()
    • getProductHydrationService

      protected ProductHydrationService getProductHydrationService()
    • getOptionGenerationService

      protected OptionGenerationService<Product> getOptionGenerationService()
    • getParser

      protected com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> getParser()
    • setParser

      @Autowired public void setParser(com.broadleafcommerce.data.tracking.core.filtering.fetch.FilterParser<cz.jirutka.rsql.parser.ast.Node> parser)