IAuditLogArchiveCallback.OnProgress

Syntax

OnProgress(Current: Integer; Total: Integer);

OnProgress(Current: integer; Total: integer);

Parameters

Current. Number of processed records.

Total. Total number of records to be checked.

Description

The OnProgress method implements an event of common status of access protocol archiving. This method has to be redefined in a custom class.

Example

Executing the example requires the AuditLog.pplog file.

Add a link to the Metabase system assembly.

Class MyCallback: Object, IAuditLogArchiveCallback
    
Sub OnProgress(Current: Integer; Total: Integer);
    
Begin
        Debug.WriteLine(
"Packed " + Current.ToString + " from " + Total.ToString + " records");
    
End Sub OnProgress;
End Class MyCallback;

Sub UserProc;
Var
    MB: IMetabase;
    MS: IMetabaseSecurity;
    AL: IAuditLog;
    Callback: MyCallback;
    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;
    Callback := 
New MyCallback.Create;
    
// Save access protocol to file
    AL.Archive("C:\AuditLog.pplog", Callback);
    
// Check in license
    Lic := Null;
End Sub UserProc;

Imports Prognoz.Platform.Interop.ForeSystem;

Public Class MyCallback: Object, IAuditLogArchiveCallback
    
Public Sub OnProgress(Current: Integer; Total: Integer);
    
Begin
        System.Diagnostics.Debug.WriteLine(
"Packed " + Current.ToString() + " from " + Total.ToString() + " records");
    
End Sub OnProgress;
End Class MyCallback;
    
Public Class Program
    [STAThread]
    
Public Shared Sub Main(Params: StartParams);
    
Var
        MB: IMetabase;
        MS: IMetabaseSecurity;
        AL: IAuditLog;
        Callback: MyCallback;
        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();
        Callback := 
New MyCallback.Create();
        
// Save access protocol to file
        AL.Archive("C:\AuditLog.pplog", Callback, AuditLogArchiveFormat.alafBinary, False);
        
// Release license
        Lic := Null;
    
End Sub;
End Class;

After executing the example, access protocol records will be saved to the AuditLog.pplog file. Saving status is displayed in the development environment console.

See also:

IAuditLogArchiveCallback