Attribute groups

Attribute groups are a set of attributes on a StoreObject which are grouped together as a unit. Care should be taken when defining a new attribute group that your use case wouldn’t be better managed as a linked object.

For clarity, when using attribute groups the convention is to refer to the “parent” record as the container object. This reduces confusion between the main record and any attribute groups extracted as group objects.

Implementing attribute groups

The attributes to be included in attribute groups are defined in schema as a new type. Objects of this type should never be created directly, but may be extracted from the container object in code.

Add a new attribute in schema requirements of data-type attribute-group, pointing to this new type, to add the group to a type, as in this example.

Using data in attribute groups

The data in an attribute group is added to the container object, so object permissions, linking, querying, etc. mostly work as usual without needed to consider the attribute group separately.

If you need to use the attribute-groups themselves, use the APIs on the StoreObject interface to decompose records into their grouped and ungrouped attributes. The AttributeExtension interface describes the extracted attribute group as its own set of attributes.

Restrictions

If you need to restrict attributes from a specific attribute group, you should use:

  • Apply a restriction using the restrict-if-label option

If changes to data elsewhere in the application mean that hLabelAttributeGroupObject would apply difference labels, call reindex() on the container object to reflect these changes in the object store.