Class CMSItemModelCloneCreator
java.lang.Object
de.hybris.platform.servicelayer.internal.model.impl.ItemModelCloneCreator
de.hybris.platform.cms2.cloning.service.impl.CMSItemModelCloneCreator
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 CMSCopyContext the caller may even add some
preset values or define which types are being used when creating copied of part-of models.
Note: CMSModelCloningContext extends the ModelCloningContext to use a CMSCopyContext instead
of the original ItemModelCloneCreator.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
ConstructorsConstructorDescriptionCMSItemModelCloneCreator(ModelService modelService, I18NService i18nService, TypeService typeService) Creates and initialize ItemModelCloneCreator -
Method Summary
Modifier and TypeMethodDescriptionCreates a copy of the given item.copy(ItemModel original, CMSCopyContext ctx) Creates a copy of the given item.copy(ItemModel original, ModelCloningContext cloningContext) Creates a copy of the given item.copy(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 Details
-
CMSItemModelCloneCreator
public CMSItemModelCloneCreator() -
CMSItemModelCloneCreator
public CMSItemModelCloneCreator(ModelService modelService, I18NService i18nService, TypeService typeService) Creates and initialize ItemModelCloneCreator
-
-
Method Details
-
copy
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
-