Progress
ADM 2 Guide


ADMProps Temp–table and Object Properties

One mechanism that supports getting and setting many SmartObject properties is the ADMProps temp–table. An ADMProps temp–table is defined for each object; it defines all of the standard object properties for that object type.

Each SmartObject super procedure uses a Progress include file that defines its own set of properties, and each SmartObject type that uses that super procedure also includes the same list. For example, the super procedure smart.p defines functions and procedures that all SmartObjects use and is at the top of the hierarchy of super procedures. This procedure includes smrtprop.i, which defines the basic properties that apply to all SmartObjects. It defines a preprocessor constant for each basic property and also puts a FIELD definition for that property in the ADMProps temp–table. In addition, all SmartObjects use smart.p as a super procedure and include the supporting include file smart.i. The smart.i include file also includes smrtprop.i, as well as adding smart.p as a super procedure.

The smrtprop.i (1 of 2) file defines these properties:

smrtprop.i
.
.
.
 /* These preprocessors let the get and set methods know at compile time
    which property values are located in the temp-table and which must
    be accessed through the property functions.
 */
 &GLOB xpObjectVersion
 &GLOB xpObjectType
 &GLOB xpContainerType
 &GLOB xpPropertyDialog
 &GLOB xpQueryObject
 &GLOB xpContainerHandle
 &GLOB xpInstanceProperties
 &GLOB xpSupportedLinks
 &GLOB xpContainerHidden
 &GLOB xpObjectInitialized
 &GLOB xpObjectHidden
 &GLOB xpContainerSource
 &GLOB xpContainerSourceEvents
 &GLOB xpDataSource
 &GLOB xpDataSourceEvents
 &GLOB xpTranslatableProperties
 &GLOB xpObjectPage
 &GLOB xpDBAware 
 /* This temp-table defines all the property fields for an object.
    This include file contributes the DEFINE statement header and 
    all basic smart object properties. Each other property class include 
    file adds its own fields and then the parent object ends the statement.  
    Define the fields for smart objects only, not for their super procedures.
 */
 /* Note that ObjectHidden is here because "hidden" is a logical concept. */
&IF "{&ADMSuper}":U = "":U &THEN
  CREATE TEMP-TABLE ghADMProps.
  ghADMProps:UNDO = FALSE.
  ghADMProps:ADD-NEW-FIELD(’ObjectVersion’:U, ’CHAR’:U, 0, ?,
    ’{&ADM-VERSION}’:U).
  ghADMProps:ADD-NEW-FIELD(’ObjectType’:U, ’CHAR’:U, 0, ?,
    ’{&PROCEDURE-TYPE}’:U).
  ghADMProps:ADD-NEW-FIELD(’ContainerType’:U, ’CHAR’:U, 0, ?,
    ’{&ADM-CONTAINER}’:U).
  ghADMProps:ADD-NEW-FIELD(’PropertyDialog’:U, ’CHAR’:U, 0, ?,
    ’{&ADM-PROPERTY-DLG}’:U).
  ghADMProps:ADD-NEW-FIELD(’QueryObject’:U, ’LOGICAL’:U, 0, ?, no).
  ghADMProps:ADD-NEW-FIELD(’ContainerHandle’:U, ’HANDLE’:U).
  ghADMProps:ADD-NEW-FIELD(’InstanceProperties’:U, ’CHAR’:U, 0, ?,
    ’{&xcInstanceProperties}’:U ).
  /* NOTE: Any need to support &User-Supported-Links??*/
  ghADMProps:ADD-NEW-FIELD(’ContainerHidden’:U, ’LOGICAL’:U, 0, ?, yes).
  ghADMProps:ADD-NEW-FIELD(’ObjectInitialized’:U, ’LOGICAL’:U, 0, ?, no).
  ghADMProps:ADD-NEW-FIELD(’ObjectHidden’:U, ’LOGICAL’:U, 0, ?, yes).
  ghADMProps:ADD-NEW-FIELD(’UIBMode’:U, ’CHAR’:U, 0, ?, ’’:U).
  ghADMProps:ADD-NEW-FIELD(’ContainerSource’:U, ’HANDLE’:U).
  ghADMProps:ADD-NEW-FIELD(’ContainerSourceEvents’:U, ’CHAR’:U, 0, ?,
    
’initializeObject,hideObject,viewObject,destroyObject,enableObject,confirmE
xit’:U).
  ghADMProps:ADD-NEW-FIELD(’DataSource’:U, ’HANDLE’:U).
  ghADMProps:ADD-NEW-FIELD(’DataSourceEvents’:U, ’CHAR’:U, 0, ?,
    ’dataAvailable,queryPosition,deleteComplete,fetchDataSet’:U).
  ghADMProps:ADD-NEW-FIELD(’TranslatableProperties’:U, ’CHAR’:U, 0, ?,
    ’{&xcTranslatableProperties}’:U).
  ghADMProps:ADD-NEW-FIELD(’ObjectPage’:U, ’INT’:U, 0, ?, 0).
  ghADMProps:ADD-NEW-FIELD(’DBAware’:U, ’LOGICAL’:U, 0, ?,
  &IF DEFINED (DB-AWARE) NE 0 &THEN
    {&DB-AWARE}).
  &ELSE
    no).
  &ENDIF
