DocBook|Search
Class Reference
%SYSTEM.OBJ
   
Server:basexml
Instance:SOAXML
User:UnknownUser
 
-
  [BASEXML] >  [%SYSTEM] >  [OBJ]
Private  Storage  

abstract class %SYSTEM.OBJ extends Help

The %SYSTEM.OBJ class provides an interface for managing objects.

You can use it via the special $system object:

	Do $system.OBJ.Load("MyFile.xml","ck")

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
63 1


Summary

Methods
CloseObjects Compile CompileAll CompileAllNamespaces
CompileList CompilePackage CompileProject Delete
DeleteAll DeletePackage DeleteProject DisplayError
Dump Export ExportAllClasses ExportAllClassesIndividual
ExportAllClassesToStream ExportCPP ExportDynCPP ExportJava
ExportJavaPackage ExportODL ExportPackage ExportPackageToStream
ExportPattern ExportPatternToStream ExportToStream GetClassList
GetConcurrencyMode GetDependencies GetPackageList GetQualifiers
GetTransactionMode Help ImportDir IsUpToDate
IsValidClassname Load LoadDir LoadLanguage
LoadStream MakeClassDeployed New ObjectListClose
ObjectListExecute ObjectListFetch Open OpenId
RedirectBindSrvUserOutput SaveObjects SetConcurrencyMode SetFlags
SetQualifiers SetTransactionMode ShowClasses ShowFlags
ShowMacros ShowObjects ShowQualifiers ShowReferences
UnCompile Upgrade UpgradeAll Version


Methods

• classmethod CloseObjects() as %Status
Deprecated function, to close objects let them go out of scope.
• classmethod Compile(ByRef classes As %String = "", qspec As %String = "", ByRef errorlog As %String, recurse As %Boolean = 0) as %Status
Compile a class.

Compiles the class classes, which can be a single class, a comma separated list, a subscripted array of class names, or include wild cards. If recurse is true then do not output the intial '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()

• classmethod CompileAll(qspec As %String = "", ByRef errorlog As %String) as %Status
Compile all classes within this namespace. By default it will 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()'
• classmethod CompileAllNamespaces(qspec As %String = "", ByRef errorlog As %String) as %Status
Invoke $system.OBJ.CompileAll for all the namespaces.
• classmethod CompileList(ByRef list As %String = "", qspec As %String = "", ByRef errorlog As %String) as %Status
Compile a list of items specified in 'list' and separated by commas, or an array list("item.MAC")="" or wild cards. Each item on the list is sufixed 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()
• classmethod CompilePackage(package As %String = "", qspec As %String = "", ByRef errorlog As %String) as %Status
Compile all classes within the specified package.
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'
• classmethod CompileProject(project As %String = "", qspec As %String = "", ByRef errorlog As %String) as %Status
Compile all entries in this project.
qspec is a list of flags or qualifiers which can be displayed with 'Do $system.OBJ.ShowQualifiers()' and 'Do $system.OBJ.ShowFlags()'
• classmethod Delete(ByRef classes As %String = "", qspec As %String = "", ByRef errorlog As %String) as %Status
Delete a class.

Delete the definition of class classes from this namespace which can be a single class, a comma separated list, a subscripted array of class names, or include wild cards.

