Sample Business Entity without before-image support
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
Following is a sample ABL class defined for a Data Object resource that has no
before-image support (and with all annotations removed). It implements the standard Data
Object CRUD operations for a Data Object resource defined for a ProDataSet named dsCustomer with the following public methods:
-
Create —
CreatedsCustomer( ) -
Read —
ReaddsCustomer( ) -
Update —
UpdatedsCustomer( ) -
Delete —
DeletedsCustomer( )
In this case, the ProDataSet contains a single temp-table, eCustomer, with a
before-table, beCustomer, that is defined for the
Customer table in the sports2000 database. The
listing of the data model follows the class.
eCustomer has a before-table
defined, it is not used to support JSDO before-imaging in this case, since the Data
Object resource is defined without before-image support. Instead, it is used to process
the appropriate Data Object operation request for the single input record in the
ProDataSet, as described below.All the public methods dispatch their function to private methods that manage
the business logic, such as to interpret the filter string passed to the ReaddsCustomer( ) method. The Create, Update, and Delete
operations rely on a commitCustomers( ) method to apply
the row state from the operation method to the changed record and execute the SAVE-ROW-CHANGES( ) method on the corresponding
before-table buffer handle accordingly.
INPUT-OUTPUT DATASET parameter
replaces the dsCustomer data left over from any prior
operation.
|
commitCustomers( ) method uses, as a
convenience, a FOR EACH statement to mark the row state
of the single temp-table record sent from the client, and uses another FOR EACH statement to call SAVE-ROW-CHANGES( ) on the single before-image record to create, update,
or delete the record according to its row state.Following is the dsCustomer.i include file that provides the data model for
the dsCustomer class.
|