OnResolve(Node: IMetabaseUpdateNode; Resolver: IMetabaseUpdateResolver);
Node. Update object.
Resolver. Collection of dependencies.
The OnResolve method implements an event that occurs if there are dependencies of updating on the repository-source objects that are not present in the destination repository.
Executing the example requires the repository to store an object with the CUBEMETAUPD identifier that contains the settings for copying the time series database. A time series database with the FC identifier should also be available in the repository.
Sub Main;
Var
MB: IMetabase;
RubUpdateEx: ICubeMetaUpdateEx;
Progress: MyUpdateProgress;
Begin
MB := MetabaseClass.Active;
RubUpdateEx := MB.ItemById("CUBEMETAUPD").Bind As ICubeMetaUpdateEx;
Progress := New MyUpdateProgress.Create;
RubUpdateEx.Apply(Progress);
End Sub Main;
Class MyUpdateProgress: UpdateProgress
Public Sub OnResolve(Node: IMetabaseUpdateNode; Resolver: IMetabaseUpdateResolver);
Var
Unresolv: IMetabaseUpdateUnresolved;
i: Integer;
MB: IMetabase;
Begin
MB := MetabaseClass.Active;
Debug.WriteLine("OnResolve");
For i := 0 To Resolver.Count - 1 Do
Unresolv := Resolver.Item(i);
If Unresolv.ClassId = MetabaseObjectClass.KE_CLASS_RUBRICATOR Then
Debug.WriteLine("Id: " + Unresolv.Id);
Debug.WriteLine("Name: " + Unresolv.Name);
Debug.WriteLine("Key: " + Unresolv.Key.ToString);
Debug.WriteLine("Description: " + Unresolv.Description);
Debug.WriteLine("KeepResolve: " + Unresolv.KeepResolve.ToString);
Unresolv.ResolveObject := MB.ItemById("FC");
Debug.WriteLine("---");
End If;
End For;
End Sub OnResolve;
End Class MyUpdateProgress;
After executing this example, the time series database is copied according to the settings contained in the CUBEMETAUPD object. The MyUpdateProgress custom class is used for processing the events that occur during copying. If during copying there is a dependency from source repository time series database that does not exist in destination repository this dependency is removed, information about it is displayed into console window.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
RubUpdateEx: ICubeMetaUpdateEx;
Progress: MyUpdateProgress;
Begin
MB := Params.Metabase;
RubUpdateEx := MB.ItemById["CUBEMETAUPD"].Bind() As ICubeMetaUpdateEx;
Progress := New MyUpdateProgress(MB);
RubUpdateEx.Apply(Progress);
End Sub;
Class MyUpdateProgress: IMetabaseUpdateProgress
_MB: IMetabase;
Public Constructor MyUpdateProgress(MB: IMetabase);
Begin
_MB := MB;
End Constructor;
Public Sub OnResolve(Node: IMetabaseUpdateNode; Resolver: IMetabaseUpdateResolver);
Var
Unresolv: IMetabaseUpdateUnresolved;
i: Integer;
Begin
System.Diagnostics.Debug.WriteLine("OnResolve");
For i := 0 To Resolver.Count - 1 Do
Unresolv := Resolver.Item[i];
If Unresolv.ClassId = (MetabaseObjectClass.KE_CLASS_RUBRICATOR As integer) Then
System.Diagnostics.Debug.WriteLine("Id: " + Unresolv.Id);
System.Diagnostics.Debug.WriteLine("Name: " + Unresolv.Name);
System.Diagnostics.Debug.WriteLine("Key: " + Unresolv.Key.ToString());
System.Diagnostics.Debug.WriteLine("Description: " + Unresolv.Description);
System.Diagnostics.Debug.WriteLine("KeepResolve: " + Unresolv.KeepResolve.ToString());
Unresolv.ResolveObject := _MB.ItemById["FC"];
System.Diagnostics.Debug.WriteLine("---");
End If;
End For;
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);
Begin
End Sub;
Public Sub OnProgress(Data: IMetabaseUpdateProgressData);
Begin
End Sub;
Public Sub OnSkip(Data: IMetabaseUpdateProgressData);
Begin
End Sub;
End Class;
See also: