public class ItemModelCloneCreator extends Object
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 ItemModelCloneCreator.CopyContext the
caller may even add some preset values or define which types are being used when creating copied of part-of models.
| Modifier and Type | Class and Description |
|---|---|
static class |
ItemModelCloneCreator.CannotCloneException
Clone error class.
|
protected static class |
ItemModelCloneCreator.CannotTranslateException
Thrown when copy could not be done
|
static class |
ItemModelCloneCreator.CopyAttribute
A wrapper for each item attribute to be stored while creating a copy.
|
static class |
ItemModelCloneCreator.CopyContext |
static class |
ItemModelCloneCreator.CopyItem
Wrapper for a single (partOf) item to be copied.
|
| Constructor and Description |
|---|
ItemModelCloneCreator(ModelService modelService,
I18NService i18nService,
TypeService typeService)
Creates and initialize ItemModelCloneCreator
|
public ItemModelCloneCreator(ModelService modelService, I18NService i18nService, TypeService typeService)
public ItemModel copy(ItemModel original) throws ItemModelCloneCreator.CannotCloneException
original - the item to copyItemModelCloneCreator.CannotCloneExceptionpublic ItemModel copy(ItemModel original, ModelCloningContext cloningContext) throws ItemModelCloneCreator.CannotCloneException
original - the item to copycloningContext - the cloning context to manage cloning processItemModelCloneCreator.CannotCloneExceptionpublic ItemModel copy(ItemModel original, ItemModelCloneCreator.CopyContext ctx) throws ItemModelCloneCreator.CannotCloneException
original - the item to copyctx - the copy contextItemModelCloneCreator.CannotCloneException@Deprecated public ItemModel copy(ComposedType targetType, ItemModel original, ItemModelCloneCreator.CopyContext ctx) throws ItemModelCloneCreator.CannotCloneException
copy(ComposedTypeModel, ItemModel, CopyContext)public ItemModel copy(ComposedTypeModel targetType, ItemModel original, ModelCloningContext ctx) throws ItemModelCloneCreator.CannotCloneException
targetType - the type of copy to create (optional)original - the item to copyctx - the copy contextItemModelCloneCreator.CannotCloneExceptionpublic ItemModel copy(ComposedTypeModel targetType, ItemModel original, ItemModelCloneCreator.CopyContext ctx) throws ItemModelCloneCreator.CannotCloneException
targetType - the type of copy to create (optional)original - the item to copyctx - the copy contextItemModelCloneCreator.CannotCloneExceptionpublic List<ItemModel> copyAll(List<ItemModel> originals, ItemModelCloneCreator.CopyContext ctx) throws ItemModelCloneCreator.CannotCloneException
originals - the items to copyctx - the copy contextItemModelCloneCreator.CannotCloneException - in case not all items could be copied completely, e.g. due to cyclic dependenciespublic List<ItemModel> copyAll(ComposedTypeModel targetType, List<ItemModel> originals, ItemModelCloneCreator.CopyContext ctx) throws ItemModelCloneCreator.CannotCloneException
originals - the items to copyctx - the copy contexttargetType - ComposedTypeModel of the clonesItemModelCloneCreator.CannotCloneException - in case not all items could be copied completely, e.g. due to cyclic dependenciespublic void copyAttributes(ItemModel source, ItemModel target, Set<String> attributes)
attributes from the source to the target model.source - model from which attribute values are to be copiedtarget - model to copy attribute values toprotected void readAttributes(ItemModelCloneCreator.CopyItem item, ItemModelCloneCreator.CopyContext ctx)
protected boolean isEmpty(Object value)
@Deprecated protected ItemModelCloneCreator.CopyItem prepareCopy(ComposedType targetType, ItemModel original, ItemModelCloneCreator.CopyContext ctx)
prepareCopy(ComposedTypeModel, ItemModel, CopyContext)protected ItemModelCloneCreator.CopyItem prepareCopy(ComposedTypeModel targetType, ItemModel original, ItemModelCloneCreator.CopyContext ctx)
protected void findPartOfItems(Object originalValue, ItemModelCloneCreator.CopyContext ctx)
protected boolean process(ItemModelCloneCreator.CopyItem item, ItemModelCloneCreator.CopyContext ctx)
protected void setAllAttributes(ItemModel copy, Collection<ItemModelCloneCreator.CopyAttribute> attributes)
protected void consume(Collection<ItemModelCloneCreator.CopyAttribute> readyAttributes)
protected Collection<ItemModelCloneCreator.CopyAttribute> translatePendingAttributes(ItemModelCloneCreator.CopyItem item, ItemModelCloneCreator.CopyContext ctx)
protected Object translateAttributeValue(ItemModelCloneCreator.CopyAttribute attr, Object originalValue, ItemModelCloneCreator.CopyContext ctx) throws ItemModelCloneCreator.CannotTranslateException
Copyright © 2017 SAP SE. All Rights Reserved.