Package de.hybris.platform.jalo.type
Class ItemCloneCreator
java.lang.Object
de.hybris.platform.jalo.type.ItemCloneCreator
Generically copies a item. It create a new instance of a specified item using all its attribute values. During copy
it also creates copies for all items being held in partOf attributes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClone error class.protected static classstatic classA wrapper for each item attribute to be stored while creating a copy.static classContext for collecting all items copied duringcopy(ComposedType, Item, CopyContext).static classWrapper for a single (partOf) item to be copied. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconsume(Collection<ItemCloneCreator.CopyAttribute> readyAttributes) Creates a copy of the given item.copy(Item original, ItemCloneCreator.CopyContext ctx) Creates a copy of the given item.copy(ComposedType targetType, Item original, ItemCloneCreator.CopyContext ctx) Creates a copy of the given item.copyAll(List<? extends Item> originals, ItemCloneCreator.CopyContext ctx) Creates copies of all specified items using a single copy context.protected voidprotected voidfindPartOfItems(Object originalValue, ItemCloneCreator.CopyContext ctx) protected ItemCloneCreator.CopyItemprepareCopy(ComposedType targetType, Item original, ItemCloneCreator.CopyContext ctx) protected booleanprotected voidtoValueMap(Collection<ItemCloneCreator.CopyAttribute> readyAttributes) protected ObjecttranslateAttributeValue(ItemCloneCreator.CopyAttribute attr, Object originalValue, ItemCloneCreator.CopyContext ctx) protected Collection<ItemCloneCreator.CopyAttribute>
-
Constructor Details
-
ItemCloneCreator
public ItemCloneCreator()
-
-
Method Details
-
copy
Creates a copy of the given item.- Parameters:
original- the item to copy- Throws:
JaloBusinessExceptionItemCloneCreator.CannotCloneException
-
copy
public Item copy(Item original, ItemCloneCreator.CopyContext ctx) throws ItemCloneCreator.CannotCloneException, JaloBusinessException Creates a copy of the given item.- Parameters:
original- the item to copyctx- the copy context- Throws:
JaloBusinessExceptionItemCloneCreator.CannotCloneException
-
copy
public Item copy(ComposedType targetType, Item original, ItemCloneCreator.CopyContext ctx) throws ItemCloneCreator.CannotCloneException, JaloBusinessException Creates a copy of the given item. Allows to specify a type for the new copy to be created.- Parameters:
targetType- the type of copy to create (optional)original- the item to copyctx- the copy context- Throws:
JaloBusinessExceptionItemCloneCreator.CannotCloneException
-
copyAll
public List<? extends Item> copyAll(List<? extends Item> originals, ItemCloneCreator.CopyContext ctx) throws ItemCloneCreator.CannotCloneException, JaloBusinessException Creates copies of all specified items using a single copy context. Therefore cross references between source items are replaces by references to the newly created copies.- Parameters:
originals- the items to copyctx- the copy context- Returns:
- the list of copies created
- Throws:
ItemCloneCreator.CannotCloneException- in case not all items could be copied completely, e.g. due to cyclic dependenciesJaloBusinessException
-
copyUntypedProperties
protected void copyUntypedProperties(ItemCloneCreator.CopyItem item, ItemCloneCreator.CopyContext ctx) -
readAttributes
-
prepareCopy
protected ItemCloneCreator.CopyItem prepareCopy(ComposedType targetType, Item original, ItemCloneCreator.CopyContext ctx) -
findPartOfItems
-
process
protected boolean process(ItemCloneCreator.CopyItem item, ItemCloneCreator.CopyContext ctx) throws JaloBusinessException - Throws:
JaloBusinessException
-
consume
-
toValueMap
-
translatePendingAttributes
protected Collection<ItemCloneCreator.CopyAttribute> translatePendingAttributes(ItemCloneCreator.CopyItem item, ItemCloneCreator.CopyContext ctx) -
translateAttributeValue
protected Object translateAttributeValue(ItemCloneCreator.CopyAttribute attr, Object originalValue, ItemCloneCreator.CopyContext ctx) throws ItemCloneCreator.CannotTranslateException
-