Class CMSItemModelCloneCreator
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.model.impl.ItemModelCloneCreator
-
- de.hybris.platform.cms2.cloning.service.impl.CMSItemModelCloneCreator
-
public class CMSItemModelCloneCreator extends ItemModelCloneCreator
This class creates a deep copy of the given original model by creating a new model instance of the same type, reading all attributes values and stores them into the new instance.The only exception are part-of attribute values which consists of other models - these are cloned themselves and then used as attribute value in the new model instance.
By providing a
CMSCopyContextthe caller may even add some preset values or define which types are being used when creating copied of part-of models.Note:
CMSModelCloningContextextends theModelCloningContextto use aCMSCopyContextinstead of the originalItemModelCloneCreator.CopyContext.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.model.impl.ItemModelCloneCreator
ItemModelCloneCreator.CannotCloneException, ItemModelCloneCreator.CannotTranslateException, ItemModelCloneCreator.CopyAttribute, ItemModelCloneCreator.CopyContext, ItemModelCloneCreator.CopyItem
-
-
Constructor Summary
Constructors Constructor Description CMSItemModelCloneCreator()CMSItemModelCloneCreator(ModelService modelService, I18NService i18nService, TypeService typeService)Creates and initialize ItemModelCloneCreator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ItemModelcopy(ItemModel original)Creates a copy of the given item.ItemModelcopy(ItemModel original, CMSCopyContext ctx)Creates a copy of the given item.ItemModelcopy(ItemModel original, ModelCloningContext cloningContext)Creates a copy of the given item.ItemModelcopy(ComposedTypeModel targetType, ItemModel original, ModelCloningContext ctx)Creates a copy of the given item.-
Methods inherited from class de.hybris.platform.servicelayer.internal.model.impl.ItemModelCloneCreator
consume, copy, copy, copy, copyAll, copyAll, copyAttributes, findPartOfItems, isEmpty, prepareCopy, prepareCopy, process, readAttributes, setAllAttributes, translateAttributeValue, translatePendingAttributes
-
-
-
-
Constructor Detail
-
CMSItemModelCloneCreator
public CMSItemModelCloneCreator()
-
CMSItemModelCloneCreator
public CMSItemModelCloneCreator(ModelService modelService, I18NService i18nService, TypeService typeService)
Creates and initialize ItemModelCloneCreator
-
-
Method Detail
-
copy
public ItemModel copy(ItemModel original) throws ItemModelCloneCreator.CannotCloneException
Creates a copy of the given item.- Overrides:
copyin classItemModelCloneCreator- Parameters:
original- the item to copy- Throws:
ItemModelCloneCreator.CannotCloneException
-
copy
public ItemModel copy(ItemModel original, ModelCloningContext cloningContext) throws ItemModelCloneCreator.CannotCloneException
Creates a copy of the given item. Optionally cloning process can be influenced by providing a cloning context instance.- Overrides:
copyin classItemModelCloneCreator- Parameters:
original- the item to copycloningContext- the cloning context to manage cloning process- Throws:
ItemModelCloneCreator.CannotCloneException
-
copy
public ItemModel copy(ItemModel original, CMSCopyContext ctx) throws ItemModelCloneCreator.CannotCloneException
Creates a copy of the given item.- Parameters:
original- the item to copyctx- the copy context- Throws:
ItemModelCloneCreator.CannotCloneException
-
copy
public ItemModel copy(ComposedTypeModel targetType, ItemModel original, ModelCloningContext ctx) throws ItemModelCloneCreator.CannotCloneException
Creates a copy of the given item. Allows to specify a type for the new copy to be created.- Overrides:
copyin classItemModelCloneCreator- Parameters:
targetType- the type of copy to create (optional)original- the item to copyctx- the copy context- Throws:
ItemModelCloneCreator.CannotCloneException
-
-