&ENDIF.
.
.
. 

If a preprocessor has a name of the form xppropname, you can access the associated property value directly from its property temp–table FIELD. The {get} and {set} pseudo-syntax uses this mechanism to optimize references to properties, primarily in super procedures. If it is necessary for either get or set to invoke the corresponding property function (because of some other action it performs), then the preprocessor constant is not defined for that property and references always go through the get and set functions. For more information on the {get} and {set} pseudo-syntax, see the "{get} and {set} Pseudo-syntax for Object Properties" section.

Now consider a SmartObject that is defined as a subclass of smart.p. For example, a SmartDataObject adds smart.p as its first super procedure, and then adds query.p and data.p as the super procedures that define behavior specific to SmartDataObjects. The data.p procedure includes the property include file dataprop.i, which appends more basic values to the list already started by smrtprop.i and continued by qryprop.i. Each property include file adds FIELD definitions to the ADMProps temp–table definition.

The dataprop.i (1 of 2) file defines these additional basic properties:

dataprop.i
.
.
.
 /* Preprocessor definitions which tell at compile time which
    properties can be retrieved directly from the property temp-table. */
 &GLOB xpEnabledTables          
 &GLOB xpAutoCommit             
 &GLOB xpDataHandle             
 &GLOB xpCurrentRowid           
 &GLOB xpAppService             
 &GLOB xpASUsePrompt            
 &GLOB xpASInfo                 
 &GLOB xpASHandle               
 &GLOB xpASDivision             
 &GLOB xpUpdateSource           
 &GLOB xpCommitSource           
 &GLOB xpCommitSourceEvents     
 &GLOB xpCommitTarget           
 &GLOB xpCommitTargetEvents     
 &GLOB xpDataModified
 &GLOB xpRowsToBatch
 &GLOB xpCheckCurrentChanged

{src/adm2/qryprop.i} 
&IF "{&ADMSuper}":U = "":U &THEN
  ghADMProps:ADD-NEW-FIELD(’RowObject’:U, ’HANDLE’:U, 0, ?, ?).
  ghADMProps:ADD-NEW-FIELD(’RowObjUpd’:U, ’HANDLE’:U, 0, ?, ?).
  ghADMProps:ADD-NEW-FIELD(’FirstRowNum’:U, ’INT’:U, 0, ?, ?).
  ghADMProps:ADD-NEW-FIELD(’LastRowNum’:U, ’INT’:U, 0, ?, ?).
  ghADMProps:ADD-NEW-FIELD(’EnabledTables’:U, ’CHAR’:U, 0, ?, ’’:U).
  ghADMProps:ADD-NEW-FIELD(’AutoCommit’:U, ’LOGICAL’:U, 0, ?, yes).
  ghADMProps:ADD-NEW-FIELD(’DataHandle’:U, ’HANDLE’:U).
  ghADMProps:ADD-NEW-FIELD(’CurrentRowid’:U, ’ROWID’:U).
  ghADMProps:ADD-NEW-FIELD(’AppService’:U, ’CHAR’:U, 0, ?, ’’:U).
  ghADMProps:ADD-NEW-FIELD(’ASUsePrompt’:U, ’LOGICAL’:U, 0, ?, ?).
  ghADMProps:ADD-NEW-FIELD(’ASInfo’:U, ’CHAR’:U, 0, ?, ’’:U).
  ghADMProps:ADD-NEW-FIELD(’ASHandle’:U, ’HANDLE’:U).
  ghADMProps:ADD-NEW-FIELD(’ASDivision’:U, ’CHAR’:U, 0, ?, ’’:U).
  ghADMProps:ADD-NEW-FIELD(’UpdateSource’:U, ’HANDLE’:U).
  ghADMProps:ADD-NEW-FIELD(’CommitSource’:U, ’HANDLE’:U).
  ghADMProps:ADD-NEW-FIELD(’CommitSourceEvents’:U, ’CHAR’:U, 0, ?,
    ’commitTransaction,undoTransaction’:U).
  ghADMProps:ADD-NEW-FIELD(’CommitTarget’:U, ’CHAR’:U, 0, ?, ’’:U).
  ghADMProps:ADD-NEW-FIELD(’CommitTargetEvents’:U, ’CHAR’:U, 0, ?, 
’rowObjectState’:U).
  ghADMProps:ADD-NEW-FIELD(’DataModified’:U, ’LOGICAL’:U, 0, ?, no).
  ghADMProps:ADD-NEW-FIELD(’RowsToBatch’:U, ’INT’:U, 0, ?, 200).  /* Rows per 
AppServer xfer */
  ghADMProps:ADD-NEW-FIELD(’CheckCurrentChanged’:U, ’LOGICAL’:U, 0, ?, yes).
  ghADMProps:ADD-NEW-FIELD(’NextBatchRow’:U, ’CHAR’:U, 0, ?, ?).   /* Next 
row to return in a batch */
  ghADMProps:ADD-NEW-FIELD(’DataQueryBrowsed’:U, ’LOGICAL’:U, 0, ?, no).
  ghADMProps:ADD-NEW-FIELD(’FirstResultRow’:U, ’CHAR’:U, 0, ?, ?).
  ghADMProps:ADD-NEW-FIELD(’LastResultRow’:U, ’CHAR’:U, 0, ?, ?).
  ghADMProps:ADD-NEW-FIELD(’RebuildOnRepos’:U, ’LOGICAL’:U, 0, ?, no).
  ghADMProps:ADD-NEW-FIELD(’RowObjectState’:U, ’CHAR’:U, 0, ?, 
’NoUpdates’:U).
  ghADMProps:ADD-NEW-FIELD(’ServerOperatingMode’:U, ’CHAR’:U, 0, ?, ?).
  ghADMProps:ADD-NEW-FIELD(’StatelessSavedProperties’:U, ’CHAR’:U, 0, ?,
    
’CheckCurrentChanged,RowObjectState,LastResultRow,FirstResultRow,QueryRowId
ent’:U).
  ghADMProps:ADD-NEW-FIELD(’DestroyStateless’:U, ’LOGICAL’:U, 0, ?, no).
  ghADMProps:ADD-NEW-FIELD(’DisconnectAppServer’:U, ’LOGICAL’:U, 0, ?, no).
&ENDIF
.
.
. 

As this example shows, each SmartObject type appends more basic properties to the end of the existing list. The process of appending basic properties to the existing list can be nested to any number of levels of object definition. In this case, both the data.p super procedure for SmartDataObjects, and individual SmartObjects themselves, include dataprop.i. The dataprop.i include file in turn includes qryprop.i, which includes smrtprop.i. Basic properties are then initialized in each corresponding object include file (such as smart.i for all SmartObjects and data.i for SmartDataObjects). This initialization both allocates FIELDs for each basic property and, where appropriate, assigns specific initial values. Because these preprocessor values are included in both the super procedures and in master objects of the type, both have access to them. This allows a super procedure to retrieve a property value directly from the ADMProps temp–table of its TARGET–PROCEDURE, which is extremely fast, instead of using function calls.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095