OpenOperationTree(Session: Integer; Operation: Integer): IAuditOperations;
OpenOperationTree(Session: uinteger; Operation: uinteger): Prognoz.Platform.Interop.Metabase.IAuditOperations;
Session. Number of session for which it is required to get a list of operations under objects. As the parameter value it is required to sent value of the IAuditLogons.Session property.
Operation. Number of operation for which it is required to get a list of operations under dependent objects. If 0 is passed as a value, the method returns the list of operations that were performed within the session. If the value of the IAuditOperations.Operation property is passed as a value for any operation, the method returns the list of operations on dependent objects of the object to which this operations corresponds.
The OpenOperationTree method returns the list of operations that were performed in the repository, represented in the tree-like form.
To execute the example, add a link to the Metabase system assembly.
Sub UserProc;
Var
MB: IMetabase;
MS: IMetabaseSecurity;
AL: IAuditLog;
ALogon: IAuditLogons;
OperatTree, OperatTreeChild: IAuditOperations;
Lic: Object;
Begin
MB := MetabaseClass.Active;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.Adm);
MS := MB.Security;
// Open access protocol
Al := MS.OpenAuditLog;
ALogon := AL.OpenLogons(False);
// Display a list of operations executed during the last connection to repository in the console
OperatTree := Al.OpenOperationTree(ALogon.Session, 0);
While Not OperatTree.Eof Do
Debug.WriteLine(OperatTree.ObjectId + " " + OperatTree.Name);
OperatTreeChild := Al.OpenOperationTree(ALogon.Session, OperatTree.Operation);
While Not OperatTreeChild.Eof Do
If OperatTreeChild.Succeeded Then
Debug.Indent;
Debug.WriteLine(OperatTreeChild.ObjectId + " " + OperatTreeChild.Name + " " + OperatTreeChild.Level.ToString);
Debug.Unindent;
OperatTreeChild.Next;
End If;
End While;
OperatTreeChild.Close;
OperatTree.Next;
End While;
OperatTree.Close;
// Check in license
Lic := Null;
End Sub UserProc;
Imports Prognoz.Platform.Interop.ForeSystem;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MS: IMetabaseSecurity;
AL: IAuditLog;
ALogon: IAuditLogons;
OperatTree, OperatTreeChild: IAuditOperations;
Lic: Object;
Begin
MB := Params.Metabase;
// Get license to work with security manager
Lic := MB.RequestLicense(UiLicenseFeatureType.lftAdm);
MS := MB.Security;
// Open access protocol
Al := MS.OpenAuditLog();
ALogon := AL.OpenLogons(False);
// Display a list of operations executed during the last connection to repository in the console
OperatTree := Al.OpenOperationTree(ALogon.Session, 0);
While Not OperatTree.Eof() Do
System.Diagnostics.Debug.WriteLine(OperatTree.ObjectId + " " + OperatTree.Name);
OperatTreeChild := Al.OpenOperationTree(ALogon.Session, OperatTree.Operation);
While Not OperatTreeChild.Eof() Do
If OperatTreeChild.Succeeded Then
System.Diagnostics.Debug.Indent();
System.Diagnostics.Debug.WriteLine(OperatTreeChild.ObjectId + " " + OperatTreeChild.Name + " " + OperatTreeChild.Level.ToString());
System.Diagnostics.Debug.Unindent();
OperatTreeChild.Next();
End If;
End While;
OperatTreeChild.Close();
OperatTree.Next();
End While;
OperatTree.Close();
// Check in license
Lic := Null;
End Sub;
After executing the example the list of operations that were performed during the last connection to the repository, is displayed in the console. The list of operations will be presented as a tree. An identifier of the relevant object and an operation name are displayed for each operation. If there are operations that are connected to the objects on which any other object depends, the level of nesting is found for these operations.
See also: