Logo

    Home

    Documentation

    Use Cases

    Training

    Applications

    Release Notes

    DynamicBusinessEntity Class: Override B1 standard with individual logic

    DynamicBusinessEntity Class: Override B1 standard with individual logic

    • 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 or RecieveData
    • Write: SaveChangesor ValidateData

    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

    icon
    Please note, that samples are currently not provided in customer environments. Contact your B1 contact person for more details

    In SWAT, SampleSwatDynamicBusinessEntity is a working example with one method for read/write:

    ‣
    See sample

    There is also screen where this can be seen: SampleDynamicBEDialog

    ‣
    See dialog

    Back to DocumentationDocumentation

    Back to Home Page

    Logo
    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.