Class ItemModelCloneCreator.CopyContext
java.lang.Object
de.hybris.platform.servicelayer.internal.model.impl.ItemModelCloneCreator.CopyContext
- Direct Known Subclasses:
CMSCopyContext,DefaultCloneAbstractOrderStrategy.OrderCopyContext
- Enclosing class:
- ItemModelCloneCreator
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new copy context.CopyContext(ModelCloningContext cloningContext) Creates a new copy context with cloning context -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAdds a new (partOf) item copy wrapper to the context.voidDefines a attribute value to be used when creating a copy instead of the original attribute value.protected Collection<ItemModelCloneCreator.CopyItem>getAll()Returns all item copy wrappers.Returns copy for specified (partOf) source item.protected ItemModelCloneCreator.CopyItemgetCopyWrapper(ItemModel original) Returns associated copy wrapper for a given (partOf) source itemReturns all item wrappers which have not been copied or hold attributes which are not copied completely.protected ObjectgetPresets(ItemModel src) Returns all preset values of a source item.getTargetType(ItemModel original) Tells which type should be used for creating a copy of the specified original item.protected booleanTells if a attribute got a preset value or not.booleanTells whether or not the context contains (partOf) items witch are not copied yet or have attributes which have not been copied completely.booleanmustBeTranslated(ItemModel original) Tells whether or not the item has been registered as (partOf) item to be copied.protected booleanskipAttribute(Object original, String qualifier) tell us if attribute have to be skippedprotected booleantreatAsPartOf(Object original, String qualifier) tell us if attribute have to be treated as part of
-
Constructor Details
-
CopyContext
public CopyContext()Creates a new copy context. -
CopyContext
Creates a new copy context with cloning context
-
-
Method Details
-
skipAttribute
tell us if attribute have to be skipped -
treatAsPartOf
tell us if attribute have to be treated as part of -
getTargetType
Tells which type should be used for creating a copy of the specified original item. Default is simply using its current type. -
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
Tells if a attribute got a preset value or not. -
getPresets
Returns all preset values of a source item. -
getPreset
-
getAll
Returns all item copy wrappers. -
add
Adds a new (partOf) item copy wrapper to the context. -
mustBeTranslated
Tells whether or not the item has been registered as (partOf) item to be copied.- Parameters:
original- the item to check
-
getCopyWrapper
Returns associated copy wrapper for a given (partOf) source item -
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.
-