When an application has added new properties to the core Commerce objects, it may be necessary to modify the cloning process. Usually, all repository items referenced by the cloned item are also cloned into new transient repository items. This is known as the deep clone. However, you may want a shallow cloning of new properties or you may want to eliminate certain properties entirely from the cloning process.

Adding Objects for Cloning

You may extend core Commerce objects, for example: Order, ShippingGroup, PaymentGroup, Relationship. For example, you may have extended the default OrderImpl object type by creating a MyOrderImpl to add new properties. The configuration of the clone editing components may require adjustments or you may have to create class extensions.

If you have extended the core Commerce objects, the new object type and its new properties must be identified to the clone editing feature so that the new properties are copied to their original order counterpart during the reconciliation process. You must map which properties should be copied based on the type of object. The following is an example of the configuration for the atg.commerce.order.OrderImpl object type.



# map of payment group properties that are copied from the clone to the original
# during reconcilation. The class name is the key

To add a new object type named MyOrderImpl, you would create an /atg/commerce/custsvc/
file in your customization directory and add the new object type and its properties, which will be appended to the default OrderPropertyHandler file:


Note: Only new properties of the class need to be defined as all inherited properties are already covered by the super-type configurations. Additionally, it is not necessary to specify any new properties that will not be updated during the modification process.

The same type of configuration change is needed for extensions to the CommerceItem, ShippingGroup, PaymentGroup and Relationship objects. See CommerceItemHandler, ShippingGroupHandler, PaymentGroupHandler and RelationshipHandler respectively.

There are two ways that the repository cloning process can be managed: By excluding properties entirely from the cloning process, or by specifying which properties should use deep versus shallow cloning.

Excluding Properties from Cloning

The cloning feature can be configured to exclude certain properties from the clone process in the atg/commerce/custsvc/order/edit/processor/CloneOrderForEdit component. The excludedOrderProperties property maps order repository item types to a list of properties that should be excluded from the cloning process. The following is the default configuration that excludes the pricelist and pricingModel properties from the cloning process:


In this example, all properties that reference an item type of itemPriceInfo or pricingAdjustment will be cloned, but the pricelist and pricingModel properties will not be cloned and will be left null.

To exclude multiple properties:

Specifying Deep Versus Shallow Clone

To specify the level of clone, extend the CloneOrderForEdit processor’s createCloningPropExceptionsMap API to create a hierarchical map that specifies which properties have special handling called property exceptions.

The keys used in this map are property names while values are null or another map if the property is an item.

The following example performs a shallow clone on any property named priceinfo:

Map priceInfoExc = new HashMap();
return priceInfoExc;

The following example performs a shallow clone of only the property named pricelist on any item found in a property named priceInfo:

Map priceInfoExc = new HashMap();
Map priceInfoProps = new HashMap();
priceInfoExc.put("priceInfo", priceInfoProps);
return priceInfoExc;

An application can also introduce a custom CloneEditHandler to perform special handling on any application-specific properties. For example, an application may want to exclude a custom property from the repository and handle the cloning process another way. The CloneEditHandler callback interface is executed after the repository cloning process is finished and provides an opportunity for applications to execute post-cloning logic.

Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices