Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development

> ## Static ADM attribute support

> In the ADM, SmartObject attributes (also referred to as properties) are defined in include files that are compiled into each static SmartObject. The first include file (or top file) is `src/adm2/smrtprop.i`. This file creates a dynamic temp-table named `ADMProps` and adds fields to the table that define the basic attributes. Each temp-table field defines the name, data-type, and, if appropriate, the initial value of the attribute. The following code below shows the initial basic attributes used by all SmartObjects:

>     CREATE TEMP-TABLE ghADMProps.
>     ghADMProps:UNDO = FALSE.
>     ghADMProps:ADD-NEW-FIELD('ObjectName':U, 'CHAR':U, 0, ?, '':U).
>     ghADMProps:ADD-NEW-FIELD('ObjectVersion':U, 'CHAR':U, 0, ?,
>     '{&ADM-VERSION}':U).
>     ghADMProps:ADD-NEW-FIELD('ObjectType':U, 'CHAR':U, 0, ?,
>     '{&PROCEDURE-TYPE}':U).
>     …

> Each file in the class object hierarchy that makes up an object adds one field for each attribute in that class to the temp-table, This creates a temp-table for each procedure-based SmartObject that has one record that holds the attribute values for the specific SmartObject. The initial values of some of the attributes are set by the `ADD-NEW-FIELD` methods that add fields to the temp-tables dynamically. The remaining attribute values are assigned either at design time or at run time.

> The include files also define a number of preprocessor values that begin with `xp` followed by the name of the attribute. These preprocessor values indicate which of the attribute values can safely be set or retrieved at run time by reading the field directly from the temp-table record. If an `xp` preprocessor is defined for that attribute, then the information in the temp-table is used. If the information cannot be read from the temp-table, it must be set and retrieved by executing `get` and `set` functions for the attribute. Typically, the `get` and `set` functions are defined in the super procedure of the class. This is appropriate for cases where the attribute value must be calculated before it is retrieved, or when setting the attribute value has side effects that must be executed in addition to setting the value in the temp-table.

> The following code shows the beginning of a list of `xp` preprocessors from the `smrtprop.i` file:

>     &GLOB xpObjectName
>     &GLOB xpObjectVersion
>     &GLOB xpObjectType
>     …

> When a static SmartObject is compiled, all of the include files that define the attribute fields are compiled into it. Run-time code then sets and manages the values in the temp-table record.

> ##### Defining support functions for new attributes

> When you define a new attribute that is required for an extended class, you can set a value that registers in the Repository where the attribute can be accessed directly without going through the standard `get` and `set` functions. However, this information is used only by the Repository Manager and not by references to the attributes in other code. For this reason, you must either define functions for the attributes or set up a property include file. Since the functions are needed to enable other objects to access your attributes, and for the attributes to work with standard static SmartObjects, it is best to include this file in your compilation.

> For more information, see the "Instantiation order for super procedures" section.

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