StoreObject interface is an object in the Object Store.
StoreObject is not mutable. To modify and existing object, use
mutableCopy to create a copy, modify it, then save the copy. This does not change any
StoreObject in memory.
The interface has a core set of properties and functions, and then schema specific functions are added. These will be different for each application.
load() function on
StoreQueryResults objects act as an array of store objects.
To create a “restricted view” of a store object, which only has the attributes that should be visible to a particular user, use the
restrictedCopy function on an original unrestricted store object.
ref property to find the object reference for an object. It has a
Ref value, or
null if the object has not been saved.
LabelList object representing the labels applied to this object.
This property is read only. Use the
relabel() function to change the labels on an object.
true is the object has been deleted (that is, labelled with the DELETED label),
Version number of the object.
The first title attribute of this object, converted to a string.
object.title is equivalent to
The shortest title attribute of this object, converted to a string. Length is measured in characters. If two title attributes have the same length, this property has the string value of the first.
Returns the title of the object, suitable for displaying in a link to an object.
Descriptive titles may include the values of some of the attributes, if configured, to disambiguate objects. Use descriptive attributes in links where the object is out of context.
title to get the title of the object without any extra information, for use where space is constrained.
Returns the url of this object. If
true, this will include the protocol and hostname, otherwise just the path on the server suitable for an intra-site link. Examples:
Only works if the object has been saved.
true if the object is mutable.
Returns a mutable copy of this object, which is independent of this object. As well as implementing this interface, it also implements
Restricted objects cannot have mutable copies of them made.
true if the object is restricted to only show attributes visible to a particular user.
Returns a restricted copy of this object, which only contains the attributes that are visible to the specified user (which will commonly be
You cannot call this function on an already-restricted object.
true if the specified user is allowed to view the specified attribute (regardless of qualifier). These are the attributes that will still be present in a restricted copy of this object. Unless a plugin uses
restrictedCopy to create a restricted version of the object with these attributes missing, they will still be able to access them through the
StoreObject API; this restriction is honoured by the platform’s object rendering logic, and (through this function and
restrictedCopy) made visible to plugins so that theyc an implement restrictions as they see fit.
true if the specified user is allowed to modify the specified attribute (regardless of qualifier). There is no restriction on plugins creating a
mutableCopy and editing this attribute through the
StoreObject interface; this restriction is honoured by the platform’s object editor user interface, and (through this function) made visible to plugins so that they can implement restrictions as they see fit.
Relabel the object, using the changes specified by the
LabelChanges object passed in. If the current user is not allowed to relabel this object, an exception will be thrown.
labelChanges wouldn’t actually change the labels on the object, this API may skip the relabel operation. In this case, there would be no audit trail entry for the operation.
Deletes this object from the store.
Note that this just labels the object as deleted, and it can still be loaded (subject to permission enforcement). Searches do not return deleted objects by default.
Returns an HTML representation of the object in the specified style. Omit the argument to use the
It’s usually better to use the
std:object standard template when including the object in a generated web page.
true if this object is the type specified as
typeRef, or one of it’s sub-types.
false will be returned.
true is this object has a type which is annotated by
Type annotations are defined in requirements.schema files.
function first(desc, qual)
Returns the first value in the object described by
qual. Use the schema
qual may be omitted. Use the schema
Remember that a core strength of the Haplo data model is its universal support for multi-values. While it may be appropriate to use the
first() function (and schema specific
firstX() functions), you should really be using the
every() function and using all values. If you find yourself using
first(), make sure you shouldn’t really be using
function every(desc, qual, iterator)
All arguments are optional.
qual as for the
If the last argument is not a function, an array of all the values will be returned.
If the last argument is a function, it will be called for each matching value with the arguments
(value, desc, qual).
function each(desc, qual, iterator)
function everyType(qual, iterator)
every(ATTR["dc:attribute:type"], qual, iterator)
every(ATTR["dc:attribute:title"], qual, iterator)
function has(value, desc, qual)
true if this object has an attribute with a given value, and
qual are optional, although typically you would use
desc to specify which attribute should be checked. If
qual is specified, only attributes with that qualifier will be checked, otherwise the qualifier is ignored in the comparison.
This is more useful than code like
(value === object.first(desc, qual)) as it takes account of multiple values in the attribute, and knows how to convert and compare values properly.
function valuesEqual(object, desc, qual)
Compare the values in this object with those in another object. Returns
true if the list of values, including their descriptors and qualifiers, are exactly equal in the two objects.
The values are sorted by descriptor, but the order of values in any given descriptor is preserved. This matches the behaviour you’d expect if you were comparing objects in the user interface.
qual are optional. If
desc is specified, then only values with that descriptor are compared. If
qual is specified, then only values with the descriptor and qualifier are compared.
Request that the text of the object is reindexed. This will happen in the background and may be delayed if there is other indexing activity.
In general, you shouldn’t need to use this, except if you’re doing exciting things with hPreIndexObject.
The user ID of the user who created this object. May be zero if it was created during initialisation of the application.
O.user() to retrieve user information.
The user ID of the user who last modified this object. May be zero if it was created during initialisation of the application.
O.user() to retrieve user information.
Array interface which contains all the previous versions of the object, ordered by version number ascending.
Note that if the labels on the object have changed over time, some versions may be omitted. Only versions with labels the user is permitted to read are included.