Class ItemSynchronizationValidator
java.lang.Object
de.hybris.platform.cmsfacades.synchronization.validator.ItemSynchronizationValidator
- All Implemented Interfaces:
org.springframework.validation.Validator
public class ItemSynchronizationValidator
extends Object
implements org.springframework.validation.Validator
Validates that the items in
SynchronizationData can be synchronized.
Rules to determine if an item can be synchronized:
- If the CmsItem is a page then it must be approved.
- If the CmsItem is a slot it must be a shared slot or used within a page that is approved.
- Otherwise, the CmsItem must only be used in shared slots or within a page that is approved.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanThis method checks if all the slots in the given list are allowed to be synchronized.protected ItemModelgetItem(ItemSynchronizationData itemSynchronizationData) This method is used to retrieve theItemModelreferenced by the givenItemSynchronizationData.protected RelatedItemsServiceprotected UniqueItemIdentifierServiceprotected booleanhasNoRelatedPages(List<CMSItemModel> items) This method is used to ensure there are no pages in the given list.protected booleanisAnyRelatedPageApproved(List<CMSItemModel> items) This method is used to check if there is at least one page approved to be synchronized in the given list.protected booleanisCmsItemApproved(ItemModel itemModel) This method is called to determine if the givenCMSItemModelis approved to be synchronized.protected booleanisPage(CMSItemModel itemModel) This method is used to determine if the givenCMSItemModelis a page (is an instance ofAbstractPageModelor one of its subclasses).protected booleanisPageApproved(CMSItemModel itemModel) This method is used to determine if a given page has been approved to be synchronized.protected booleanisSlot(CMSItemModel itemModel) This method is used to determine if the givenCMSItemModelis a slot.protected booleanisSlotApproved(CMSItemModel cmsItem) This method is used to determine if a given slot can be synchronized.voidsetCmsContentSlotPredicate(Predicate<ItemModel> cmsContentSlotPredicate) voidsetPageTypePredicate(Predicate<ItemModel> pageTypePredicate) voidsetRelatedItemsService(RelatedItemsService relatedItemsService) voidsetUniqueItemIdentifierService(UniqueItemIdentifierService uniqueItemIdentifierService) booleanvoid
-
Constructor Details
-
ItemSynchronizationValidator
public ItemSynchronizationValidator()
-
-
Method Details
-
supports
- Specified by:
supportsin interfaceorg.springframework.validation.Validator
-
validate
- Specified by:
validatein interfaceorg.springframework.validation.Validator
-
isCmsItemApproved
This method is called to determine if the givenCMSItemModelis approved to be synchronized.- Parameters:
itemModel- The item to check if it has been approved to be synchronized.- Returns:
- boolean True if the item is approved to be synchronized. False, otherwise.
-
isPage
This method is used to determine if the givenCMSItemModelis a page (is an instance ofAbstractPageModelor one of its subclasses).- Parameters:
itemModel- The item to check if it is a page- Returns:
- boolean True if the item is a page. False, otherwise.
-
isSlot
This method is used to determine if the givenCMSItemModelis a slot.- Parameters:
itemModel- The item to check if it is a slot- Returns:
- boolean True if the item is a slot. False, otherwise.
-
isPageApproved
This method is used to determine if a given page has been approved to be synchronized.- Parameters:
itemModel- The page to check if it has been approved.- Returns:
- boolean True if the page has been approved. False, otherwise.
-
isSlotApproved
This method is used to determine if a given slot can be synchronized. This can only happen if the slot is a shared slot or if it's related to at least one page that is approved to be synchronized.- Parameters:
cmsItem- The slot to check if it can be synchronized.- Returns:
- boolean True if the slot can be synchronized. False, otherwise.
-
isAnyRelatedPageApproved
This method is used to check if there is at least one page approved to be synchronized in the given list.- Parameters:
items- The items where to look for pages.- Returns:
- boolean True if at least one page is approved. False, otherwise.
-
areAllRelatedSlotsApproved
This method checks if all the slots in the given list are allowed to be synchronized. A slot can be synchronized if it is a shared slot or if it's related to at least one page that is approved to be synchronized.- Parameters:
items- The items where to look for the slots to check.- Returns:
- boolean True if all the slots are approved. False, otherwise.
-
hasNoRelatedPages
This method is used to ensure there are no pages in the given list.- Parameters:
items- The items where to look for pages.- Returns:
- boolean True if no pages were found in the given list. False, otherwise.
-
getItem
This method is used to retrieve theItemModelreferenced by the givenItemSynchronizationData.- Parameters:
itemSynchronizationData- The object that contains the data that identifies the itemModel to retrieve- Returns:
- the retrieved ItemModel.
-
getUniqueItemIdentifierService
-
setUniqueItemIdentifierService
-
getRelatedItemsService
-
getCmsContentSlotPredicate
-
setCmsContentSlotPredicate
-
getPageTypePredicate
-
setPageTypePredicate
-