Class DefaultCMSAdminRestrictionService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.cms2.servicelayer.services.admin.impl.AbstractCMSAdminService
-
- de.hybris.platform.cms2.servicelayer.services.admin.impl.DefaultCMSAdminRestrictionService
-
- All Implemented Interfaces:
CMSAdminRestrictionService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
public class DefaultCMSAdminRestrictionService extends AbstractCMSAdminService implements CMSAdminRestrictionService
Default implementation of the restriction service.- 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 Modifier and Type Field Description protected static java.lang.StringCATALOG_VERSIONS-
Fields inherited from class de.hybris.platform.cms2.servicelayer.services.admin.impl.AbstractCMSAdminService
ACTIVECATALOGVERSION, ACTIVESITE, CLONE_CONTEXT, ORIGINAL_ITEM_CONTEXT, RESTORE_CONTEXT, TYPE_CONTEXT
-
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 DefaultCMSAdminRestrictionService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CMSCampaignRestrictionModelcreateCampaignRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<CampaignModel> campaigns)Creates a new CampaignRestriction and a new relation between the restriction and the given pageCMSCatalogRestrictionModelcreateCatalogRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<CatalogModel> catalogs)Creates a new CatalogRestriction and a new relation between the restriction and the given page.CMSCategoryRestrictionModelcreateCategoryRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<CategoryModel> categories)Creates a new CategoryRestriction and a new relation between the restriction and the given pageCMSProductRestrictionModelcreateProductRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<ProductModel> products)Creates a new ProductRestriction and a new relation between the restriction and the given pagevoidcreateRelation(AbstractPageModel page, AbstractRestrictionModel restriction)creates a new relation between the given page and the given restrictionvoidcreateRelation(java.lang.String pageId, java.lang.String restrictionId)creates a new relation between the given page (pageId) and the given restriction (restrictionId)CMSTimeRestrictionModelcreateTimeRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Date from, java.util.Date until)Creates a new TimeRestriction and a new relation between the restriction and the given pageCMSUserGroupRestrictionModelcreateUserGroupRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<UserGroupModel> userGroups)Creates a new UserGroupRestriction and a new relation between the restriction and the given pageCMSUserRestrictionModelcreateUserRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<UserModel> users)Creates a new UserRestriction and a new relation between the restriction and the given pagevoiddeleteRelation(AbstractRestrictionModel restriction, AbstractPageModel page)deletes the relation between the restriction and the pagevoiddeleteRelation(java.lang.String restrictionId, java.lang.String pageId)deletes the relation between the restriction and the pageprotected voidfindCategoriesInLocalSession(PreviewDataModel previewContext, java.util.List<CategoryModel> ret, java.util.Collection<java.lang.String> categoryListCodes)protected voidfindProductsInLocalSession(PreviewDataModel previewContext, java.util.List<ProductModel> ret, java.util.Collection<java.lang.String> productListCodes)java.util.Collection<RestrictionTypeModel>getAllowedRestrictionTypesForPage(AbstractPageModel page)Returns a collection of all restrictions which can be applied on the given pagejava.util.Collection<RestrictionTypeModel>getAllowedRestrictionTypesForPage(java.lang.String id)Returns a collection of all restrictions which can be applied on the given page (via its id)java.util.Collection<AbstractRestrictionModel>getAllRestrictions()Returns all restrictionjava.util.Collection<AbstractRestrictionModel>getAllRestrictionsByType(java.lang.String restrictionType)Returns all restriction of the given restriction typejava.util.Collection<AbstractRestrictionModel>getAllRestrictionsByTypeNotLinkedToPage(java.lang.String pageId, java.lang.String restrictionType)Returns all restrictions of the given restriction type which are currently not linked to the given page (via its id)java.util.Collection<RestrictionTypeModel>getAllRestrictionTypes()Returns a collection of all available restriction types.java.util.List<CategoryModel>getCategories(CMSCategoryRestrictionModel categoryRestriction, PreviewDataModel previewContext)Returns products for product restrictionprotected CategoryServicegetCategoryService()protected CMSAdminPageServicegetCmsAdminPageService()protected CMSRestrictionDaogetCmsRestrictionDao()protected CMSRestrictionServicegetCmsRestrictionService()protected CommonI18NServicegetCommonI18NService()protected ComposedTypeModelgetComposedTypeModel(java.lang.String composedType)protected I18NServicegetI18nService()protected java.util.LocalegetLocalLocale(PreviewDataModel previewContext)protected UserModelgetLocalUser(PreviewDataModel previewContext)java.util.List<ProductModel>getProducts(CMSProductRestrictionModel productRestriction, PreviewDataModel previewContext)Returns products for product restrictionprotected ProductServicegetProductService()AbstractRestrictionModelgetRestriction(java.lang.String id)Returns a restriction via its idjava.util.List<AbstractRestrictionModel>getRestrictionsByName(java.lang.String name)Returns a restriction via its namejava.util.Collection<AbstractRestrictionModel>getRestrictionsForPage(AbstractPageModel page)Returns all restrictions which are applied on the given pagejava.util.Collection<AbstractRestrictionModel>getRestrictionsForPage(AbstractPageModel page, java.lang.String restrictionType)Returns all restrictions of the given restriction type which are applied on the given pagejava.util.Collection<AbstractRestrictionModel>getRestrictionsForPage(java.lang.String id, java.lang.String restrictionType)Returns all restrictions of the given restriction type which are applied on the given page (via its id)protected TypeServicegetTypeService()booleanhasOtherRelations(AbstractRestrictionModel restriction, AbstractPageModel page)Checks if a given restriction has also other relations than to the given pagebooleanhasOtherRelations(java.lang.String restrictionId, java.lang.String pageId)Checks if a given restriction has also other relations than to the given pageprotected voidprepareRestricion(AbstractRestrictionModel res, java.lang.String id, java.lang.String name)voidsetCategoryService(CategoryService categoryService)voidsetCmsAdminPageService(CMSAdminPageService cmsAdminPageService)voidsetCmsRestrictionDao(CMSRestrictionDao cmsRestrictionDao)voidsetCmsRestrictionService(CMSRestrictionService cmsRestrictionService)voidsetCommonI18NService(CommonI18NService commonI18NService)voidsetI18nService(I18NService i18nService)voidsetProductService(ProductService productService)voidsetTypeService(TypeService typeService)-
Methods inherited from class de.hybris.platform.cms2.servicelayer.services.admin.impl.AbstractCMSAdminService
getActiveCatalogVersion, getActiveSite, getBaseSiteService, getUserService, setBaseSiteService, 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
-
-
-
-
Field Detail
-
CATALOG_VERSIONS
protected static final java.lang.String CATALOG_VERSIONS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAllRestrictionTypes
public java.util.Collection<RestrictionTypeModel> getAllRestrictionTypes()
Description copied from interface:CMSAdminRestrictionServiceReturns a collection of all available restriction types.- Specified by:
getAllRestrictionTypesin interfaceCMSAdminRestrictionService- Returns:
- collection of all restriction types; never
null
-
createCatalogRestriction
public CMSCatalogRestrictionModel createCatalogRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<CatalogModel> catalogs) throws CMSItemCreateException
Description copied from interface:CMSAdminRestrictionServiceCreates a new CatalogRestriction and a new relation between the restriction and the given page.- Specified by:
createCatalogRestrictionin interfaceCMSAdminRestrictionService- Parameters:
page- page to be linked to the new restrictionid- id of the restrictionname- name of the restrictioncatalogs- list of catalogs for this restriction- Returns:
- a new catalog restriction
- Throws:
CMSItemCreateException- if the restriction could not be created
-
createCategoryRestriction
public CMSCategoryRestrictionModel createCategoryRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<CategoryModel> categories) throws CMSItemCreateException
Description copied from interface:CMSAdminRestrictionServiceCreates a new CategoryRestriction and a new relation between the restriction and the given page- Specified by:
createCategoryRestrictionin interfaceCMSAdminRestrictionService- Parameters:
page- page to be linked to the new restrictionid- id of the restrictionname- name of the restrictioncategories- list of categories for this restriction- Returns:
- a new category restriction
- Throws:
CMSItemCreateException- if the restriction could not be created
-
createProductRestriction
public CMSProductRestrictionModel createProductRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<ProductModel> products) throws CMSItemCreateException
Description copied from interface:CMSAdminRestrictionServiceCreates a new ProductRestriction and a new relation between the restriction and the given page- Specified by:
createProductRestrictionin interfaceCMSAdminRestrictionService- Parameters:
page- page to be linked to the new restrictionid- id of the restrictionname- name of the restrictionproducts- list of products for this restriction- Returns:
- a new product restriction
- Throws:
CMSItemCreateException- if the restriction could not be created
-
createRelation
public void createRelation(AbstractPageModel page, AbstractRestrictionModel restriction)
Description copied from interface:CMSAdminRestrictionServicecreates a new relation between the given page and the given restriction- Specified by:
createRelationin interfaceCMSAdminRestrictionService- Parameters:
page- the page modelrestriction- the restriction model
-
createRelation
public void createRelation(java.lang.String pageId, java.lang.String restrictionId) throws CMSItemNotFoundExceptionDescription copied from interface:CMSAdminRestrictionServicecreates a new relation between the given page (pageId) and the given restriction (restrictionId)- Specified by:
createRelationin interfaceCMSAdminRestrictionService- Parameters:
pageId- the page idrestrictionId- the restriciton id- Throws:
CMSItemNotFoundException- if the page and/or restriction is not found
-
createTimeRestriction
public CMSTimeRestrictionModel createTimeRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Date from, java.util.Date until) throws CMSItemCreateException
Description copied from interface:CMSAdminRestrictionServiceCreates a new TimeRestriction and a new relation between the restriction and the given page- Specified by:
createTimeRestrictionin interfaceCMSAdminRestrictionService- Parameters:
page- page to be linked to the new restrictionid- id of the restrictionname- name of the restrictionfrom- restriction is active fromuntil- restriction is active until- Returns:
- a new time restriction
- Throws:
CMSItemCreateException- if the restriction could not be created
-
createUserGroupRestriction
public CMSUserGroupRestrictionModel createUserGroupRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<UserGroupModel> userGroups) throws CMSItemCreateException
Description copied from interface:CMSAdminRestrictionServiceCreates a new UserGroupRestriction and a new relation between the restriction and the given page- Specified by:
createUserGroupRestrictionin interfaceCMSAdminRestrictionService- Parameters:
page- page to be linked to the new restrictionid- id of the restrictionname- name of the restrictionuserGroups- list of user groups for this restriction- Returns:
- a new user group restriction
- Throws:
CMSItemCreateException- if the restriction could not be created
-
createUserRestriction
public CMSUserRestrictionModel createUserRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<UserModel> users) throws CMSItemCreateException
Description copied from interface:CMSAdminRestrictionServiceCreates a new UserRestriction and a new relation between the restriction and the given page- Specified by:
createUserRestrictionin interfaceCMSAdminRestrictionService- Parameters:
page- page to be linked to the new restrictionid- id of the restrictionname- name of the restrictionusers- list of users for this restriction- Returns:
- a new user restriction
- Throws:
CMSItemCreateException- if the restriction could not be created
-
createCampaignRestriction
public CMSCampaignRestrictionModel createCampaignRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<CampaignModel> campaigns) throws CMSItemCreateException
Description copied from interface:CMSAdminRestrictionServiceCreates a new CampaignRestriction and a new relation between the restriction and the given page- Specified by:
createCampaignRestrictionin interfaceCMSAdminRestrictionService- Parameters:
page- page to be linked to the new restrictionid- id of the restrictionname- name of the restrictioncampaigns- list of campaigns for this restriction- Returns:
- a new campaign restriction
- Throws:
CMSItemCreateException- if the restriction could not be created
-
deleteRelation
public void deleteRelation(AbstractRestrictionModel restriction, AbstractPageModel page)
Description copied from interface:CMSAdminRestrictionServicedeletes the relation between the restriction and the page- Specified by:
deleteRelationin interfaceCMSAdminRestrictionService- Parameters:
restriction- the restriciton modelpage- the page model
-
deleteRelation
public void deleteRelation(java.lang.String restrictionId, java.lang.String pageId) throws CMSItemNotFoundExceptionDescription copied from interface:CMSAdminRestrictionServicedeletes the relation between the restriction and the page- Specified by:
deleteRelationin interfaceCMSAdminRestrictionService- Parameters:
restrictionId- the restriction idpageId- the page id- Throws:
CMSItemNotFoundException- if the restriction and/or page is not found
-
getAllowedRestrictionTypesForPage
public java.util.Collection<RestrictionTypeModel> getAllowedRestrictionTypesForPage(AbstractPageModel page)
Description copied from interface:CMSAdminRestrictionServiceReturns a collection of all restrictions which can be applied on the given page- Specified by:
getAllowedRestrictionTypesForPagein interfaceCMSAdminRestrictionService- Parameters:
page- the page model- Returns:
- all restriction types applicable for a given page
-
getAllowedRestrictionTypesForPage
public java.util.Collection<RestrictionTypeModel> getAllowedRestrictionTypesForPage(java.lang.String id) throws CMSItemNotFoundException
Description copied from interface:CMSAdminRestrictionServiceReturns a collection of all restrictions which can be applied on the given page (via its id)- Specified by:
getAllowedRestrictionTypesForPagein interfaceCMSAdminRestrictionService- Parameters:
id- id of page- Returns:
- all restriction types applicable for a given page
- Throws:
CMSItemNotFoundException- if the page is not found
-
getAllRestrictionsByType
public java.util.Collection<AbstractRestrictionModel> getAllRestrictionsByType(java.lang.String restrictionType) throws CMSItemNotFoundException
Description copied from interface:CMSAdminRestrictionServiceReturns all restriction of the given restriction type- Specified by:
getAllRestrictionsByTypein interfaceCMSAdminRestrictionService- Parameters:
restrictionType- ComposedType code of restriction- Returns:
- all restrictions for a given restriction type
- Throws:
CMSItemNotFoundException- if the composed type is not found
-
getAllRestrictionsByTypeNotLinkedToPage
public java.util.Collection<AbstractRestrictionModel> getAllRestrictionsByTypeNotLinkedToPage(java.lang.String pageId, java.lang.String restrictionType) throws CMSItemNotFoundException
Description copied from interface:CMSAdminRestrictionServiceReturns all restrictions of the given restriction type which are currently not linked to the given page (via its id)- Specified by:
getAllRestrictionsByTypeNotLinkedToPagein interfaceCMSAdminRestrictionService- Parameters:
pageId- id of the pagerestrictionType- composed type code of restriction- Returns:
- all restrictions of a given restriction type which are not currently linked to a given page
- Throws:
CMSItemNotFoundException- if the page or the composed type is not found
-
getCategories
public java.util.List<CategoryModel> getCategories(CMSCategoryRestrictionModel categoryRestriction, PreviewDataModel previewContext)
Description copied from interface:CMSAdminRestrictionServiceReturns products for product restriction- Specified by:
getCategoriesin interfaceCMSAdminRestrictionService- Parameters:
categoryRestriction- given restrictionpreviewContext- preview context information- Returns:
- products attached to productRestriction
-
findCategoriesInLocalSession
protected void findCategoriesInLocalSession(PreviewDataModel previewContext, java.util.List<CategoryModel> ret, java.util.Collection<java.lang.String> categoryListCodes)
-
getProducts
public java.util.List<ProductModel> getProducts(CMSProductRestrictionModel productRestriction, PreviewDataModel previewContext)
Description copied from interface:CMSAdminRestrictionServiceReturns products for product restriction- Specified by:
getProductsin interfaceCMSAdminRestrictionService- Parameters:
productRestriction- given restrictionpreviewContext- preview context information- Returns:
- products attached to productRestriction
-
findProductsInLocalSession
protected void findProductsInLocalSession(PreviewDataModel previewContext, java.util.List<ProductModel> ret, java.util.Collection<java.lang.String> productListCodes)
-
getRestriction
public AbstractRestrictionModel getRestriction(java.lang.String id) throws CMSItemNotFoundException
Description copied from interface:CMSAdminRestrictionServiceReturns a restriction via its id- Specified by:
getRestrictionin interfaceCMSAdminRestrictionService- Parameters:
id- id of restriction- Returns:
- the restriction for a given id
- Throws:
CMSItemNotFoundException- if no restriction with the given id is found
-
getRestrictionsByName
public java.util.List<AbstractRestrictionModel> getRestrictionsByName(java.lang.String name) throws CMSItemNotFoundException
Description copied from interface:CMSAdminRestrictionServiceReturns a restriction via its name- Specified by:
getRestrictionsByNamein interfaceCMSAdminRestrictionService- Parameters:
name- name of restriction- Returns:
- the restriction for a given name
- Throws:
CMSItemNotFoundException- if no restriction with the given name is found
-
getRestrictionsForPage
public java.util.Collection<AbstractRestrictionModel> getRestrictionsForPage(AbstractPageModel page, java.lang.String restrictionType) throws CMSItemNotFoundException
Description copied from interface:CMSAdminRestrictionServiceReturns all restrictions of the given restriction type which are applied on the given page- Specified by:
getRestrictionsForPagein interfaceCMSAdminRestrictionService- Parameters:
page- the page modelrestrictionType- ComposedType code of restriction- Returns:
- all restrictions applied for a given page
- Throws:
CMSItemNotFoundException- if the page or the composed type is not found
-
getRestrictionsForPage
public java.util.Collection<AbstractRestrictionModel> getRestrictionsForPage(java.lang.String id, java.lang.String restrictionType) throws CMSItemNotFoundException
Description copied from interface:CMSAdminRestrictionServiceReturns all restrictions of the given restriction type which are applied on the given page (via its id)- Specified by:
getRestrictionsForPagein interfaceCMSAdminRestrictionService- Parameters:
id- id of pagerestrictionType- ComposedType code of restriction- Returns:
- all restrictions applied for a given page
- Throws:
CMSItemNotFoundException- if the page or the composed type is not found
-
hasOtherRelations
public boolean hasOtherRelations(AbstractRestrictionModel restriction, AbstractPageModel page)
Description copied from interface:CMSAdminRestrictionServiceChecks if a given restriction has also other relations than to the given page- Specified by:
hasOtherRelationsin interfaceCMSAdminRestrictionService- Parameters:
restriction- the restriciton modelpage- the page model- Returns:
- true if there are also other relations, otherwise false
-
hasOtherRelations
public boolean hasOtherRelations(java.lang.String restrictionId, java.lang.String pageId) throws CMSItemNotFoundExceptionDescription copied from interface:CMSAdminRestrictionServiceChecks if a given restriction has also other relations than to the given page- Specified by:
hasOtherRelationsin interfaceCMSAdminRestrictionService- Parameters:
restrictionId- the restriction idpageId- the page id- Returns:
- true if there are also other relations, otherwise false
- Throws:
CMSItemNotFoundException- if the restriction and/or page is not found
-
getAllRestrictions
public java.util.Collection<AbstractRestrictionModel> getAllRestrictions()
Description copied from interface:CMSAdminRestrictionServiceReturns all restriction- Specified by:
getAllRestrictionsin interfaceCMSAdminRestrictionService- Returns:
- collection of restrictions; never
null
-
getRestrictionsForPage
public java.util.Collection<AbstractRestrictionModel> getRestrictionsForPage(AbstractPageModel page)
Description copied from interface:CMSAdminRestrictionServiceReturns all restrictions which are applied on the given page- Specified by:
getRestrictionsForPagein interfaceCMSAdminRestrictionService- Parameters:
page- - the page for which we want to retrieve restrictions- Returns:
- all restrictions applied for a given page
-
getCategoryService
protected CategoryService getCategoryService()
-
setCategoryService
public void setCategoryService(CategoryService categoryService)
-
getCmsAdminPageService
protected CMSAdminPageService getCmsAdminPageService()
-
setCmsAdminPageService
public void setCmsAdminPageService(CMSAdminPageService cmsAdminPageService)
-
getCmsRestrictionDao
protected CMSRestrictionDao getCmsRestrictionDao()
-
setCmsRestrictionDao
public void setCmsRestrictionDao(CMSRestrictionDao cmsRestrictionDao)
-
getCmsRestrictionService
protected CMSRestrictionService getCmsRestrictionService()
-
setCmsRestrictionService
public void setCmsRestrictionService(CMSRestrictionService cmsRestrictionService)
-
getCommonI18NService
protected CommonI18NService getCommonI18NService()
-
setCommonI18NService
public void setCommonI18NService(CommonI18NService commonI18NService)
-
getI18nService
protected I18NService getI18nService()
-
setI18nService
public void setI18nService(I18NService i18nService)
-
getProductService
protected ProductService getProductService()
-
setProductService
public void setProductService(ProductService productService)
-
getTypeService
protected TypeService getTypeService()
-
setTypeService
public void setTypeService(TypeService typeService)
-
getComposedTypeModel
protected ComposedTypeModel getComposedTypeModel(java.lang.String composedType) throws CMSItemNotFoundException
- Throws:
CMSItemNotFoundException
-
getLocalLocale
protected java.util.Locale getLocalLocale(PreviewDataModel previewContext)
-
getLocalUser
protected UserModel getLocalUser(PreviewDataModel previewContext)
-
prepareRestricion
protected void prepareRestricion(AbstractRestrictionModel res, java.lang.String id, java.lang.String name) throws CMSItemCreateException
- Throws:
CMSItemCreateException
-
-