Class DefaultCMSRestrictionService
java.lang.Object
de.hybris.platform.servicelayer.internal.service.AbstractService
de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSService
de.hybris.platform.cms2.servicelayer.services.impl.DefaultCMSRestrictionService
- All Implemented Interfaces:
CMSRestrictionService,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
RankingCMSRestrictionService
public class DefaultCMSRestrictionService
extends AbstractCMSService
implements CMSRestrictionService
Default implementation of cms restriction service which is used for evaluate restriction that is attached to page or
component.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO -
Field Summary
Fields inherited from class de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSService
CURRENTCATALOGVERSION, CURRENTSITEFields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManagerFields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateMoreThanOneDefaultPageWarning(Collection<AbstractPageModel> defaultPages) booleanevaluate(AbstractRestrictionModel restriction, RestrictionData restrictionDataInfo) Evaluates given restriction forRestrictionDatacontext object.protected booleanevaluate(List<AbstractRestrictionModel> restrictions, RestrictionData data, boolean oneRestrictionApply) protected booleanevaluateAnyRestriction(AbstractRestrictionModel restrictionModel, RestrictionData context) booleanevaluateCMSComponent(AbstractCMSComponentModel component, RestrictionData data) Evaluate cms component forRestrictionDatacontext object.evaluateCMSComponents(List<AbstractCMSComponentModel> components, RestrictionData data) Evaluate cms components forRestrictionDatacontext object.evaluatePages(Collection<AbstractPageModel> pages, RestrictionData data) Evaluate pages forRestrictionDatacontext object.Gets the category codes for restriction.protected CatalogLevelServiceprotected CMSComponentServiceprotected Comparator<AbstractPageModel>protected CMSRestrictionDaoprotected Collection<AbstractPageModel>protected Collection<AbstractPageModel>Finds the restriction for the given page based on catalog hierarchy defined in the context of multi-countrygetOwnRestrictionsForComponents(Collection<AbstractCMSComponentModel> components, CatalogVersionModel catalogVersion) Find restrictions for components by components and catalog version.getOwnRestrictionsForPage(AbstractPageModel pageModel, CatalogVersionModel catalogVersion) Find restrictions for page by page and catalog version.getProductCodesForRestriction(CMSProductRestrictionModel restriction) Gets the product codes for restriction.protected Collection<AbstractPageModel>getRestrictedPages(Collection<AbstractPageModel> pages, AbstractPageModel abstractPageModel, CatalogVersionModel catalogVersion) Finds pages that matches the given catalog version.protected Collection<AbstractPageModel>Sorts a collection of pages based on their catalog levelbooleanrelatedSharedSlots(AbstractRestrictionModel restrictionModel) Check if a restriction is related to a shared slot or not.voidsetCmsCatalogLevelService(CatalogLevelService cmsCatalogLevelService) voidsetCmsComponentService(CMSComponentService cmsComponentService) voidsetCmsItemCatalogLevelComparator(Comparator<AbstractPageModel> cmsItemCatalogLevelComparator) voidsetCmsRestrictionDao(CMSRestrictionDao cmsRestrictionDao) voidsetEvaluatorRegistry(CMSRestrictionEvaluatorRegistry evaluatorRegistry) Methods inherited from class de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSService
getBaseSiteService, getCurrentCatalogVersion, getCurrentSite, getSearchRestrictionService, getUserService, setBaseSiteService, setSearchRestrictionService, setUserServiceMethods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerMethods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
Constructor Details
-
DefaultCMSRestrictionService
public DefaultCMSRestrictionService()
-
-
Method Details
-
evaluate
public boolean evaluate(AbstractRestrictionModel restriction, RestrictionData restrictionDataInfo) throws RestrictionEvaluationException Evaluates given restriction forRestrictionDatacontext object.- Specified by:
evaluatein interfaceCMSRestrictionService- Parameters:
restriction- the restrictionrestrictionDataInfo- the restriction data info- Returns:
- true, if successful
- Throws:
RestrictionEvaluationException- the restriction evaluation exception
-
evaluateCMSComponent
Evaluate cms component forRestrictionDatacontext object.- Specified by:
evaluateCMSComponentin interfaceCMSRestrictionService- Parameters:
component- the componentdata- the data- Returns:
- true, if successful
-
evaluateCMSComponents
public List<AbstractCMSComponentModel> evaluateCMSComponents(List<AbstractCMSComponentModel> components, RestrictionData data) Evaluate cms components forRestrictionDatacontext object.- Specified by:
evaluateCMSComponentsin interfaceCMSRestrictionService- Parameters:
components- the componentsdata- the data- Returns:
- the list
-
evaluatePages
public Collection<AbstractPageModel> evaluatePages(Collection<AbstractPageModel> pages, RestrictionData data) Evaluate pages forRestrictionDatacontext object.- Specified by:
evaluatePagesin interfaceCMSRestrictionService- Parameters:
pages- the pagesdata- the data- Returns:
- the collection
-
getOwnRestrictionsForPage
public Collection<AbstractRestrictionModel> getOwnRestrictionsForPage(AbstractPageModel pageModel, CatalogVersionModel catalogVersion) Description copied from interface:CMSRestrictionServiceFind restrictions for page by page and catalog version.- Specified by:
getOwnRestrictionsForPagein interfaceCMSRestrictionService- Parameters:
pageModel- the pagecatalogVersion- the catalog version- Returns:
- the collection of found
AbstractRestrictionModelobjects or empty list when not found.
-
getOwnRestrictionsForComponents
public Collection<AbstractRestrictionModel> getOwnRestrictionsForComponents(Collection<AbstractCMSComponentModel> components, CatalogVersionModel catalogVersion) Description copied from interface:CMSRestrictionServiceFind restrictions for components by components and catalog version.- Specified by:
getOwnRestrictionsForComponentsin interfaceCMSRestrictionService- Parameters:
components- the componentscatalogVersion- the catalog version- Returns:
- the collection of found
AbstractRestrictionModelobjects or empty list when not found.
-
getMultiCountryRestrictedPages
protected Collection<AbstractPageModel> getMultiCountryRestrictedPages(Collection<AbstractPageModel> pages) Finds the restriction for the given page based on catalog hierarchy defined in the context of multi-country- Parameters:
pages- - the list of pages to be evaluated- Returns:
- the filtered pages
-
getSortedPagesByCatalogLevel
protected Collection<AbstractPageModel> getSortedPagesByCatalogLevel(Collection<AbstractPageModel> pages) Sorts a collection of pages based on their catalog level- Parameters:
pages- the unsorted collection of pages- Returns:
- a sorted collection of pages
-
getRestrictedPages
protected Collection<AbstractPageModel> getRestrictedPages(Collection<AbstractPageModel> pages, AbstractPageModel abstractPageModel, CatalogVersionModel catalogVersion) Finds pages that matches the given catalog version.- Parameters:
pages- - the list of pages to be filteredabstractPageModel- - the page used for filtering (page type and labelOrId)catalogVersion- - the catalog version used for filtering- Returns:
- a list of pages
-
getCategoryCodesForRestriction
Gets the category codes for restriction.- Specified by:
getCategoryCodesForRestrictionin interfaceCMSRestrictionService- Parameters:
restriction- the restriction- Returns:
- the category codes for restriction
-
getProductCodesForRestriction
Gets the product codes for restriction.- Specified by:
getProductCodesForRestrictionin interfaceCMSRestrictionService- Parameters:
restriction- the restriction- Returns:
- the product codes for restriction
-
getCmsRestrictionDao
-
setCmsRestrictionDao
-
setEvaluatorRegistry
- Parameters:
evaluatorRegistry- the evaluatorRegistry to set
-
evaluate
protected boolean evaluate(List<AbstractRestrictionModel> restrictions, RestrictionData data, boolean oneRestrictionApply) -
evaluateAnyRestriction
protected boolean evaluateAnyRestriction(AbstractRestrictionModel restrictionModel, RestrictionData context) throws RestrictionEvaluationException - Throws:
RestrictionEvaluationException
-
getDefaultPages
-
createMoreThanOneDefaultPageWarning
-
getCmsCatalogLevelService
-
setCmsCatalogLevelService
-
getCmsItemCatalogLevelComparator
-
setCmsItemCatalogLevelComparator
public void setCmsItemCatalogLevelComparator(Comparator<AbstractPageModel> cmsItemCatalogLevelComparator) -
getCmsComponentService
-
setCmsComponentService
-