- Description
- How to use it
- Overriding the dynamic Business entity class
- Migration: Replace existing DSOs
- Sample
Description
In this example we describe the possibility to override a Standard B1 class, which will be executed on every action performed to the database. A real life example would be to enable an self implemented multi tenancy logic, where for each query to the backend some information will be added
How to use it
Overriding the dynamic Business entity class
Create a new class, which inherits the existing SwatDynamicBusinessEntity
class, and override the desired methods:
- Read:
FetchData
orRecieveData
- Write:
SaveChanges
orValidateData
USING Progress.Lang.*.
USING Consultingwerk.Exceptions.Exception FROM PROPATH.
BLOCK-LEVEL ON ERROR UNDO, THROW.
CLASS Akioma.Swat.Samples.DynamicBusinessEntity.SampleSwatDynamicBusinessEntity
INHERITS Akioma.Swat.OERA.Dynamic.SwatDynamicBusinessEntity:
CONSTRUCTOR PUBLIC SampleSwatDynamicBusinessEntity(pcEntityIdentifier AS CHARACTER):
SUPER(pcEntityIdentifier).
END CONSTRUCTOR.
METHOD PUBLIC OVERRIDE VOID FetchData (poFetchDataRequest AS Consultingwerk.OERA.IFetchDataRequest):
// your code
END METHOD.
METHOD PUBLIC OVERRIDE VOID SaveChanges ():
// your code
END METHOD.
END CLASS.
Migration: Replace existing DSOs
In order to override existing BEs, without changing each DSO manually, we have a new procedure: replace-base-dynamic-dso-in-repository.p.
Here you provide an input product code, such as “SWAT” and a new dynamic class name, such as Akioma.Swat.Samples.DynamicBusinessEntity.SampleSwatDynamicBusinessEntity
. The procedure will replace all class values of the “resourceName” attribute with the given class, on DSO master or instance, if the class is valid.
The procedure can be called from wurmel
, using the relative path:
run Akioma/Swat/Tools/replace-base-dynamic-dso-in-repository.p(”productName”, “newDynamicClassName”).
Sample
In SWAT, SampleSwatDynamicBusinessEntity is a working example with one method for read/write:
There is also screen where this can be seen: SampleDynamicBEDialog
Back to Documentation
Back to Home Page