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,java.io.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:
- Serialized Form
-
-
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, CURRENTSITE
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultCMSRestrictionService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringcreateMoreThanOneDefaultPageWarning(java.util.Collection<AbstractPageModel> defaultPages)booleanevaluate(AbstractRestrictionModel restriction, RestrictionData restrictionDataInfo)Evaluates given restriction forRestrictionDatacontext object.protected booleanevaluate(java.util.List<AbstractRestrictionModel> restrictions, RestrictionData data, boolean oneRestrictionApply)protected booleanevaluateAnyRestriction(AbstractRestrictionModel restrictionModel, RestrictionData context)booleanevaluateCMSComponent(AbstractCMSComponentModel component, RestrictionData data)Evaluate cms component forRestrictionDatacontext object.java.util.List<AbstractCMSComponentModel>evaluateCMSComponents(java.util.List<AbstractCMSComponentModel> components, RestrictionData data)Evaluate cms components forRestrictionDatacontext object.java.util.Collection<AbstractPageModel>evaluatePages(java.util.Collection<AbstractPageModel> pages, RestrictionData data)Evaluate pages forRestrictionDatacontext object.java.util.Collection<java.lang.String>getCategoryCodesForRestriction(CMSCategoryRestrictionModel restriction)Gets the category codes for restriction.protected CatalogLevelServicegetCmsCatalogLevelService()protected java.util.Comparator<AbstractPageModel>getCmsItemCatalogLevelComparator()protected CMSRestrictionDaogetCmsRestrictionDao()protected java.util.Collection<AbstractPageModel>getDefaultPages(java.util.Collection<AbstractPageModel> pages)protected java.util.Collection<AbstractPageModel>getMultiCountryRestrictedPages(java.util.Collection<AbstractPageModel> pages)Finds the restriction for the given page based on catalog hierarchy defined in the context of multi-countryjava.util.Collection<java.lang.String>getProductCodesForRestriction(CMSProductRestrictionModel restriction)Gets the product codes for restriction.protected java.util.Collection<AbstractPageModel>getRestrictedPages(java.util.Collection<AbstractPageModel> pages, AbstractPageModel abstractPageModel, CatalogVersionModel catalogVersion)Finds pages that matches the given catalog version.protected java.util.Collection<AbstractPageModel>getSortedPagesByCatalogLevel(java.util.Collection<AbstractPageModel> pages)Sorts a collection of pages based on their catalog levelvoidsetCmsCatalogLevelService(CatalogLevelService cmsCatalogLevelService)voidsetCmsItemCatalogLevelComparator(java.util.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, setUserService
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Method Detail
-
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
public boolean evaluateCMSComponent(AbstractCMSComponentModel component, RestrictionData data)
Evaluate cms component forRestrictionDatacontext object.- Specified by:
evaluateCMSComponentin interfaceCMSRestrictionService- Parameters:
component- the componentdata- the data- Returns:
- true, if successful
-
evaluateCMSComponents
public java.util.List<AbstractCMSComponentModel> evaluateCMSComponents(java.util.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 java.util.Collection<AbstractPageModel> evaluatePages(java.util.Collection<AbstractPageModel> pages, RestrictionData data)
Evaluate pages forRestrictionDatacontext object.- Specified by:
evaluatePagesin interfaceCMSRestrictionService- Parameters:
pages- the pagesdata- the data- Returns:
- the collection
-
getMultiCountryRestrictedPages
protected java.util.Collection<AbstractPageModel> getMultiCountryRestrictedPages(java.util.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 java.util.Collection<AbstractPageModel> getSortedPagesByCatalogLevel(java.util.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 java.util.Collection<AbstractPageModel> getRestrictedPages(java.util.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
public java.util.Collection<java.lang.String> getCategoryCodesForRestriction(CMSCategoryRestrictionModel restriction)
Gets the category codes for restriction.- Specified by:
getCategoryCodesForRestrictionin interfaceCMSRestrictionService- Parameters:
restriction- the restriction- Returns:
- the category codes for restriction
-
getProductCodesForRestriction
public java.util.Collection<java.lang.String> getProductCodesForRestriction(CMSProductRestrictionModel restriction)
Gets the product codes for restriction.- Specified by:
getProductCodesForRestrictionin interfaceCMSRestrictionService- Parameters:
restriction- the restriction- Returns:
- the product codes for restriction
-
getCmsRestrictionDao
protected CMSRestrictionDao getCmsRestrictionDao()
-
setCmsRestrictionDao
public void setCmsRestrictionDao(CMSRestrictionDao cmsRestrictionDao)
-
setEvaluatorRegistry
public void setEvaluatorRegistry(CMSRestrictionEvaluatorRegistry evaluatorRegistry)
- Parameters:
evaluatorRegistry- the evaluatorRegistry to set
-
evaluate
protected boolean evaluate(java.util.List<AbstractRestrictionModel> restrictions, RestrictionData data, boolean oneRestrictionApply)
-
evaluateAnyRestriction
protected boolean evaluateAnyRestriction(AbstractRestrictionModel restrictionModel, RestrictionData context) throws RestrictionEvaluationException
- Throws:
RestrictionEvaluationException
-
getDefaultPages
protected java.util.Collection<AbstractPageModel> getDefaultPages(java.util.Collection<AbstractPageModel> pages)
-
createMoreThanOneDefaultPageWarning
protected java.lang.String createMoreThanOneDefaultPageWarning(java.util.Collection<AbstractPageModel> defaultPages)
-
getCmsCatalogLevelService
protected CatalogLevelService getCmsCatalogLevelService()
-
setCmsCatalogLevelService
public void setCmsCatalogLevelService(CatalogLevelService cmsCatalogLevelService)
-
getCmsItemCatalogLevelComparator
protected java.util.Comparator<AbstractPageModel> getCmsItemCatalogLevelComparator()
-
setCmsItemCatalogLevelComparator
public void setCmsItemCatalogLevelComparator(java.util.Comparator<AbstractPageModel> cmsItemCatalogLevelComparator)
-
-