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 Summary
-
Constructor Summary
ConstructorDescriptionProductTagTagEndpoint
(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 Summary
Modifier and TypeMethodDescriptionaddProductTag
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, String tagId, ProductTag req) org.springframework.http.ResponseEntity<Void>
deleteProductTag
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, String tagId, String id) findMatchingApplicationCatalog
(@NonNull com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, String productCatalogId) Returns theproductCatalogId
if it matches on theapplication's
Application.getIsolatedCatalogs()
.findMatchingInheritedCatalog
(@NonNull com.broadleafcommerce.data.tracking.core.tenant.domain.Application application, String productCatalogId) Finds the ID of the isolatedCatalog
in one of the requestedApplication's InheritanceLines
that contains theproductCatalogId
from which the isolated catalog inherits.protected org.apache.commons.lang3.tuple.Pair<AdvancedTag,
ProductTag> findWithRelatedTag
(String tagId, String productTagId, String operationType, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Finds theProductTag
and itsAdvancedTag
.protected com.broadleafcommerce.data.tracking.core.web.ContextRequestHydrator
protected ProductService<Product>
protected ProductTagService<ProductTag>
protected AdvancedTagService<AdvancedTag>
protected com.broadleafcommerce.translation.service.TranslationEntityService<com.broadleafcommerce.translation.domain.Translation>
protected com.broadleafcommerce.common.extension.TypeFactory
protected void
inheritCatalogInfoFromProductIfMissing
(ProductTag req, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates theContextRequest
oncontextInfo
based on the catalog info ofProductTag.getProduct()
if no catalog info is present.org.springframework.data.domain.Page<ProductTag>
readAllProductTags
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, String tagId, String targetType, cz.jirutka.rsql.parser.ast.Node filters, org.springframework.data.domain.Pageable page) readProductTag
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, String tagId, String id) com.broadleafcommerce.translation.service.dto.TranslationsPayload
replaceAllProductTagTranslations
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context, String tagId, String id, Locale locale, com.broadleafcommerce.translation.service.dto.TranslationsPayload translationRequest) replaceProductTag
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, String tagId, String id, ProductTag req) updateProductTag
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, String tagId, String id, ProductTag req)
-
Field Details
-
BASE_URI
- See Also:
-
-
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 theProductTag
and itsAdvancedTag
. This will also implicitly validate that both exist and the tag is the parent of the product tag.- Parameters:
tagId
- ID of the owning tagproductTagId
- ID of the product tag to fetchcontextInfo
- Additional sandbox and multitenant info- Returns:
- The
ProductTag
and itsProduct
.
-
inheritCatalogInfoFromProductIfMissing
protected void inheritCatalogInfoFromProductIfMissing(ProductTag req, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Updates theContextRequest
oncontextInfo
based on the catalog info ofProductTag.getProduct()
if no catalog info is present. This means that thereq
will inherit implicitly.- Parameters:
req
- TheProductTag
being createdcontextInfo
- 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 isolatedCatalog
in one of the requestedApplication's InheritanceLines
that contains theproductCatalogId
from which the isolated catalog inherits.- Parameters:
application
- TheApplication
from theContextRequest
productCatalogId
- ID of theProductTag's
parentProduct's
owningCatalog
.- Returns:
- The ID of the isolated
Catalog
in one of the requestedApplication's InheritanceLines
that contains theproductCatalogId
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 theproductCatalogId
if it matches on theapplication's
Application.getIsolatedCatalogs()
.- Parameters:
application
- TheApplication
from theContextRequest
productCatalogId
- ID of theProductTag's
parentProduct's
owningCatalog
.- Returns:
- The
productCatalogId
if it matches on theapplication's
Application.getIsolatedCatalogs()
.
-
getProductService
-
getTagService
-
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()
-