Registering a new MRU entity is done by following the steps below:
First, set the 'MruTableNames' application setting (comma-separated list) to include the table name(s) for which you want to register a new entity.
This can be done in SWAT either in the (config→ environment -> .restapplicationsettings file)
Or from the Application Settings Desktop (from UI, if available).
The methods from RecordHdlHelper are used to specify the MRU item icon/description/key etc. Previously, those values were hardcoded in SWAT and were not customizable.
This was remedied by allowing the framework customers to customize this code through a new service: IEntityMetadataService. A default implementation is shipped with SWAT: LegacyEntityMetadataService.
Customers would need to provide their own implementation of this service (either by implementing the service from scratch or overriding the default SWAT legacy implementation). Create a folder in src → backend which is called <Customer Name > create a folder <OERA> create folder <metadata> and file EntityMetadataService.cls and insert the following code and overwrite the table name.
|
You also need to specify which implementation of the service will be used:
|
The following methods can be customized from RecordHdlHelper through the service:
RecordHdlHelper Method | IEntityMetadataService Method | Description |
---|---|---|
GetKeyFieldOfTableId | GetKeyFieldById | |
GetKeyFieldOfTableName | GetKeyFieldByName | |
GetTableNameFromId | GetNameById | |
GetInternalKeyOfTable | GetInternalKeyFieldByName | |
GetTableIdFromName | GetIdByName | |
GetDescFieldsOfTable | GetDescriptionFieldsByName | |
GetOwnerOfTable | GetProductByName | |
IsTransField | IsTransField | |
GetForeignTablePropertiesOfField | GetLinkedEntityPropertiesOfField | |
GetForeignTableNameOfField | GetLinkedEntityOfField | |
GetContainerOfHdl | GetDetailsScreen | Used for MRU details container |
GetLabelOfHdl | GetLabel | Used for MRU Label |
GetIconOfHdl | GetIcon | Used for MRU Icon |
Some fields used in the template get their value based on the table definition file
(for ex. TargetKey is set based on the xml table KeyFields attribute; so at runtime, for our table, the value display for the MRU entry keycomes from the field specified in the attribute).
This applies for the key (KeyFields attribute) and the MRU record description (descriptionFields attribute).
For SWAT and for POCs, the table definition file needs to be included in pasoe-config.xml, under the tableDefinitionsDumpFile property:
Registering an MRU entity should be done when a details screen is opened.
In order to launch the screen (in our case, articlemaintenancescreen) by clicking on a grid column, you need to do the following steps:
The details screen should have the same PrimarySDO as the DSO used in the grid (ArticleDSO).
After those steps are followed, the new MRU entities will show up in the MRU Data View.
IMPORTANT: Double-clicking on an item from the MRU data View will only work if the data Source has one of the following fields: selfhdl, refhdl or childhdl.