IMetabaseUpdateProgress.OnAfterApplyCustomObject

Fore Syntax

OnBeforeCustomObjectSaveToPef(Resolver: ICustomObjectResolver);

Fore.NET Syntax

OnBeforeCustomObjectSaveToPef(Resolver: Prognoz.Platform.Interop.Metabase.ICustomObjectResolver);

Parameters

Resolver. Object used to work with custom object.

Description

The OnAfterApplyCustomObject method implements the event occurring after applying custom object update, but before it is saved to repository.

Comments

The event occurs for each custom object contained in the update.

Fore Example

Executing the example requires that the file system contains the C:\CustomObjData.pefx update file. This file must contain a custom object, in which any data is written. It is also required to have the C:\From.txt text file containing data that must be written to custom object.

Add links to the Metabase system assembly.

Sub UserProc;
Var
    Mb: IMetabase;
    Update: IMetabaseUpdate;
    Progress: MyUpdateProgress;
Begin
    // Get current repository
    Mb := MetabaseClass.Active;
    // Create an update
    Update := Mb.CreateUpdate;
    // Load update parameters from file
    Update.LoadFromFileNF("C:\CustomObjData.pefx");
    // Create an object that implements events that occur during update
    Progress := New MyUpdateProgress.Create;
    // Perform update
    Update.ApplyEx(Progress, Null);
End Sub UserProc;

// Class that implements events that occur during update
Class MyUpdateProgress: UpdateProgress
    // Event that occurs after applying custom object update,
    // but before it is saved to repository
    Sub OnAfterApplyCustomObject(Resolver: ICustomObjectResolver);
    Begin
        // Read data from custom object to text file
        Resolver.ReadToFile("C:\To.txt");
        // Write data to custom object from text file
        Resolver.WriteFromFile("C:\From.txt");
    End Sub OnAfterApplyCustomObject;
    
End Class MyUpdateProgress;

After executing the example the C:\CustomObjData.pefx update is applied. Custom object data in the update is downloaded to the C:\To.txt file, data from the C:\From.txt file is written to the object.

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;
    Update: IMetabaseUpdate;
    Progress: MyUpdateProgress;
Begin
    // Get current repository
    Mb := Params.Metabase;
    // Create an update
    Update := Mb.CreateUpdate();
    // Load update parameters from file
    Update.LoadFromFileNF("C:\CustomObjData.pefx", UpdateLoadMode.ulmReplace);
    // Create an object that implements events that occur during update
    Progress := New MyUpdateProgress.Create();
    // Perform update
    Update.ApplyEx(Progress, Null);
End Sub;

// Class that implements events that occur during update
Public Class MyUpdateProgress: IMetabaseUpdateProgress
    // Event that occurs after applying custom object update,
    // but before it is saved to repository
    Public Sub OnAfterApplyCustomObject(Resolver: ICustomObjectResolver);
    Begin
        // Read data from custom object to text file
        Resolver.ReadToFile("C:\To.txt");
        // Write data to custom object from text file
        Resolver.WriteFromFile("C:\From.txt");
    End Sub OnAfterApplyCustomObject;
    
    Public Sub OnProgress(Data: IMetabaseUpdateProgressData);
    Begin
    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
    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