Each repository item belongs to one of several itemtypes. An item type describes all the properties that are common to the repository items of that type. The Repository API allows you to perform a task similar to JavaBean introspection to find out information about the properties of a repository item. Each item type is described by a Repository item descriptor (also called a RepositoryView).

An item descriptor implements the atg.repository.RepositoryItemDescriptor interface and may subclass atg.repository.ItemDescriptorImpl. The item descriptor gives a name to the type, and also describes the properties for that type. The name of each property is defined in the item descriptor, as well as the class of the Java object used to represent that type (Integer, String, etc.). The item descriptors exposed by a repository depend on a combination of the underlying data store and the configuration of the repository. In the SQL repository, for example, each database table might have its own repository item descriptor. Another alternative might join multiple tables into a single item descriptor. Repositories can support multiple item descriptors. For example, a SQL repository instance that supports a commerce application might have different item descriptors representing users, products, product categories, orders, etc.

Note the use of three closely related terms: item type, item descriptor, and Repository View. An item type is a collection of repository items that share a common set of properties. For example, a bookstore application might use item types for customers, books, and authors. Each item type is defined by an item descriptor. There is a one-to-one correspondence between item descriptors and Repository Views.

The figure below shows an example of two item descriptors used by a repository that stores customer information.

Inside each repository, there can be several types of items defined by item descriptors and for each item type there can be several repository items. The definition of each type of item is described in a repository definition file using XML. In this example, the Visitor Profile Repository defines two types of items (user and address).

Developers can model relationships between types of items as shown in the following figure. In this example, the user item type has a property named address. The value of the address property is a repository item of another item type named address.

The ItemDescriptor mechanism is built upon ATG Dynamic Beans (atg.beans.*) system (described in the Nucleus: Organizing JavaBean Components chapter of the ATG Programming Guide), which allows you to describe properties for Java objects without defining the getX and setX methods for each property required by the JavaBean specification. This interface is used to describe a set of dynamic properties that occur together and have consistent behavior and semantics. An item descriptor essentially acts like a BeanInfo where one can get access to the PropertyDescriptors that compose the repository item. (For information about BeanInfos and PropertyDescriptors, see the JSDK 2 API documentation for java.beans.BeanInfo and java.beans.PropertyDescriptor.)

Most repositories support simple property types such as Strings and Integers. ATG repositories can also use the Java Collections Framework to model complex relationships between items using familiar object-oriented concepts. You can store a “list” of addresses as a Set, List, Map, or array, whichever make sense for your applications needs. Some repositories support complex property types, in which the value of the property is itself another repository item or collection of repository items. For example, a repository might have item descriptors for types Person and Address. The Person item descriptor might have an addresses property that exposes the list of Addresses that a Person might have. This property might be of type RepositoryItem[], and the repository items in that array will use the Address item descriptor. This allows repositories to represent one-to-one, one-to-many, or many-to-many relationships.

The information stored in ItemDescriptor components is usually not needed for development of your ATG application. This property metadata is available for applications that need to expose a user interface that allows one to explore and navigate the state of a repository. The ATG Control Center uses the ItemDescriptors of the repository to automatically constrain the user interface with appropriate selections.

 
loading table of contents...