Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.Image Removed 

Image Added

Expand
titleCode snippet


Code Block
languagejs
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
titleCode snippet


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

...

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 key comes 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:

Image RemovedImage Added


Repository Object Changes

...