Kbase 21326: How To Split a Procedure Across an AppServer Boundary
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Verified
GOAL:
How To Split a Procedure or Structured Procedure Across an AppServer Boundary.
The average structured procedure does not provide the DB-Required check box in its code sections and therefore is not intended to be split.
FACT(s) (Environment):
Progress 9.x
FIX:
When designing applications to work across an AppServer boundary, there will inevitably be reusable logic that the application developer might need throughout different sections of the application.
One way to reuse logic is by creating a .p with a number of Internal Procedures or Functions. These can be loaded as a super procedure of particular procedures or of the session itself.
Within this logic, you are likely to see some that rely on a database connection, that is data lookups and validation, and some that apply specifically to the UI.
In the ADM2, the SmartDataObject (SDO) is designed this way. It has a Client-side piece (<filename>_cl.w) and a Server-side piece (<filename>.w).
This gives the developer the ability to specify which internal routines require a database connection and which don't. This is something that is settable in the Section Editor.
To illustrate this, open an SDO in the AppBuilder and access its Procedures or Functions Section in the Section Editor. You should see a 'DB-Required' toggle-box at the top of the window. By checking this toggle-box you will make the entire internal procedure/function database-required. That means that the AppBuilder's analyzer will compile out this section of the code for the client version of the file (_cl), but it will remain in the DB-Required section of the code.
If this toggle-box is left unchecked, the code will be available in both versions of the file.
Alternatively, if you wish to make only part of the procedure DB-Required, the db-required code should be surrounded by the following tags.
{&DB-REQUIRED-START}
<db required code here...>
{&DB-REQUIRED-END}
The above describes the default behavior of the SDO and the SmartBusinessObject (SBO). The average structured procedure does not provide the DB-Required check box in its code sections and therefore is not intended to be split.
To achieve this result with a procedure, follow the below steps. For existing structured procedures start with step 4.
Creating a Structured Procedure
1) In the AppBuilder, select File > New.
2) In the New dialog, select Structured Procedure then click OK.
Splitting the Procedure across an AppServer boundary
3) Save the procedure giving it a name such as, biznisLogic.p.
4) Open the new procedure in the Procedure Editor and find the section that starts with, 'Settings for THIS-PROCEDURE'. This section will be surrounded in comments and the last line of it begins with 'Other Settings'.
5) At the end of the line that begins 'Other Settings', add DB-AWARE to this space separated list.
6) Close and Save the procedure, then re-open it in the AppBuilder.
7) Save the procedure in the AppBuilder, then look in the directory where you saved it. You should see a client proxy (_cl) file for the procedure.
8) To further test the success of this, go to the Procedures Section of the procedure and create a new procedure, once in the Section Editor for the new procedure you should see the 'DB-Required' toggle-box.