abstract class EnsLib.RecordMap.Generator extends EnsLib.RecordMap.GenUtilsClass that controls displaying and creating object projections for RecordMaps. See the documentation for individual methods to see detailed information regarding usage and available options.
classmethod DisplayObjectStructure(ByRef pRecordMap As %String = "", pShowTopFields As %Boolean = 1, pDisplayDetails As %Boolean = 1) as %Status [ Language = objectscript ]
Write the object structure for a particular RecordMap to the current device.
- pRecordMap the name of a RecordMap, or an array constructed by GetObjectStructure()
- pShowTopFields indicates whether fields without an explicit object type should be included in the display
- pDisplayDetails indicates whether detailed information about each field's object representation should be displayed
- pTopObjectName specifies the name to be used for the topmost object in the tree.
classmethod GenerateObject(pRecordMap As %String = "", ByRef pTargetClassname As %String, ByRef pStructure As %Integer = 1, pGenTopFields As %Boolean = 1, ByRef pCompile As %Integer = 2, pDisplay As %Integer = 2, pCompileFlags As %String = "ck", pOverwriteBehaviour As %Integer = 2, Output pGeneratedClasses As %String, pKeepStorage As %Boolean = 1) as %Status [ Language = objectscript ]
Generate a parent object for a particular RecordMap.
- pRecordMap: the RecordMap to generate the class definitions from.
- pTargetClassname: the container object to generate the classes in; any generated classes will be created in the same package. If this is not supplied, it will be retrieved from the RecordMap definition.
- pStructure: the structure to use for the generated object and the objects
embedded within the main class. All classes below the top two levels extend %SerialObject.
Possible values are:
- 1: %Persistent main class, %SerialObject for embedded objects [Default]
- 2: %RegisteredObject main class, %Persistent for embedded objects
- 3: %SerialObject for all objects
- 4: %Persistent main class, %SerialObject for embedded objects AND ensure each serial object uses its own storage node. This can be useful for very large input files with many properties.
- 5: %Persistent main class with %Persistent object properties, and %SerialObject subobjects below the second level. Note that this approach generates an OnDelete trigger and uses the %OnDelete() callback in the main class to ensure that its persistent properties are deleted along with their container.
- pGenTopFields: control generation of properties without an object defined. These properties will be generated in the top level class if the flag is enabled.
- pCompile: control compilation of the generated classes. Possible values are:
- 0: Do not compile. A list of generated classes will be returned in the "Generated" subscript of the pCompile variable.
- 1: Compile entire package using $system.OBJ.CompilePackage() (also compiles RecordMap class)
- 2: Compile generated classes as a group and then recompile RecordMap class [Default]
- pDisplay: control display options for the current device. Possible values are:
- 0: Do not display any output
- 1: Display basic object structure and compiler output
- 2: Display detailed object structure, including type information [Default]
- pCompileFlags: compiler flags to use during the compilation. Note that "-d" is added to the compiler flags if pDisplay=0
- pOverwriteBehaviour: control behaviour if a class already exists. Options are:
- 0: Always overwrite existing classes
- 1: Prompt for user input before overwriting. NOTE: this option requires a terminal interface.
- 2: Never overwrite. This prevents generation of further classes [Default from terminal]
- pGeneratedClasses: an array of classes that were generated in the call to the method. The list includes all classes that were generated, even if an error occurs.
- pKeepStorage: flag to control whether we retain the existing storage definition. The flag is needed to ensure that we can add properties to an existing object without corrupting existing data. That said, it may be necessary during development to modify the structure, so this flag can be set to 0 to remove the existing storage definition.
Helper method to generate PutObject() code.