IMetabaseUpdateProgress.OnProgress

Fore Syntax

OnProgress(Data: IMetabaseUpdateProgressData);

Fore.NET Syntax

OnProgress(Data: IMetabaseUpdateProgressData);

Parameters

Data. Update process information.

Description

The OnProgress method implements an event of the common status of the process of updating/synchronization.

Comments

This event is generated when the update is applied or during synchronization of repository objects with the objects in the update.

Fore Example

Executing the example requires that the file system contains the TSDB.pef update file. This file contains information to update time series database. If any objects are updated with the access permissions, the method of transfer of objects rights is implemented in the query after update of the objects.

Add a link to the Metabase system assembly.

Sub UserProc;
Var
    MB: IMetabase;
    MUpdate: IMetabaseUpdate;
    Progress: MyUpdateProgress;
Begin
    MB := MetabaseClass.Active;
    MUpdate := MB.CreateUpdate;
    MUpdate.LoadFromFile(
"c:\TSDB.pef");
    Progress := 
New MyUpdateProgress.Create;
    MUpdate.Apply(Progress);
End Sub UserProc;

Class MyUpdateProgress: UpdateProgress
    
Sub OnProgress(Data: IMetabaseUpdateProgressData);
    
Begin
        
Select Case Data.Stage
            
Case MetabaseUpdateProgressStage.Start: Debug.WriteLine("Start object update");
            
Case MetabaseUpdateProgressStage.Prepare: Debug.WriteLine("Object preparation");
            
Case MetabaseUpdateProgressStage.Apply: Debug.WriteLine("Object update");
            
Case MetabaseUpdateProgressStage.Finish: Debug.WriteLine("Object update completed");
        
End Select;
        Debug.WriteLine(
"Current " + Data.Current.ToString + " from " + Data.Total.ToString + " Object " + Data.Node.Label);
        
If Data.Node.NodeType = MetabaseUpdateNodeType.Object Then
            Debug.WriteLine(
"Old object key: " + (Data.Node As IMetabaseUpdateObjectNode).ObjectOldKey.ToString);
        
End If;
    
End Sub OnProgress;

    
Sub OnAskReflectRights(Var Cancel: Boolean);
    
Begin
        Cancel := 
True;
    
End Sub OnAskReflectRights;

End Class MyUpdateProgress;

After executing the example, the TSDB.pef file is updated. The custom class MyUpdateProgress is used to process events that appear on update. Update status is displayed to the console window. If the update includes tables for which it is required to update access permissions then the permissions will be updated only on the platform level.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MUpdate: IMetabaseUpdate;
    Progress: MyUpdateProgress;
Begin
    MB := Params.Metabase;
    MUpdate := MB.CreateUpdate();
    MUpdate.LoadFromFile("c:\TSDB.pef", UpdateLoadMode.ulmReplace);
    Progress := New MyUpdateProgress.Create();
    MUpdate.Apply(Progress);
End Sub;

// Class that implements events that occur during update
Public Class MyUpdateProgress: IMetabaseUpdateProgress
    
    Public Sub OnAfterApplyCustomObject(Resolver: ICustomObjectResolver);
    Begin
    End Sub;
    
    Public Sub OnProgress(Data: IMetabaseUpdateProgressData);
    Begin
        Select Case Data.Stage
            Case MetabaseUpdateProgressStage.mupsStart:
                System.Diagnostics.Debug.WriteLine("Object update start");
            Case MetabaseUpdateProgressStage.mupsPrepare:
                System.Diagnostics.Debug.WriteLine("Object preparation");
            Case MetabaseUpdateProgressStage.mupsApply:
                System.Diagnostics.Debug.WriteLine("Object update");
            Case MetabaseUpdateProgressStage.mupsFinish:
                System.Diagnostics.Debug.WriteLine("Object update completed");
        End Select;
        System.Diagnostics.Debug.WriteLine("Current " + Data.Current.ToString() + " from " +
            Data.Total.ToString() + " Object " + Data.Node.Label);
        If Data.Node.NodeType = MetabaseUpdateNodeType.untObject Then
            System.Diagnostics.Debug.WriteLine("Old object key: " +
                (Data.Node As IMetabaseUpdateObjectNode).ObjectOldKey.ToString());
        End If;
    End Sub;
    
    Public Sub OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
    Begin
    End Sub;
    
    Public Sub OnAskConstraintsHandling(Node: IMetabaseUpdateNode; Details: String; Var Handling: UpdateDataConstraintsHandlingType);
    Begin
    End Sub;
    
    Public Sub OnAskReflectRights(Var Cancel: Boolean);
    Begin
        Cancel := True;
    End Sub;
    
    Public Sub OnContext(Context: IMetabaseUpdateContext);
    Begin
    End Sub;
    
    Public Sub OnResolve(Node: IMetabaseUpdateNode; Resolver: IMetabaseUpdateResolver);
    Begin
    End Sub;
    
    Public Sub OnSkip(Data: IMetabaseUpdateProgressData);
    Begin
    End Sub;
    
    Public Sub OnNullLinks(Node: IMetabaseUpdateNode; Links: IMetabaseUpdateNullLinks);
    Begin
    End Sub;
    
    Public Sub OnBeforeCustomObjectSaveToPef(Resolver: ICustomObjectResolver);
    Begin
    End Sub;
End Class MyUpdateProgress;

See also:

IMetabaseUpdateProgress