• classmethod DeleteAll(qspec As %String = "") as %Status
Delete all the classes in this namespace.
• classmethod DeletePackage(package As %String = "", qspec As %String = "") as %Status
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 pacakge is mapped from another database.
• classmethod DeleteProject(project As %String = "", qspec As %String = "") as %Status
Delete the named project from this namespace.
• classmethod DisplayError(err As %Status = $get(%objlasterror)) as %Status
Decode and display an object error message to the console. If err is omitted, display the last generated object error.
• 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)
• classmethod Export(ByRef items As %String = "", ByRef filename As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") as %Status
Export items as an XML file

Each of the items must have a type determined by an extension selected from the following list:

  • 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 an array, or use wild cards.

If the output filename is empty, matching items will be exported to the current device. If you pass qualifier '/recursive=1' then it will also export 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.

• classmethod ExportAllClasses(ByRef filename As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") as %Status
Export all the classes in this namespace as one large XML file.

This function will loop through all the classes exporting them to the file filename. It will restrict which classes are exported based on the qspec

• classmethod ExportAllClassesIndividual(dirname As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "", Package As %String = "*") as %Status
Export all the classes as individual XML files to a directory.

This function will loop 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 will only export this package.

• 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 as one large XML file.

This function will loop through all the classes exporting them to the file filename. It will restrict which classes are exported based on the qspec If stream is passed in then the data is appended to this stream. If it is "" when called it will create a stream and return this.

• classmethod ExportCPP(classname As %String = "", dirname As %String = "", qspec As %String = "", ByRef errorlog As %String) as %Status
Export a class to C++ files.

Export class classname to C++ files in directory dirname.

• classmethod ExportDynCPP(classname As %String = "", dirname As %String = "", proplist As %String = "", methodlist As %String = "", qspec As %String, ByRef errorlog As %String) as %Status
• 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.

• 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 "*" then it will search for all classes in this namespace.

Export class package to a JAVA file in directory dirname.

• classmethod ExportODL(classname As %String = "", filename As %String = "", qspec As %String = "", ByRef errorlog As %String) as %Status
Export a class to ODL file.

Export class classname to ODL file with file name filename.

• classmethod ExportPackage(package As %String = "", ByRef filename As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") as %Status
Export a set of classes in a package as an XML file.

Export package package to an XML file with name filename.

• 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 it will create a stream and return this.

• classmethod ExportPattern(pattern As %String = "", ByRef filename As %String = "", qspec As %String = "", ByRef errorlog As %String, Charset As %String = "") as %Status
Export all items matching a pattern to an XML file

If you pass a pattern of '*.cls' then all classes in this namespace will be exported, or a pattern of 'a*.mac' will export all MAC routines that start with the letter 'a' to be exported.

• 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' then all classes in this namespace will be exported, or a pattern of 'a*.mac' will export all MAC routines that start with the letter 'a' to be exported. If stream is passed in then the data is appended to this stream. If it is "" when called it will create a stream and return this.

• 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

Each of the items must have a type determined by an extension selected from the following list:

  • 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 an array, or use wild cards.

If the output filename is empty, matching items will be exported to the current device.

• classmethod GetClassList(ByRef items As %String, qspec As %String = "") as %Status
Return an array of classes in this namespace.

Search for classes in this namespace and put their names into the local array items. 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
• classmethod GetConcurrencyMode() as %Integer
Return the current Object Concurrency mode.
• classmethod GetDependencies(ByRef class As %String, Output included As %String, qspec As %String) as %Status
This will return a list of classes the class compiler will include if the listed classes are compiled. The class can be a single class, a comma separated list, a subscripted array of class names, or include wild cards. It returns the list of classes that will be compiled in included based on the compile qspec.
• classmethod GetPackageList(ByRef items As %String, package As %String, qspec As %String = "") as %Status
Return an 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 it will return for all classes in this namespace. It uses the qualfier in qspec /includesubpackages to determine if it searches inside a package to subpackages or not.

• classmethod GetQualifiers(system As %Boolean = 0) as %String
Get the default qualifiers for this namespace or this system. If system is true then this gets the default qualifiers for this system, otherwise it sets the default qualifiers for this namespace.
• classmethod GetTransactionMode() as %Integer
Return the current Object transaction mode.
• 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 will import all files found in a directory using the Load so it should be able to detect most common formats. If you pass it the compile flag ('c') after loading it will also compile all these items. The other flags are the same as found in the Load except for the dir which is the directory to load and the recurse which determines if this will look into subdirectories or not. You can limit the items it will import by specifying a wildcards value for example '*.xml' will only import 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()

• classmethod IsUpToDate(class As %String, log As %Boolean = 0, type As %Integer = 1) as %Boolean
Return if this class is up to date or not. If log is true then it will display a log of what it is checking in order to show if it is up to date or not. The type determines what it looks at to see if this class is up to date:
  • 0 - Check timestamps on class, so even if a description was modified this will show 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
• 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 say).
• 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 = "") as %Status
Load a file from disk into Cache.

Load and, optionally compile (if 'c' flag is present), class definitions, CSP pages, routines or globals from the file file. It imports files exported in XML format, %RO format, CDL format, CSR/CSP files. Returns a comma separated list of the items it loaded in loadedlist, this also returns the item as a single subscript array in case there are more than 32k worth of them. You may give it a list of files to load separated with '*' symbols. If you pass listonly as true then it will not import anything but just list the items that exist in the files that you supply it.
If selecteditems is defined then this will contain a comma separated list of items to import (or a single subscripted array). It will only import items that are in this list from the file/s 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()

• 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 will include subdirectories. Returns a comma separated list of the items it loaded in loadedlist and the same data also as a loadedlist(name)="" in case the comma list is more than 32k. Note that this will only compile classes found in these XML files and no other types. If you want to be able to compile anything 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()

• classmethod LoadLanguage(language As %String = "", qspec As %String = "") as %Status
Import the specified language from CacheSys\bin\Errors_[language].xml and make this the current language. If language is not specified, then Upgrade the Object locale and import the current language.
• 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 into Cache.

Load and, optionally compile (if 'c' flag is present), class definitions, CSP pages, routines or globals from the stream stream. Returns an array of the items it loaded in loadedlist. If you pass listonly as true then it will not import anything but just list the items that exist in the stream that you supply.
If selecteditems is defined then this will contain a comma separated list of items to import (or a single subscripted array). It will only import 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()

• classmethod MakeClassDeployed(ByRef classes As %String = "", qspec As %String = "") as %Status
Make a class or classes deployed. classes can be a single class, a comma separated list, a subscripted array of class names, or include wild cards. This will delete all the source code of the class from the disk. Once a class is in deployed mode, it can not be edited or exported or recompiled. You can still create subclasses of a deployed class and compile these.
• classmethod New(ClassName As %String = "") as %ObjectHandle
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")
• classmethod ObjectListClose(QHandle As %Binary) as %Status
• classmethod ObjectListExecute(ByRef QHandle As %Binary) as %Status
• classmethod ObjectListFetch(ByRef QHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status
• classmethod Open(ClassName As %String = "", oid As %String = "") as %ObjectHandle
Open a persistent object instance.

Load 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)
• classmethod OpenId(ClassName As %String = "", id As %String = "") as %ObjectHandle
Open a persistent object instance.

Load 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)
• classmethod RedirectBindSrvUserOutput(val As %Boolean)
Turn output redirection on and off in the binding server.
• classmethod SaveObjects() as %Status
Save all instances of %Library.Persistent in the process. Returns a status value.
• 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:

