IMetabaseUpdateUnresolved.IsRequired

Fore Syntax

IsRequired: Boolean;

Fore.NET Syntax

IsRequired: Boolean;

Description

The IsRequired property determines whether a mistake (forbidden reference) is processed during update.

Comments

Default property value is False and a mistake is ignored. If value is True, in the OnResolve event  transition to  process of forbidden references (the OnError event) is performed.

Fore Example

Executing the example requires an update file with the Update.pef name by a specified path.

Sub main;
Var
    mb: IMetabase;
    u: IMetabaseUpdate;
    progress: MyUpdateProgress;
Begin
    mb := MetabaseClass.Active;
    u := mb.CreateUpdate;
    u.LoadFromFile("c:\Temp\pef\Update.pef");
    progress := New MyUpdateProgress.Create;
    u.ApplyOptions := u.ApplyOptions Or MetabaseUpdateApplyOptions.EnableIgnoreErrors;
    u.Apply(progress);
End Sub main;

Class MyUpdateProgress: UpdateProgress

    Public Sub OnResolve(Node: IMetabaseUpdateNode; Resolver: IMetabaseUpdateResolver);
    Var i: integer;
    Begin
        Debug.WriteLine("Worked OnResolve for Node '" + Node.Label + "' !");
        For i := 0 To Resolver.Count - 1 Do
            Debug.WriteLine(i.ToString + " Resolver.Item(" + i.ToString + ").Name " + Resolver.Item(i).Name + "' !");
            Resolver.Item(i).IsRequired := True//mistake of synchronization will be processed in OnError
        End For;
    End Sub OnResolve;

    Sub OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
    Begin
        Debug.WriteLine("Worked OnError for node '" + Data.Node.Label + "' !");
        Debug.WriteLine("Mistake text: " + Data.Error.Message);
        Debug.WriteLine("MessageID: " + Data.Error.MessageID.ToString);
        If Data.Object <> Null Then
            Debug.WriteLine("Error source: " + Data.Object.Id);
            Debug.WriteLine("Object key: " + Data.Object.Key.ToString);
        End If;
        //ignore object
        Ignore := True;
    End Sub OnError;
End Class MyUpdateProgress;

The custom class MyUpdateProgress is used to process events that appear on update. If an update process there will be an object that has forbidden references (dependency an update object from source repository objects that do not exist in destination repository) an error of synchronization of repository object with an object in update (OnError) will be created and information about forbidden reference will be displayed into development environment console. The objects with errors are skipped.

See also:

IMetabaseUpdateUnresolved