Config.CommonMapMethods
Class Config.CommonMapMethods Extends Config.CommonMethods [ Abstract, System = 4 ]
This class contains methods which are common (inherited) by classes which manipulate namespace mappings in the CPF file.
Parameters
CPFFlags
Parameter CPFFlags [ Internal ] = {1};
{$$$CPFSave};
SECTIONTYPE
Parameter SECTIONTYPE = 2;
This parameter governs how the class creates audit records.
Value = 0 - Class contains a single entry (SQL, Net, etc.)
Value = 1 - Class contains multiple entries (Databases, Namespaces, etc.)
Value = 2 - Class deals with mappings (MapGlobals, MapRoutines, MapPackages.)
Methods
Create
ClassMethod Create(Namespace As %String, Name As %String, ByRef Properties As %String, ByRef CPFFile As %String = "", Flags As %Integer = {$$$CPFSave+$$$CPFWrite+$$$CPFActivate})
Create a mapping in the CPF file.
Parameters:
Namespace - Namespace to create mapping for.
Name - Name of the mapping.
Properties - Array of properties used to create the mapping. See the subclass for a list of valid properties.
CPFFile (byref) - Name of the CPF file to use, Default=current active CPF file. The file must have a .CPF file extension if specified.
Flags - (From %syConfig.inc) Bit string of flags which governs how the mappings are added.
Bit $$$CPFSave - Save the Mappings to the CPF object.
Bit $$$CPFWrite - Write the CPF object to the CPF file.
Bit $$$CPFActivate - Activate the Mappings on the system if the CPF file is the current active file.
By default, all these bits are set, and you should normally not pass this parameter. If you are modifying a CPF file which is not the active CPF file, Bit $$$CPFActivate is ignored.
If you have a batch of updates to do to the same namespace, then you should pass only Bit $$$CPFSave for each call. Then when creating the last one, don't pass this parameter (default=All bits). This will cause all the previous additions to be written to the CPF file and activated all at once.
If you want to update several different namespaces at the same time you should use the following mechanism:
- Pass the flag $$$CPFSave on all the calls to update the object (without writing to the CPF or activating it.) You could also pass the Write to CPF flag here if you want all your changes written out to the CPF immediately.
- When you are finished with your updates, call Config.CPF.Write() to write out your changes to the CPF file (if you didn't pass the write to cpf flag in step #1)
- Now Call Config.CPF.Activate() to load and activate all the new mappings.
Return values:
CPFFile (byref) - Name of the CPF file the modification was made in.
CreateOne
ClassMethod CreateOne(ByRef Properties As %String) As %Status [ Internal ]
Default
ClassMethod Default(CPFFile As %String, Platform As %String) As %Status [ Internal ]
No default mapping section in a CPF file.
Delete
ClassMethod Delete(Namespace As %String, Name As %String, ByRef CPFFile As %String = "", Flags As %Integer = {$$$CPFSave+$$$CPFWrite+$$$CPFActivate}) As %Status
Delete a mapping from a CPF file.
Parameters:
Namespace - Namespace to delete the mapping from.
Name - Name of the mapping to delete.
CPFFile (byref) - Name of the CPF file to use, Default=current active CPF file. The file must have a .CPF file extension if specified.
Flags - Bit string of options to perform. See the Create method for values.
Return values:
CPFFile (byref) - Name of the CPF file the modification was made in.
DeleteOne
ClassMethod DeleteOne(ByRef Properties As %String) As %Status [ Internal ]
Exists
ClassMethod Exists(Namespace, Name As %String, ByRef Obj As %ObjectHandle, ByRef Status As %Status, ByRef CPFFile As %String = "", Flags As %Integer = {$$$CPFSave+$$$CPFWrite+$$$CPFActivate}) As %Boolean
Checks for the existence of a mapping in a CPF file.
Parameters:
Namespace - Namespace of the mapping.
Name - Name of the mapping to check existence of.
CPFFile (byref) - Name of the CPF file to use, Default=current active CPF file. The file must have a .CPF file extension if specified.
Flags - Bit string of options to perform if the object is later saved with the %Save() method. See the Create method for values.
Return values:
If Value of the method = 0 (Mapping does not exist, or some error occured)
Obj = Null
Status = Mapping "x" does not exist, or other error message
If Value of the method = 1 (Mapping exists)
Obj = Object handle to Mapping
CPFFile = Name of the CPF file the properties were retrieved from.
Status = MapGlobal "x" already exists
Get
ClassMethod Get(Namespace As %String, Name As %String, ByRef Properties As %String, ByRef CPFFile As %String = "", Flags As %Integer = {$$$CPFSave+$$$CPFWrite+$$$CPFActivate}) As %Status
Get a mapping's properties from a CPF file.
Parameters:
Namespace - Namespace of the mapping.
Name - Name of the mapping to get.
CPFFile (byref) - Name of the CPF file to use, Default=current active CPF file. The file must have a .CPF file extension if specified.
Return values:
Properties (byref) - List of the properties in Properties(Name)=Value format. See the subclass for a list of valid properties.
CPFFile (byref) - Name of the CPF file the properties were retrieved from.
GetList
ClassMethod GetList(Namespace As %String, Name As %String, ByRef CPFFile As %String = "", Flags As %Integer = {$$$CPFSave+$$$CPFWrite+$$$CPFActivate}) As %Status
Returns the properties from a instance of a mapping section from a CPF file by value in $list format
Parameters:
Namespace - Namespace of the mapping.
Name - Name of the instance to get.
CPFFile (byref) - Name of the CPF file to use, Default=current active CPF file. The file must have a .CPF file extension if specified.
Return value:
$lb(%Status,Result)
where Result=$LB($LB(property name,value),...) for each property in the instance of the section
GetProperties
ClassMethod GetProperties(Obj As %ObjectHandle, ByRef Properties As %String) As %Status [ Internal ]
Get a sections properties from a CPF file.
Parameters:
Obj - Object handle to a section in the CPF object
Return values:
Properties (byref) - See the subclass for more information on the array of Properties returned.
Load
ClassMethod Load(Obj As %ObjectHandle = "", Flags As %Integer = 1) As %Status [ Internal ]
Load the parameters into memory and activate.
Parameters:
Obj = Handle to the object which caused the load. If "", then load everything, only called from STU.
If a delete operation, then Obj is the NAME of the item which was deleted since the oject itself has already been deleted.
Flags = Type of modification.
0 - Modify
1 - Create/Insert
2 - Delete
Modify
ClassMethod Modify(Namespace As %String, Name As %String, ByRef Properties As %String, ByRef CPFFile As %String = "", Flags As %Integer = {$$$CPFSave+$$$CPFWrite+$$$CPFActivate}) As %Status
Modify a mapping in a CPF file.
Parameters:
Namespace - Namespace of the mapping.
Name - Name of the mapping to modify.
Properties (byref) - List of the properties to modify in Properties(Name)=Value format. See the subclass for a list of valid properties. If a specific property is not passed in the properties array, the value is not modified.
CPFFile (byref) - Name of the CPF file to use, Default=current active CPF file. The file must have a .CPF file extension if specified.
Flags - Bit string of options to perform. See the Create method for values.
Return values:
CPFFile (byref) - Name of the CPF file the modification was made in.
ModifyOne
ClassMethod ModifyOne(ByRef Properties As %String) As %Status [ Internal ]
MoveToActive
ClassMethod MoveToActive(Obj As %ObjectHandle = "", Flags As %Integer = 0) As %Status [ Internal ]
Load the parameters into memory and activate.
Parameters:
Obj = Handle to the object which caused the load. If "", then load everything, only called from STU.
If a delete operation, then Obj is the NAME of the item which was deleted since the oject itself has already been deleted.
Flags = Type of modification.
0 - Insert
1 - Modify
2 - Delete
Open
ClassMethod Open(Namespace As %String, Name As %String, ByRef CPFFile As %String = "", concurrency As %Integer = -1, ByRef Status As %Status, Flags As %Integer = {$$$CPFSave+$$$CPFWrite+$$$CPFActivate}) As %ObjectHandle
Open an instance of a mapping object in a CPF file.
Parameters:
Name - Name of the mapping to open
CPFFile (byref) - Name of the CPF file to use, Default=current active CPF file. The file must have a .CPF file extension if specified.
Flags - Bit string of options to perform if the object is later saved with the %Save() method. See the Create method for values.
Return Values:
CPFFile (byref) - Name of the CPF file the object was opened in.
WriteSection
ClassMethod WriteSection(Namespace As %String, ByRef CommentNext As %String, CPFFile As %String) As %Status [ Internal ]
Write a section to the CPF file from the Config database for s single namespace.
This method assumes that the CPF file has been opened, and USED.
Parameters:
Namespace - Namespace of the mapping.
CommentNext by ref - Array of comments to be written out before the next section is written.
CPFFile (byref) - Name of the CPF file to use, Default=current active CPF file. The file must have a .CPF file extension if specified.
%OnNew
Method %OnNew(initvalue As %RawString) As %Status [ Internal, Private ]
Set the Section header of the index to the class name.