Interface CMSAdminRestrictionService
-
- All Known Implementing Classes:
DefaultCMSAdminRestrictionService
public interface CMSAdminRestrictionServiceService to manage restrictions and the relations between pages and restrictions. All methods work on the active catalogVersion of the current user.- Spring Bean ID:
- cmsAdminRestrictionService
-
-
Method Summary
All Methods Instance Methods Abstract 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 pagejava.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 pageId)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 restrictionjava.util.List<ProductModel>getProducts(CMSProductRestrictionModel productRestriction, PreviewDataModel previewContext)Returns products for product restrictionAbstractRestrictionModelgetRestriction(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 pageId, java.lang.String restrictionType)Returns all restrictions of the given restriction type which are applied on the given page (via its id)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 page
-
-
-
Method Detail
-
getAllRestrictionTypes
java.util.Collection<RestrictionTypeModel> getAllRestrictionTypes()
Returns a collection of all available restriction types.- Returns:
- collection of all restriction types; never
null
-
getAllowedRestrictionTypesForPage
java.util.Collection<RestrictionTypeModel> getAllowedRestrictionTypesForPage(java.lang.String pageId) throws CMSItemNotFoundException
Returns a collection of all restrictions which can be applied on the given page (via its id)- Parameters:
pageId- id of page- Returns:
- all restriction types applicable for a given page
- Throws:
CMSItemNotFoundException- if the page is not found
-
getAllowedRestrictionTypesForPage
java.util.Collection<RestrictionTypeModel> getAllowedRestrictionTypesForPage(AbstractPageModel page)
Returns a collection of all restrictions which can be applied on the given page- Parameters:
page- the page model- Returns:
- all restriction types applicable for a given page
-
getRestrictionsForPage
java.util.Collection<AbstractRestrictionModel> getRestrictionsForPage(java.lang.String pageId, java.lang.String restrictionType) throws CMSItemNotFoundException
Returns all restrictions of the given restriction type which are applied on the given page (via its id)- Parameters:
pageId- 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
-
getRestrictionsForPage
java.util.Collection<AbstractRestrictionModel> getRestrictionsForPage(AbstractPageModel page, java.lang.String restrictionType) throws CMSItemNotFoundException
Returns all restrictions of the given restriction type which are applied on the given page- 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
java.util.Collection<AbstractRestrictionModel> getRestrictionsForPage(AbstractPageModel page)
Returns all restrictions which are applied on the given page- Parameters:
page- - the page for which we want to retrieve restrictions- Returns:
- all restrictions applied for a given page
-
getAllRestrictionsByType
java.util.Collection<AbstractRestrictionModel> getAllRestrictionsByType(java.lang.String restrictionType) throws CMSItemNotFoundException
Returns all restriction of the given restriction type- Parameters:
restrictionType- ComposedType code of restriction- Returns:
- all restrictions for a given restriction type
- Throws:
CMSItemNotFoundException- if the composed type is not found
-
getAllRestrictionsByTypeNotLinkedToPage
java.util.Collection<AbstractRestrictionModel> getAllRestrictionsByTypeNotLinkedToPage(java.lang.String pageId, java.lang.String restrictionType) throws CMSItemNotFoundException
Returns all restrictions of the given restriction type which are currently not linked to the given page (via its id)- 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
-
getRestriction
AbstractRestrictionModel getRestriction(java.lang.String id) throws CMSItemNotFoundException
Returns a restriction via its id- Parameters:
id- id of restriction- Returns:
- the restriction for a given id
- Throws:
CMSItemNotFoundException- if no restriction with the given id is found
-
getRestrictionsByName
java.util.List<AbstractRestrictionModel> getRestrictionsByName(java.lang.String name) throws CMSItemNotFoundException
Returns a restriction via its name- Parameters:
name- name of restriction- Returns:
- the restriction for a given name
- Throws:
CMSItemNotFoundException- if no restriction with the given name is found
-
getAllRestrictions
java.util.Collection<AbstractRestrictionModel> getAllRestrictions()
Returns all restriction- Returns:
- collection of restrictions; never
null
-
createCategoryRestriction
CMSCategoryRestrictionModel createCategoryRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<CategoryModel> categories) throws CMSItemCreateException
Creates a new CategoryRestriction and a new relation between the restriction and the given page- 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
CMSProductRestrictionModel createProductRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<ProductModel> products) throws CMSItemCreateException
Creates a new ProductRestriction and a new relation between the restriction and the given page- 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
-
createTimeRestriction
CMSTimeRestrictionModel createTimeRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Date from, java.util.Date until) throws CMSItemCreateException
Creates a new TimeRestriction and a new relation between the restriction and the given page- 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
-
createUserRestriction
CMSUserRestrictionModel createUserRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<UserModel> users) throws CMSItemCreateException
Creates a new UserRestriction and a new relation between the restriction and the given page- 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
-
createUserGroupRestriction
CMSUserGroupRestrictionModel createUserGroupRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<UserGroupModel> userGroups) throws CMSItemCreateException
Creates a new UserGroupRestriction and a new relation between the restriction and the given page- 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
-
createCatalogRestriction
CMSCatalogRestrictionModel createCatalogRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<CatalogModel> catalogs) throws CMSItemCreateException
Creates a new CatalogRestriction and a new relation between the restriction and the given page.- 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
-
createCampaignRestriction
CMSCampaignRestrictionModel createCampaignRestriction(AbstractPageModel page, java.lang.String id, java.lang.String name, java.util.Collection<CampaignModel> campaigns) throws CMSItemCreateException
Creates a new CampaignRestriction and a new relation between the restriction and the given page- 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
-
createRelation
void createRelation(AbstractPageModel page, AbstractRestrictionModel restriction)
creates a new relation between the given page and the given restriction- Parameters:
page- the page modelrestriction- the restriction model
-
createRelation
void createRelation(java.lang.String pageId, java.lang.String restrictionId) throws CMSItemNotFoundExceptioncreates a new relation between the given page (pageId) and the given restriction (restrictionId)- Parameters:
pageId- the page idrestrictionId- the restriciton id- Throws:
CMSItemNotFoundException- if the page and/or restriction is not found
-
hasOtherRelations
boolean hasOtherRelations(AbstractRestrictionModel restriction, AbstractPageModel page)
Checks if a given restriction has also other relations than to the given page- Parameters:
restriction- the restriciton modelpage- the page model- Returns:
- true if there are also other relations, otherwise false
-
hasOtherRelations
boolean hasOtherRelations(java.lang.String restrictionId, java.lang.String pageId) throws CMSItemNotFoundExceptionChecks if a given restriction has also other relations than to the given page- 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
-
deleteRelation
void deleteRelation(AbstractRestrictionModel restriction, AbstractPageModel page)
deletes the relation between the restriction and the page- Parameters:
restriction- the restriciton modelpage- the page model
-
deleteRelation
void deleteRelation(java.lang.String restrictionId, java.lang.String pageId) throws CMSItemNotFoundExceptiondeletes the relation between the restriction and the page- Parameters:
restrictionId- the restriction idpageId- the page id- Throws:
CMSItemNotFoundException- if the restriction and/or page is not found
-
getProducts
java.util.List<ProductModel> getProducts(CMSProductRestrictionModel productRestriction, PreviewDataModel previewContext)
Returns products for product restriction- Parameters:
productRestriction- given restrictionpreviewContext- preview context information- Returns:
- products attached to productRestriction
-
getCategories
java.util.List<CategoryModel> getCategories(CMSCategoryRestrictionModel categoryRestriction, PreviewDataModel previewContext)
Returns products for product restriction- Parameters:
categoryRestriction- given restrictionpreviewContext- preview context information- Returns:
- products attached to productRestriction
-
-