Registry objects in Groovy are instances of net.sf.csutils.groovy.RegistryObject, as opposed to javax.xml.registry.infomodel.RegistryObject. The former class is a wrapper for the latter, adding some "Groovyness" and simplifying the handling of registry objects in Groovy scripts.
The properties of registry objects are basically their attributes. For any slot, relation, and so on, there is a matching property. For example, if you have an asset type with an attribute counter, and a variable ro, which holds an instance of this asset type, then you can access the counter attribute by simply writing:
def counter = ro.counter
It is also possible to modify slot values:
ro.counter = 5
If you do modify objects, you also need to save them. Within templates, this is done in the usual JAXR manner:
registryFacade.getBusinessLifeCycleManager().saveObjects([ro]);
A lot of methods are available to access the registry objects internals. For example, you could write
def name = ro.name()
to access the registry objects name or
def name = ro.name('de-DE')
for the registry objects german name. The available methods are:
Method name | Description |
---|---|
attribute | Returns the value of the attribute, which is given by the first argument. In other words, ro.slotName is equivalent to ro.attribute("slotName"). |
description | Returns one of the objects descriptions as a string, following the algorithm as described in the section on international strings. |
descriptions | Returns a list containing all of the objects descriptions. Any object in the list is an instance of InternationalString. |
externalURI | For external links: Returns the external URI; otherwise returns null. |
key | Returns the objects key as a string. |
majorVersion | Returns the objects major version as an integer. |
minorVersion | Returns the objects minor version as an integer. |
name | Returns one of the objects names as a string, following the algorithm as described in the section on international strings. |
names | Returns a list containing all of the objects names. Any object in the list is an instance of InternationalString. |
objectType | Returns the registry objects type. In other words, it returns another registry object. Use, for example, ro.objectType().value(), if you want the object type as a string. |
stability | Returns the registry objects stability as a name. In other words, returns DYNAMIC, DYNAMIC_COMPATIBLE, or STATIC. |
stabilityInt | Returns the registry objects stability as an integer value. |
status | Returns the registry objects status as a name. In other words, returns APPROVED, DEPRECATED, or SUBMITTED, or WITHDRAWN. |
statusInt | Returns the registry objects status as an integer value. |
userVersion | Returns the registry objects user version as a string. |
validateURI | For external links: Returns, whether the URI is being validated; otherwise returns null. |
value | For concepts: Returns the concept value; otherwise returns null. |
The methods name, names, description, and descriptions are related to international strings. This a relatively complex topic, so we'll describe it in more detail here.
For name, and description, there are two versions of the method available: One (name, and description) returns a single string, the other (names, and descriptions) returns a collection of objects.
The algorithm of the single string is as follows:
If you need a more precise control over the handling of the international strings, use the second method version to obtain all the names, or descriptions. These methods are returning a list. The objects in the list are instances of InternationalString.