The atg.repository.RepositoryUtils
class includes a method you can use to clone a repository item. This creates a copy of a repository item in a repository without adding the item to the repository. A copy can be a deep copy or a shallow copy. Furthermore, you can specify a list of properties to exclude from the copy.
The full signature of the cloneItem
method is:
public static MutableRepositoryItem cloneItem(RepositoryItem pItem, boolean pDeepCopy, Map pPropExceptions, Map pExcludedProperties, MutableRepository pDestRepository, String pId) throws RepositoryException, DuplicateIdException
The cloneItem
method’s parameters are as follows:
Parameter | Description |
---|---|
| Item to copy. |
| Boolean, specifies the mode of the copy:
Shallow copying only works if the source and destination repositories are the same. |
| Hierarchical map of property name exceptions to the above mode. Keys are property names, while values are null or, if the property is another repository item, another Map. For example, if you clone a Alternatively, you can add the key |
| Properties to exclude from the clone. Keys are item descriptor names and the values are collections of property names to exclude.. |
| Repository to copy the new item into. If the source and destination repositories are the same, properties that are items are cloned to the repository of the source item-property. If this parameter is omitted, the new item is copied to source repository. |
| Repository ID to use in the copy of the item. If this parameter is omitted, a unique ID is automatically generated. |