Class ComponentController
java.lang.Object
de.hybris.platform.cmsocc.controllers.ComponentController
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindComponentsByIds(List<String> componentIds, String catalogCode, String productCode, String categoryCode, String fields, int currentPage, int pageSize, String sort) formatSearchPageDataResult(String fields, SearchPageData<AbstractCMSComponentData> searchPageDataResult) Transforms theSearchPageDatacontaining the list of cms component data into aListAdaptedComponentsobject.getComponentById(String componentId, String catalogCode, String productCode, String categoryCode, String fields) getComponentsByIds(List<String> componentIds, String catalogCode, String productCode, String categoryCode, String fields, int currentPage, int pageSize, String sort) Finds cms components by the specified IDs.searchComponentsByIds(ComponentIDListWsDTO componentIdList, String catalogCode, String productCode, String categoryCode, String fields, int currentPage, int pageSize, String sort) Deprecated, for removal: This API element is subject to removal in a future version.voidsetComponentItemFacade(ComponentItemFacade componentItemFacade) voidsetDataMapper(CMSDataMapper dataMapper) voidsetWebPaginationUtils(WebPaginationUtils webPaginationUtils)
-
Field Details
-
DEFAULT_CURRENT_PAGE
- See Also:
-
DEFAULT_PAGE_SIZE
- See Also:
-
-
Constructor Details
-
ComponentController
public ComponentController()
-
-
Method Details
-
getComponentById
@SecurePortalUnauthenticatedAccess @GetMapping("/components/{componentId}") @ResponseBody public ComponentAdapterUtil.ComponentAdaptedData getComponentById(@PathVariable String componentId, @RequestParam(required=false) String catalogCode, @RequestParam(required=false) String productCode, @RequestParam(required=false) String categoryCode, @RequestParam(defaultValue="DEFAULT") 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) String catalogCode, @RequestParam(required=false) String productCode, @RequestParam(required=false) String categoryCode, @RequestParam(defaultValue="DEFAULT") String fields, @RequestParam(required=false,defaultValue="0") int currentPage, @RequestParam(required=false,defaultValue="10") int pageSize, @RequestParam(required=false) 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
@SecurePortalUnauthenticatedAccess @GetMapping("/components") @ResponseBody public ComponentListWsDTOAdapter.ListAdaptedComponents findComponentsByIds(@RequestParam(required=false) List<String> componentIds, @RequestParam(required=false) String catalogCode, @RequestParam(required=false) String productCode, @RequestParam(required=false) String categoryCode, @RequestParam(defaultValue="DEFAULT") String fields, @RequestParam(required=false,defaultValue="0") int currentPage, @RequestParam(required=false,defaultValue="10") int pageSize, @RequestParam(required=false) String sort) -
getComponentsByIds
protected ComponentListWsDTOAdapter.ListAdaptedComponents getComponentsByIds(List<String> componentIds, String catalogCode, String productCode, String categoryCode, String fields, int currentPage, int pageSize, 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(String fields, SearchPageData<AbstractCMSComponentData> searchPageDataResult) Transforms theSearchPageDatacontaining the list of cms component data into aListAdaptedComponentsobject.- 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
-
setComponentItemFacade
-
getDataMapper
-
setDataMapper
-
getWebPaginationUtils
-
setWebPaginationUtils
-
findComponentsByIds(List, String, String, String, String, int, int, String)instead.