Class ContentSlotCloningStrategy
java.lang.Object
de.hybris.platform.cms2.cloning.strategy.impl.ContentSlotCloningStrategy
- All Implemented Interfaces:
CMSCloningStrategy<ContentSlotModel>
public class ContentSlotCloningStrategy
extends Object
implements CMSCloningStrategy<ContentSlotModel>
This strategy clones a content slot and either deep clones its cms components or excludes them all based on the context
value "cloneAction"
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuildCloneContentSlotModel(AbstractPageModel sourcePage, ContentSlotModel sourceContentSlotModel, Boolean isSlotCustom, ContentSlotModel clonedContentSlotModel, CloneAction cloneAction) clone(ContentSlotModel sourceContentSlotModel, Optional<ContentSlotModel> template, Optional<Map<String, Object>> context) Clones the CMS item given by the source universal identifier.protected voidcreateContentSlotForPageRelation(CatalogVersionModel catalogVersionModel, String position, AbstractPageModel pageModel, ContentSlotModel contentSlotModel) Creates a new ContentSlotForPageModelprotected voidcreateContentSlotForTemplateRelation(CatalogVersionModel catalogVersion, String position, PageTemplateModel pageTemplate, ContentSlotModel contentSlotModel) Method creates a content slot for template relation.protected booleancustomPositionIsAvailable(AbstractPageModel sourcePage, String targetPosition) Validates whether the position of the new created custom slot can be used or it's already taken by another custom slot.protected CatalogVersionServiceprotected CMSAdminContentSlotServiceprotected CMSItemCloningServiceprotected SessionSearchRestrictionsDisablerprotected ModelServicevoidsetCatalogVersionService(CatalogVersionService catalogVersionService) voidsetCmsAdminContentSlotService(CMSAdminContentSlotService cmsAdminContentSlotService) voidsetCmsContentSlotService(CMSContentSlotService cmsContentSlotService) voidsetCmsItemCloningService(CMSItemCloningService cmsItemCloningService) voidsetCmsSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler cmsSessionSearchRestrictionsDisabler) voidsetModelService(ModelService modelService)
-
Constructor Details
-
ContentSlotCloningStrategy
public ContentSlotCloningStrategy()
-
-
Method Details
-
clone
public ContentSlotModel clone(ContentSlotModel sourceContentSlotModel, Optional<ContentSlotModel> template, Optional<Map<String, Object>> context) throws CMSItemNotFoundExceptionDescription copied from interface:CMSCloningStrategyClones the CMS item given by the source universal identifier. If a template is provided, it may be augmented, otherwise a new item may be created.- Specified by:
clonein interfaceCMSCloningStrategy<ContentSlotModel>- Parameters:
sourceContentSlotModel- the cms item model to be copiedtemplate- (optional) the template of the cloned item that may be augmentedcontext- (optional) this map contains any context specific data required to clone the item- Returns:
- the cloned CMS item model
- Throws:
CMSItemNotFoundException- when no CMS item with the given source Uid can be found
-
buildCloneContentSlotModel
protected void buildCloneContentSlotModel(AbstractPageModel sourcePage, ContentSlotModel sourceContentSlotModel, Boolean isSlotCustom, ContentSlotModel clonedContentSlotModel, CloneAction cloneAction) -
customPositionIsAvailable
Validates whether the position of the new created custom slot can be used or it's already taken by another custom slot.- Parameters:
sourcePage- the page on which the position is checkedtargetPosition- the target position- Returns:
- true if the position is available on page, false otherwise
-
createContentSlotForPageRelation
protected void createContentSlotForPageRelation(CatalogVersionModel catalogVersionModel, String position, AbstractPageModel pageModel, ContentSlotModel contentSlotModel) Creates a new ContentSlotForPageModel- Parameters:
catalogVersionModel- the catalog version of the ContentSlotForPageModelposition- the position of the content slot with respect to other slots on the page. Same as the source content slot.pageModel- the page where the content slot will be associated to. Same as the source content slot.contentSlotModel- the cloned content slot
-
createContentSlotForTemplateRelation
protected void createContentSlotForTemplateRelation(CatalogVersionModel catalogVersion, String position, PageTemplateModel pageTemplate, ContentSlotModel contentSlotModel) Method creates a content slot for template relation.- Parameters:
catalogVersion- the catalog version where the relation must be createdposition- the position of the slotpageTemplate- the page template to which the association must be createdcontentSlotModel- the content slot that will be associated with a template
-
getCmsSessionSearchRestrictionsDisabler
-
setCmsSessionSearchRestrictionsDisabler
public void setCmsSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler cmsSessionSearchRestrictionsDisabler) -
getCatalogVersionService
-
setCatalogVersionService
-
getCmsItemCloningService
-
setCmsItemCloningService
-
getModelService
-
setModelService
-
getCmsAdminContentSlotService
-
setCmsAdminContentSlotService
-
getCmsContentSlotService
-
setCmsContentSlotService
-