Interface CMSItemDeepCloningService
-
- All Known Implementing Classes:
DefaultCMSItemDeepCloningService
public interface CMSItemDeepCloningServiceService to deep clone item models by specifying aCMSModelCloningContextto theCMSItemModelCloneCreator.Note:
CMSModelCloningContextandCMSItemModelCloneCreatorrespectively extends theModelCloningContextandItemModelCloneCreatorto override some platform behaviour.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ItemModeldeepCloneComponent(ItemModel srcComponent, ModelCloningContext cloningContext)Creates a clone of the given component and deep copies all the component's attributes.java.lang.StringgenerateCloneComponentName(java.lang.String originalComponentName)Creates a new name to be used on a cloned component to avoid clashing with the original one.java.lang.StringgenerateCloneItemUid()Creates a uid consisting of the prefixclone_and a generated number.java.lang.StringgenerateCloneItemUid(java.lang.String originalUid)Creates a new uid to be used on a cloned item to avoid clashing with the original one.
-
-
-
Method Detail
-
deepCloneComponent
ItemModel deepCloneComponent(ItemModel srcComponent, ModelCloningContext cloningContext)
Creates a clone of the given component and deep copies all the component's attributes.- Parameters:
srcComponent- - the cms component to be clonedcloningContext- - the cloning context- Returns:
- a newly cloned component
-
generateCloneItemUid
java.lang.String generateCloneItemUid()
Creates a uid consisting of the prefixclone_and a generated number.- Returns:
- a new uid to be assigned to a cloned item; never null
-
generateCloneItemUid
java.lang.String generateCloneItemUid(java.lang.String originalUid)
Creates a new uid to be used on a cloned item to avoid clashing with the original one. Consisting of the following: - prefix (cms.item.deep.clone.attribute.uid.prefix in properties file) or "clone_" by default, - separator (cms.item.deep.clone.attribute.uid.separator in properties file) or "_" be default - generated number. Never adds the prefix if it already exists. The result length must not exceed the value cms.item.deep.clone.attribute.uid.max.length from properties or 100 by default.- Input: component1 Output: clone_component1_123
- Input: component1_123 Output: clone_component1_123_456
- Input: clone_component1_123 Output: clone_component1_123_789
- Parameters:
originalUid- - the original uid used as base for the clone uid- Returns:
- a new uid to be assigned to a cloned item; never null
-
generateCloneComponentName
java.lang.String generateCloneComponentName(java.lang.String originalComponentName)
Creates a new name to be used on a cloned component to avoid clashing with the original one. Consisting of the following: - prefix (cms.item.deep.clone.attribute.name.prefix in properties file) or "Clone" by default, - separator (cms.item.deep.clone.attribute.name.separator in properties file) or " " be default - generated number. Never adds the prefix if it already exists. The result length must not exceed the value cms.item.deep.clone.attribute.name.max.length from properties or 100 by default. Examples:- Input: component1 Output: Clone component1 123
- Input: component1 123 Output: component1 123 456
- Input: this is a component Output: Clone this is a component 789
- Input: Clone this is a component Output: Clone this is a component 789
- Parameters:
originalComponentName- - the original name to use as a base for the clone name.- Returns:
- the name to use for the cloned component
-
-