org.broadleafcommerce.core.web.api.endpoint.catalog
Class CatalogEndpoint

java.lang.Object
  extended by org.broadleafcommerce.core.web.api.endpoint.BaseEndpoint
      extended by org.broadleafcommerce.core.web.api.endpoint.catalog.CatalogEndpoint
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.MessageSourceAware

public abstract class CatalogEndpoint
extends BaseEndpoint

This class exposes catalog services as RESTful APIs. It is dependent on a JAX-RS implementation such as Jersey. This class must be extended, with appropriate JAX-RS annotations, such as:

javax.ws.rs.@Scope

javax.ws.rs.@Path

javax.ws.rs.@Produces

javax.ws.rs.@Consumes

javax.ws.rs.@Context

etc...

... in the subclass. The subclass must also be a Spring Bean. The subclass can then override the methods, and specify custom inputs and outputs. It will also specify javax.ws.rs.@Path annotations, javax.ws.rs.@Context, javax.ws.rs.@PathParam, javax.ws.rs.@QueryParam, javax.ws.rs.@GET, javax.ws.rs.@POST, etc... Essentially, the subclass will override and extend the methods of this class, add new methods, and control the JAX-RS behavior using annotations according to the JAX-RS specification. User: Kelly Tisdell


Field Summary
protected  CatalogService catalogService
           
protected  ExploitProtectionService exploitProtectionService
           
protected  SearchFacetDTOService facetService
           
protected  SearchService searchService
           
protected  StaticAssetService staticAssetService
           
 
Fields inherited from class org.broadleafcommerce.core.web.api.endpoint.BaseEndpoint
context, messageSource
 
Constructor Summary
CatalogEndpoint()
           
 
Method Summary
 CategoriesWrapper findActiveSubCategories(javax.servlet.http.HttpServletRequest request, Long id, int limit, int offset)
           
 CategoriesWrapper findAllCategories(javax.servlet.http.HttpServletRequest request, String name, int limit, int offset)
           
 List<CategoryAttributeWrapper> findCategoryAttributesForCategory(javax.servlet.http.HttpServletRequest request, Long id)
           
 CategoryWrapper findCategoryById(javax.servlet.http.HttpServletRequest request, Long id, int productLimit, int productOffset, int subcategoryLimit, int subcategoryOffset)
           
 CategoryWrapper findCategoryByIdOrName(javax.servlet.http.HttpServletRequest request, String searchParameter, int productLimit, int productOffset, int subcategoryLimit, int subcategoryOffset)
          Allows you to search for a category by ID or by name.
 List<RelatedProductWrapper> findCrossSaleProductsByProduct(javax.servlet.http.HttpServletRequest request, Long id, int limit, int offset)
           
 SkuWrapper findDefaultSkuByProductId(javax.servlet.http.HttpServletRequest request, Long id)
           
 List<MediaWrapper> findMediaForCategory(javax.servlet.http.HttpServletRequest request, Long id)
           
 List<MediaWrapper> findMediaForProduct(javax.servlet.http.HttpServletRequest request, Long id)
           
 List<MediaWrapper> findMediaForSku(javax.servlet.http.HttpServletRequest request, Long id)
           
 CategoriesWrapper findParentCategoriesForProduct(javax.servlet.http.HttpServletRequest request, Long id)
           
 List<ProductAttributeWrapper> findProductAttributesForProduct(javax.servlet.http.HttpServletRequest request, Long id)
           
 ProductWrapper findProductById(javax.servlet.http.HttpServletRequest request, Long id)
          Search for Product by product id
 SearchResultsWrapper findProductsByCategoryAndQuery(javax.servlet.http.HttpServletRequest request, Long categoryId, String q, Integer pageSize, Integer page)
          This uses Broadleaf's search service to search for products within a category.
 SearchResultsWrapper findProductsByQuery(javax.servlet.http.HttpServletRequest request, String q, Integer pageSize, Integer page)
          Queries the products.
 List<SkuAttributeWrapper> findSkuAttributesForSku(javax.servlet.http.HttpServletRequest request, Long id)
           
 SkuWrapper findSkuById(javax.servlet.http.HttpServletRequest request, Long id)
           
 List<SkuWrapper> findSkusByProductById(javax.servlet.http.HttpServletRequest request, Long id)
          Search for Sku instances for a given product
 CategoriesWrapper findSubCategories(javax.servlet.http.HttpServletRequest request, Long id, int limit, int offset, boolean active)
           
 List<RelatedProductWrapper> findUpSaleProductsByProduct(javax.servlet.http.HttpServletRequest request, Long id, int limit, int offset)
           
protected  StaticAssetService getStaticAssetService()
           
static void main(String[] args)
           
 
Methods inherited from class org.broadleafcommerce.core.web.api.endpoint.BaseEndpoint
setApplicationContext, setMessageSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