0No concurrency controls
1Atomic
2Shared
3Shared retained
4Exclusive
If a valid value is passed in then the concurrency mode for the current process will be set to that value and the previous concurrency mode value is returned. Otherwise the concurrency mode setting is left unchanged and pStatus will contain a %Status value describing the error and the current concurrency mode value is returned.

• classmethod SetFlags(flags As %String, system As %Boolean = 0) as %String
Set the default flags for this namespace or this system. If system is true then this sets the default flags for this system, otherwise it sets the default flags for this 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.
• classmethod SetQualifiers(qspec As %String = "", system As %Boolean = 0, group As %String) as %Status
Set the default qualifiers for this namespace or this system. If system is true then this 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.
• 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:

0No transactions used for Object filing
1Use transactions for Object filing
If a valid value is passed in then the transaction mode for the current process will be set to that value and the previous transaction mode value is returned. Otherwise the transaction mode setting is left unchanged and pStatus will contain a %Status value describing the error and the current transaction mode value is returned.

• 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:
/detailShow details.
/hiddenShow hidden classes.
/mappedShow mapped classes.

For example:

	Do $System.OBJ.ShowClasses("/detail")
• classmethod ShowFlags()
Display the list of flags used by the compiler.
• classmethod ShowMacros()
Display the list of supported macros defined in the system.
• classmethod ShowObjects(qspec As %String = "") as %Status
Write all object instances in this process to the console.

The optional qspec argument is a string containing any of the following characters:
dShow details.

For example:

	Do $System.OBJ.ShowObjects("d")
• classmethod ShowQualifiers(group As %String = "")
Display the list of qualifiers defined in the system. It also shows the default qualifiers defined at system level and at namespace levels. The argument group has been deprecated.
• classmethod ShowReferences(oref As %String, chkObj As %Boolean = 0)
Display a list of all variables that contain a reference to this oref. If chkObj is set to 1, the properties of any varibles that contain an object reference will also be searched and displayed. Otherwise only non-object variables will be 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.
• classmethod UnCompile(ByRef classes As %String = "", qspec As %String = "") as %Status
Uncompile a class or classes. classes can be a single class, a comma separated list, a subscripted array of class names, or include wild cards.
• classmethod Upgrade(qspec As %String = "", ByRef errorlog As %String) as %Status
Upgrade the class definition database in one namespace.
• classmethod UpgradeAll(qspec As %String = "", ByRef errorlog As %String) as %Status
Upgrade the class definition database in all the namespaces.
• classmethod Version() as %String
Return the version number of the current object library.

Queries

• query ObjectList()
Selects OREF, ClassName
This query returns a list of all object instances currently in memory within the current process.