...
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).
...
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.
Expand |
---|
|
Code Block |
---|
| USING Progress.Lang.*.
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS <your class>.OERA.Metadata.EntityMetadataService
INHERITS Akioma.Swat.OERA.Metadata.LegacyEntityMetadataService
IMPLEMENTS Akioma.Swat.OERA.Metadata.IEntityMetadataService:
CONSTRUCTOR EntityMetadataService():
SUPER().
END CONSTRUCTOR.
METHOD OVERRIDE PUBLIC CHARACTER GetDetailsScreen(pcRecordHdl AS CHARACTER):
DEFINE VARIABLE cTableName AS CHARACTER NO-UNDO.
DEFINE VARIABLE cContainerName AS CHARACTER NO-UNDO.
cTableName = Akioma.Swat.RecordHdlHelper:GetTableNameFromHdl(pcRecordHdl).
CASE cTableName:
WHEN "Article" THEN
RETURN "ArticleMaintenanceScreen".
END CASE.
cContainerName = SUPER:GetDetailsScreen(pcRecordHdl).
IF cContainerName > "" THEN
RETURN cContainerName.
RETURN "".
END METHOD.
METHOD OVERRIDE PUBLIC CHARACTER GetLabel(pcRecordHdl AS CHARACTER):
DEFINE VARIABLE cTableName AS CHARACTER NO-UNDO.
DEFINE VARIABLE cLabel AS CHARACTER NO-UNDO.
cTableName = Akioma.Swat.RecordHdlHelper:GetTableNameFromHdl(pcRecordHdl).
CASE cTableName:
WHEN "Article" THEN
RETURN "Article".
END CASE.
cLabel = SUPER:GetLabel(pcRecordHdl).
IF cLabel > "" THEN
RETURN cLabel.
RETURN "".
END METHOD.
METHOD OVERRIDE PUBLIC CHARACTER GetIcon(pcRecordHdl AS CHARACTER):
DEFINE VARIABLE cTableName AS CHARACTER NO-UNDO.
DEFINE VARIABLE cIcon AS CHARACTER NO-UNDO.
cTableName = Akioma.Swat.RecordHdlHelper:GetTableNameFromHdl(pcRecordHdl).
CASE cTableName:
WHEN "Article" THEN
RETURN "fad fa-shopping-cart".
END CASE.
cIcon = SUPER:GetIcon(pcRecordHdl).
IF cIcon > "" THEN
RETURN cIcon.
RETURN "".
END METHOD.
END CLASS.
|
|
Declaration
You also need to specify which implementation of the service will be used:Image Removed
Image Added
Expand |
---|
|
Code Block |
---|
<?xml version="1.0"?>
<ttServiceLoader xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ttServiceLoaderRow>
<Order>0</Order>
<ServiceTypeName>Akioma.Swat.OERA.Metadata.IEntityMetadataService</ServiceTypeName>
<ServiceClassName>YOURCLASS.OERA.Metadata.EntityMetadataService</ServiceClassName>
</ttServiceLoaderRow>
</ttServiceLoader> |
|
IEntityMetadataService customization
...