Class ProductTagTagEndpoint

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

@FrameworkRestController @FrameworkMapping("/tags/{tagId}/products") @DataRouteByExample(AdvancedTag.class) public class ProductTagTagEndpoint extends Object
Endpoint for managing ProductTags from an AdvancedTag context.
Author:
Nathan Moore (nathandmoore)
  • Field Details

  • Constructor Details

    • ProductTagTagEndpoint

      public ProductTagTagEndpoint(ProductService<Product> productService, AdvancedTagService<AdvancedTag> tagService, ProductTagService<ProductTag> productTagService, com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation> translationEntityService, com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator hydrator, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • readAllProductTags

      @FrameworkGetMapping @Policy(permissionRoots="ADVANCED_TAG") public org.springframework.data.domain.Page<ProductTag> readAllProductTags(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("tagId") String tagId, @RequestParam(required=false) String targetType, cz.jirutka.rsql.parser.ast.Node filters, @PageableDefault(size=50) org.springframework.data.domain.Pageable page)
    • readProductTag

      @FrameworkGetMapping("/{id}") @Policy(permissionRoots="ADVANCED_TAG") public ProductTag readProductTag(@ContextOperation com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("tagId") String tagId, @PathVariable("id") String id)
    • replaceProductTag

      @FrameworkPutMapping(path="/{id}", consumes="application/json") @Policy(permissionRoots="ADVANCED_TAG") public ProductTag replaceProductTag(@ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("tagId") String tagId, @PathVariable("id") String id, @RequestBody ProductTag req)
    • updateProductTag

      @FrameworkPatchMapping(path="/{id}", consumes="application/json") @Policy(permissionRoots="ADVANCED_TAG") public ProductTag updateProductTag(@ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("tagId") String tagId, @PathVariable("id") String id, @RequestBody ProductTag req)
    • addProductTag

      @FrameworkPostMapping(consumes="application/json") @Policy(permissionRoots="ADVANCED_TAG") public ProductTag addProductTag(@ContextOperation(CREATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("tagId") String tagId, @RequestBody ProductTag req)
    • deleteProductTag

      @FrameworkDeleteMapping("/{id}") @Policy(permissionRoots="ADVANCED_TAG") public org.springframework.http.ResponseEntity<Void> deleteProductTag(@ContextOperation(DELETE) com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @PathVariable("tagId") String tagId, @PathVariable("id") String id)
    • replaceAllProductTagTranslations

      @FrameworkPutMapping(path="/{id}/translation/{locale}") @Policy(permissionRoots="ADVANCED_TAG") public com.broadleafcommerce.translation.service.dto.TranslationsPayload replaceAllProductTagTranslations(@ContextOperation(UPDATE) com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @PathVariable("tagId") String tagId, @PathVariable("id") String id, @PathVariable("locale") Locale locale, @RequestBody com.broadleafcommerce.translation.service.dto.TranslationsPayload translationRequest)
    • findWithRelatedTag

      protected org.apache.commons.lang3.tuple.Pair<AdvancedTag,ProductTag> findWithRelatedTag(String tagId, String productTagId, String operationType, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Finds the ProductTag and its AdvancedTag. This will also implicitly validate that both exist and the tag is the parent of the product tag.
      Parameters:
      tagId - ID of the owning tag
      productTagId - ID of the product tag to fetch
      contextInfo - Additional sandbox and multitenant info
      Returns:
      The ProductTag and its Product.
    • inheritCatalogInfoFromProductIfMissing

      protected void inheritCatalogInfoFromProductIfMissing(ProductTag req, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Updates the ContextRequest on contextInfo based on the catalog info of ProductTag.getProduct() if no catalog info is present. This means that the req will inherit implicitly.
      Parameters:
      req - The ProductTag being created
      contextInfo - Additional sandbox and multitenant state
    • findMatchingInheritedCatalog

      protected Optional<String> findMatchingInheritedCatalog(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, String productCatalogId)
      Finds the ID of the isolated Catalog in one of the requested Application's InheritanceLines that contains the productCatalogId from which the isolated catalog inherits.
      Parameters:
      application - The Application from the ContextRequest
      productCatalogId - ID of the ProductTag's parent Product's owning Catalog.
      Returns:
      The ID of the isolated Catalog in one of the requested Application's InheritanceLines that contains the productCatalogId from which the isolated catalog inherits.
    • findMatchingApplicationCatalog

      protected Optional<String> findMatchingApplicationCatalog(@NonNull @NonNull com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, String productCatalogId)
      Returns the productCatalogId if it matches on the application's Application.getIsolatedCatalogs().
      Parameters:
      application - The Application from the ContextRequest
      productCatalogId - ID of the ProductTag's parent Product's owning Catalog.
      Returns:
      The productCatalogId if it matches on the application's Application.getIsolatedCatalogs().
    • getProductService

      protected ProductService<Product> getProductService()
    • getTagService

      protected AdvancedTagService<AdvancedTag> getTagService()
    • getProductTagService

      protected ProductTagService<ProductTag> getProductTagService()
    • getTranslationEntityService

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

      protected com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator getHydrator()
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()