public static class ItemCloneCreator.CopyContext extends Object
ItemCloneCreator.copy(ComposedType, Item, CopyContext). In
addition it allows to specify preset values to be used instead of original attributes.| Constructor and Description |
|---|
CopyContext()
Creates a new copy context.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
add(ItemCloneCreator.CopyItem item) |
void |
addCopyUntypedPropsFor(Collection<Item> sourceItems)
Switches on copying of untyped properties for the specified items.
|
void |
addCopyUntypedPropsFor(Item sourceItem)
Switches on copying of untyped properties for the specified item.
|
void |
addPreset(Item srcItem,
String qualifier,
Object value)
Defines a attribute value to be used when creating a copy instead of the original attribute value.
|
protected Collection<ItemCloneCreator.CopyItem> |
getAll() |
Item |
getCopy(Item original)
Returns copy for specified (partOf) source item.
|
protected Set<ItemCloneCreator.CopyItem> |
getCopyUntypedItems() |
protected ItemCloneCreator.CopyItem |
getCopyWrapper(Item original) |
Collection<ItemCloneCreator.CopyItem> |
getPendingItems()
Returns all item wrappers which have not been copied or hold attributes which are not copied completely.
|
protected Map<String,Object> |
getPresets(Item src) |
protected ComposedType |
getTargetType(Item original) |
protected boolean |
gotPreset(Item src,
String qualifier) |
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.
|
protected boolean |
isCopyUntypedPropsFor(ItemCloneCreator.CopyItem item) |
boolean |
mustBeTranslated(Item original)
Tells whether or not the item has been registered as (partOf) item to be copied.
|
protected ComposedType getTargetType(Item original)
public void addCopyUntypedPropsFor(Item sourceItem)
sourceItem - the original item to copy props frompublic void addCopyUntypedPropsFor(Collection<Item> sourceItems)
sourceItems - the original items to copy props fromprotected boolean isCopyUntypedPropsFor(ItemCloneCreator.CopyItem item)
protected Set<ItemCloneCreator.CopyItem> getCopyUntypedItems()
public void addPreset(Item srcItem, String qualifier, 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 Collection<ItemCloneCreator.CopyItem> getAll()
protected void add(ItemCloneCreator.CopyItem item)
public boolean mustBeTranslated(Item original)
original - the item to checkprotected ItemCloneCreator.CopyItem getCopyWrapper(Item original)
public Item getCopy(Item original)
original - null if it hasn't been copied yetIllegalArgumentException - if item is not registered as (partOf) item to be copiedpublic boolean hasPendingItems()
public Collection<ItemCloneCreator.CopyItem> getPendingItems()
Copyright © 2017 SAP SE. All Rights Reserved.