Attribute queries

Plugins can query the schema to find out more information about the attributes defined in the current application.

Schema query

function SCHEMA.getAttributeInfo(attribute)

Returns a JavaScript object with properties describing the attribute, described below.

attribute must be one of the ATTR properties. You should not rely on the exact underlying type of this value in your code.

Info properties

Each attribute information object contains the following keys:

key name

The name of the attribute, suitable for displaying to the user.

key code

The API code for the attribute, eg "dc:attribute:title". May be undefined if the attribute does not have an API code.

key shortName

The short name, or “search name”, of the attribute. Used in search constraints.

key typecode

The expected typecode of values stored in this attribute. Constants are defined as in Value types or Text types.

You must not assume that every value in this attribute will be of this type. The object store does not type check values in objects. Changes to the schema can result in other types of values being stored in an attribute.

key types

An array of Ref objects specifying the types to which this attribute may link. Note that the object store does not type check linked objects in attributes.

This is provided only when typecode === O.T_REF.

key allowedQualifiers

An array of qualifier values for the qualifiers currently allowed to be applied in the object editor UI. Note that it is entirely possible for an object to have a qualifier which is not in this list, either because the allowed qualifiers changed, or a plugin applied the qualifier.

An empty list means that all qualifiers will be allowed by the object editor UI.

key groupType

A Ref object specifying the group-type of the attribute group. Useful for retrieving information about the attributes defined within a group.

This is only provided when typecode === O.T_ATTRIBUTE_GROUP.