You can use the <attribute>
tag as a child tag in a <property>
or <item-descriptor>
tag to associate arbitrary name/string value pairs with the property. These named values correspond to those specified in java.beans.FeatureDescriptor
, which RepositoryPropertyDescriptor
implements.
This is simply a way of letting applications associate more metadata with individual properties. The SQL repository does not do anything with the data expressed in the <attribute>
tag; it remembers the values defined in the template and allows one to read them at runtime. This is the same mechanism that the @beaninfo
JavaDoc tag system uses.
Here is an example, which assigns to the author
property the name/value pair of maxLength="30"
:
<!-- The "book" item type -->
<item-descriptor name="book">
<table name="book" id-column-names="book_id" type="primary">
<property name="title"/>
<property name="author">
<attribute name="maxLength" value="30"/>
</property>
</table>
</item-descriptor>
It is also useful to refer to values of Nucleus components as attributes. You can do this with the bean
attribute of the <attribute>
tag. For example:
<attribute name="documentRootPath"
bean="/atg/demo/Motorprise/repositories/
FeaturesDataStore.relativePathPrefix" />
If you use a relative Nucleus address for the bean
attribute, it refers to a component relative to the Repository
component.
You can access property attributes programmatically with the RepositoryPropertyDescriptor.getValue
method. For example:
RepositoryPropertyDescriptor.getValue("maxLength");