Represents one item in the asset library, such as an image, video, block of text or content item. Every asset carries a unique id, a human readable name, a media format and any number of asset type tags, and assets can be linked to one another with named relations, for example to point a video at its thumbnail. Server side JavaScript obtains an asset from the asset manager, for example by calling uploadBinaryAsset, which returns whichever kind of asset matches the uploaded content. BinaryAsset extends this interface for assets whose content is a stored file, ImageAsset and VideoAsset specialise BinaryAsset further with the dimensions and playback details of the media, and ContentItemAsset extends this interface for structured content held as fields and relations rather than a file.
Group: Assets
Properties
| Property | Returns | Description |
|---|---|---|
| allRelations | List<Relation> | Every relation which points from this asset to another one, for example the thumbnail of a video. This reads the relations from the database, so treat it as a query rather than as a cheap field read. |
| assetTypes | List<String> | The asset type names this asset is tagged with, which is how the library is filtered into groups such as banners or product shots. Types are applied when the asset is uploaded and can be added afterwards, and the list is empty rather than null when the asset has none. |
| authorProfileId | Long | Identifier of the profile which created the asset, where that was recorded. Null for assets which were not attributed to a person. |
| createdDate | Date | When the asset was first added to the library. Duplicating an asset keeps the created date of the asset it was copied from. |
| format | String | The media format of the asset, for example image, video, text, or a media type such as text and html. Treat it as the asset's type; searching the library matches on this as well as on the name, and uploading through the asset manager routes on it to decide whether an image, a video or a plain binary file is created. |
| language | String | Language code for the asset's content, used to pick the right variant when the same asset exists in several languages. Null when the asset is not language specific. |
| modifiedDate | Date | When the asset was last changed. It is set by whatever updates the asset, so it is only as accurate as the code which maintains it. |
| name | String | Human readable name for the asset, used when searching the library and when listing assets. It is not guaranteed to be unique within a tenant. |
| notes | String | Free text notes about the asset, describing what it is or how it should be used. Set when the asset is uploaded, and null when nothing has been recorded. |
| relatedEntityId | Long | Identifier of a profile or organisation this asset relates to, typically set when the asset is a contract document belonging to one specific person or organisation. Null for a general library asset. It can be set when uploading through the asset manager by passing a related entity id. |
| uniqueId | String | A globally unique identifier for the asset, usually a UUID. This is the stable handle to refer to an asset by, so use it rather than a database id when linking to an asset from content, and note that a duplicated asset is given a fresh one. |
Methods
getUniqueId() · getName() · getAuthorProfileId() · getRelatedEntityId() · getCreatedDate() · getModifiedDate() · getFormat() · getNotes() · getAssetTypes() · getLanguage() · getAllRelations() · getRelations(String predicate) · getRelationsTo(String predicate)
getUniqueId()
Returns: String
A globally unique identifier for the asset, usually a UUID. This is the stable handle to refer to an asset by, so use it rather than a database id when linking to an asset from content, and note that a duplicated asset is given a fresh one.
getName()
Returns: String
Human readable name for the asset, used when searching the library and when listing assets. It is not guaranteed to be unique within a tenant.
getAuthorProfileId()
Returns: Long
Identifier of the profile which created the asset, where that was recorded. Null for assets which were not attributed to a person.
getRelatedEntityId()
Returns: Long
Identifier of a profile or organisation this asset relates to, typically set when the asset is a contract document belonging to one specific person or organisation. Null for a general library asset. It can be set when uploading through the asset manager by passing a related entity id.
getCreatedDate()
Returns: Date
When the asset was first added to the library. Duplicating an asset keeps the created date of the asset it was copied from.
getModifiedDate()
Returns: Date
When the asset was last changed. It is set by whatever updates the asset, so it is only as accurate as the code which maintains it.
getFormat()
Returns: String
The media format of the asset, for example image, video, text, or a media type such as text and html. Treat it as the asset's type; searching the library matches on this as well as on the name, and uploading through the asset manager routes on it to decide whether an image, a video or a plain binary file is created.
getNotes()
Returns: String
Free text notes about the asset, describing what it is or how it should be used. Set when the asset is uploaded, and null when nothing has been recorded.
getAssetTypes()
Returns: List<String>
The asset type names this asset is tagged with, which is how the library is filtered into groups such as banners or product shots. Types are applied when the asset is uploaded and can be added afterwards, and the list is empty rather than null when the asset has none.
getLanguage()
Returns: String
Language code for the asset's content, used to pick the right variant when the same asset exists in several languages. Null when the asset is not language specific.
getAllRelations()
Returns: List<Relation>
Every relation which points from this asset to another one, for example the thumbnail of a video. This reads the relations from the database, so treat it as a query rather than as a cheap field read.
getRelations(String predicate)
Returns: List<Relation>
Finds the relations of one kind which point from this asset to another, for example the thumb relation from a video to its thumbnail image. This reads from the database, so treat it as a query rather than as a cheap field read.
| Parameter | Description |
|---|---|
predicate | the name of the relationship to match, usually the type of the relationship to the object, for example "thumb" |
getRelationsTo(String predicate)
Returns: List<Relation>
Finds the relations of one kind which point at this asset from other assets, in other words the reverse of getRelations. This reads from the database, so treat it as a query rather than as a cheap field read.
| Parameter | Description |
|---|---|
predicate | the name of the relationship to match, for example "thumb" to find the assets which use this asset as their thumbnail |