%SYSTEM.OBJ
Class %SYSTEM.OBJ Extends Help [ Abstract, System = 4 ]
The %SYSTEM.OBJ class provides an interface for managing class definitions.
You can use it via the special $system object: Do $system.OBJ.Load("MyFile.xml","ck")
Many methods in this class use the qspec argument, which is a list of flags or qualifiers. See System Flags and Qualifiers.
Methods
New
ClassMethod New(ClassName As %String = "") As %ObjectHandle [ CodeMode = expression ]
Create a new object instance.
Create a new object instance of type ClassName and return a reference (OREF) to it.
Using this method, you can dynamically create objects, that is you can determine what type of object to create at run-time.
For example: Set obj = $System.OBJ.New("Person")
Open
ClassMethod Open(ClassName As %String = "", oid As %String = "") As %ObjectHandle [ CodeMode = expression ]
Open a persistent object instance.
Load a persistent object instance of type ClassName and with OID value oid from disk and return a reference (OREF) to it.
For example: Set person = $System.OBJ.Open("Person",oid)
OpenId
ClassMethod OpenId(ClassName As %String = "", id As %String = "") As %ObjectHandle [ CodeMode = expression ]
Open a persistent object instance.
Load a persistent object instance of type ClassName and with ID value id from disk and return a reference (OREF) to it.
For example: Set person = $System.OBJ.OpenId("Person",22)
Dump
ClassMethod Dump(oref As %String = "") As %Status
Dump an object to the console.
Write the in-memory state of a object referred to by oref to the console (the current device). Set person = ##class(Person).%OpenId(22) Do $system.OBJ.Dump(person)
DisplayError
ClassMethod DisplayError(err As %Status = {$get(%objlasterror)}) As %Status [ CodeMode = expression ]
Decode and display an object error message to the console. If err is omitted, display the last generated object error.
Load
ClassMethod Load(file As %String = "", qspec As %String = "", ByRef errorlog As %String, ByRef loadedlist As %String, listonly As %Boolean, selecteditems As %String, displayname As %String, charset As %String = "", ByRef description As %String) As %Status
Load a file from disk.
Load, and optionally compile (if 'c' flag is present), class definitions, CSP pages, routines, or globals from the file file. file may be a list of files to load separated with '*' symbols.
You can import files exported in XML format, %RO format, CDL format, UDL format, %GOF, and CSR/CSP files.
A comma-separated list of the items it loaded is returned in loadedlist. If the list is too long to fit in the variable, it is terminated with '...'. Items loaded are always returned as subscripts of the multidimensional loadedlist array.
If you pass listonly as true, the method does not import anything, but instead just lists the items that exist in file.
If selecteditems is defined, then this must contain either a comma-separated list of items to import or a multidimensional array. The method imports only items that are in this list from the file provided, so this provides a way to limit which items get imported.
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'.
When loading a %RO file, the description variable is filled in with the description from the %RO file, if there is one present.
errorlog is a multidimensional array of the %Status return values from this call.
The displayname is normally not provided. If present, it changes the 'load file XYZ' name from the filename to the displayname. This is useful when loading a stream where the stream filename is not the name of the file the user knows from a client system and we want to present a meaningful name. If the filename ends in .gzip or .gz, the method uses ungzip to decompress this file before loading it.
LoadStream
ClassMethod LoadStream(stream As %AbstractStream, qspec As %String = "", ByRef errorlog As %String, ByRef loadedlist As %String, listonly As %Boolean, selecteditems As %String, displayname As %String, charset As %String = "") As %Status
Load a stream.
Load and, optionally compile (if 'c' flag is present), class definitions, CSP pages, routines or globals from the stream stream. Returns, by reference, a multidimensional array of the items it loaded in loadedlist. If you pass listonly as true, then it does not import anything but instead just lists the items that exist in the stream that you supply.
If selecteditems is defined, then this must contain a comma-separated list of items to import (or a multidimensional array). It imports only items that are in this list from the stream provided, so this provides a way to limit which items get imported.
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'.
LoadDir
ClassMethod LoadDir(dir As %String = "", qspec As %String = "", ByRef errorlog As %String, recurse As %Boolean, ByRef loadedlist As %String) As %Status
Load all class definitions in a directory.
Load and optionally compile (if 'c' flag is present) all class definitions within directory dir, this includes all .XML files. If the recurse is true, then it includes subdirectories. Returns a comma-separated list of the items it loaded in loadedlist and the same data also as loadedlist(name)="" in case the comma list is more than 32k. Note that this method compiles only *classes* found in these XML files and no other types. If you want to be able to compile anything, instead use the ImportDir.
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'.
ImportDir
ClassMethod ImportDir(dir As %String = "", wildcards As %String, qspec As %String = "", ByRef errorlog As %String, recurse As %Boolean = 0, ByRef imported As %String, listonly As %Boolean, ByRef selectedlist As %String)
Import and optionally compile all items in a directory.
This imports all files found in a directory using the Load method so it should be able to detect most common formats. If you pass it the compile flag ('c'), after loading it also compiles all these items. The other flags are the same as found in Load except for the dir which is the directory to load and the recurse which determines if this looks into subdirectories or not.
You can limit the items it imports by specifying a wildcards value. For example '*.xml' imports only files that end in XML.
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'.
Compile
ClassMethod Compile(ByRef classes As %String = "", qspec As %String = "", ByRef errorlog As %String, recurse As %Boolean = 0) As %Status [ CodeMode = expression ]
Compile a class.
Compiles the class or classes specified by the classes argument, which can be a single class name, a comma-separated list of class names, or a multidimensional array of class names. You can also use ? or * wildcards. If you wish to exclude items, pass ' before the item name; this syntax also supports wildcards, e.g. "User.*,'User.T*".
If recurse is true, then do not output the initial 'compiling' message or the compile report as this is being called inside another compile loop.
qspec is a list of flags or qualifiers, which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'.
CompileList
ClassMethod CompileList(ByRef list As %String = "", qspec As %String = "", ByRef errorlog As %String, ByRef updatedlist As %String) As %Status
Compile a list of items specified in 'list' and separated by commas, or a multidimensional array ("item.MAC")="". You can also use ? or * wildcards. If you wish to exclude items, pass ' before the item name; this syntax also supports wildcards, e.g. "User.*.cls,'User.T*.cls".
Each item on the list is suffixed by the type of item it is, so to compile a class and a routine, you could specify 'class.cls,routine.mac'
The order of compilation is INT, CLS, MAC, CSR, CSP.
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. Note that while /mapped=0 qualifier applies to the pattern passed in by only searching the default routine database, however any compile is done in the current namespace. So it is possible a routine/class found with /mapped=0 may not be visible in the current namespace or may be a different version if there are complicated package mappings.
CompileAllNamespaces
ClassMethod CompileAllNamespaces(qspec As %String = "", ByRef errorlog As %String) As %Status [ CodeMode = expression ]
Invoke $system.OBJ.CompileAll() for all the namespaces.
Parameters
Name | Description |
---|---|
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. |
errorlog | errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus(). |
The return value is a %Status value indicating success or failure. |
CompileAll
ClassMethod CompileAll(qspec As %String = "", ByRef errorlog As %String) As %Status [ CodeMode = expression ]
Compile all classes within this namespace.
By default, the method does not compile classes mapped from another database unless the qualifier '/mapped=1' is provided.
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'.
CompilePackage
ClassMethod CompilePackage(package As %String = "", qspec As %String = "", ByRef errorlog As %String) As %Status [ CodeMode = expression ]
Compile all classes within the specified package.
Parameters
Name | Description |
---|---|
package | You can pass one or more comma-separated packages in package argument. |
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. |
errorlog | errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus. |
The return value is a %Status value indicating success or failure. |
CompileProject
ClassMethod CompileProject(project As %String = "", qspec As %String = "", ByRef errorlog As %String) As %Status
Compile all entries in this project.
Parameters
Name | Description |
---|---|
project | The name of the package to be compiled. |
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. |
errorlog | errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus(). |
The return value is a %Status value indicating success or failure. |
Delete
ClassMethod Delete(ByRef classes As %String = "", qspec As %String = "", ByRef errorlog As %String) As %Status [ CodeMode = expression ]
Delete a class.
Delete the definition of the given class or classes, specified by the classes argument from this namespace. This argument can be a single class name, a comma-separated list of class names, or a multidimensional array of class names. You can also use ? or * wildcards. If you wish to exclude items, pass ' before the item name; this syntax also supports wildcards, e.g. "User.*,'User.T*".
If the class to delete is persistent, include the 'e' flag or '/deleteextent' qualifier to delete the extent data and extent metadata. Refer to %ExtentMgr.Util for more information on extent metadata.
Parameters
Name | Description |
---|---|
classes | The class, a comma-separated list of classes, or a multidimensional array of class names. Wildcards may be specified. |
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. |
errorlog | errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus. |
The return value is a %Status value indicating success or failure. |
DeletePackage
ClassMethod DeletePackage(package As %String = "", qspec As %String = "") As %Status [ CodeMode = expression ]
Delete all the classes within the specified package. Note that this ignores the '/mapped' qualifier as if you know the exact package name it is assumed you wish to delete it even if the package is mapped from another database.
Parameters
Name | Description |
---|---|
package | You can pass one or more comma-separated packages in package argument. If package is '*' then all classes are deleted. |
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. |
The return value is a %Status value indicating success or failure. |
DeleteAll
ClassMethod DeleteAll(qspec As %String = "") As %Status [ CodeMode = expression ]
Delete all the classes in this namespace.
Parameters
Name | Description |
---|---|
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. |
The return value is a %Status value indicating success or failure. |
DeleteProject
ClassMethod DeleteProject(project As %String = "", qspec As %String = "") As %Status [ CodeMode = expression, ProcedureBlock = 1 ]
Delete the named project from this namespace.
Parameters
Name | Description |
---|---|
project | The name of the project to delete. |
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. |
The return value is a %Status value indicating success or failure. |
Export
ClassMethod Export(ByRef items As %String = "", ByRef filename As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") As %Status [ CodeMode = expression ]
Export items as an XML file.
Parameters
Name | Description |
---|---|
items | The items to export. Each of the items must have a type determined by an extension selected from the following list of basic types, additional types are supported under the abstract routine interface, so this list is not exhaustive. CLS - Classes CSP - Server Pages CSR - Rule files MAC - Macro routines INT - Non-macro routines BAS - Basic routines INC - Include files GBL - Globals PRJ - Projects OBJ - Compiled object code PKG - Package definitions If exporting multiple items, separate them with commas or pass the items("item")="" as a multidimensional array. For example, you can define the items argument as a comma-separated list as follows: set items="PackageOne.ClassA.cls,PackageTwo.ClassB.cls,PackageThree.ClassC.cls" Then you could invoke the Export method as follows: do $system.OBJ.Export(items,myfilename) Or you could define the items argument as a multidimensional array as follows: set items("PackageOne.ClassA.cls")="" set items("PackageTwo.ClassB.cls")="" set items("PackageThree.ClassC.cls")="" In this case, you must pass the items argument by reference as follows: do $system.OBJ.Export(.items,myfilename) You can also use ? or * wildcards. If you wish to exclude items, pass ' before the item name; this syntax also supports wildcard, e.g. "User.*.cls,'User.T*.cls". |
filename | If the output filename is empty, matching items are exported to the current device. |
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. If you pass qualifier '/recursive=1', the method also exports any related, e.g. include files included by a class or a superclass, the idea being that this will be a compilable set of items. If the filename ends in .gz or .gzip, the method automatically compresses the file with gzip. |
errorlog | errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus. |
Charset | The character set to use for this export. If this argument is not specified, the method uses 'utf-8'. |
The return value is a %Status value indicating success or failure. |
ExportToStream
ClassMethod ExportToStream(items As %String = "", ByRef stream As %Stream.Object = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") As %Status
Export items in XML format to a stream
Parameters
Name | Description |
---|---|
items | The items to export. Each of the items must have a type determined by an extension selected from the following list of basic types, additional types are supported under the abstract routine interface so this list is not exhaustive. CLS - Classes CSP - Cache Server Pages CSR - Cache Rule files MAC - Macro routines INT - Non-macro routines BAS - Basic routines INC - Include files GBL - Globals PRJ - Studio projects OBJ - Compiled object code PKG - Package definitions If exporting multiple items, separate them with commas, pass the items("item")="" as a multidimensional array. You can also use ? or * wildcards. If you wish to exclude items, pass ' before the item name; this syntax also supports wildcard, e.g. "User.*.cls,'User.T*.cls". |
stream | The stream in which to place exported items. |
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. If you pass qualifier '/recursive=1', the method also exports any related, e.g. include files included by a class or a superclass, the idea being that this will be a compilable set of items. If the filename ends in .gz or .gzip, the method automatically compresses the file with gzip. |
errorlog | errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus. |
Charset | The character set to use for this export. Note that if you pass in a Charset and also pass in a character stream, the method does not use the Charset argument unless the stream is a file character stream. The reason for this is a character stream deals with characters so Charset is only about binary representations of character data. In this specific case of a file character stream, the method sets the TranslateTable property of the file stream to the Charset argument. |
The return value is a %Status value indicating success or failure. |
ExportPattern
ClassMethod ExportPattern(pattern As %String = "", ByRef filename As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") As %Status [ CodeMode = expression ]
Export all items matching a pattern to an XML file
If you pass a pattern of '*.cls', the method exports all classes in this namespace. If you pass a pattern of 'a*.mac', the method exports all MAC routines that start with the letter 'a'. If the filename ends in .gz or .gzip, the method automatically compresses the file with gzip.
Parameters
Name | Description |
---|---|
pattern | The pattern used to construct a list of items to be exported. |
filename | If the output filename is empty, matching items are exported to the current device. |
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. If you pass qualifier '/recursive=1', the method also exports any related, e.g. include files included by a class or a superclass, the idea being that this will be a compilable set of items. If the filename ends in .gz or .gzip, the method automatically compresses the file with gzip. |
errorlog | errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus. |
Charset | The character set to use for this export. If this argument is not specified, the method uses 'utf-8'. |
The return value is a %Status value indicating success or failure. |
ExportPatternToStream
ClassMethod ExportPatternToStream(pattern As %String = "", ByRef stream As %Stream.Object = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") As %Status
Export all items matching a pattern in XML format to a stream
If you pass a pattern of '*.cls', the method exports all classes in this namespace. If you pass a pattern of 'a*.mac', the method exports all MAC routines that start with the letter 'a'.
Parameters
Name
Description
pattern
The pattern used to construct a list of items to be exported.
stream
If stream is passed in then the data is appended to this stream. If it is "" when called, the method creates a stream and returns this.
qspec
qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'.
If you pass qualifier '/recursive=1', the method also exports any related, e.g. include files included by a class or a superclass, the idea being that this will be a compilable set of items. If the filename ends in .gz or .gzip, the method automatically compresses the file with gzip.
errorlog
errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus.
Charset
The character set to use for this export. If this argument is not specified, the method uses 'utf-8'.
The return value is a %Status value indicating success or failure.
ExportJava
ClassMethod ExportJava(classname As %String = "", dirname As %String = "", qspec As %String = "", ByRef errorlog As %String, ByRef paths = "", ByRef Seen) As %Status
Export a class to a Java file.
Export class classname to a Java file in directory dirname.
ExportJavaPackage
ClassMethod ExportJavaPackage(Package As %String = "", dirname As %String = "", qspec As %String = "", ByRef errorlog As %String, ByRef paths = "") As %Status
Export classes in this package to Java.
Search for classes in the package and export them. The search for classes respects the qspec passed. If the package is "*", the method searches for all classes in this namespace.
Export class package to a Java file in directory dirname.
ExportCPP
ClassMethod ExportCPP(classname As %String = "", dirname As %String = "", qspec As %String = "", ByRef errorlog As %String) As %Status [ CodeMode = expression ]
Export a class to C++ files.
Export class classname to C++ files in directory dirname.
ExportDynCPP
ClassMethod ExportDynCPP(classname As %String = "", dirname As %String = "", proplist As %String = "", methodlist As %String = "", qspec As %String, ByRef errorlog As %String) As %Status [ CodeMode = expression ]
ExportODL
ClassMethod ExportODL(classname As %String = "", filename As %String = "", qspec As %String = "", ByRef errorlog As %String) As %Status [ CodeMode = expression ]
Export a class to ODL file.
Export class classname to ODL file with file name filename.
ExportUDL
ClassMethod ExportUDL(itemname As %String = "", filename As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") As %Status [ CodeMode = expression ]
Export a class or routine in UDL format.
Export document itemname to file filename in UDL format.
ExportPackage
ClassMethod ExportPackage(package As %String = "", ByRef filename As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") As %Status [ CodeMode = expression ]
Export a set of classes in a package as an XML file.
Export package package to an XML file with name filename.
ExportPackageToStream
ClassMethod ExportPackageToStream(package As %String = "", ByRef stream As %Stream.Object = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") As %Status
Export a set of classes in a package in XML format to a stream.
Export package package to an XML file with name filename. If stream is passed in, then the data is appended to this stream. If it is "" when called, the method creates a stream and returns this.
ExportAllClasses
ClassMethod ExportAllClasses(ByRef filename As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") As %Status [ CodeMode = expression ]
Export all the classes in this namespace as one large XML file.
This method loops through all the classes, exporting them to the file filename. It restricts which classes are exported based on the qspec parameter.
Parameters
Name | Description |
---|---|
filename | The file to which data is exported. |
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. If you pass qualifier '/recursive=1', the method also exports any related, e.g. include files included by a class or a superclass, the idea being that this will be a compilable set of items. If the filename ends in .gz or .gzip, the method automatically compresses the file with gzip. |
errorlog | errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus. |
Charset | The character set to use for this export. If this argument is not specified, the method uses 'utf-8'. |
The return value is a %Status value indicating success or failure. |
ExportAllClassesToStream
ClassMethod ExportAllClassesToStream(ByRef stream As %Stream.Object = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") As %Status
Export all the classes in this namespace to a stream.
This method loops through all the classes, exporting them to a stream. It restricts the classes that are exported based on the qspec parameter.
Parameters
Name
Description
stream
If stream is passed in, then the data is appended to this stream. If it is null when called, the method creates a stream and returns this.
qspec
qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. See System Flags and Qualifiers.
If you pass qualifier '/recursive=1', the method also exports any related, e.g. include files included by a class or a superclass, the idea being that this will be a compilable set of items. If the filename ends in .gz or .gzip, the method automatically compresses the file with gzip.
errorlog
errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus.
Charset
The character set to use for this export. If this argument is not specified, the method uses 'utf-8'.
The return value is a %Status value indicating success or failure.
ExportAllClassesIndividual
ClassMethod ExportAllClassesIndividual(dirname As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "", Package As %String = "*", SubDir As %Boolean = 0) As %Status [ CodeMode = expression ]
Export all the classes as individual XML files to a directory.
This method loops through all the classes, exporting each one as an individual XML file named after the classname to the directory dirname. If you specify a Package, then it exports only this package. If SubDir is true,, the method exports sub-packages as subdirectories.
Parameters
Name | Description |
---|---|
dirname | The directory where exported files will be placed. |
qspec | qspec is a list of flags and qualifiers that can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. If you pass qualifier '/recursive=1', the method also exports any related, e.g. include files included by a class or a superclass, the idea being that this will be a compilable set of items. If the filename ends in .gz or .gzip, the method automatically compresses the file with gzip. |
errorlog | errorlog is a multidimensional array of the %Status error values encountered during the execution of this method. Each status value is in the format returned by $system.Status.DecomposeStatus. |
Charset | The character set to use for this export. If this argument is not specified, the method uses 'utf-8'. |
Package | If you specify a Package, the method exports only this package. |
Subdir | If SubDir is true, the method exports sub-packages as subdirectories. |
The return value is a %Status value indicating success or failure. |
GetPackageList
ClassMethod GetPackageList(ByRef items As %String, package As %String, qspec As %String = "") As %Status
Return, by reference, a multidimensional array of classes in this package.
Search for classes in the package and put their names into the local array items. If the package is "*", then the method returns all classes in this namespace; this does not include mapped packages (see the comments on qspec).
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. For example, to search mapped packages, include the qualifier /mapped within the qspec argument. Similarly, to search subpackages, include the qualifier /includesubpackages within the qspec argument.
For example, the following code returns (within myitems), a multidimensional array of the classes within the Test package, including any mapped items and all subpackages:
do $system.OBJ.GetPackageList(.myitems,"Test","/mapped/includesubpackages")
GetClassList
ClassMethod GetClassList(ByRef items As %String, qspec As %String = "") As %Status
Return, by reference, a multidimensional array of classes in this namespace.
Search for classes in this namespace and put their names into the multidimensional array items.
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'. The search for classes respects the qspec passed. It uses the following qualifiers:
- /application=1/0 - Include application classes
- /system=1/0 - Include system classes (ones with class attribute 'system' set to something other than zero)
- /percent=1/0 - Include percent classes
- /mapped=1/0 - Include classes mapped from other databases or just classes in default databases
MakeClassDeployed
ClassMethod MakeClassDeployed(ByRef classes As %String = "", qspec As %String = "", fulldeploy As %Boolean = 0) As %Status [ CodeMode = expression ]
Make a class or classes deployed. classes can be a single class, a comma-separated list, a multidimensional array of class names. You can also use ? or * wildcards. If you wish to exclude items, pass ' before the item name; this syntax also supports wildcard, e.g. "User.*,'User.T*". This deletes all the source code of the class from the disk. Once a class is in deployed mode, it cannot be edited or exported or recompiled. You can still create subclasses of a deployed class and compile these.
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'.
If fulldeploy is true, the method attempts to remove pretty much the entire class definition, leaving just the minimum so the class is runnable. This does not work on persistent, serial, datatype, or XML-enabled classes as these require access to the class definition at runtime in order to function.
Note that for a class to be deployed, it must be compiled; if you try to deploy a class which is not compiled it will report an error.
UnCompile
ClassMethod UnCompile(ByRef classes As %String = "", qspec As %String = "") As %Status [ CodeMode = expression ]
Uncompile a class or classes.
classes can be a single class, a comma-separated list, a multidimensional array of class names. You can also use ? or * wildcards. If you wish to exclude items, pass ' before the item name; this syntax also supports wildcard, e.g. "User.*,'User.T*".
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'.
ShowClasses
ClassMethod ShowClasses(qspec As %String = "") As %Status
Write all classes defined in this namespace to the console.
The optional qspec argument is a qualifier string containing any of the following options:
/detail | Show details. |
---|---|
/hidden | Show hidden classes. |
/mapped | Show mapped classes. |
For example: Do $System.OBJ.ShowClasses("/detail")
ShowObjects
ClassMethod ShowObjects(qspec As %String = "") As %Status
Write all object instances in this process to the console. Note that some of the objects displayed may be process-specific singleton objects such as classes in the %SYSTEM.Context package or oref's that these singleton objects themselves hold.
The optional qspec argument is a string containing any of the following characters:
/detail=1 | Show details. |
---|
For example: Do $System.OBJ.ShowObjects("/detail=1")
CloseObjects
ClassMethod CloseObjects() As %Status [ CodeMode = expression, Deprecated ]
Deprecated method; to close objects, let them go out of scope.
SaveObjects
ClassMethod SaveObjects() As %Status
Save all instances of %Library.Persistent in the process. Returns a status value.
Version
ClassMethod Version() As %String [ CodeMode = expression ]
Return the version number of the current object library.
ShowFlags
ClassMethod ShowFlags()
Display the list of flags used by the compiler. Should use ShowQualifiers as flags have been superseded by qualifiers.
ShowQualifiers
ClassMethod ShowQualifiers(group As %String = "")
Display the list of qualifiers defined in the system. This method also shows the default qualifiers defined at system level and at namespace levels. The argument group has been deprecated.
ShowReferences
ClassMethod ShowReferences(oref As %String, chkObj As %Boolean = 0) [ PublicList = arr ]
Display a list of all variables that contain a reference to this oref.
If chkObj is 1, the properties of any varibles that contain an object reference are also searched and displayed. Otherwise only non-object variables are searched.
The list has the base $STACK level of the variable, the internal stack level (as shown by the %STACK utility), and the variable name.
ShowMacros
ClassMethod ShowMacros()
Display the list of supported macros defined in the system.
SetFlags
ClassMethod SetFlags(flags As %String, system As %Boolean = 0) As %String
Set the default flags for this namespace or this system. See System Flags and Qualifiers.
If system is true, this method sets the default flags for this system; otherwise it sets the default flags for the current namespace. If flags are set for this namespace, these override any set for the system. These flags are combined with the built-in defaults to create the defaults used.
This method returns the new defaults after this change.
SetQualifiers
ClassMethod SetQualifiers(qspec As %String = "", system As %Boolean = 0, group As %String) As %Status
Set the default qualifiers for this namespace or this system. See System Flags and Qualifiers. If system is true, the method sets the default qualifiers for this system, otherwise it sets the default qualifiers for this namespace. If qualifiers are set for this namespace, these override any set for the system. These qualifiers are combined with the built in defaults to create the defaults used. The argument group has been deprecated.
GetQualifiers
ClassMethod GetQualifiers(system As %Boolean = 0) As %String
Get the default qualifiers for this namespace or this system. If system is true, the method gets the default qualifiers for this system; otherwise it gets the default qualifiers for the current namespace.
ObjectListExecute
ClassMethod ObjectListExecute(ByRef QHandle As %Binary) As %Status
This query returns a list of all object instances currently in memory within the current process.
ObjectListClose
ClassMethod ObjectListClose(QHandle As %Binary) As %Status
ObjectListFetch
ClassMethod ObjectListFetch(ByRef QHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status
Upgrade
ClassMethod Upgrade(qspec As %String = "", ByRef errorlog As %String, classname As %String) As %Status [ CodeMode = expression ]
Upgrade the class definition database in one namespace. Pass in qspec /mapped=1 to upgrade databases mapped into current namespace or if you pass in classname, the method upgrades the database associated with this specific class.
UpgradeAll
ClassMethod UpgradeAll(qspec As %String = "", ByRef errorlog As %String) As %Status [ CodeMode = expression ]
Upgrade the class definition database in all the namespaces. Pass in qspec /mapped=1 to upgrade databases mapped into current namespace.
LoadLanguage
ClassMethod LoadLanguage(language As %String = "", qspec As %String = "") As %Status
Import the system messages for the specified language from ...\mgr\Locale\allmessages_[language].xml and make this the current language. If language is not specified, then Upgrade the Object locale and import the current language.
IsValidClassname
ClassMethod IsValidClassname(class As %String) As %Status
Return $$OK if this class name is valid, or an error message if it is not. If it is invalid it is typically because it contains characters that are not allowed in a class name or because it clashes with a class that already exists (different case in package, for example).
IsUpToDate
ClassMethod IsUpToDate(class As %String, log As %Boolean = 0, type As %Integer = 1) As %Boolean
For classes in a read/write database, return 1 if this class is up to date (or 0 if it is not). If log is true, the method displays a log of what it is checking. The type determines *what* it checks to make the determination:
- 0 - Check timestamps on class, so even if a description was modified this shows the class as out of date.
- 1 - Ignore changes to descriptions in checking up to date status, this is the default and is what the class compiler typically uses.
- 2 - Ignore changes to descriptions and method code in checking up-to-date status, this is useful to see if the class has 'structurally' changed in a way that would require a class referencing this via SQL to be recompiled This method returns 1 if the class is in a read-only database.
GetDependencies
ClassMethod GetDependencies(ByRef class As %String, Output included As %String, qspec As %String) As %Status
This returns, as output, a list of classes the class compiler will include if the listed classes are compiled. The class argument can be a single class name, a comma-separated list of class names, or a multidimensional array of class names. You can also use ? or * wildcards. If you wish to exclude items, pass ' before the item name; this syntax also supports wildcards, e.g. "User.*,'User.T*". This method returns the list of classes that will be compiled in the included argument, based on the compile qspec argument.
SetTransactionMode
ClassMethod SetTransactionMode(value As %Integer = 1, ByRef pStatus As %Library.Status) As %Integer
Set the object transaction mode for the current process to a new value. Valid values are:
0 | No transactions used for Object filing |
---|---|
1 | Use transactions for Object filing |
If a valid value is passed in, then the transaction mode for the current process is set to that value and the previous transaction mode value is returned. Otherwise the transaction mode setting is left unchanged and pStatus contains a %Status value describing the error and the current transaction mode value is returned.
GetTransactionMode
ClassMethod GetTransactionMode() As %Integer [ CodeMode = expression ]
Return the current object transaction mode.
SetConcurrencyMode
ClassMethod SetConcurrencyMode(value As %Integer = 1, ByRef pStatus As %Library.Status) As %Integer
Set the Object concurrency mode for the current process to a new value. Valid values are:
0 | No concurrency controls |
---|---|
1 | Atomic |
2 | Shared |
3 | Shared retained |
4 | Exclusive |
If a valid value is passed in then the concurrency mode for the current process is set to that value and the previous concurrency mode value is returned. Otherwise the concurrency mode setting is left unchanged and pStatus contains a %Status value describing the error and the current concurrency mode value is returned.
GetConcurrencyMode
ClassMethod GetConcurrencyMode() As %Integer [ CodeMode = expression ]
Return the current object concurrency mode.
RebuildExtentIndex
ClassMethod RebuildExtentIndex(updateMode As %Boolean = 0, lockMode As %Integer = 1) As %Status
The Extent Index is an index on all persistent classes that are runnable in the current namespace. It is currently used by %BuildIndices, %KillExtent, and the %FindGUID utility method in %Library.GUID. Other uses may be added at a later time.
The index is maintained in the globals database in the current namespace. If the globals database in the current namespace is readonly, then an error is returned. The class compiler automatically maintains this index for classes compiled in the namespace. Classes mapped from other namespaces are not automatically added to or removed from the index when mapping changes or changes to the class runtime occur in the original namespace. Such changes must be updated in the local namespace's extent index by running a utility method. There are two methods: this method rebuilds the index completely and RebuildExtentIndexOne rebuilds the index entries for only the specified class.
This method returns a status value indicating success or failure.
Parameters
Name
Description
updateMode
If zero then the extent index is purged and rebuilt completely. Otherwise, the existing index is checked against existing defintions and only changed classes are rebuilt.
lockMode
Specifies the type of locking to be used while modifying the index. If the requested locks cannot be obtained then an error is reported to the caller.
0 | No locking; |
---|---|
1 | Exclusive lock on the entire extent index, released immediately on completion; |
2 | The nodes for each class in the extent index are locked during update, released immediately when class's index entries are built; |
3 | Shared lock on the entire extent index, released immediately on completion. |
The return value is a %Status value indicating success or failure. |
RebuildExtentIndexOne
ClassMethod RebuildExtentIndexOne(className, lockMode As %Integer = 1) As %Status
This method updates the extent index for the specified class in the current namespace. If the globals database in the current namespace is readonly, then an error is returned. Call this method to rebuild the extent index for a single class in the current namespace. Refer to RebuildExtentIndex for more information.
This method returns a status value indicating success or failure.
Parameters
Name
Description
className
The name of the class to be indexed.
lockMode
Specifies the type of locking to be used. If the requested locks cannot be obtained then an error is reported to the caller.
0 | No locking; |
---|---|
1 | The nodes for each class in the extent index are locked during update, released immediately when class's index entries are built; |
2 | The nodes for each class in the extent index are locked during update, released immediately when class's index entries are built; |
3 | Shared lock on the class nodes in the extent index, released immediately on completion. |
The return value is a %Status value indicating success or failure. |
RedirectBindSrvUserOutput
ClassMethod RedirectBindSrvUserOutput(val As %Boolean)
Turn output redirection on and off in the binding server.
CompileInfoClass
ClassMethod CompileInfoClass(class As %String, Output version As %String, Output compiletime As %String) As %Status
Given a class this returns the version of InterSystems IRIS this was compiled on and the compiletime of this class.
CompileInfoExecute
ClassMethod CompileInfoExecute(ByRef QHandle As %Binary, sortorder As %Integer = 0) As %Status
Query to return version and time when classes were compiled. This only returns compiled classes, so classes not compiled are skipped. The sortorder can be one of:
- 0 - Time class was compiled (default)
- 1 - Classname
- 2 - InterSystems IRIS version
CompileInfoClose
ClassMethod CompileInfoClose(QHandle As %Binary) As %Status
CompileInfoFetch
ClassMethod CompileInfoFetch(ByRef QHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) As %Status [ CodeMode = expression ]
CompileInfoFetchRows
ClassMethod CompileInfoFetchRows(ByRef QHandle As %Binary, FetchCount As %Integer = 0, ByRef RowSet As %List, ByRef ReturnCount As %Integer, ByRef AtEnd As %Integer) As %Status
UpdateConfigParam
ClassMethod UpdateConfigParam(classname As %String, parameter As %String, value As %String) As %Status
Allows updating a CONFIGVALUE parameter type.
If you have defined a parameter in the classname which is specified as 'CONFIGVALUE' in the type keyword then this method allows this to be updated from the original value to a new value.
Note that this should be a rare event and not be used for any value that needs to be updated a lot, a global should be used for a rapidly updating value. The advantage of using a class parameter for a configuration value is that a very large number of processes can access this value using 'Set val=##class(ClassName).#ParamName' faster than access to a global.
ValidateIndices
ClassMethod ValidateIndices(classname As %Library.String, idxList As %String = "", autoCorrect As %Boolean = 0, lockOption As %Integer = 1, multiProcess As %Boolean = 0, verbose As %Boolean = 1, ByRef errors As %String) As %Library.Status [ PublicList = mapList ]
Validate indices for a class
Parameters:
classname Name of the persistent class to validate indices for. idxList Optional. "" to check all indices, or specify a $list of index names to check. Default="" autoCorrect Optional. If true, correct any errors found. Default=0 lockOption Optional. Default = 1 0 - No locking is performed at all 1 - Shared locking as each row is checked 2 - exclusive lock on entire table for duration of the run multiProcess Optional. If true, parts of %ValidateIndices() use parallel processing when possible. Default=0 verbose Optional. If true, display output to the current device. Default=1. When called for a sharded class, verbose is force to 0. errors Optional. Passed by reference. Returns a multidimensional array of errors found in the index(es) validated. If autoCorrect=1, this is a multidimensional array of issues corrected.
Returns:
Status Code
Example:
- Do $SYSTEM.OBJ.ValidateIndices("Sample.Person","",1,2)
- Do $SYSTEM.OBJ.ValidateIndices("Sample.Company",$lb("NameIdx"),1,1)
Note::
Indices may also be validated by calling the class method ##class(classname).%ValidateIndices(idxList,autoCorrect,lockOption,verbose).
There is one main difference between validating indices through $SYSTEM.OBJ.ValidateIndices() and ##class(classname).%ValidateIndices().
$SYSTEM.OBJ.ValidateIndices() validates the indices for a table, and also validates any indices in collection child tables for that table.
When using ##class(classname).%ValidateIndices(), collection child table indices must be checked with separate calls.
Also, when calling $SYSTEM.OBJ.ValidateIndices(), multiProcess default is 0. When calling ##class(classname).%ValidateIndices(), multiProcess default is 1.
GenerateEmbedded
ClassMethod GenerateEmbedded(ByRef list As %String = "", qspec As %String = "", ByRef errorlog As %String, delete As %Boolean = 0) As %Status
Generate embedded SQL cached queries (UCQ) for all routines that match the list passed in. This can be a pattern such as 'A*' to mean all runnable code that starts with 'A'. The qspec uses /mapped to determine if patterns should include mapped items or just local ones. Specify 1 for delete to delete the UCQ found for the routines in list.
SetMPPOption
ClassMethod SetMPPOption(optionName As %String = "", optionValue As %Integer = "", ByRef oldValue As %String) As %Status
Set the specified Macro Pre-Processor (MPP) Configuration Settings 'optionName' to the specified 'optionValue'
------------------------------------------------------------------------------- Method: SetMPPOption Definition: This method sets the specified Macro Pre-Processor (MPP) Configuration Settings 'optionName' to the specified 'optionValue'. This method also returns the original value via the PBR 'oldValue' parameter, along with the invocation status via the method's return value. Options: The following is a list of currently supported Macro Pre-Processor Configuration Settings Options: optionName/optionValue Description ------------------------- ----------------------------------- MPPParsingMode - The MPP's Parsing Mode {1 | 2} 1 - Standard Macro Pre-Processor Parsing [$$$MPPParsingModeStandard] 2 - Enhanced Macro Pre-Processor Parsing [$$$MPPParsingModeEnhanced] This mode supports $$$MACRO[(args)] Recursion Parsing [DEFAULT: 1 = $$$MPPParsingModeDefault] MacroMaxRecursionNoArg - The maximum allowed sub-string repetitions between $$$MACRO references (without arguments) of the same name {3...n} 3 - The minimum number to determine $$$MACRO Recursive Referencing or Self-Referencing n - This number can be increased, but should never need to be for $$$MACRO references without arguments [DEFAULT: 3 = $$$MacroMaxRecursionNoArgDefault] MacroMaxRecursionGotArg - The maximum allowed sub-string repetitions between $$$MACRO(...) references (with arguments) of the same name {10...n} 10 - The minimum number to determine $$$MACRO(...) Recursive Referencing or Self-Referencing n - This number can be increased for $$$MACRO(...) references (with arguments) that may exceed 10 nesting levels, but this should be very rare Example: $$$A($$$A($$$A(...))) [DEFAULT: 10 $$$MacroMaxRecursionGotArgDefault] Restriction: You must have the "USE" permission on the %Admin Manage Resource in order to change this MPP Configuration Setting. Notes: - Changing this MPP Configuration Setting affects all processes immediately. - This is a system-wide setting. Invocation: This method can be invoked in the following ways: ObjectScript: $SYSTEM.OBJ.SetMPPOption(...) SQL: N/A Examples: The following examples shows the use of this method: #1 Set the 'MPPParsingMode' option of the Macro Pre-Processor to the value two (2), which specifies the use of the Enhanced Parsing to check for $$$MACRO[(args)] Recursion: set tSC=$SYSTEM.OBJ.SetMPPOption("MPPParsingMode",2,.oldVal) Data Storage: ^%SYS("MPP","Parsing") & ^%SYS("MPP","MacroRecursion") Parameters: optionName - The Pre-Processor (MPP) Configuration Settings 'option' name. The following is a list of currently supported Macro Pre-Processor Configuration Settings Options: - MPPParsingMode - MacroMaxRecursionNoArg - MacroMaxRecursionGotArg optionValue - The value to set for the specified 'optionName' oldValue - A Pass By Reference (PBR) parameter which returns the old MPP Configuration Setting value RETURN Value: The status from the invocation of this method -------------------------------------------------------------------------------
GetMPPOption
ClassMethod GetMPPOption(optionName As %String = "", ByRef tSC As %Status, getGloValue As %Integer = 0) As %Status
Get the current value for the specified Macro Pre-Processor (MPP) Configuration Settings 'optionName'
------------------------------------------------------------------------------- Method: GetMPPOption Definition: This method returns the current value for the specified Macro Pre-Processor (MPP) Configuration Settings 'optionName' Options: The following is a list of currently supported Macro Pre-Processor Configuration Settings Options: optionName Description ------------------------- ----------------------------------- MPPParsingMode - The MPP's Parsing Mode {1 | 2} MacroMaxRecursionNoArg - The maximum allowed sub-string repetitions between $$$MACRO references (without arguments) of the same name {3...n} MacroMaxRecursionGotArg - The maximum allowed sub-string repetitions between $$$MACRO(...) references (with arguments) of the same name {10...n} ALL Get all 'optionName' values Notes: - See the 'SetMPPOption(...)' method for specific details about each of the 'optionName' values Invocation: This method can be invoked in the following ways: ObjectScript: $SYSTEM.OBJ.GetMPPOption(...) SQL: N/A Examples: The following examples shows the use of this method: #1 Get the current value for the 'MPPParsingMode' option of the Macro Pre-Processor Configuration Settings set optVal=$SYSTEM.OBJ.GetMPPOption("MPPParsingMode",.tSC) Data Storage: ^%SYS("MPP","Parsing") & ^%SYS("MPP","MacroRecursion") Parameters: optionName - The Pre-Processor (MPP) Configuration Settings 'option' name. The following is a list of currently supported Macro Pre-Processor Configuration Settings Options: - MPPParsingMode - MacroMaxRecursionNoArg - MacroMaxRecursionGotArg - ALL (Get all 'optionName' values) tSC - A Pass By Reference (PBR) parameter which returns the status from the invocation of this method getGloValue - 0 = Don't retrieve the value from the System-Global [DEFAULT] 1 = Retrieve the value from the System-Global NOTE: This parameter should be used for internal purposes only! RETURN Value: The current value of the specified Macro Pre-Processor (MPP) Configuration Settings 'optionName'. NOTE: If 'optionName' is passed the value "ALL", then return a $LIST(...) of a $LIST(...) of the following values for each of the valid 'optionName' values: $LIST($LIST(optionName,optionValue,tSC),...) -------------------------------------------------------------------------------