A grouping of products within one organisation, used to organise a reward store or product catalogue. Categories form a tree through the optional parent category, and a product can sit in as many categories as needed through the ProductInCategory join records. Categories are also what a product's brand points at, so deleting one clears the brand from any product referencing it. Titles and other display text can be translated, keyed by the category's name.
Group: Database Entities
Implements: Serializable, Auditable, Translatable
Properties
| Property | Returns | Description |
|---|---|---|
| assetId | String | Identifier of an asset in the asset library that this category represents, letting categories be looked up by the asset they mirror. Null for a category which is not linked to an asset. |
| auditOrg | Organisation | The organisation that audit entries for this category are recorded against, which is the organisation which owns it. |
| hidden | Boolean | Whether the category is suppressed from the reward store components. Returns false rather than null when the column has never been set, so the result is always safe to test directly. |
| hidden | Boolean | Whether the category is suppressed from the reward store components. Identical to getHidden, and provided so templates can read it as a boolean property. |
| id | long | Unique database identifier for this category. |
| mainImageHash | String | Content hash of the image used to represent the category in a store front. Use it to read the image from the content store. Null when no image has been set. |
| multiplier | Float | A numeric factor stored against the category and surfaced in the admin product screens, for accounts which scale a value such as points or price by category. The platform itself does not apply it, so anything relying on it must do the multiplication for itself. |
| name | String | The portable, path-safe identifier for the category. It is derived from the title when the category is created but does not change with it, so it can map to a fixed directory in the repository and be used as a stable lookup key. It is also the key translations are stored against. Never null. |
| notes | String | Free-text notes about the category for administrators. Also searchable as a lookup key, so some accounts use it to hold an identifier from an external system. |
| parentCategory | Category | The category this one sits under, forming the category tree. Null means this is a root category, which is what the top-level listings return. Deleting a category promotes its children to root rather than deleting them. |
| position | Integer | Manual sort order for displaying categories, for accounts which want a deliberate order rather than the alphabetical ordering the finder methods apply. Null when no position has been set. |
| productInCategorys | List<ProductInCategory> | The join records linking products into this category, one per product. Each record carries the membership rather than the product itself, so read its product to get the product. Can be null on a category which has never had a product added. |
| sourceId | String | The key translated text for this category is stored against, which is the category's name. Renaming a category therefore orphans its existing translations. |
| title | String | Free-text display label entered by an administrator and shown to shoppers. Category listings are sorted by it, and it is not guaranteed to be unique or path-safe, so never use it as an identifier - that is what the name is for. Never null. |
Methods
getId() · getTitle() · getMultiplier() · getName() · getNotes() · getProductInCategorys() · getMainImageHash() · getParentCategory() · getHidden() · isHidden() · getAssetId() · getPosition() · productInCategory(Product p) · getAuditOrg() · getSourceId()
getId()
Returns: long
Unique database identifier for this category.
getTitle()
Returns: String
Free-text display label entered by an administrator and shown to shoppers. Category listings are sorted by it, and it is not guaranteed to be unique or path-safe, so never use it as an identifier - that is what the name is for. Never null.
getMultiplier()
Returns: Float
A numeric factor stored against the category and surfaced in the admin product screens, for accounts which scale a value such as points or price by category. The platform itself does not apply it, so anything relying on it must do the multiplication for itself.
getName()
Returns: String
The portable, path-safe identifier for the category. It is derived from the title when the category is created but does not change with it, so it can map to a fixed directory in the repository and be used as a stable lookup key. It is also the key translations are stored against. Never null.
getNotes()
Returns: String
Free-text notes about the category for administrators. Also searchable as a lookup key, so some accounts use it to hold an identifier from an external system.
getProductInCategorys()
Returns: List<ProductInCategory>
The join records linking products into this category, one per product. Each record carries the membership rather than the product itself, so read its product to get the product. Can be null on a category which has never had a product added.
getMainImageHash()
Returns: String
Content hash of the image used to represent the category in a store front. Use it to read the image from the content store. Null when no image has been set.
getParentCategory()
Returns: Category
The category this one sits under, forming the category tree. Null means this is a root category, which is what the top-level listings return. Deleting a category promotes its children to root rather than deleting them.
getHidden()
Returns: Boolean
Whether the category is suppressed from the reward store components. Returns false rather than null when the column has never been set, so the result is always safe to test directly.
isHidden()
Returns: Boolean
Whether the category is suppressed from the reward store components. Identical to getHidden, and provided so templates can read it as a boolean property.
getAssetId()
Returns: String
Identifier of an asset in the asset library that this category represents, letting categories be looked up by the asset they mirror. Null for a category which is not linked to an asset.
getPosition()
Returns: Integer
Manual sort order for displaying categories, for accounts which want a deliberate order rather than the alphabetical ordering the finder methods apply. Null when no position has been set.
productInCategory(Product p)
Returns: ProductInCategory
The membership record linking the given product to this category, or null if the product is not in it. This reads the already loaded memberships rather than querying, so it is cheap but relies on the collection being populated.
| Parameter | Description |
|---|---|
p | the product to look for in this category |
getAuditOrg()
Returns: Organisation
The organisation that audit entries for this category are recorded against, which is the organisation which owns it.
getSourceId()
Returns: String
The key translated text for this category is stored against, which is the category's name. Renaming a category therefore orphans its existing translations.