Class DefaultCMSItemFacade
java.lang.Object
de.hybris.platform.cmsfacades.cmsitems.impl.DefaultCMSItemFacade
- All Implemented Interfaces:
CMSItemFacade
Default implementation of the
CMSItemFacade.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildCMSItemConvertAndPopulate(String uuid, boolean throwException) buildContextForItem(Map<String, Object> itemMap) protected voidconvertAndPopulate(CMSItemModel itemModel) Converts and populates Map to return to the frontend.protected ItemModelconvertAndPopulate(Map<String, Object> itemMap) Converts and populates model to saveprotected CMSItemNotFoundExceptionCreates a newCMSItemNotFoundException.createItem(Map<String, Object> itemMap) Create CMS Items given the attribute value map.protected TypePermissionExceptioncreateTypePermissionException(String permissionName, String itemType) Creates a newTypePermissionExceptionwith a localized error messagevoiddeleteCMSItemByUuid(String uuid) Deletes one single CMSItem by its uuid (Universal Unique Identifier)findCMSItems(CMSItemSearchData cmsItemSearchData, PageableData pageableData) A paged Search for CMSItems in a given catalogversion.findCMSItems(List<String> uuids) A Search for CMSItems by their universally unique identifiersfindCMSItems(List<String> uuids, String mode) A Search for CMSItems by their universally unique identifiers.protected CatalogVersionServiceprotected CMSAdminSiteServicegetCMSItemByUuid(String uuid) Get one single CMSItem by its uuid (Universal Unique Identifier) For more information about Unique Identifiers, seeUniqueItemIdentifierServicegetCMSItemByUuid(String uuid, boolean throwException) Get one single CMSItem by its uuid (Universal Unique Identifier)
For more information about Unique Identifiers, seeUniqueItemIdentifierServicegetCMSItemByUuid(String uuid, String mode) Get one single CMSItem by its uuid (Universal Unique Identifier) For more information about Unique Identifiers, seeUniqueItemIdentifierServiceprotected CMSItemConverterprotected Converter<CMSItemSearchData,CMSItemSearchData> protected org.springframework.validation.Validatorprotected CMSItemSearchServiceprotected FacadeValidationServiceprotected ItemDataPopulatorProviderprotected ItemTypePopulatorProviderprotected ModelServiceprotected OriginalClonedItemProvidergetOriginalItemUuid(Map<String, Object> source) Method returns original uuid for an item in the payload.protected PermissionCRUDServiceprotected org.springframework.transaction.PlatformTransactionManagerprotected TypeServiceprotected UniqueItemIdentifierServiceprotected ValidationErrorsProviderprotected voidinitialUpdateValidation(String uuid, Map<String, Object> itemMap) Checks if an item exists.saveItem(Map<String, Object> itemMap, Predicate<String> typePermissionPredicate, String permissionName) Saves Item using a local transaction.protected voidsetCatalogInSession(Map<String, Object> source) Sets the catalogVersion in the current session.voidsetCatalogVersionService(CatalogVersionService catalogVersionService) protected voidsetCloneContext(Map<String, Object> source) Sets the clone context in the current session.voidsetCmsAdminSiteService(CMSAdminSiteService cmsAdminSiteService) voidsetCmsItemAttributeFilterEnablerService(CMSItemAttributeFilterEnablerService cmsItemAttributeFilterEnablerService) voidsetCmsItemConverter(CMSItemConverter cmsItemConverter) voidsetCmsItemSearchDataConverter(Converter<CMSItemSearchData, CMSItemSearchData> cmsItemSearchDataConverter) voidsetCmsItemSearchDataValidator(org.springframework.validation.Validator cmsItemSearchDataValidator) voidsetCmsItemSearchService(CMSItemSearchService cmsItemSearchService) voidsetFacadeValidationService(FacadeValidationService facadeValidationService) voidsetItemDataPopulatorProvider(ItemDataPopulatorProvider itemDataPopulatorProvider) voidsetItemTypePopulatorProvider(ItemTypePopulatorProvider itemTypePopulatorProvider) voidsetModelService(ModelService modelService) voidsetOriginalClonedItemProvider(OriginalClonedItemProvider originalClonedItemProvider) protected voidsetOriginalItemContext(Map<String, Object> source) Sets the original item context in the current session.voidsetPermissionCRUDService(PermissionCRUDService permissionCRUDService) protected voidsetRestoreContext(Map<String, Object> source) Sets the restore context in the current session.voidsetSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler sessionSearchRestrictionsDisabler) voidsetTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) voidsetTypeService(TypeService typeService) voidsetUniqueItemIdentifierService(UniqueItemIdentifierService uniqueItemIdentifierService) voidsetValidationErrorsProvider(ValidationErrorsProvider validationErrorsProvider) protected voidParses the ModelSavingException and transforms it into validation error(s).updateItem(String uuid, Map<String, Object> itemMap) Updates a CMS Item given the attribute value map and its uuid.validateItem(Map<String, Object> itemMap) Validates and convert the item for the sole purpose of validation.validateItemForCreate(Map<String, Object> itemMap) Validates CMS Items given the attribute value map.validateItemForUpdate(String uuid, Map<String, Object> itemMap) Validates a CMS Item given the attribute value map and its uuid.
-
Field Details
-
IGNORE_PART_OF_CONSTRAINT_FOR_TYPE_CODE
- See Also:
-
NAVIGATIONNODE_TYPE_CODE
- See Also:
-
convertedItem
Thread safe temporary storage of a convertedItem just before explicitly rollbacking the transaction in dryRun mode
-
-
Constructor Details
-
DefaultCMSItemFacade
public DefaultCMSItemFacade()
-
-
Method Details
-
findCMSItems
public SearchResult<Map<String,Object>> findCMSItems(CMSItemSearchData cmsItemSearchData, PageableData pageableData) Description copied from interface:CMSItemFacadeA paged Search for CMSItems in a given catalogversion. Optionally filter by name/uid or typeCode- Specified by:
findCMSItemsin interfaceCMSItemFacade- Parameters:
cmsItemSearchData- The catalog and filter informationpageableData- The paging information- Returns:
- A SearchResult containing the paging information and the results
-
findCMSItems
Description copied from interface:CMSItemFacadeA Search for CMSItems by their universally unique identifiers- Specified by:
findCMSItemsin interfaceCMSItemFacade- Parameters:
uuids- The list of uuids of the CMSItems to look for- Returns:
- A list of the corresponding CMSItems
- Throws:
CMSItemNotFoundException- if the item is not found
-
findCMSItems
public List<Map<String,Object>> findCMSItems(List<String> uuids, String mode) throws CMSItemNotFoundException Description copied from interface:CMSItemFacadeA Search for CMSItems by their universally unique identifiers.- Specified by:
findCMSItemsin interfaceCMSItemFacade- Parameters:
uuids- - the list of uuids of the CMSItems to look formode- - list of fields, which should be returned in response- Returns:
- A list of the corresponding CMSItems
- Throws:
CMSItemNotFoundException- if the item is not found
-
getCMSItemByUuid
Get one single CMSItem by its uuid (Universal Unique Identifier) For more information about Unique Identifiers, seeUniqueItemIdentifierService- Specified by:
getCMSItemByUuidin interfaceCMSItemFacade- Parameters:
uuid- - the universal unique identifier- Returns:
- the
Map<String, Object>representation of the CMS Item - Throws:
TypePermissionException- when user does not have permission to read an instance of the given item type.CMSItemNotFoundException- when a CMS Item can not be found for a givenuuid.
-
getCMSItemByUuid
public Map<String,Object> getCMSItemByUuid(String uuid, String mode) throws CMSItemNotFoundException Description copied from interface:CMSItemFacadeGet one single CMSItem by its uuid (Universal Unique Identifier) For more information about Unique Identifiers, seeUniqueItemIdentifierService- Specified by:
getCMSItemByUuidin interfaceCMSItemFacade- Parameters:
uuid- - the universal unique identifiermode- - list of fields, which should be returned in response- Returns:
- the
Map<String, Object>representation of the CMS Item - Throws:
CMSItemNotFoundException- when a CMS Item can not be found for a givenuuid.
-
getCMSItemByUuid
Get one single CMSItem by its uuid (Universal Unique Identifier)
For more information about Unique Identifiers, seeUniqueItemIdentifierService- Parameters:
uuid- the universal unique identifierthrowException- determines if an exception is thrown or not if an item is not found for the given uuid- Returns:
- The CMS Item matching the provided uuid;
Can beNULLwhen user does not have READ permission for the type of the CMS Item andthrowExceptionisFALSE - Throws:
CMSItemNotFoundException- when a CMS Item can not be found for a given uuiTypePermissionException- when user does not have READ permission for the type of the CMS Item.
-
createItem
Create CMS Items given the attribute value map.- Specified by:
createItemin interfaceCMSItemFacade- Parameters:
itemMap- - theMap<String, Object>that contains the attributes values for the new CMSItem.- Returns:
- the Map tha represents the newly created CMS Item.
- Throws:
TypePermissionException- when user does not have permission to create an instance of the given item type.CMSItemNotFoundException- when a CMS Item can not be found for a givenuuid.
-
updateItem
public Map<String,Object> updateItem(String uuid, Map<String, Object> itemMap) throws CMSItemNotFoundExceptionUpdates a CMS Item given the attribute value map and its uuid. For more information about Unique Identifiers, seeUniqueItemIdentifierService- Specified by:
updateItemin interfaceCMSItemFacade- Parameters:
uuid- - the universal unique identifieritemMap- - theMap<String, Object>that contains the attributes values for the new CMSItem.- Returns:
- the Map tha represents the newly created CMS Item.
- Throws:
TypePermissionException- when user does not have permission to update an instance of the given item type.CMSItemNotFoundException- when a CMS Item can not be found for a givenuuid.
-
buildCMSItemConvertAndPopulate
-
initialUpdateValidation
protected void initialUpdateValidation(String uuid, Map<String, Object> itemMap) throws CMSItemNotFoundExceptionChecks if an item exists. If the item exists, then stores it in the local session for further validation.- Parameters:
uuid- the item unique identifieritemMap- the itemMap representation of the item model.- Throws:
CMSItemNotFoundException- when the item does not exist.
-
saveItem
protected Map<String,Object> saveItem(Map<String, Object> itemMap, Predicate<String> typePermissionPredicate, String permissionName) Saves Item using a local transaction. Any CMS items created or modified during this save operation will be versioned.- Parameters:
itemMap- the itemMap to be savedtypePermissionPredicate- the predicate to evaluate the type permissions for the current userpermissionName- the operation user wants to perform on the item; possible values can be found inPermissionsConstants- Returns:
- the item Map representation after saving.
- Throws:
CMSItemNotFoundException- when an item for a given uid does not exist
-
buildContextForItem
-
transformValidationException
Parses the ModelSavingException and transforms it into validation error(s).- Parameters:
error- the ModelSavingException
-
convertAndPopulate
Converts and populates model to save- Parameters:
itemMap- the Map representing the ItemModel to be converted and saved- Returns:
- the model ready to be saved
-
convertAndPopulate
Converts and populates Map to return to the frontend.- Parameters:
itemModel- the itemModel to be converted to the Map.- Returns:
- the itemMap ready to be consumed by frontend.
-
deleteCMSItemByUuid
Deletes one single CMSItem by its uuid (Universal Unique Identifier)
The deleted CMS item will be versioned.- Specified by:
deleteCMSItemByUuidin interfaceCMSItemFacade- Parameters:
uuid- - the universal unique identifier- Throws:
TypePermissionException- when user does not have permission to remove an instance of the given item type.CMSItemNotFoundException- when a CMS Item can not be found for a givenuuid.
-
validateItemForUpdate
public Map<String,Object> validateItemForUpdate(String uuid, Map<String, Object> itemMap) throws CMSItemNotFoundExceptionDescription copied from interface:CMSItemFacadeValidates a CMS Item given the attribute value map and its uuid. For more information about Unique Identifiers, seeUniqueItemIdentifierService- Specified by:
validateItemForUpdatein interfaceCMSItemFacade- Parameters:
uuid- - the universal unique identifieritemMap- - theMap<String, Object>that contains the attributes values for the new CMSItem.- Returns:
- the Map that represents the CMS Item.
- Throws:
CMSItemNotFoundException- when a CMS Item can not be found for a givenuuid.
-
validateItemForCreate
public Map<String,Object> validateItemForCreate(Map<String, Object> itemMap) throws CMSItemNotFoundExceptionDescription copied from interface:CMSItemFacadeValidates CMS Items given the attribute value map.- Specified by:
validateItemForCreatein interfaceCMSItemFacade- Parameters:
itemMap- - theMap<String, Object>that contains the attributes values for the new CMSItem.- Returns:
- the Map that represents the newly created CMS Item.
- Throws:
CMSItemNotFoundException- when a CMS Item can not be found for a givenuuid.
-
validateItem
Validates and convert the item for the sole purpose of validation. The transaction will be rolled back at the end.- Parameters:
itemMap- the item model representation as a map- Returns:
- the converted item model into its representation after validation and conversion.
- Throws:
CMSItemNotFoundException- when any item in its map does not exist.
-
createCMSItemNotFoundException
Creates a newCMSItemNotFoundException.- Parameters:
uuid- The string representing the UUID of the item not found.- Returns:
- the new exception.
-
buildContextForValidItem
-
createTypePermissionException
protected TypePermissionException createTypePermissionException(String permissionName, String itemType) Creates a newTypePermissionExceptionwith a localized error message- Parameters:
permissionName- The permission name defined byPermissionsConstantsitemType- The type code of the item- Returns:
- a new
TypePermissionException
-
getCmsItemConverter
-
setCmsItemConverter
-
getModelService
-
setModelService
-
getUniqueItemIdentifierService
-
setUniqueItemIdentifierService
-
setCatalogInSession
Sets the catalogVersion in the current session.- Parameters:
source-- Throws:
CMSItemNotFoundException
-
setCloneContext
Sets the clone context in the current session. The clone context contains information about original catalog version.- Parameters:
source-
-
setOriginalItemContext
Sets the original item context in the current session. The original item context is used to detect that the item is being modified by this facade class and that theRelatedPageRejectionServiceshould not save this item part of its processing.- Parameters:
source-
-
getOriginalItemUuid
Method returns original uuid for an item in the payload. Important: even if the UUID exists in the payload it's not always the uuid of the original item. For example: while cloning component the payload contains FIELD_PAGE_UUID but it can not be considered as original item- Parameters:
source- the source object.- Returns:
- the optional UUID of the item, empty if there is no original uuid.
-
setRestoreContext
Sets the restore context in the current session. The restore context contains information about whether to override while restore or not.- Parameters:
source-
-
getItemTypePopulatorProvider
-
setItemTypePopulatorProvider
-
getCmsItemSearchService
-
setCmsItemSearchService
-
getCmsItemSearchDataValidator
protected org.springframework.validation.Validator getCmsItemSearchDataValidator() -
setCmsItemSearchDataValidator
public void setCmsItemSearchDataValidator(org.springframework.validation.Validator cmsItemSearchDataValidator) -
getFacadeValidationService
-
setFacadeValidationService
-
getCmsItemSearchDataConverter
-
setCmsItemSearchDataConverter
public void setCmsItemSearchDataConverter(Converter<CMSItemSearchData, CMSItemSearchData> cmsItemSearchDataConverter) -
getValidationErrorsProvider
-
setValidationErrorsProvider
-
getTransactionManager
protected org.springframework.transaction.PlatformTransactionManager getTransactionManager() -
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager) -
setCatalogVersionService
-
getCatalogVersionService
-
setCmsAdminSiteService
-
getCmsAdminSiteService
-
getTypeService
-
setTypeService
-
getSessionSearchRestrictionsDisabler
-
setSessionSearchRestrictionsDisabler
public void setSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler sessionSearchRestrictionsDisabler) -
getOriginalClonedItemProvider
-
setOriginalClonedItemProvider
-
getItemDataPopulatorProvider
-
setItemDataPopulatorProvider
-
getPermissionCRUDService
-
setPermissionCRUDService
-
getCmsItemAttributeFilterEnablerService
-
setCmsItemAttributeFilterEnablerService
public void setCmsItemAttributeFilterEnablerService(CMSItemAttributeFilterEnablerService cmsItemAttributeFilterEnablerService)
-