public static class ItemModelCloneCreator.CopyContext
extends java.lang.Object
| Constructor and Description |
|---|
CopyContext()
Creates a new copy context.
|
CopyContext(ModelCloningContext cloningContext)
Creates a new copy context with cloning context
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(ItemModelCloneCreator.CopyItem item)
Adds a new (partOf) item copy wrapper to the context.
|
void |
addPreset(ItemModel srcItem,
java.lang.String qualifier,
java.lang.Object value)
Defines a attribute value to be used when creating a copy instead of the original attribute value.
|
protected java.util.Collection<ItemModelCloneCreator.CopyItem> |
getAll()
Returns all item copy wrappers.
|
ItemModel |
getCopy(ItemModel original)
Returns copy for specified (partOf) source item.
|
protected ItemModelCloneCreator.CopyItem |
getCopyWrapper(ItemModel original)
Returns associated copy wrapper for a given (partOf) source item
|
java.util.Collection<ItemModelCloneCreator.CopyItem> |
getPendingItems()
Returns all item wrappers which have not been copied or hold attributes which are not copied completely.
|
protected java.lang.Object |
getPreset(ItemModel src,
java.lang.String qualifier) |
protected java.util.Map<java.lang.String,java.lang.Object> |
getPresets(ItemModel src)
Returns all preset values of a source item.
|
ComposedTypeModel |
getTargetType(ItemModel original)
Tells which type should be used for creating a copy of the specified original item.
|
protected boolean |
gotPreset(ItemModel src,
java.lang.String qualifier)
Tells if a attribute got a preset value or not.
|
boolean |
hasPendingItems()
Tells whether or not the context contains (partOf) items witch are not copied yet or have attributes which have
not been copied completely.
|
boolean |
mustBeTranslated(ItemModel original)
Tells whether or not the item has been registered as (partOf) item to be copied.
|
protected boolean |
skipAttribute(java.lang.Object original,
java.lang.String qualifier)
tell us if attribute have to be skipped
|
protected boolean |
treatAsPartOf(java.lang.Object original,
java.lang.String qualifier)
tell us if attribute have to be treated as part of
|
public CopyContext()
public CopyContext(ModelCloningContext cloningContext)
protected boolean skipAttribute(java.lang.Object original,
java.lang.String qualifier)
protected boolean treatAsPartOf(java.lang.Object original,
java.lang.String qualifier)
public ComposedTypeModel getTargetType(ItemModel original)
public void addPreset(ItemModel srcItem, java.lang.String qualifier, java.lang.Object value)
Media original = ... ItemCloneCreator creator = new ItemCloneCreator(); CopyContext ctx = new CopyContext(); ctx.addPreset( original, Media.CODE, original.getCode()+"(copy") ); Media copy = creator.copy( original, ctx );Since you may specify multiple source items it's possible to add preset values for partOf items as well.
srcItem - the source item which is used for copyingqualifier - the attribute qualifiervalue - the value to useprotected boolean gotPreset(ItemModel src, java.lang.String qualifier)
protected java.util.Map<java.lang.String,java.lang.Object> getPresets(ItemModel src)
protected java.lang.Object getPreset(ItemModel src, java.lang.String qualifier)
protected java.util.Collection<ItemModelCloneCreator.CopyItem> getAll()
protected void add(ItemModelCloneCreator.CopyItem item)
public boolean mustBeTranslated(ItemModel original)
original - the item to checkprotected ItemModelCloneCreator.CopyItem getCopyWrapper(ItemModel original)
public ItemModel getCopy(ItemModel original)
original - null if it hasn't been copied yetjava.lang.IllegalArgumentException - if item is not registered as (partOf) item to be copiedpublic boolean hasPendingItems()
public java.util.Collection<ItemModelCloneCreator.CopyItem> getPendingItems()
Copyright © 2018 SAP SE. All Rights Reserved.