catalogService

protected CatalogService catalogService

searchService

protected SearchService searchService

facetService

protected SearchFacetDTOService facetService

exploitProtectionService

protected ExploitProtectionService exploitProtectionService

staticAssetService

protected StaticAssetService staticAssetService
Constructor Detail

CatalogEndpoint

public CatalogEndpoint()
Method Detail

findProductById

public ProductWrapper findProductById(javax.servlet.http.HttpServletRequest request,
                                      Long id)
Search for Product by product id

Parameters:
id - the product id
Returns:
the product instance with the given product id

findProductsByCategoryAndQuery

public SearchResultsWrapper findProductsByCategoryAndQuery(javax.servlet.http.HttpServletRequest request,
                                                           Long categoryId,
                                                           String q,
                                                           Integer pageSize,
                                                           Integer page)
This uses Broadleaf's search service to search for products within a category.

Parameters:
request -
q -
categoryId -
pageSize -
page -
Returns:

findProductsByQuery

public SearchResultsWrapper findProductsByQuery(javax.servlet.http.HttpServletRequest request,
                                                String q,
                                                Integer pageSize,
                                                Integer page)
Queries the products. The parameter q, which represents the query, is required. It can be any string, but is typically a name or keyword, similar to a search engine search.

Parameters:
request -
q -
pageSize -
page -
Returns:

findSkusByProductById

public List<SkuWrapper> findSkusByProductById(javax.servlet.http.HttpServletRequest request,
                                              Long id)
Search for Sku instances for a given product

Parameters:
id -
Returns:
the list of sku instances for the product

findDefaultSkuByProductId

public SkuWrapper findDefaultSkuByProductId(javax.servlet.http.HttpServletRequest request,
                                            Long id)

findAllCategories

public CategoriesWrapper findAllCategories(javax.servlet.http.HttpServletRequest request,
                                           String name,
                                           int limit,
                                           int offset)

findSubCategories

public CategoriesWrapper findSubCategories(javax.servlet.http.HttpServletRequest request,
                                           Long id,
                                           int limit,
                                           int offset,
                                           boolean active)

findActiveSubCategories

public CategoriesWrapper findActiveSubCategories(javax.servlet.http.HttpServletRequest request,
                                                 Long id,
                                                 int limit,
                                                 int offset)

findCategoryById

public CategoryWrapper findCategoryById(javax.servlet.http.HttpServletRequest request,
                                        Long id,
                                        int productLimit,
                                        int productOffset,
                                        int subcategoryLimit,
                                        int subcategoryOffset)

findCategoryByIdOrName

public CategoryWrapper findCategoryByIdOrName(javax.servlet.http.HttpServletRequest request,
                                              String searchParameter,
                                              int productLimit,
                                              int productOffset,
                                              int subcategoryLimit,
                                              int subcategoryOffset)
Allows you to search for a category by ID or by name.

Parameters:
request -
searchParameter -
productLimit -
productOffset -
subcategoryLimit -
subcategoryOffset -
Returns:

findCategoryAttributesForCategory

public List<CategoryAttributeWrapper> findCategoryAttributesForCategory(javax.servlet.http.HttpServletRequest request,
                                                                        Long id)

findUpSaleProductsByProduct

public List<RelatedProductWrapper> findUpSaleProductsByProduct(javax.servlet.http.HttpServletRequest request,
                                                               Long id,
                                                               int limit,
                                                               int offset)

findCrossSaleProductsByProduct

public List<RelatedProductWrapper> findCrossSaleProductsByProduct(javax.servlet.http.HttpServletRequest request,
                                                                  Long id,
                                                                  int limit,
                                                                  int offset)

findProductAttributesForProduct

public List<ProductAttributeWrapper> findProductAttributesForProduct(javax.servlet.http.HttpServletRequest request,
                                                                     Long id)

findSkuAttributesForSku

public List<SkuAttributeWrapper> findSkuAttributesForSku(javax.servlet.http.HttpServletRequest request,
                                                         Long id)

findMediaForSku

public List<MediaWrapper> findMediaForSku(javax.servlet.http.HttpServletRequest request,
                                          Long id)

findSkuById

public SkuWrapper findSkuById(javax.servlet.http.HttpServletRequest request,
                              Long id)

findMediaForProduct

public List<MediaWrapper> findMediaForProduct(javax.servlet.http.HttpServletRequest request,
                                              Long id)

findMediaForCategory

public List<MediaWrapper> findMediaForCategory(javax.servlet.http.HttpServletRequest request,
                                               Long id)

findParentCategoriesForProduct

public CategoriesWrapper findParentCategoriesForProduct(javax.servlet.http.HttpServletRequest request,
                                                        Long id)

getStaticAssetService

protected StaticAssetService getStaticAssetService()

main

public static void main(String[] args)


Copyright © 2013. All Rights Reserved.