OnNullLinks(Node: IMetabaseUpdateNode; Links: IMetabaseUpdateNullLinks);
Node. Update object.
Links. Collection of missing links.
The OnNullLinksResolve method implements an event that occurs if there are links that are missing in destination repository.
Executing the example requires the Update.pefx update file that contains an object with the 1286399 key, that will contain missing links on update.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
MB: IMetabase;
MUpdate: IMetabaseUpdate;
Progress: MyUpdateProgress;
UpdateCxt: IMetabaseUpdateContext;
Begin
MB := MetabaseClass.Active;
MUpdate := MB.CreateUpdate;
MUpdate.LoadFromFileNF("C:\update.pefx");
Progress := New MyUpdateProgress.Create;
UpdateCxt := MUpdate.CreateUpdateContext;
UpdateCxt.RegisterNullRemapping(1286399);
MUpdate.ApplyEx(Progress, UpdateCxt);
End Sub Button1OnClick;
Class MyUpdateProgress: UpdateProgress
Sub OnNullLinks(Node: IMetabaseUpdateNode; Links: IMetabaseUpdateNullLinks);
Var
Link: IMetabaseUpdateNullLink;
i: Integer;
MB: IMetabase;
Begin
MB := MetabaseClass.Active;
Debug.WriteLine("OnNullLInks");
For i := 0 To Links.Count - 1 Do
Link := Links.Item(i);
Debug.WriteLine("Id: " + Link.Id);
Debug.WriteLine("Name: " + Link.Name);
Debug.WriteLine("Key: " + Link.Key.ToString);
Debug.WriteLine("Description: " + Link.Description);
Debug.WriteLine("ClassId: " + Link.ClassId.ToString);
Debug.WriteLine("---");
End For;
End Sub OnNullLinks;
End Class MyUpdateProgress;
After executing the example the console displays information about missing links.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Public Class Program
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MUpdate: IMetabaseUpdate;
Progress: MyUpdateProgress;
UpdateCxt: IMetabaseUpdateContext;
Begin
MB := Params.Metabase;
MUpdate := MB.CreateUpdate();
MUpdate.LoadFromFileNF("C:\\update.pefx", UpdateLoadMode.ulmReplace);
Progress := New MyUpdateProgress(MB);
UpdateCxt := MUpdate.CreateUpdateContext();
UpdateCxt.RegisterNullRemapping(1286399);
MUpdate.ApplyEx(Progress, UpdateCxt);
End Sub;
End Class;
Class MyUpdateProgress: IMetabaseUpdateProgress
_MB: IMetabase;
Public Constructor MyUpdateProgress(MB: IMetabase);
Begin
_MB := MB;
End Constructor;
Public Sub OnResolve(Node: IMetabaseUpdateNode; Resolver: IMetabaseUpdateResolver);
Begin
End Sub OnResolve;
Public Sub OnAfterApplyCustomObject(Resolver: ICustomObjectResolver);
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 OnBeforeCustomObjectSaveToPef(Resolver: ICustomObjectResolver);
Begin
End Sub;
Public Sub OnContext(Context: IMetabaseUpdateContext);
Begin
End Sub;
Public Sub OnError(Data: IMetabaseUpdateProgressData; Var Ignore: Boolean);
Begin
End Sub;
Public Sub OnNullLinks(Node: IMetabaseUpdateNode; Links: IMetabaseUpdateNullLinks);
Var
Link: IMetabaseUpdateNullLink;
i: Integer;
Begin
System.Diagnostics.Debug.WriteLine("OnNullLInks");
For i := 0 To Links.Count - 1 Do
Link := Links.Item[i];
System.Diagnostics.Debug.WriteLine("Id: " + Link.Id);
System.Diagnostics.Debug.WriteLine("Name: " + Link.Name);
System.Diagnostics.Debug.WriteLine("Key: " + Link.Key.ToString());
System.Diagnostics.Debug.WriteLine("Description: " + Link.Description);
System.Diagnostics.Debug.WriteLine("ClassId: " + Link.ClassId.ToString());
System.Diagnostics.Debug.WriteLine("---");
End For;
End Sub;
Public Sub OnProgress(Data: IMetabaseUpdateProgressData);
Begin
End Sub;
Public Sub OnSkip(Data: IMetabaseUpdateProgressData);
Begin
End Sub;
End Class;
See also: