public class ItemModelCloneCreator
extends java.lang.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
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
consume(java.util.Collection<ItemModelCloneCreator.CopyAttribute> readyAttributes) |
ItemModel |
copy(ComposedType targetType,
ItemModel original,
ItemModelCloneCreator.CopyContext ctx)
Deprecated.
since ages - use
copy(ComposedTypeModel, ItemModel, CopyContext) |
ItemModel |
copy(ComposedTypeModel targetType,
ItemModel original,
ItemModelCloneCreator.CopyContext ctx)
Creates a copy of the given item.
|
ItemModel |
copy(ComposedTypeModel targetType,
ItemModel original,
ModelCloningContext ctx)
Creates a copy of the given item.
|
ItemModel |
copy(ItemModel original)
Creates a copy of the given item.
|
ItemModel |
copy(ItemModel original,
ItemModelCloneCreator.CopyContext ctx)
Creates a copy of the given item.
|
ItemModel |
copy(ItemModel original,
ModelCloningContext cloningContext)
Creates a copy of the given item.
|
java.util.List<ItemModel> |
copyAll(ComposedTypeModel targetType,
java.util.List<ItemModel> originals,
ItemModelCloneCreator.CopyContext ctx)
Creates copies of all specified items using a single copy context.
|
java.util.List<ItemModel> |
copyAll(java.util.List<ItemModel> originals,
ItemModelCloneCreator.CopyContext ctx)
Creates copies of all specified items using a single copy context.
|
void |
copyAttributes(ItemModel source,
ItemModel target,
java.util.Set<java.lang.String> attributes)
Copies only given set of
attributes from the source to the target model. |
protected void |
findPartOfItems(java.lang.Object originalValue,
ItemModelCloneCreator.CopyContext ctx)
makes copy of partof items
|
protected boolean |
isEmpty(java.lang.Object value)
Return true if value is null or value is empty collection/map.
|
protected ItemModelCloneCreator.CopyItem |
prepareCopy(ComposedType targetType,
ItemModel original,
ItemModelCloneCreator.CopyContext ctx)
Deprecated.
since ages - use
prepareCopy(ComposedTypeModel, ItemModel, CopyContext) |
protected ItemModelCloneCreator.CopyItem |
prepareCopy(ComposedTypeModel targetType,
ItemModel original,
ItemModelCloneCreator.CopyContext ctx)
prepare copy of original.
|
protected boolean |
process(ItemModelCloneCreator.CopyItem item,
ItemModelCloneCreator.CopyContext ctx) |
protected void |
readAttributes(ItemModelCloneCreator.CopyItem item,
ItemModelCloneCreator.CopyContext ctx) |
protected void |
setAllAttributes(ItemModel copy,
java.util.Collection<ItemModelCloneCreator.CopyAttribute> attributes) |
protected java.lang.Object |
translateAttributeValue(ItemModelCloneCreator.CopyAttribute attr,
java.lang.Object originalValue,
ItemModelCloneCreator.CopyContext ctx) |
protected java.util.Collection<ItemModelCloneCreator.CopyAttribute> |
translatePendingAttributes(ItemModelCloneCreator.CopyItem item,
ItemModelCloneCreator.CopyContext ctx) |
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 java.util.List<ItemModel> copyAll(java.util.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 java.util.List<ItemModel> copyAll(ComposedTypeModel targetType, java.util.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, java.util.Set<java.lang.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(java.lang.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(java.lang.Object originalValue,
ItemModelCloneCreator.CopyContext ctx)
protected boolean process(ItemModelCloneCreator.CopyItem item, ItemModelCloneCreator.CopyContext ctx)
protected void setAllAttributes(ItemModel copy, java.util.Collection<ItemModelCloneCreator.CopyAttribute> attributes)
protected void consume(java.util.Collection<ItemModelCloneCreator.CopyAttribute> readyAttributes)
protected java.util.Collection<ItemModelCloneCreator.CopyAttribute> translatePendingAttributes(ItemModelCloneCreator.CopyItem item, ItemModelCloneCreator.CopyContext ctx)
protected java.lang.Object translateAttributeValue(ItemModelCloneCreator.CopyAttribute attr, java.lang.Object originalValue, ItemModelCloneCreator.CopyContext ctx) throws ItemModelCloneCreator.CannotTranslateException
Copyright © 2018 SAP SE. All Rights Reserved.