Type queries
Plugins can query the schema to find out more information about the types defined in the current application.
Schema query
function SCHEMA.getTypeInfo(type)
Returns a JavaScript object with properties describing the type, described below.
type
is a Ref
object which refers to the type. Use the TYPE
properties.
Info properties
Each type information object contains the following keys:
key name
The name of the type, suitable for displaying to the user.
key code
The API code for the type, eg "std:type:person"
. May be undefined
if the type does not have an API code.
key shortName
The short name, or “search name”, of the type. Used in search constraints.
key parentType
The Ref
of the parent type, or undefined
if this is a root type.
key rootType
The Ref
of the root type, which may be equal to the requested type if it is a root type.
key childTypes
An Array
of Refs
of the direct child types of this type. If a type has no direct child types, the array will be empty.
key attributes
An array of attribute descriptors, in the order that the attributes should be displayed in the user interface. Each matches an ATTR
constant.
Where the application uses an aliased attribute, the descriptor of the underlying attribute is included in this array.
key aliasedAttributes
An array of any aliased attribute descriptors used on this type. Each matches an ATTR
constant.
Plugins are not usually expected to need this information, but it may be useful for displaying appropriate schema names in the user interface.
key annotations
An array of annotation names, applied by requirements.schema files.
key createShowType
true
if this type or subtype is offered in the object editor. This corresponds to the create-show-subtype
statement in requirements.schema files.
key elements
An array of names of Elements which will be displayed on objects of this type. The order may not be the order they are displayed, and only the names of the elements are available.
key behaviours
An array of strings describing the behaviours associated with this type.
"classification" |
Classification type |
"physical" |
Represents a physical item |
"hierarchical" |
Hierarchical user interface |
"show-hierarchy" |
Show hierarchy when displaying a link to objects |
"force-label-choice" |
Force explicit choice of label when creating new object |
"self-labelling" |
Automatically label objects of this type with itself |
"hide-from-browse" |
Hide from Browse |