Package de.hybris.platform.jalo.type
Class ItemCloneCreator.CopyContext
java.lang.Object
de.hybris.platform.jalo.type.ItemCloneCreator.CopyContext
- Enclosing class:
- ItemCloneCreator
Context for collecting all items copied during
ItemCloneCreator.copy(ComposedType, Item, CopyContext). In
addition it allows to specify preset values to be used instead of original attributes.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadd(ItemCloneCreator.CopyItem item) voidaddCopyUntypedPropsFor(Item sourceItem) Switches on copying of untyped properties for the specified item.voidaddCopyUntypedPropsFor(Collection<Item> sourceItems) Switches on copying of untyped properties for the specified items.voidDefines a attribute value to be used when creating a copy instead of the original attribute value.protected Collection<ItemCloneCreator.CopyItem>getAll()Returns copy for specified (partOf) source item.protected Set<ItemCloneCreator.CopyItem>protected ItemCloneCreator.CopyItemgetCopyWrapper(Item original) Returns all item wrappers which have not been copied or hold attributes which are not copied completely.getPresets(Item src) protected ComposedTypegetTargetType(Item original) protected booleanbooleanTells whether or not the context contains (partOf) items witch are not copied yet or have attributes which have not been copied completely.protected booleanbooleanmustBeTranslated(Item original) Tells whether or not the item has been registered as (partOf) item to be copied.
-
Constructor Details
-
CopyContext
public CopyContext()Creates a new copy context.
-
-
Method Details
-
getTargetType
-
addCopyUntypedPropsFor
Switches on copying of untyped properties for the specified item. While creating a copy of the specified item all untyped properties are copied as well.- Parameters:
sourceItem- the original item to copy props from
-
addCopyUntypedPropsFor
Switches on copying of untyped properties for the specified items. While creating copies of the specified items all untyped properties are copied as well.- Parameters:
sourceItems- the original items to copy props from
-
isCopyUntypedPropsFor
-
getCopyUntypedItems
-
addPreset
Defines a attribute value to be used when creating a copy instead of the original attribute value.Example:
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.
- Parameters:
srcItem- the source item which is used for copyingqualifier- the attribute qualifiervalue- the value to use
-
gotPreset
-
getPresets
-
getAll
-
add
-
mustBeTranslated
Tells whether or not the item has been registered as (partOf) item to be copied.- Parameters:
original- the item to check
-
getCopyWrapper
-
getCopy
Returns copy for specified (partOf) source item.- Parameters:
original-- Returns:
- the copy item or
nullif it hasn't been copied yet - Throws:
IllegalArgumentException- if item is not registered as (partOf) item to be copied
-
hasPendingItems
public 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. -
getPendingItems
Returns all item wrappers which have not been copied or hold attributes which are not copied completely.
-