Assets Component
The assets component adds the functionality to upload and download files.
This allows you to store files and link them to the related data elementData Element (DataElement). A fundamental data concept or entity within an application's domain, acting as an anthropomorphic translation of a real-life object or concept. (e.g. a drivingLicense photo linked to a Booking data elementData Element (DataElement). A fundamental data concept or entity within an application's domain, acting as an anthropomorphic translation of a real-life object or concept.)
The assets components handles:
- File storage in database or disk
- Upload interface to browse and link files
- Download interface
- Implementations to read and manipulate files in business logic
Modeling an asset
If we need to store a file on a data elementData Element (DataElement). A fundamental data concept or entity within an application's domain, acting as an anthropomorphic translation of a real-life object or concept., we will create a regular fieldFieldA property of a DataElement expanded to a database column and user interface input element.. Name this fieldFieldA property of a DataElement expanded to a database column and user interface input element. and label it as a linkField with type Ln01. By defining Asset, the fieldFieldA property of a DataElement expanded to a database column and user interface input element. will automatically be marked and handled as a file
Let's say a customer has to provide a copy of its driving license when booking a Car. We can store this file and link it to Booking by modeling a fieldFieldA property of a DataElement expanded to a database column and user interface input element. called copyOfLicense. This fieldFieldA property of a DataElement expanded to a database column and user interface input element. will be of type
Asset Types
The assets component supports three types of assets.
Internal assets
The internal asset type (Asset.type == "INTERNAL") represents assets that are stored by the underlying database used by the applicationApplicationThe overarching model container grouping all components, domain logic, and configurations for an enterprise solution..
These assets are handed off to the data layer for processing and are typically stored as BLOBs in an SQL database.
File assets
The file asset type (Asset.type == "FILE") represents assets that are stored on the filesystem of the applicationApplicationThe overarching model container grouping all components, domain logic, and configurations for an enterprise solution..
The directory where uploaded files are stored is defined in a ParamTargetValue with parameter name fileUploadDirUri and target default.
External assets
The file asset type (Asset.type == "REMOTE") represents assets that are stored at a remote location.
A String fieldFieldA property of a DataElement expanded to a database column and user interface input element. RemoteAsset.url contains an URL to the location where the asset can be accessed.
The data elementData Element (DataElement). A fundamental data concept or entity within an application's domain, acting as an anthropomorphic translation of a real-life object or concept. remoteAsset is deprecated and should not be used, use externalAsset instead.