ATG Repository Guide

Creating Composite and Contributing Items

The contributing-item-creation-policy dictates how contributing items are created (if at all) in a MutableRepository. This attribute can have a value of eager, lazy, or none.

eager

When users create a new composite item via the createItem() method in MutableCompositeRepository, new instances of the primary item and of all contributing items are created. So, for example, if you have a user item type defined in your composite repository that borrows properties from the SQL and LDAP repositories, any new user composite repository item that is created creates both an SQL repository item and an LDAP repository item. However, before these items can be added to their respective repositories, the correct link needs to exist between them. If the items are linked by a certain property, this property needs to be set on the primary item before the items are added, otherwise an error occurs as those two items cannot be linked back together later.

lazy

If this option is chosen, contributing items are created only when they are needed. In this case, when users call setPropertyValue on a property that is defined in the contributing repository, the composite repository creates the item in the contributing then and there. There are two different behaviors depending on whether the CompositeItem is transient or not.

If the item is transient, wait until the item is persisted before checking to see that all appropriate linking properties are set, so they can be propagated to the new contributing item.

If the item is not transient, check whether the correct linking properties are set on the primary item, then add the contributing item to its repository. If there any properties used for linking are missing, an error is returned.

The check for valid linking properties occurs during the updateItem call, and not during the setPropertyValue call on the contributing item. So if you use lazy item creation and call setPropertyValue on a persistent item, you do not need to already have valid values set for any linking properties on the primary item at that exact point in time. As long as the values of the linking properties are set before updateItem is called, the item should be successfully created.

none

If this option is chosen, no repository items are created in the underlying repositories under any circumstance. Any contributing items used in the composite repository must already exist in order for valid results to be returned from property value requests.