Registry objects

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.

Properties

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]);

Methods

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 nameDescription
attributeReturns the value of the attribute, which is given by the first argument. In other words, ro.slotName is equivalent to ro.attribute("slotName").
descriptionReturns one of the objects descriptions as a string, following the algorithm as described in the section on international strings.
descriptionsReturns a list containing all of the objects descriptions. Any object in the list is an instance of InternationalString.
externalURIFor external links: Returns the external URI; otherwise returns null.
keyReturns the objects key as a string.
majorVersionReturns the objects major version as an integer.
minorVersionReturns the objects minor version as an integer.
nameReturns one of the objects names as a string, following the algorithm as described in the section on international strings.
namesReturns a list containing all of the objects names. Any object in the list is an instance of InternationalString.
objectTypeReturns 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.
stabilityReturns the registry objects stability as a name. In other words, returns DYNAMIC, DYNAMIC_COMPATIBLE, or STATIC.
stabilityIntReturns the registry objects stability as an integer value.
statusReturns the registry objects status as a name. In other words, returns APPROVED, DEPRECATED, or SUBMITTED, or WITHDRAWN.
statusIntReturns the registry objects status as an integer value.
userVersionReturns the registry objects user version as a string.
validateURIFor external links: Returns, whether the URI is being validated; otherwise returns null.
valueFor concepts: Returns the concept value; otherwise returns null.

International Strings

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 the object has a name in the current default locale, return that.
  • If the object has a name in the en-US (USA) locale, return that.
  • If the object has a name in the en (ENGLISH) locale, return that.
  • Otherwise, return any of the names, in a somewhat random manner.

    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.