Class ComponentController
- java.lang.Object
-
- de.hybris.platform.cmsoccaddon.controllers.ComponentController
-
@Controller @RequestMapping("/{baseSiteId}/cms") public class ComponentController extends java.lang.Object
Default Controller for CMS Component. This controller is used for all CMS components that don\"t have a specific controller to handle them.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_CURRENT_PAGE
static java.lang.String
DEFAULT_PAGE_SIZE
-
Constructor Summary
Constructors Constructor Description ComponentController()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ComponentListWsDTOAdapter.ListAdaptedComponents
findComponentsByIds(java.util.List<java.lang.String> componentIds, java.lang.String catalogCode, java.lang.String productCode, java.lang.String categoryCode, java.lang.String fields, int currentPage, int pageSize, java.lang.String sort)
protected ComponentListWsDTOAdapter.ListAdaptedComponents
formatSearchPageDataResult(java.lang.String fields, SearchPageData<AbstractCMSComponentData> searchPageDataResult)
Transforms theSearchPageData
containing the list of cms component data into aListAdaptedComponents
object.ComponentAdapterUtil.ComponentAdaptedData
getComponentById(java.lang.String componentId, java.lang.String catalogCode, java.lang.String productCode, java.lang.String categoryCode, java.lang.String fields)
ComponentItemFacade
getComponentItemFacade()
protected ComponentListWsDTOAdapter.ListAdaptedComponents
getComponentsByIds(java.util.List<java.lang.String> componentIds, java.lang.String catalogCode, java.lang.String productCode, java.lang.String categoryCode, java.lang.String fields, int currentPage, int pageSize, java.lang.String sort)
Finds cms components by the specified IDs.CMSDataMapper
getDataMapper()
WebPaginationUtils
getWebPaginationUtils()
ComponentListWsDTOAdapter.ListAdaptedComponents
searchComponentsByIds(ComponentIDListWsDTO componentIdList, java.lang.String catalogCode, java.lang.String productCode, java.lang.String categoryCode, java.lang.String fields, int currentPage, int pageSize, java.lang.String sort)
Deprecated, for removal: This API element is subject to removal in a future version.since 1905, please usefindComponentsByIds(List, String, String, String, String, int, int, String)
instead.void
setComponentItemFacade(ComponentItemFacade componentItemFacade)
void
setDataMapper(CMSDataMapper dataMapper)
void
setWebPaginationUtils(WebPaginationUtils webPaginationUtils)
-
-
-
Field Detail
-
DEFAULT_CURRENT_PAGE
public static final java.lang.String DEFAULT_CURRENT_PAGE
- See Also:
- Constant Field Values
-
DEFAULT_PAGE_SIZE
public static final java.lang.String DEFAULT_PAGE_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getComponentById
@GetMapping("/components/{componentId}") @ResponseBody public ComponentAdapterUtil.ComponentAdaptedData getComponentById(@PathVariable java.lang.String componentId, @RequestParam(required=false) java.lang.String catalogCode, @RequestParam(required=false) java.lang.String productCode, @RequestParam(required=false) java.lang.String categoryCode, @RequestParam(defaultValue="DEFAULT") java.lang.String fields) throws CMSItemNotFoundException
- Throws:
CMSItemNotFoundException
-
searchComponentsByIds
@PostMapping("/components") @ResponseBody @Deprecated(since="1905", forRemoval=true) public ComponentListWsDTOAdapter.ListAdaptedComponents searchComponentsByIds(@RequestBody ComponentIDListWsDTO componentIdList, @RequestParam(required=false) java.lang.String catalogCode, @RequestParam(required=false) java.lang.String productCode, @RequestParam(required=false) java.lang.String categoryCode, @RequestParam(defaultValue="DEFAULT") java.lang.String fields, @RequestParam(required=false,defaultValue="0") int currentPage, @RequestParam(required=false,defaultValue="10") int pageSize, @RequestParam(required=false) java.lang.String sort)
Deprecated, for removal: This API element is subject to removal in a future version.since 1905, please usefindComponentsByIds(List, String, String, String, String, int, int, String)
instead.This endpoint will trigger CORS preflight requests by the browser in a cross-origin setup, which is the most common cases. You can use the GET endpoint (findComponentsByIds(List, String, String, String, String, int, int, String)
) to easily circumvent the browser's preflight requests.However, when requesting for a very large number of components using the GET endpoint, you may eventually reach the maximum number of characters allowed in a URL request. For example:
Request Method: GET
Request URL: /cms/components?componentIds=uid1,uid2,uid3,...,uid1000&catalogCode=...
This POST endpoint allows you to request for such large number of components, but you will have to address the preflight requests issues in a cross-origin setup.
-
findComponentsByIds
@GetMapping("/components") @ResponseBody public ComponentListWsDTOAdapter.ListAdaptedComponents findComponentsByIds(@RequestParam(required=false) java.util.List<java.lang.String> componentIds, @RequestParam(required=false) java.lang.String catalogCode, @RequestParam(required=false) java.lang.String productCode, @RequestParam(required=false) java.lang.String categoryCode, @RequestParam(defaultValue="DEFAULT") java.lang.String fields, @RequestParam(required=false,defaultValue="0") int currentPage, @RequestParam(required=false,defaultValue="10") int pageSize, @RequestParam(required=false) java.lang.String sort)
-
getComponentsByIds
protected ComponentListWsDTOAdapter.ListAdaptedComponents getComponentsByIds(java.util.List<java.lang.String> componentIds, java.lang.String catalogCode, java.lang.String productCode, java.lang.String categoryCode, java.lang.String fields, int currentPage, int pageSize, java.lang.String sort)
Finds cms components by the specified IDs. When none is provided, this will retrieve all components. The components list will be filtered by the given catalog, product or category restrictions, as well as by the pagination information. The result will be sorted in the specified order.- Parameters:
componentIds
- - the list of component uid'scatalogCode
- - the catalog code determining the restriction to applyproductCode
- - the product code determining the restriction to applycategoryCode
- - the category code determining the restriction to applyfields
- - the response configuration determining which fields to include in the responsecurrentPage
- - the pagination information determining the page indexpageSize
- - the pagination information determining the page sizesort
- - the sorting information determining which field to sort on and the ordering direction (ASC or DESC)- Returns:
- a list of cms component data
-
formatSearchPageDataResult
protected ComponentListWsDTOAdapter.ListAdaptedComponents formatSearchPageDataResult(java.lang.String fields, SearchPageData<AbstractCMSComponentData> searchPageDataResult)
Transforms theSearchPageData
containing the list of cms component data into aListAdaptedComponents
object.- Parameters:
fields
- - the response configuration determining which fields to include in the responsesearchPageDataResult
- - the configuration containing the pagination and sorting information- Returns:
- a list of components of type
ComponentListWsDTOAdapter.ListAdaptedComponents
-
getComponentItemFacade
public ComponentItemFacade getComponentItemFacade()
-
setComponentItemFacade
public void setComponentItemFacade(ComponentItemFacade componentItemFacade)
-
getDataMapper
public CMSDataMapper getDataMapper()
-
setDataMapper
public void setDataMapper(CMSDataMapper dataMapper)
-
getWebPaginationUtils
public WebPaginationUtils getWebPaginationUtils()
-
setWebPaginationUtils
public void setWebPaginationUtils(WebPaginationUtils webPaginationUtils)
-
-